org.neo4j.kernel
Class KernelExtension<S>
java.lang.Object
org.neo4j.helpers.Service
org.neo4j.kernel.KernelExtension<S>
- Type Parameters:
S
- the Extension state type
public abstract class KernelExtension<S>
- extends Service
Hook for providing extended functionality to the Neo4j Graph Database kernel.
Implementations of KernelExtension
must fulfill the following
contract:
- Must have a public no-arg constructor.
- The same instance must be able to load with multiple GraphDatabase
kernels.
- Different instances should be able to access the same state from the same
kernel.
To achieve this, different instances of the same class should have the same
hashCode()
and be equals(Object)
. This is enforced by this
base class by delegating hashCode()
and equals(Object)
to
the same methods on the class object
.
The simplest way to implement an extension
that
fulfills this contract is if the extension
implementation is stateless, and all state is kept in the state object
returned by the load method
.
Note that for an extension
to be considered loaded by
the kernel, the load method
may not return
null
. The unload method
will only be
invoked if the kernel considers the extension
loaded.
- Author:
- Tobias Ivarsson
KernelExtension
public KernelExtension(String key)
hashCode
public final int hashCode()
- Overrides:
hashCode
in class Object
equals
public final boolean equals(Object obj)
- Overrides:
equals
in class Object
loadAgent
public final void loadAgent(String agentArgs)
loadAgent
protected final void loadAgent(KernelData kernel,
Object param)
agentArgument
protected Object agentArgument(String agentArg)
load
protected abstract S load(KernelData kernel)
- Load this extension for a particular Neo4j Kernel.
agentLoad
protected S agentLoad(KernelData kernel,
Object param)
agentVisit
protected void agentVisit(KernelData kernel,
S state,
Object param)
loadConfiguration
protected void loadConfiguration(KernelData kernel)
- Takes place before any data sources has been registered and is there to
let extensions affect the configuration of other things starting up.
unload
protected void unload(S state)
getState
protected final S getState(KernelData kernel)
isLoaded
protected boolean isLoaded(KernelData kernel)
Copyright © 2002-2012 The Neo4j Graph Database Project. All Rights Reserved.