http://docs.neo4j.org/chunked/snapshot/server-plugins.htmlに基づいてNeo4jRESTサーバー用のサンプルサーバープラグインを作成しようとしています
私はAmazonEC2インスタンスをインストールしましたがNeo4j 1.7.2 CE Ubuntu 12.04 64-bit (ami-f3c8679a)
、動作しています-取得しようとすると適切な応答が返されるMyEC2DNS:7474/db/data
ので、サーバーは問題ありません。
日食で
- 新しいJavaプロジェクトを作成しました
- フォルダを作成し、ダウンロードしたファイルからすべての
libs
ファイルをコピーし、ビルドパスに追加しました1.7.2 Neo4j Community Edition
neo4j-community-1.7.2/lib
package com.neo4j.server.plugins.example
コンテンツを使用してでサンプルクラスを作成しました
@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();
}
}
- Eclipseでは、1行でファイル
org.neo4j.server.plugins.ServerPlugin
を作成しましたMETA-INF/services
com.neo4j.server.plugins.example.GetAll
- Javaプロジェクトフォルダに配置されて実行され
jar -cvf get_all.jar *
ました-〜13Mbの.jarファイルを取得しました - それを私のAmazonEC2インスタンスにコピーしました
/opt/neo4j/neo4j-community-1.7.2/plugins
- Neo4jサーバーを再起動しました
sudo -u neo4j ./bin/neo4j restart
- 私が得るものは
応答
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
それでも、GETしたときに拡張子が表示されませんMyEC2DNS:7474/db/data
。
アイデア?私の推測では、このプラグインは単純に大きすぎると思います(これらの.jarをすべて含める必要はありませんが、他の方法は何ですか?相対パスに配置するにはどうすればよいですか?)。