use of org.apache.tinkerpop.gremlin.structure.util.wrapped.WrappedGraph in project titan by thinkaurelius.
the class AbstractTitanGraphProvider method clear.
// @Override
// public <ID> ID reconstituteGraphSONIdentifier(final Class<? extends Element> clazz, final Object id) {
// if (Edge.class.isAssignableFrom(clazz)) {
// // TitanGraphSONModule toStrings the edgeid - expect a String value for the id
// if (!(id instanceof String)) throw new RuntimeException("Expected a String value for the RelationIdentifier");
// return (ID) RelationIdentifier.parse((String) id);
// } else {
// return (ID) id;
// }
// }
@Override
public void clear(Graph g, final Configuration configuration) throws Exception {
if (null != g) {
while (g instanceof WrappedGraph) g = ((WrappedGraph<? extends Graph>) g).getBaseGraph();
TitanGraph graph = (TitanGraph) g;
if (graph.isOpen()) {
if (g.tx().isOpen())
g.tx().rollback();
g.close();
}
}
WriteConfiguration config = new CommonsConfiguration(configuration);
BasicConfiguration readConfig = new BasicConfiguration(GraphDatabaseConfiguration.ROOT_NS, config, BasicConfiguration.Restriction.NONE);
if (readConfig.has(GraphDatabaseConfiguration.STORAGE_BACKEND)) {
TitanGraphBaseTest.clearGraph(config);
}
}
Aggregations