Changed info about running SDG on the server

This commit is contained in:
Andres Taylor
2011-04-05 08:21:39 +02:00
parent ee04814066
commit fc64a6e973

View File

@@ -24,7 +24,7 @@
For complete freedom in your implementation an <ulink
url="http://docs.neo4j.org/chunked/milestone/server-unmanaged-extensions.html">unmanaged extension</ulink>
might be the right solution. Unmanaged
extensions are <ulink url="http://jersey.java.net/">jersey</ulink> resource implementations.
extensions are <ulink url="http://jersey.java.net/">Jersey</ulink> resource implementations.
The resources constructors or methods can get the <code>GraphDatabaseService</code> injected to execute the
necessary operations and return appropriate Representations.
</para>
@@ -32,23 +32,14 @@
Both kinds of extensions have to be packaged as a jar and added to the Neo4j-Server's plugin directory.
Server Plugins are picked up at server startup when they provide the necessary
<code>META-INF.services/org.neo4j.server.plugins.ServerPlugin</code> file for Javas service loader mechanism.
Unmanaged extensions have to be registered with the neo4j-server configuration.
Unmanaged extensions have to be registered with the Neo4j Server configuration.
<programlisting language="ini"><![CDATA[
org.neo4j.server.thirdparty_jaxrs_classes=com.example.mypackage=/my-context
]]></programlisting>
</para>
<para>
Integrating Spring Data Graph into this setup is not so trivial because the graph database is not created
by the spring context but already provided by the Neo4j-server. But a correctly set up and loaded
spring context ist the requirement for spring data graph to work. By using the lifecycle support of
Neo4j server extendsions it is possible to register the provided graph database with the
spring configuration and also to expose certain spring beans (e.g. graphRepositoryFactory, graphDatabaseContext) to be
injected via jersey into subsequent resources.
</para>
<para>
This can be achieved by subclassing SpringPluginInitializer and providing the context-locations and the
beans that should be exposed. The <code>SpringPluginInitializer</code> merges the graph database service
with the spring configuration and registers the named beans as jersey Injectables.
Running Spring Data Graph on the server is easy. You need to tell the server where to find the Spring Context
file, and which beans from it to expose:
<programlisting language="java"><![CDATA[
public class HelloWorldInitializer extends SpringPluginInitializer {
public HelloWorldInitializer() {
@@ -56,11 +47,12 @@ public class HelloWorldInitializer extends SpringPluginInitializer {
}
}
]]></programlisting>
The <code>SpringPluginInitializer</code> merges the graph database service
with the spring configuration and registers the named beans as jersey Injectables.
It is still necessary to list the initializer fully qualified class name in a
file named META-INF/services/org.neo4j.server.plugins.PluginLifecycle. Then the Neo4j Server can pick up
and run the initialization classes before the the extensions are loaded.
</para>
</para>
</section>
<section>
<title>Using Spring Data Graph as a REST-Client</title>