Class TinkerFactoryDataLoader

java.lang.Object
org.apache.tinkerpop.gremlin.server.util.TinkerFactoryDataLoader
All Implemented Interfaces:
LifeCycleHook

public class TinkerFactoryDataLoader extends Object implements LifeCycleHook
A LifeCycleHook that loads TinkerFactory sample datasets into a graph during server startup. Replaces the Groovy init scripts (e.g. generate-modern.groovy) for default server configurations.

Configuration parameters (via config in YAML):

  • graph — name of the graph (as defined in graphs: config) to load data into
  • dataset — which dataset to load: modern, classic, crew, grateful, sink, airroutes, zoo

Example YAML usage:

 lifecycleHooks:
   - className: org.apache.tinkerpop.gremlin.server.util.TinkerFactoryDataLoader
     config: {graph: graph, dataset: modern}
 
  • Constructor Details

    • TinkerFactoryDataLoader

      public TinkerFactoryDataLoader()
  • Method Details

    • init

      public void init(Map<String,Object> config)
      Description copied from interface: LifeCycleHook
      Called once after instantiation to pass configuration from the lifecycleHooks YAML section. Implementations that require configuration should override this method. The default implementation is a no-op so that existing hooks are not forced to implement it.

      If this method throws an exception, the hook is skipped and the server continues to start without it.

      Specified by:
      init in interface LifeCycleHook
      Parameters:
      config - the key/value pairs from the config block in the YAML entry
    • onStartUp

      public void onStartUp(LifeCycleHook.Context c)
      Description copied from interface: LifeCycleHook
      Called when the server starts up. The graph collection will have been initialized at this point and all initialization scripts will have been executed when this callback is called.

      If this method throws an exception (other than UnsupportedOperationException), the server will fail to start.

      Specified by:
      onStartUp in interface LifeCycleHook
    • onShutDown

      public void onShutDown(LifeCycleHook.Context c)
      Description copied from interface: LifeCycleHook
      Called when the server is shutdown.

      If this method throws an exception, remaining shutdown hooks and graph cleanup may be skipped.

      Specified by:
      onShutDown in interface LifeCycleHook