Database Reference
In-Depth Information
6.
Once the project is finished importing into your workspace, you should have a directory
structure that looks similar to the one shown in Figure 6-6 .
Figure 6-6. The local project for the Neo4j plugins
Neo4j Server Plugins
To create a plugin, your code must extend the org.neo4j.server.plugins.ServerPlugin class. Your plugin should
also ensure that it will produce one the following items:
An iterable of node, relationship, or path
Any Java primitive or string
org.neo4j.server.rest.repr.Representation
An instance of a
The plugin could include parameters, a point of extension, and any necessary application logic. Listing 6-1
exemplifies how, when creating the plugin, to be sure that the discovery point type in the @PluginTarget and the
@Source parameter are of the same type.
Listing 6-1. Example of a Neo4j Plugin That Returns All Relationships from a Node
package com.graphstory.practicalneo4j.plugin;
import java.util.ArrayList;
import org.neo4j.graphdb.Direction;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Relationship;
import org.neo4j.graphdb.Transaction;
import org.neo4j.server.plugins.Description;
import org.neo4j.server.plugins.PluginTarget;
import org.neo4j.server.plugins.ServerPlugin;
import org.neo4j.server.plugins.Source;
@Description("An extension to the Neo4j Server for getting all nodes or relationships")
public class GraphStoryPlugin extends ServerPlugin {
 
Search WWH ::




Custom Search