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()
|
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. |
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. |
public 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 GraphManagerpublic 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–2020 Apache Software Foundation. All rights reserved.