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 Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe message used when noDefaultGraphProvidercan be found, naming the ways to fix it. -
Method Summary
Modifier and TypeMethodDescriptionstatic Optional<DefaultGraphProvider>find()Finds theDefaultGraphProvider, if any, on the class or module path.open(org.apache.commons.configuration2.Configuration configuration) Opens a new, empty instance of the providedGraphimplementation.
-
Field Details
-
NO_PROVIDER_MESSAGE
The message used when noDefaultGraphProvidercan be found, naming the ways to fix it.- See Also:
-
-
Method Details
-
open
Opens a new, empty instance of the providedGraphimplementation.- Parameters:
configuration- configuration for the graph; an implementation should tolerate an empty configuration and apply its own defaults
-
find
Finds theDefaultGraphProvider, if any, on the class or module path. The class loader ofgremlin-coreis searched first and the thread context class loader second, so a provider thatgremlin-corecan use is preferred even when a child-first context class loader carries its own copies ofgremlin-coreandtinkergraph-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
-