@PluginTarget(Node.class)没有注册为neo4j插件

时间:2014-10-28 05:03:30

标签: java curl neo4j

下面的简单课程不会显示为插件

package com.danmacias.neoneoteplugin;

import java.util.ArrayList;
import java.util.List;

import org.neo4j.graphdb.*;
import org.neo4j.server.plugins.*;
import org.neo4j.graphalgo.*;
//import org.neo4j.tooling.GlobalGraphOperations;

@Description( "An extension to the Neo4j Server for getting all nodes or relationships" )
public class GetPaths extends ServerPlugin
{
  @Name( "breadth_first_paths" )
  @Description( "Breadth First Traversal of a specific node." )
  @PluginTarget( Node.class )
  public Iterable<Path> getPaths( @Source Node graphDb )
  {
    ArrayList<Path> paths = new ArrayList<>();
    return paths;
  }
}

卷曲返回

{                                                                                                                              
  "extensions" : {
    "GetAll" : {
      "get_all_nodes" : "http://localhost:7474/db/data/ext/GetAll/graphdb/get_all_nodes"
    }
    ...
},

但是,当我用 GraphDatabaseService.class 替换 Node.class 的两个实例时,它会很好地识别插件。为什么不接受节点?

此外,/ var / logs / neo4j没有显示与此相关的任何错误

1 个答案:

答案 0 :(得分:2)

不是100%肯定,但我认为插件停留在节点级别 - 使用@PluginTarget(Node.class)不会出现在全局扩展中。相反,当通过REST API检索节点时,有一个extensions块以及基于节点的插件。