Optimized code
diff --git a/src/main/java/net/onrc/onos/graph/DBOperation.java b/src/main/java/net/onrc/onos/graph/DBOperation.java
index fdb6e38..f9b0e9f 100644
--- a/src/main/java/net/onrc/onos/graph/DBOperation.java
+++ b/src/main/java/net/onrc/onos/graph/DBOperation.java
@@ -43,7 +43,6 @@
@Override
public ISwitchObject newSwitch(final String dpid) {
- System.out.println("newSwitch: " + conn.getFramedGraph());
ISwitchObject obj = (ISwitchObject) conn.getFramedGraph().addVertex(null, ISwitchObject.class);
if (obj != null) {
obj.setType("switch");
@@ -85,7 +84,6 @@
@Override
public IPortObject newPort(String dpid, Short portNum) {
- System.out.println("newPort: " + conn.getFramedGraph());
IPortObject obj = (IPortObject) conn.getFramedGraph().addVertex(null, IPortObject.class);
if (obj != null) {
obj.setType("port");
@@ -95,6 +93,21 @@
}
return obj;
}
+
+ /**
+ * Create a port having specified port number.
+ *
+ * @param portNumber port number
+ */
+ @Deprecated
+ public IPortObject newPort(Short portNumber) {
+ IPortObject obj = (IPortObject) conn.getFramedGraph().addVertex(null, IPortObject.class);
+ if (obj != null) {
+ obj.setType("port");
+ obj.setNumber(portNumber);
+ }
+ return obj;
+ }
public IPortObject searchPort(String dpid, Short number, final FramedGraph fg) {
String id = dpid + number.toString();
@@ -105,7 +118,6 @@
@Override
public IDeviceObject newDevice() {
- System.out.println("newDevice: " + conn.getFramedGraph());
IDeviceObject obj = (IDeviceObject) conn.getFramedGraph().addVertex(null, IDeviceObject.class);
if (obj != null) {
obj.setType("device");
@@ -113,6 +125,10 @@
return obj;
}
+ /**
+ * Create and return a flow path object.
+ */
+
@Override
public IFlowPath newFlowPath() {
IFlowPath flowPath = (IFlowPath)conn.getFramedGraph().addVertex(null, IFlowPath.class);
@@ -180,8 +196,9 @@
return nonNullFlows;
}
- protected IFlowEntry newFlowEntry(final FramedGraph fg) {
- IFlowEntry flowEntry = (IFlowEntry) fg.addVertex(null, IFlowEntry.class);
+ @Override
+ public IFlowEntry newFlowEntry() {
+ IFlowEntry flowEntry = (IFlowEntry) conn.getFramedGraph().addVertex(null, IFlowEntry.class);
if (flowEntry != null) {
flowEntry.setType("flow_entry");
}
diff --git a/src/main/java/net/onrc/onos/graph/RamCloudDBOperation.java b/src/main/java/net/onrc/onos/graph/RamCloudDBOperation.java
index 2f974cc..9aa038a 100644
--- a/src/main/java/net/onrc/onos/graph/RamCloudDBOperation.java
+++ b/src/main/java/net/onrc/onos/graph/RamCloudDBOperation.java
@@ -45,17 +45,6 @@
}
@Override
- public IPortObject newPort(Short portNumber) {
- final FramedGraph<RamCloudGraph> fg = conn.getFramedGraph();
- IPortObject obj = fg.addVertex(null, IPortObject.class);
- if (obj != null) {
- obj.setType("port");
- obj.setNumber(portNumber);
- }
- return obj;
- }
-
- @Override
public IPortObject searchPort(String dpid, Short number) {
final FramedGraph<RamCloudGraph> fg = conn.getFramedGraph();
return searchPort(dpid, number, fg);
@@ -109,12 +98,6 @@
}
@Override
- public IFlowEntry newFlowEntry() {
- FramedGraph<RamCloudGraph> fg = conn.getFramedGraph();
- return newFlowEntry(fg);
- }
-
- @Override
public IFlowEntry searchFlowEntry(FlowEntryId flowEntryId) {
FramedGraph<RamCloudGraph> fg = conn.getFramedGraph();
diff --git a/src/main/java/net/onrc/onos/graph/TitanDBOperation.java b/src/main/java/net/onrc/onos/graph/TitanDBOperation.java
index aa42bfd..02b8052 100644
--- a/src/main/java/net/onrc/onos/graph/TitanDBOperation.java
+++ b/src/main/java/net/onrc/onos/graph/TitanDBOperation.java
@@ -79,16 +79,6 @@
}
}
- /**
- * Create and return a flow path object.
- */
- public IFlowPath newFlowPath() {
- FramedGraph<TitanGraph> fg = conn.getFramedGraph();
- IFlowPath flowPath = fg.addVertex(null, IFlowPath.class);
- if (flowPath != null) flowPath.setType("flow");
- return flowPath;
- }
-
@Override
public IFlowPath searchFlowPath(FlowId flowId) {
FramedGraph<TitanGraph> fg = conn.getFramedGraph();
@@ -109,12 +99,6 @@
}
@Override
- public IFlowEntry newFlowEntry() {
- FramedGraph<TitanGraph> fg = conn.getFramedGraph();
- return newFlowEntry(fg);
- }
-
- @Override
public IFlowEntry searchFlowEntry(FlowEntryId flowEntryId) {
FramedGraph<TitanGraph> fg = conn.getFramedGraph();
@@ -156,20 +140,4 @@
public void close() {
conn.close();
}
-
- /**
- * Create a port having specified port number.
- *
- * @param portNumber port number
- */
- @Deprecated
- public IPortObject newPort(Short portNumber) {
- FramedGraph<TitanGraph> fg = conn.getFramedGraph();
- IPortObject obj = fg.addVertex(null, IPortObject.class);
- if (obj != null) {
- obj.setType("port");
- obj.setNumber(portNumber);
- }
- return obj;
- }
}
\ No newline at end of file