Search in sources :

Example 6 with GraphManager

use of org.apache.tinkerpop.gremlin.server.GraphManager in project janusgraph by JanusGraph.

the class JanusGraphHttpChannelizer method init.

@Override
public void init(final ServerGremlinExecutor serverGremlinExecutor) {
    this.serverGremlinExecutor = serverGremlinExecutor;
    super.init(serverGremlinExecutor);
    final GraphManager graphManager = serverGremlinExecutor.getGraphManager();
    Preconditions.checkArgument(graphManager instanceof JanusGraphManager, "Must use JanusGraphManager with a JanusGraphChannelizer.");
    ((JanusGraphManager) graphManager).configureGremlinExecutor(serverGremlinExecutor.getGremlinExecutor());
}
Also used : GraphManager(org.apache.tinkerpop.gremlin.server.GraphManager) JanusGraphManager(org.janusgraph.graphdb.management.JanusGraphManager) JanusGraphManager(org.janusgraph.graphdb.management.JanusGraphManager)

Example 7 with GraphManager

use of org.apache.tinkerpop.gremlin.server.GraphManager in project janusgraph by JanusGraph.

the class JanusGraphServer method start.

public synchronized CompletableFuture<Void> start() {
    if (serverStarted != null) {
        return serverStarted;
    }
    serverStarted = new CompletableFuture<>();
    try {
        logger.info("Configuring JanusGraph Server from {}", confPath);
        janusGraphSettings = JanusGraphSettings.read(confPath);
        gremlinServer = new GremlinServer(janusGraphSettings);
        CompletableFuture<Void> grpcServerFuture = CompletableFuture.completedFuture(null);
        if (janusGraphSettings.getGrpcServer().isEnabled()) {
            grpcServerFuture = CompletableFuture.runAsync(() -> {
                GraphManager graphManager = gremlinServer.getServerGremlinExecutor().getGraphManager();
                grpcServer = createGrpcServer(janusGraphSettings, graphManager);
                try {
                    grpcServer.start();
                } catch (IOException e) {
                    throw new IllegalStateException(e);
                }
            });
        }
        CompletableFuture<Void> gremlinServerFuture = gremlinServer.start().thenAcceptAsync(JanusGraphServer::configure);
        serverStarted = CompletableFuture.allOf(gremlinServerFuture, grpcServerFuture);
    } catch (Exception ex) {
        serverStarted.completeExceptionally(ex);
    }
    return serverStarted;
}
Also used : GremlinServer(org.apache.tinkerpop.gremlin.server.GremlinServer) GraphManager(org.apache.tinkerpop.gremlin.server.GraphManager) JanusGraphManager(org.janusgraph.graphdb.management.JanusGraphManager) IOException(java.io.IOException) IOException(java.io.IOException)

Aggregations

GraphManager (org.apache.tinkerpop.gremlin.server.GraphManager)7 JanusGraphManager (org.janusgraph.graphdb.management.JanusGraphManager)6 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)1 IOException (java.io.IOException)1 Collections.singletonList (java.util.Collections.singletonList)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Optional.empty (java.util.Optional.empty)1 Tokens (org.apache.tinkerpop.gremlin.driver.Tokens)1 RequestMessage (org.apache.tinkerpop.gremlin.driver.message.RequestMessage)1 ResponseMessage (org.apache.tinkerpop.gremlin.driver.message.ResponseMessage)1 ResponseStatusCode (org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode)1 SERVER_ERROR (org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode.SERVER_ERROR)1 P (org.apache.tinkerpop.gremlin.process.traversal.P)1 Traversal (org.apache.tinkerpop.gremlin.process.traversal.Traversal)1 TraversalSource (org.apache.tinkerpop.gremlin.process.traversal.TraversalSource)1 DefaultGraphTraversal (org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.DefaultGraphTraversal)1 GraphTraversal (org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal)1