WIP: Add Design memo to each Objects
Change-Id: Ic8dd106508b6c3e1f09e82c11d20dd089d37da99
diff --git a/src/main/java/net/onrc/onos/ofcontroller/networkgraph/SwitchImpl.java b/src/main/java/net/onrc/onos/ofcontroller/networkgraph/SwitchImpl.java
index 7b83224..6e250bc 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/networkgraph/SwitchImpl.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/networkgraph/SwitchImpl.java
@@ -11,14 +11,20 @@
import net.onrc.onos.datastore.topology.RCSwitch;
import net.onrc.onos.ofcontroller.util.FlowEntry;
+/**
+ * Switch Object stored in In-memory Topology.
+ *
+ * TODO REMOVE following design memo: This object itself may hold the DBObject,
+ * but this Object itself will not issue any read/write to the DataStore.
+ */
public class SwitchImpl extends NetworkGraphObject implements Switch {
-
+
private long dpid;
private final Map<Short, Port> ports;
public SwitchImpl(NetworkGraph graph) {
super(graph);
-
+
ports = new HashMap<Short, Port>();
}
@@ -68,7 +74,7 @@
public void setDpid(long dpid) {
this.dpid = dpid;
}
-
+
public void addPort(Port port) {
this.ports.put(port.getNumber(), port);
}
@@ -77,23 +83,23 @@
public Iterable<Link> getLinks() {
return graph.getLinksFromSwitch(dpid);
}
-
+
public void store() {
RCSwitch rcSwitch = new RCSwitch(dpid);
-
+
for (Port port : ports.values()) {
RCPort rcPort = new RCPort(dpid, (long)port.getNumber());
rcSwitch.addPortId(rcPort.getId());
}
-
-
+
+
try {
rcSwitch.update();
-
+
} catch (ObjectDoesntExistException | WrongVersionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
}
}