use of com.tinkerpop.blueprints.util.wrappers.id.IdGraph in project pentaho-metaverse by pentaho.
the class SynchronizedGraphFactory method wrapGraph.
/**
* Wraps the underlying graph with a synchronized one
* @param graph The graph to wrap
* @return The synchronized graph
*/
protected static Graph wrapGraph(Graph graph) {
if (graph instanceof KeyIndexableGraph) {
KeyIndexableGraph keyIndexableGraph = (KeyIndexableGraph) graph;
IdGraph<KeyIndexableGraph> idGraph = new IdGraph<KeyIndexableGraph>(keyIndexableGraph);
return new SynchronizedGraph(idGraph);
} else {
throw new IllegalArgumentException(Messages.getString("ERROR.BackingGraph.MustImplement.KeyIndexableGraph"));
}
}
use of com.tinkerpop.blueprints.util.wrappers.id.IdGraph in project pentaho-metaverse by pentaho.
the class SynchronizedGraphFactoryTest method testWrapGraph.
@Test
public void testWrapGraph() throws Exception {
Graph g = new TinkerGraph();
SynchronizedGraph wrapped = (SynchronizedGraph) SynchronizedGraphFactory.wrapGraph(g);
assertTrue(wrapped instanceof SynchronizedGraph);
assertTrue(wrapped.graph instanceof IdGraph);
assertTrue(wrapped.graph instanceof KeyIndexableGraph);
}
Aggregations