public 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  Settingsfrom Gremlin Server. | 
| Modifier and Type | Method and 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 all  Graphobjects. | 
| Bindings | getAsBindings()Get the  GraphandTraversalSourcelist as a set of bindings. | 
| Graph | getGraph(String graphName)Get  Graphinstance whose name matchesgraphName. | 
| Set<String> | getGraphNames() | 
| TraversalSource | getTraversalSource(String traversalSourceName)Get  TraversalSourceinstance whose name matchestraversalSourceName | 
| Set<String> | getTraversalSourceNames()Get a  Setof the names of the the storedTraversalSourceinstances. | 
| Graph | openGraph(String graphName,
         Function<String,Graph> supplier)Implementation that allows for custom graph-opening implementations; if the  Maptracking 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. | 
| void | putGraph(String graphName,
        Graph g)Add or update the specified  Graphwith the specified name toMap<String, Graph>. | 
| void | putTraversalSource(String tsName,
                  TraversalSource ts)Add or update the specified  TraversalSourcewith the specified name. | 
| Graph | removeGraph(String graphName)Implementation that allows for custom graph closing implementations; this method should remove the  Graphfrom theGraphManager. | 
| TraversalSource | removeTraversalSource(String tsName)Remove  TraversalSourceby 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  Graphobjects. | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithasAnyOpenTransactionspublic 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–2022 Apache Software Foundation. All rights reserved.