Hi,
This works for me.
When I start my service I also start Gremlin Server with below-mentioned configuration.
private void startGremlin() throws Exception {
final InputStream stream = this.getClass().getResourceAsStream("/gremlin-server.yaml");
this.gremlinServer = new GremlinServer(Settings.read(stream));
gremlinServer.start();
Map<String, Object> map = new HashMap<>();
map.put("storage.backend", "hbase");
ConfiguredGraphFactory.updateTemplateConfiguration(new MapConfiguration(map));
}
Note: createTemplateConfiguration was giving me run time errors so that's why using updateTemplateConfiguration instead.
Once the server is started you can access different graph by providing the only graphName.
public JanusGraph getGraph(String graphName) {
if (!ConfiguredGraphFactory.getGraphNames().contains(graphName)) {
ConfiguredGraphFactory.create(graphName);
}
g = ConfiguredGraphFactory.open(graphName);
return g;
}
gremlin.yaml
graphManager: org.janusgraph.graphdb.management.JanusGraphManager
graphs: {
graph: janusgraph-hbase.properties,
ConfigurationManagementGraph: janusGraph-configurationmanagement.properties
}
janusGraph-configurationmanagement.properties
gremlin.graph=org.janusgraph.core.JanusGraphFactory
graph.graphname=ConfigurationManagementGraph
storage.backend=hbase
storage.hostname=localhost
storage.hbase.table=Janus
janusgraph-hbase.properties
storage.backend=hbase
storage.hostname=localhost
storage.hbase.table=Janus
Regards,
Satyajit Bhadange