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 forGraph
andTraversalSource
instances configured for the server to be passed to script engine bindings. TheGraph
instances are read from theSettings
for Gremlin Server as defined in the configuration file. TheTraversalSource
instances are rebound to theGraphManager
once initialization scripts construct them.
-
-
Constructor Summary
Constructors Constructor Description DefaultGraphManager(Settings settings)
Create a new instance using theSettings
from Gremlin Server.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addGraph(String name, String configurationFile)
void
commit(Set<String> graphSourceNamesToCloseTxOn)
Selectively commit transactions on the specified graphs or the graphs of traversal sources.void
commitAll()
Commit transactions across allGraph
objects.Bindings
getAsBindings()
Get theGraph
andTraversalSource
list as a set of bindings.Graph
getGraph(String graphName)
GetGraph
instance whose name matchesgraphName
.Set<String>
getGraphNames()
TraversalSource
getTraversalSource(String traversalSourceName)
GetTraversalSource
instance whose name matchestraversalSourceName
Set<String>
getTraversalSourceNames()
Get aSet
of the names of the the storedTraversalSource
instances.Graph
openGraph(String graphName, Function<String,Graph> supplier)
Implementation that allows for custom graph-opening implementations; if theMap
tracking graph references has aGraph
object corresponding to the graph name, then we return thatGraph
-- otherwise, we use the customFunction
to instantiate a newGraph
, add it to theMap
tracking graph references, and return saidGraph
.void
putGraph(String graphName, Graph g)
Add or update the specifiedGraph
with the specified name toMap<String, Graph>
.void
putTraversalSource(String tsName, TraversalSource ts)
Add or update the specifiedTraversalSource
with the specified name.Graph
removeGraph(String graphName)
Implementation that allows for custom graph closing implementations; this method should remove theGraph
from theGraphManager
.TraversalSource
removeTraversalSource(String tsName)
RemoveTraversalSource
by name.void
rollback(Set<String> graphSourceNamesToCloseTxOn)
Selectively rollback transactions on the specified graphs or the graphs of traversal sources.void
rollbackAll()
Rollback transactions across allGraph
objects.-
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
hasAnyOpenTransactions
-
-
-
-
Method Detail
-
getGraphNames
public final Set<String> getGraphNames()
Description copied from interface:GraphManager
- Specified by:
getGraphNames
in interfaceGraphManager
-
getGraph
public final Graph getGraph(String graphName)
Description copied from interface:GraphManager
GetGraph
instance whose name matchesgraphName
.- Specified by:
getGraph
in interfaceGraphManager
- Returns:
Graph
if exists, else null
-
putGraph
public final void putGraph(String graphName, Graph g)
Description copied from interface:GraphManager
Add or update the specifiedGraph
with the specified name toMap<String, Graph>
.- Specified by:
putGraph
in interfaceGraphManager
-
getTraversalSourceNames
public final Set<String> getTraversalSourceNames()
Description copied from interface:GraphManager
Get aSet
of the names of the the storedTraversalSource
instances.- Specified by:
getTraversalSourceNames
in interfaceGraphManager
-
getTraversalSource
public final TraversalSource getTraversalSource(String traversalSourceName)
Description copied from interface:GraphManager
GetTraversalSource
instance whose name matchestraversalSourceName
- Specified by:
getTraversalSource
in interfaceGraphManager
- Returns:
TraversalSource
if exists, else null
-
putTraversalSource
public final void putTraversalSource(String tsName, TraversalSource ts)
Description copied from interface:GraphManager
Add or update the specifiedTraversalSource
with the specified name.- Specified by:
putTraversalSource
in interfaceGraphManager
-
removeTraversalSource
public final TraversalSource removeTraversalSource(String tsName)
Description copied from interface:GraphManager
RemoveTraversalSource
by name.- Specified by:
removeTraversalSource
in interfaceGraphManager
-
getAsBindings
public final Bindings getAsBindings()
Get theGraph
andTraversalSource
list as a set of bindings.- Specified by:
getAsBindings
in interfaceGraphManager
-
rollbackAll
public final void rollbackAll()
Rollback transactions across allGraph
objects.- Specified by:
rollbackAll
in interfaceGraphManager
-
rollback
public final void rollback(Set<String> graphSourceNamesToCloseTxOn)
Selectively rollback transactions on the specified graphs or the graphs of traversal sources.- Specified by:
rollback
in interfaceGraphManager
-
commitAll
public final void commitAll()
Commit transactions across allGraph
objects.- Specified by:
commitAll
in interfaceGraphManager
-
commit
public final void commit(Set<String> graphSourceNamesToCloseTxOn)
Selectively commit transactions on the specified graphs or the graphs of traversal sources.- Specified by:
commit
in interfaceGraphManager
-
openGraph
public final Graph openGraph(String graphName, Function<String,Graph> supplier)
Implementation that allows for custom graph-opening implementations; if theMap
tracking graph references has aGraph
object corresponding to the graph name, then we return thatGraph
-- otherwise, we use the customFunction
to instantiate a newGraph
, add it to theMap
tracking graph references, and return saidGraph
.- Specified by:
openGraph
in interfaceGraphManager
-
removeGraph
public final Graph removeGraph(String graphName) throws Exception
Implementation that allows for custom graph closing implementations; this method should remove theGraph
from theGraphManager
.- Specified by:
removeGraph
in interfaceGraphManager
- Throws:
Exception
-
-