I'm trying to create sample server plugin for Neo4j REST server based on http://docs.neo4j.org/chunked/snapshot/server-plugins.html
I put up Amazon EC2 instance with Neo4j 1.7.2 CE Ubuntu 12.04 64-bit (ami-f3c8679a) and it's working - I get proper response when trying to get MyEC2DNS:7474/db/data so server is OK.
In eclipse
- created new Java project
- created
libsfolder and copied all the files from the downloaded1.7.2 Neo4j Community Edition-neo4j-community-1.7.2/liband added them to build path - created sample class at
package com.neo4j.server.plugins.examplewith the content
@Description("An extension to the Neo4j Server for getting all nodes or relationships")
public class GetAll extends ServerPlugin {
@Name("get_all_nodes")
@Description("Get all nodes from the Neo4j graph database")
@PluginTarget( GraphDatabaseService.class)
public Iterable<Node> getAllNodes(@Source GraphDatabaseService graphDb) {
return GlobalGraphOperations.at(graphDb).getAllNodes();
}
@Description("Get all relationships from the Neo4j graph database")
@PluginTarget(GraphDatabaseService.class)
public Iterable<Relationship> getAllRelationships(@Source GraphDatabaseService graphDb) {
return GlobalGraphOperations.at(graphDb).getAllRelationships();
}
}
- in Eclipse created file
org.neo4j.server.plugins.ServerPlugininsideMETA-INF/serviceswith single linecom.neo4j.server.plugins.example.GetAll - positioned in Java project folder and executed
jar -cvf get_all.jar *- I got ~13Mb .jar file - copied it to my Amazon EC2 instance to
/opt/neo4j/neo4j-community-1.7.2/plugins - restarted Neo4j server with
sudo -u neo4j ./bin/neo4j restart - what I get is
Response
Stopping Neo4j server [1718].... done
./bin/neo4j: line 174: ulimit: open files: cannot modify limit: Operation not permitted
Starting Neo4j Server...WARNING: not chaning user
process [1891]... waiting for server to be ready...... OK
Still the extension is not visible when I GET MyEC2DNS:7474/db/data.
Ideas? My guess is that maybe this plugin is simply too large (there is no need to include all those .jars but what is the other way - to put them in relative paths, how?).