Spring Data Graph

org.springframework.data.neo4j.server
Class SpringPluginInitializer

java.lang.Object
  extended by org.springframework.data.neo4j.server.SpringPluginInitializer
All Implemented Interfaces:
org.neo4j.server.plugins.PluginLifecycle

public abstract class SpringPluginInitializer
extends Object
implements org.neo4j.server.plugins.PluginLifecycle

Initializer to run Spring Data Graph based Server Plugins in a Neo4j REST-server. It takes the list of config locations and a number of spring beans from those contexts that should be exposed as injectable dependencies with a Jersey @Context.
For example:

 class MyInitializer extends SpringPluginInitializer {
     public MyInitializer() {
         super(new String[]{"myContext.xml"},"graphRepositoryFactory","myRepository");
     }
 }
 


Field Summary
protected  ProvidedClassPathXmlApplicationContext ctx
           
 
Constructor Summary
SpringPluginInitializer(String[] contextLocations, org.neo4j.helpers.Pair<String,Class>... exposedBeans)
           
 
Method Summary
protected static org.neo4j.helpers.Pair<String,Class> expose(String name, Class<?> type)
           
 Collection<org.neo4j.server.plugins.Injectable<?>> start(org.neo4j.graphdb.GraphDatabaseService graphDatabaseService, org.apache.commons.configuration.Configuration config)
          Binds the provided graph database to the spring contexts so that spring beans that consume a graph database can be populated.
 void stop()
          closes the spring context
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ctx

protected ProvidedClassPathXmlApplicationContext ctx
Constructor Detail

SpringPluginInitializer

public SpringPluginInitializer(String[] contextLocations,
                               org.neo4j.helpers.Pair<String,Class>... exposedBeans)
Method Detail

expose

protected static org.neo4j.helpers.Pair<String,Class> expose(String name,
                                                             Class<?> type)

start

public Collection<org.neo4j.server.plugins.Injectable<?>> start(org.neo4j.graphdb.GraphDatabaseService graphDatabaseService,
                                                                org.apache.commons.configuration.Configuration config)
Binds the provided graph database to the spring contexts so that spring beans that consume a graph database can be populated.

Specified by:
start in interface org.neo4j.server.plugins.PluginLifecycle
Parameters:
graphDatabaseService - of the Neo4j server
config - of the Neo4j Server
Returns:
Exposes the requested Spring beans as @{see Injectable}s

stop

public void stop()
closes the spring context

Specified by:
stop in interface org.neo4j.server.plugins.PluginLifecycle

Spring Data Graph

Copyright © 2011 SpringSource. All Rights Reserved.