Class DefaultGraphManager
- java.lang.Object
-
- org.apache.tinkerpop.gremlin.server.util.DefaultGraphManager
-
- All Implemented Interfaces:
GraphManager
- Direct Known Subclasses:
CheckedGraphManager
public class DefaultGraphManager extends Object implements GraphManager
Holder forGraphandTraversalSourceinstances configured for the server to be passed to script engine bindings. TheGraphinstances are read from theSettingsfor Gremlin Server as defined in the configuration file. TheTraversalSourceinstances are rebound to theGraphManageronce initialization scripts construct them.
-
-
Constructor Summary
Constructors Constructor Description DefaultGraphManager(Settings settings)Create a new instance using theSettingsfrom Gremlin Server.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddGraph(String name, String configurationFile)voidcommit(Set<String> graphSourceNamesToCloseTxOn)Selectively commit transactions on the specified graphs or the graphs of traversal sources.voidcommitAll()Commit transactions across allGraphobjects.BindingsgetAsBindings()Get theGraphandTraversalSourcelist as a set of bindings.GraphgetGraph(String graphName)GetGraphinstance whose name matchesgraphName.Set<String>getGraphNames()TraversalSourcegetTraversalSource(String traversalSourceName)GetTraversalSourceinstance whose name matchestraversalSourceNameSet<String>getTraversalSourceNames()Get aSetof the names of the the storedTraversalSourceinstances.GraphopenGraph(String graphName, Function<String,Graph> supplier)Implementation that allows for custom graph-opening implementations; if theMaptracking graph references has aGraphobject corresponding to the graph name, then we return thatGraph-- otherwise, we use the customFunctionto instantiate a newGraph, add it to theMaptracking graph references, and return saidGraph.voidputGraph(String graphName, Graph g)Add or update the specifiedGraphwith the specified name toMap<String, Graph>.voidputTraversalSource(String tsName, TraversalSource ts)Add or update the specifiedTraversalSourcewith the specified name.GraphremoveGraph(String graphName)Implementation that allows for custom graph closing implementations; this method should remove theGraphfrom theGraphManager.TraversalSourceremoveTraversalSource(String tsName)RemoveTraversalSourceby name.voidrollback(Set<String> graphSourceNamesToCloseTxOn)Selectively rollback transactions on the specified graphs or the graphs of traversal sources.voidrollbackAll()Rollback transactions across allGraphobjects.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.tinkerpop.gremlin.server.GraphManager
beforeQueryStart, hasAnyOpenTransactions, onQueryError, onQuerySuccess
-
-
-
-
Method Detail
-
getGraphNames
public final Set<String> getGraphNames()
Description copied from interface:GraphManager- Specified by:
getGraphNamesin interfaceGraphManager
-
getGraph
public final Graph getGraph(String graphName)
Description copied from interface:GraphManagerGetGraphinstance whose name matchesgraphName.- Specified by:
getGraphin interfaceGraphManager- Returns:
Graphif exists, else null
-
putGraph
public final void putGraph(String graphName, Graph g)
Description copied from interface:GraphManagerAdd or update the specifiedGraphwith the specified name toMap<String, Graph>.- Specified by:
putGraphin interfaceGraphManager
-
getTraversalSourceNames
public final Set<String> getTraversalSourceNames()
Description copied from interface:GraphManagerGet aSetof the names of the the storedTraversalSourceinstances.- Specified by:
getTraversalSourceNamesin interfaceGraphManager
-
getTraversalSource
public final TraversalSource getTraversalSource(String traversalSourceName)
Description copied from interface:GraphManagerGetTraversalSourceinstance whose name matchestraversalSourceName- Specified by:
getTraversalSourcein interfaceGraphManager- Returns:
TraversalSourceif exists, else null
-
putTraversalSource
public final void putTraversalSource(String tsName, TraversalSource ts)
Description copied from interface:GraphManagerAdd or update the specifiedTraversalSourcewith the specified name.- Specified by:
putTraversalSourcein interfaceGraphManager
-
removeTraversalSource
public final TraversalSource removeTraversalSource(String tsName)
Description copied from interface:GraphManagerRemoveTraversalSourceby name.- Specified by:
removeTraversalSourcein interfaceGraphManager
-
getAsBindings
public final Bindings getAsBindings()
Get theGraphandTraversalSourcelist as a set of bindings.- Specified by:
getAsBindingsin interfaceGraphManager
-
rollbackAll
public final void rollbackAll()
Rollback transactions across allGraphobjects.- Specified by:
rollbackAllin interfaceGraphManager
-
rollback
public final void rollback(Set<String> graphSourceNamesToCloseTxOn)
Selectively rollback transactions on the specified graphs or the graphs of traversal sources.- Specified by:
rollbackin interfaceGraphManager
-
commitAll
public final void commitAll()
Commit transactions across allGraphobjects.- Specified by:
commitAllin interfaceGraphManager
-
commit
public final void commit(Set<String> graphSourceNamesToCloseTxOn)
Selectively commit transactions on the specified graphs or the graphs of traversal sources.- Specified by:
commitin interfaceGraphManager
-
openGraph
public final Graph openGraph(String graphName, Function<String,Graph> supplier)
Implementation that allows for custom graph-opening implementations; if theMaptracking graph references has aGraphobject corresponding to the graph name, then we return thatGraph-- otherwise, we use the customFunctionto instantiate a newGraph, add it to theMaptracking graph references, and return saidGraph.- Specified by:
openGraphin interfaceGraphManager
-
removeGraph
public final Graph removeGraph(String graphName) throws Exception
Implementation that allows for custom graph closing implementations; this method should remove theGraphfrom theGraphManager.- Specified by:
removeGraphin interfaceGraphManager- Throws:
Exception
-
-