use of com.baidu.hugegraph.auth.ContextGremlinServer in project incubator-hugegraph by apache.
the class HugeGremlinServer method start.
public static GremlinServer start(String conf, String graphsDir, EventHub hub) throws Exception {
// Start GremlinServer with inject traversal source
LOG.info(GremlinServer.getHeader());
final Settings settings;
try {
settings = Settings.read(conf);
} catch (Exception e) {
LOG.error("Can't found the configuration file at '{}' or " + "being parsed properly. [{}]", conf, e.getMessage());
throw e;
}
// Scan graph confs and inject into gremlin server context
E.checkState(settings.graphs != null, "The GremlinServer's settings.graphs is null");
settings.graphs.putAll(ConfigUtil.scanGraphsDir(graphsDir));
LOG.info("Configuring Gremlin Server from {}", conf);
ContextGremlinServer server = new ContextGremlinServer(settings, hub);
// Inject customized traversal source
server.injectTraversalSource();
server.start().exceptionally(t -> {
LOG.error("Gremlin Server was unable to start and will " + "shutdown now: {}", t.getMessage());
server.stop().join();
throw new HugeException("Failed to start Gremlin Server");
}).join();
return server;
}
Aggregations