public final class DefaultGraphManager extends Object implements GraphManager
Graph and TraversalSource instances configured for the server to be passed to script
engine bindings. The Graph instances are read from the Settings for Gremlin Server as defined in
the configuration file. The TraversalSource instances are rebound to the GraphManager once
initialization scripts construct them.| Constructor and Description |
|---|
DefaultGraphManager(Settings settings)
Create a new instance using the
Settings from Gremlin Server. |
| Modifier and Type | Method and Description |
|---|---|
void |
commit(Set<String> graphSourceNamesToCloseTxOn)
Selectively commit transactions on the specified graphs or the graphs of traversal sources.
|
void |
commitAll()
Commit transactions across all
Graph objects. |
Bindings |
getAsBindings()
Get the
Graph and TraversalSource list as a set of bindings. |
Graph |
getGraph(String graphName)
Get
Graph instance whose name matches graphName. |
Set<String> |
getGraphNames()
|
Map<String,Graph> |
getGraphs()
Deprecated.
As of release 3.2.5, replaced by a combination of
getGraphNames() and
getGraph(String) |
TraversalSource |
getTraversalSource(String traversalSourceName)
Get
TraversalSource instance whose name matches traversalSourceName |
Set<String> |
getTraversalSourceNames()
Get a
Set of the names of the the stored TraversalSource instances. |
Map<String,TraversalSource> |
getTraversalSources()
Deprecated.
As of release 3.2.5, replaced by a combination of
getTraversalSource(String) ()} and
getTraversalSource(String) (String)} |
Graph |
openGraph(String graphName,
Function<String,Graph> supplier)
Implementation that allows for custom graph-opening implementations; if the
Map
tracking graph references has a Graph object corresponding to the graph name, then we return that
Graph-- otherwise, we use the custom Function to instantiate a new Graph, add it to
the Map tracking graph references, and return said Graph. |
void |
putGraph(String graphName,
Graph g)
Add or update the specified
Graph with the specified name to Map<String, Graph> . |
void |
putTraversalSource(String tsName,
TraversalSource ts)
Add or update the specified
TraversalSource with the specified name. |
Graph |
removeGraph(String graphName)
Implementation that allows for custom graph closing implementations; this method should remove the
Graph
from the GraphManager. |
TraversalSource |
removeTraversalSource(String tsName)
Remove
TraversalSource 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 all
Graph objects. |
@Deprecated public final Map<String,Graph> getGraphs()
getGraphNames() and
getGraph(String)Graph instances and their binding names as defined in the Gremlin Server
configuration file.getGraphs in interface GraphManagerMap where the key is the name of the Graph and the value is the Graph itselfpublic final Set<String> getGraphNames()
GraphManagergetGraphNames in interface GraphManagerpublic final Graph getGraph(String graphName)
GraphManagerGraph instance whose name matches graphName.getGraph in interface GraphManagerGraph if exists, else nullpublic final void putGraph(String graphName, Graph g)
GraphManagerGraph with the specified name to Map<String, Graph> .putGraph in interface GraphManager@Deprecated public final Map<String,TraversalSource> getTraversalSources()
getTraversalSource(String) ()} and
getTraversalSource(String) (String)}TraversalSource instances and their binding names as defined by Gremlin Server
initialization scripts.getTraversalSources in interface GraphManagerMap where the key is the name of the TraversalSource and the value is the
TraversalSource itselfpublic final Set<String> getTraversalSourceNames()
GraphManagerSet of the names of the the stored TraversalSource instances.getTraversalSourceNames in interface GraphManagerpublic final TraversalSource getTraversalSource(String traversalSourceName)
GraphManagerTraversalSource instance whose name matches traversalSourceNamegetTraversalSource in interface GraphManagerTraversalSource if exists, else nullpublic final void putTraversalSource(String tsName, TraversalSource ts)
GraphManagerTraversalSource with the specified name.putTraversalSource in interface GraphManagerpublic final TraversalSource removeTraversalSource(String tsName)
GraphManagerTraversalSource by name.removeTraversalSource in interface GraphManagerpublic final Bindings getAsBindings()
Graph and TraversalSource list as a set of bindings.getAsBindings in interface GraphManagerpublic final void rollbackAll()
Graph objects.rollbackAll in interface GraphManagerpublic final void rollback(Set<String> graphSourceNamesToCloseTxOn)
rollback in interface GraphManagerpublic final void commitAll()
Graph objects.commitAll in interface GraphManagerpublic final void commit(Set<String> graphSourceNamesToCloseTxOn)
commit in interface GraphManagerpublic final Graph openGraph(String graphName, Function<String,Graph> supplier)
Map
tracking graph references has a Graph object corresponding to the graph name, then we return that
Graph-- otherwise, we use the custom Function to instantiate a new Graph, add it to
the Map tracking graph references, and return said Graph.openGraph in interface GraphManagerpublic final Graph removeGraph(String graphName) throws Exception
Graph
from the GraphManager.removeGraph in interface GraphManagerExceptionCopyright © 2013–2017 Apache Software Foundation. All rights reserved.