getPort from frames is buggy...reverting to gremlin
diff --git a/src/main/java/net/onrc/onos/util/GraphDBConnection.java b/src/main/java/net/onrc/onos/util/GraphDBConnection.java
index 78f26ea..2f30806 100644
--- a/src/main/java/net/onrc/onos/util/GraphDBConnection.java
+++ b/src/main/java/net/onrc/onos/util/GraphDBConnection.java
@@ -5,16 +5,12 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.esotericsoftware.minlog.Log;
import com.thinkaurelius.titan.core.TitanFactory;
import com.thinkaurelius.titan.core.TitanGraph;
import com.tinkerpop.blueprints.TransactionalGraph;
-import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.blueprints.TransactionalGraph.Conclusion;
-import com.tinkerpop.blueprints.util.wrappers.event.EventGraph;
+import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.blueprints.util.wrappers.event.EventTransactionalGraph;
-import com.tinkerpop.blueprints.util.wrappers.event.EventTransactionalIndexableGraph;
-import com.tinkerpop.blueprints.util.wrappers.event.listener.GraphChangedListener;
import com.tinkerpop.frames.FramedGraph;
public class GraphDBConnection {
@@ -85,7 +81,7 @@
return utils;
}
- protected FramedGraph<TitanGraph> getFramedGraph() {
+ public FramedGraph<TitanGraph> getFramedGraph() {
if (isValid()) {
FramedGraph<TitanGraph> fg = new FramedGraph<TitanGraph>(graph);
@@ -121,12 +117,17 @@
}
public void endTx(Transaction tx) {
- switch (tx) {
- case COMMIT:
- graph.stopTransaction(Conclusion.SUCCESS);
- case ROLLBACK:
- graph.stopTransaction(Conclusion.FAILURE);
- }
+ try {
+ switch (tx) {
+ case COMMIT:
+ graph.stopTransaction(Conclusion.SUCCESS);
+ case ROLLBACK:
+ graph.stopTransaction(Conclusion.FAILURE);
+ }
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
public void endTx(TransactionHandle tr, Transaction tx) {
diff --git a/src/main/java/net/onrc/onos/util/GraphDBUtils.java b/src/main/java/net/onrc/onos/util/GraphDBUtils.java
index 92b8205..eea57fd 100644
--- a/src/main/java/net/onrc/onos/util/GraphDBUtils.java
+++ b/src/main/java/net/onrc/onos/util/GraphDBUtils.java
@@ -55,24 +55,24 @@
@Override
public IPortObject searchPort(GraphDBConnection conn, String dpid, short number) {
ISwitchObject sw = searchSwitch(conn, dpid);
- if (sw != null) {
-
- IPortObject port = null;
- try {
- port = sw.getPort(number);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- return port;
- }
- return null;
- /* GremlinPipeline<Vertex, IPortObject> pipe = new GremlinPipeline<Vertex, IPortObject>();
+// if (sw != null) {
+//
+// IPortObject port = null;
+// try {
+// port = sw.getPort(number);
+// } catch (Exception e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// }
+//
+// return port;
+// }
+// return null;
+ GremlinPipeline<Vertex, IPortObject> pipe = new GremlinPipeline<Vertex, IPortObject>();
pipe.start(sw.asVertex());
pipe.out("on").has("number", number);
FramedVertexIterable<IPortObject> r = new FramedVertexIterable<IPortObject>(conn.getFramedGraph(), (Iterable) pipe, IPortObject.class);
- return r.iterator().hasNext() ? r.iterator().next() : null; */
+ return r.iterator().hasNext() ? r.iterator().next() : null;
}
@Override