use of org.apache.tinkerpop.gremlin.server.GraphManager in project janusgraph by JanusGraph.
the class JanusGraphWebSocketChannelizer 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());
}
use of org.apache.tinkerpop.gremlin.server.GraphManager in project cypher-for-gremlin by opencypher.
the class CypherOpProcessor method traversal.
private GraphTraversalSource traversal(Context context) throws OpProcessorException {
RequestMessage msg = context.getRequestMessage();
GraphManager graphManager = context.getGraphManager();
Optional<Map<String, String>> aliasesOptional = msg.optionalArgs(Tokens.ARGS_ALIASES);
String gAlias = aliasesOptional.map(aliases -> aliases.get(Tokens.VAL_TRAVERSAL_SOURCE_ALIAS)).orElse(null);
if (gAlias == null) {
return graphManager.getGraphNames().stream().findFirst().map(graphManager::getGraph).map(Graph::traversal).orElseThrow(() -> opProcessorException(msg, "No graphs found on the server"));
}
Graph graph = graphManager.getGraph(gAlias);
if (graph != null) {
return graph.traversal();
}
TraversalSource traversalSource = graphManager.getTraversalSource(gAlias);
if (traversalSource instanceof GraphTraversalSource) {
return (GraphTraversalSource) traversalSource;
}
throw opProcessorException(msg, "Traversable alias '" + gAlias + "' not found");
}
use of org.apache.tinkerpop.gremlin.server.GraphManager in project janusgraph by JanusGraph.
the class JanusGraphServer method configure.
private static void configure(ServerGremlinExecutor serverGremlinExecutor) {
GraphManager graphManager = serverGremlinExecutor.getGraphManager();
if (!(graphManager instanceof JanusGraphManager)) {
return;
}
((JanusGraphManager) graphManager).configureGremlinExecutor(serverGremlinExecutor.getGremlinExecutor());
}
use of org.apache.tinkerpop.gremlin.server.GraphManager in project janusgraph by JanusGraph.
the class JanusGraphNioChannelizer 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());
}
use of org.apache.tinkerpop.gremlin.server.GraphManager in project janusgraph by JanusGraph.
the class JanusGraphWsAndHttpChannelizer 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());
}
Aggregations