Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 1 | package net.floodlightcontroller.util; |
| 2 | |
| 3 | import net.floodlightcontroller.util.CallerId; |
| 4 | import net.floodlightcontroller.util.DataPath; |
| 5 | import net.floodlightcontroller.util.FlowId; |
Pavlin Radoslavov | ad008e0 | 2013-02-21 18:42:42 -0800 | [diff] [blame] | 6 | import net.floodlightcontroller.util.serializers.FlowPathSerializer; |
| 7 | |
| 8 | import org.codehaus.jackson.annotate.JsonProperty; |
| 9 | import org.codehaus.jackson.map.annotate.JsonSerialize; |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 10 | |
| 11 | /** |
| 12 | * The class representing the Flow Path. |
| 13 | */ |
Pavlin Radoslavov | ad008e0 | 2013-02-21 18:42:42 -0800 | [diff] [blame] | 14 | @JsonSerialize(using=FlowPathSerializer.class) |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 15 | public class FlowPath { |
| 16 | private FlowId flowId; // The Flow ID |
| 17 | private CallerId installerId; // The Caller ID of the path installer |
| 18 | private DataPath dataPath; // The data path |
| 19 | |
| 20 | /** |
| 21 | * Default constructor. |
| 22 | */ |
| 23 | public FlowPath() { |
| 24 | } |
| 25 | |
| 26 | /** |
Pavlin Radoslavov | a10a9a8 | 2013-02-22 11:47:54 -0800 | [diff] [blame] | 27 | * Constructor from a string. |
| 28 | */ |
| 29 | public FlowPath(String str) { |
| 30 | // TODO: Implement it. |
| 31 | } |
| 32 | |
| 33 | /** |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 34 | * Get the flow path Flow ID. |
| 35 | * |
| 36 | * @return the flow path Flow ID. |
| 37 | */ |
| 38 | public FlowId flowId() { return flowId; } |
| 39 | |
| 40 | /** |
| 41 | * Set the flow path Flow ID. |
| 42 | * |
| 43 | * @param flowId the flow path Flow ID to set. |
| 44 | */ |
| 45 | public void setFlowId(FlowId flowId) { |
| 46 | this.flowId = flowId; |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Get the Caller ID of the flow path installer. |
| 51 | * |
| 52 | * @return the Caller ID of the flow path installer. |
| 53 | */ |
| 54 | public CallerId installerId() { return installerId; } |
| 55 | |
| 56 | /** |
| 57 | * Set the Caller ID of the flow path installer. |
| 58 | * |
| 59 | * @param installerId the Caller ID of the flow path installer. |
| 60 | */ |
| 61 | public void setInstallerId(CallerId installerId) { |
| 62 | this.installerId = installerId; |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Get the flow path's data path. |
| 67 | * |
| 68 | * @return the flow path's data path. |
| 69 | */ |
| 70 | public DataPath dataPath() { return dataPath; } |
| 71 | |
| 72 | /** |
| 73 | * Set the flow path's data path. |
| 74 | * |
| 75 | * @param dataPath the flow path's data path to set. |
| 76 | */ |
| 77 | public void setDataPath(DataPath dataPath) { |
| 78 | this.dataPath = dataPath; |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * Convert the flow path to a string. |
| 83 | * |
Pavlin Radoslavov | a10a9a8 | 2013-02-22 11:47:54 -0800 | [diff] [blame] | 84 | * The string has the following form: |
| 85 | * [flowId=XXX installerId=XXX dataPath=XXX] |
| 86 | * |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 87 | * @return the flow path as a string. |
| 88 | */ |
| 89 | @Override |
| 90 | public String toString() { |
Pavlin Radoslavov | a10a9a8 | 2013-02-22 11:47:54 -0800 | [diff] [blame] | 91 | String ret = "[flowId=" + this.flowId.toString(); |
| 92 | ret += " installerId=" + this.installerId.toString(); |
| 93 | ret += " dataPath=" + this.dataPath.toString(); |
| 94 | ret += "]"; |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 95 | return ret; |
| 96 | } |
| 97 | } |