Devices REST API
diff --git a/src/main/java/net/onrc/onos/util/GraphDBConnection.java b/src/main/java/net/onrc/onos/util/GraphDBConnection.java
index 7c1ea2a..a2a8689 100644
--- a/src/main/java/net/onrc/onos/util/GraphDBConnection.java
+++ b/src/main/java/net/onrc/onos/util/GraphDBConnection.java
@@ -24,7 +24,7 @@
/* Static 'instance' method */
public static GraphDBConnection getInstance(String conf) {
- if (graph == null||graph.isOpen()) {
+ if (graph == null||graph.isOpen() == Boolean.FALSE) {
graph = TitanFactory.open(conf);
// FIXME: Creation on Indexes should be done only once
Set<String> s = graph.getIndexedKeys(Vertex.class);
diff --git a/src/main/java/net/onrc/onos/util/GraphDBUtils.java b/src/main/java/net/onrc/onos/util/GraphDBUtils.java
index 8bb83ea..d01de21 100644
--- a/src/main/java/net/onrc/onos/util/GraphDBUtils.java
+++ b/src/main/java/net/onrc/onos/util/GraphDBUtils.java
@@ -1,7 +1,6 @@
package net.onrc.onos.util;
import com.thinkaurelius.titan.core.TitanGraph;
-import com.thinkaurelius.titan.graphdb.transaction.VertexIterable;
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.frames.FramedGraph;
import com.tinkerpop.frames.FramedVertexIterable;
@@ -10,7 +9,6 @@
import net.floodlightcontroller.core.INetMapTopologyObjects.IDeviceObject;
import net.floodlightcontroller.core.INetMapTopologyObjects.IPortObject;
import net.floodlightcontroller.core.INetMapTopologyObjects.ISwitchObject;
-import net.floodlightcontroller.routing.Link;
public class GraphDBUtils implements IDBUtils {
@@ -56,4 +54,10 @@
fg.removeVertex(dev.asVertex());
}
+ @Override
+ public Iterable<IDeviceObject> getDevices(GraphDBConnection conn) {
+ FramedGraph<TitanGraph> fg = conn.getFramedGraph();
+ return fg.getVertices("type","device",IDeviceObject.class);
+ }
+
}
diff --git a/src/main/java/net/onrc/onos/util/IDBUtils.java b/src/main/java/net/onrc/onos/util/IDBUtils.java
index 52dbc70..a27a261 100644
--- a/src/main/java/net/onrc/onos/util/IDBUtils.java
+++ b/src/main/java/net/onrc/onos/util/IDBUtils.java
@@ -10,4 +10,5 @@
public IDeviceObject newDevice(GraphDBConnection conn);
public void removeDevice(GraphDBConnection conn, IDeviceObject dev);
public IPortObject searchPort(GraphDBConnection conn, String dpid, short number);
+ public Iterable<IDeviceObject> getDevices(GraphDBConnection conn);
}