org.apache.tinkerpop.gremlin.server

## Interface GraphManager

- All Known Implementing Classes:
    DefaultGraphManager

      public interface GraphManager

  The `GraphManager` interface allows for reference tracking of Graph references through a `Map<String, Graph>`; the interface plugs into the lifeline of gremlin script executions, meaning that commit() and rollback() will be called on all graphs stored in the graph reference tracker at the end of the script executions; you may want to implement this interface if you want to define a custom graph instantiation/closing mechanism; note that the interface also defines similar features for `TraversalSource` objects.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    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()` Get a `Set` of `String` graphNames corresponding to names stored in the graph's reference tracker.
    `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.

- - ### Method Detail

    - #### getGraphNames

          Set<String> getGraphNames()

      Get a `Set` of `String` graphNames corresponding to names stored in the graph's reference tracker.

    - #### getGraph

          Graph getGraph(String graphName)

      Get `Graph` instance whose name matches `graphName`.
      Returns:
        `Graph` if exists, else null

    - #### putGraph

          void putGraph(String graphName,
                        Graph g)

      Add or update the specified `Graph` with the specified name to `Map<String, Graph>` .

    - #### getTraversalSourceNames

          Set<String> getTraversalSourceNames()

      Get a `Set` of the names of the the stored `TraversalSource` instances.

    - #### getTraversalSource

          TraversalSource getTraversalSource(String traversalSourceName)

      Get `TraversalSource` instance whose name matches `traversalSourceName`
      Returns:
        `TraversalSource` if exists, else null

    - #### putTraversalSource

          void putTraversalSource(String tsName,
                                  TraversalSource ts)

      Add or update the specified `TraversalSource` with the specified name.

    - #### removeTraversalSource

          TraversalSource removeTraversalSource(String tsName)

      Remove `TraversalSource` by name.

    - #### getAsBindings

          Bindings getAsBindings()

      Get the `Graph` and `TraversalSource` list as a set of bindings.

    - #### rollbackAll

          void rollbackAll()

      Rollback transactions across all `Graph` objects.

    - #### rollback

          void rollback(Set<String> graphSourceNamesToCloseTxOn)

      Selectively rollback transactions on the specified graphs or the graphs of traversal sources.

    - #### commitAll

          void commitAll()

      Commit transactions across all `Graph` objects.

    - #### commit

          void commit(Set<String> graphSourceNamesToCloseTxOn)

      Selectively commit transactions on the specified graphs or the graphs of traversal sources.

    - #### openGraph

          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`.

    - #### removeGraph

          Graph removeGraph(String graphName)
                     throws Exception

      Implementation that allows for custom graph closing implementations; this method should remove the `Graph` from the `GraphManager`.
      Throws:
        `Exception`

Copyright © 2013–2020 Apache Software Foundation. All rights reserved.