org.neo4j.server.plugins
Class ServerPlugin

java.lang.Object
  extended by org.neo4j.server.plugins.ServerPlugin

public abstract class ServerPlugin
extends Object

API for creating extensions for the Neo4j server. Extensions are created by creating a subclass of this class. The subclass should have a public no-argument constructor. Then place this class in a jar-file that contains a file called META-INF/services/org.neo4j.server.plugins.ServerPlugin. This file should contain the fully qualified name of the class that extends ServerPlugin, e.g. com.example.MyNeo4jServerExtension on a single line. If the jar contains multiple extensions to the Neo4j server, this file should contain the fully qualified class names of all extension classes, each class name on its own line in the file. When the jar file is placed on the class path of the server, it will be loaded automatically when the server starts. The easiest way to implement Neo4j server extensions is by defining public methods on the extension class annotated with @PluginTarget. The parameter for the PluginTarget annotation should be the class representing the entity that the method extends. The entities that can be extended are currently:

You can then use the @Source annotation on one parameter of the method to get the instance that was extended. Additional parameters needs to be of a supported type, and annotated with the @Parameter annotation specifying the name by which the parameter is passed from the client. The supported parameter types are: All exceptions thrown by an PluginTarget method are treated as server errors, unless the method has declared the ability to throw such an exception, in that case the exception is treated as a bad request and propagated to the invoking client.

Author:
Tobias Ivarsson
See Also:
ServiceLoader

Constructor Summary
ServerPlugin()
          Create a server extension using the simple name of the concrete class that extends ServerPlugin as the name for the extension.
ServerPlugin(String name)
          Create a server extension with the specified name.
 
Method Summary
protected  Collection<PluginPoint> getDefaultExtensionPoints(org.apache.commons.configuration.Configuration serverConfig)
          Loads the extension points of this server extension.
protected  void loadServerExtender(ServerExtender extender, org.apache.commons.configuration.Configuration serverConfig)
          Loads the extension points of this server extension.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServerPlugin

public ServerPlugin(String name)
Create a server extension with the specified name.

Parameters:
name - the name of this extension.

ServerPlugin

public ServerPlugin()
Create a server extension using the simple name of the concrete class that extends ServerPlugin as the name for the extension.

Method Detail

toString

public String toString()
Overrides:
toString in class Object

loadServerExtender

protected void loadServerExtender(ServerExtender extender,
                                  org.apache.commons.configuration.Configuration serverConfig)
Loads the extension points of this server extension. Override this method to provide your own, custom way of loading extension points. The default implementation loads PluginPoint based on methods with the PluginTarget annotation.

Parameters:
extender - the collection of PluginPoints for this ServerPlugin.
serverConfig - the configuration parameters for the server.

getDefaultExtensionPoints

protected Collection<PluginPoint> getDefaultExtensionPoints(org.apache.commons.configuration.Configuration serverConfig)
Loads the extension points of this server extension. Override this method to provide your own, custom way of loading extension points. The default implementation loads PluginPoint based on methods with the PluginTarget annotation.

Parameters:
serverConfig - the configuration parameters for the server.
Returns:
the collection of PluginPoints for this ServerPlugin.


Copyright © 2010 The Neo4j Graph Database Project. All Rights Reserved.