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