Interface DefaultGraphProvider

All Known Implementing Classes:
TinkerGraphDefaultProvider

public interface DefaultGraphProvider
An SPI, discovered with ServiceLoader, through which a Graph implementation registers itself as TinkerPop's default in-memory graph. gremlin-core has no compile-time dependency on any concrete Graph implementation, so this is how it opens one when it needs a graph to deserialize a remote Graph result into, or to use as the default subgraph() side-effect, without naming that implementation directly. tinkergraph-gremlin provides this service for TinkerGraph.

Implementations need a public no-argument constructor and must be registered in META-INF/services/org.apache.tinkerpop.gremlin.structure.util.DefaultGraphProvider for the class path and with a provides clause in their module descriptor for the module path. Only one distinct implementation may be present. Repeated registrations of the same implementation class count as one provider.

  • Field Details

  • Method Details

    • open

      Graph open(org.apache.commons.configuration2.Configuration configuration)
      Opens a new, empty instance of the provided Graph implementation.
      Parameters:
      configuration - configuration for the graph; an implementation should tolerate an empty configuration and apply its own defaults
    • find

      Finds the DefaultGraphProvider, if any, on the class or module path. The class loader of gremlin-core is searched first and the thread context class loader second, so a provider that gremlin-core can use is preferred even when a child-first context class loader carries its own copies of gremlin-core and tinkergraph-gremlin. A provider that fails to load, for example because it implements another copy of this interface, is skipped rather than failing the lookup. Repeated registrations of the same implementation class count as one provider.
      Throws:
      IllegalStateException - if more than one distinct provider implementation is found