I can't understand how to get a JanusGraphManagement instance from a graph created with the ConfiguredGraphFactory.
I tried doing something like this:
JanusGraphFactory.Builder config = JanusGraphFactory.build();
config.set("storage.hostname", storageHostname);
config.set("storage.port", storagePort);
config.set("storage.backend", STORAGE_BACKEND);
config.set("index.search.backend", SEARCH_BACKEND);
config.set("index.search.hostname", indexHostname);
config.set("index.search.port", indexPort);
config.set("graph.graphname", graphName);
JanusGraph graph = config.open();
JanusGraphManagement mgmt = graph.openManagement();
But it generates the following exception:
java.lang.NullPointerException: Gremlin Server must be configured to use the JanusGraphManager.
The gremlin-server is ruinning with the following configuration:
host: 0.0.0.0
port: 8182
scriptEvaluationTimeout: 180000
# channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer
channelizer: org.janusgraph.channelizers.JanusGraphWebSocketChannelizer
graphManager: org.janusgraph.graphdb.management.JanusGraphManager
graphs: {
#graph: conf/gremlin-server/janusgraph-cql-es-server.properties,
ConfigurationManagementGraph: conf/gremlin-server/janusgraph-cql-es-server-configured.properties
}
.....
And the JanusGraph's one is this:
gremlin.graph=org.janusgraph.core.ConfiguredGraphFactory
graph.graphname=ConfigurationManagementGraph
storage.backend=cql
storage.hostname=127.0.0.1
storage.cql.keyspace=janusgraph
cache.db-cache = true
cache.db-cache-time = 180000
cache.db-cache-size = 0.25
index.search.backend=elasticsearch
index.search.hostname=127.0.0.1
index.search.elasticsearch.client-only=true
What I'd like to do is to define the graph schema directly from Java code, that's why I need to the a managment instance and a traversal source is not enough