Package org.neo4j.kernel

Examples of org.neo4j.kernel.EmbeddedGraphDatabase


public class Neo4jServer {

    private Smack smackServer;
   
    public static void main(String[] args) throws IOException {
        final Neo4jServer neo4jServer = new Neo4jServer(args[0], Integer.parseInt(args[1]), new EmbeddedGraphDatabase(args[2]));
        neo4jServer.start();
        System.in.read();
        neo4jServer.stop();
    }
View Full Code Here


  static final String DB_PATH = "db/neo4j-test-db";

  @Bean(destroyMethod = "shutdown") public EmbeddedGraphDatabase graphDatabaseService() throws IOException {
    FileUtils.deleteRecursively(new File(DB_PATH));
    return new EmbeddedGraphDatabase(DB_PATH);
  }
View Full Code Here

    private Config assertInjected(String testCase) {
        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:org/springframework/data/neo4j/config/DataGraphNamespaceHandlerTest" + testCase + "-context.xml");
        Config config = ctx.getBean("config", Config.class);
        GraphDatabaseContext graphDatabaseContext = config.graphDatabaseContext;
        Assert.assertNotNull("graphDatabaseContext", graphDatabaseContext);
        EmbeddedGraphDatabase graphDatabaseService = (EmbeddedGraphDatabase) graphDatabaseContext.getGraphDatabaseService();
        Assert.assertEquals("store-dir", "target/config-test", graphDatabaseService.getStoreDir());
        Assert.assertNotNull("graphRepositoryFactory",config.graphRepositoryFactory);
        Assert.assertNotNull("graphDatabaseService",config.graphDatabaseService);
        Assert.assertNotNull("transactionManager",config.transactionManager);
        config.graphDatabaseService.shutdown();
        return config;
View Full Code Here

        if (url.startsWith( "file:" )) {
            path = new URI(url).getPath();
        }
        File file = new File( path );
        // if (!file.isDirectory()) file=file.getParentFile();
        return new DelegatingGraphDatabase(new EmbeddedGraphDatabase(file.getAbsolutePath()));
    }
View Full Code Here

    return false;
  }

  @Override
  public GraphDatabaseService graphDatabaseService() {
    return new EmbeddedGraphDatabase("target/neo4j-db");
  }
View Full Code Here

    private Index<Node> nodeIndex, nameIndex;
    private RelationshipIndex friendIndex;
    private int nodeCount, edgeCount;

    public NeoFeeder(String dbpath) {
        db = new EmbeddedGraphDatabase(dbpath);
        nodeIndex = db.index().forNodes(Prop.TWITTER_ID.toString());
        nameIndex = db.index().forNodes(Prop.NAME.toString());
        friendIndex = db.index().forRelationships(TwitterRelationship.FRIEND.toString());
        registerShutdownHook();
    }
View Full Code Here

public class UnderstandDatabase {
  private EmbeddedGraphDatabase graphDB;
 
  public UnderstandDatabase(String path){
    graphDB = new EmbeddedGraphDatabase(path);
  }
View Full Code Here

//    return graphDB;
//  }

  // Get NEO4J RW version
  public static EmbeddedGraphDatabase getGraphDatabase(ServletContext servletContext){
    EmbeddedGraphDatabase graphDB = (EmbeddedGraphDatabase)servletContext.getAttribute(RW_NEO4J);
    if (graphDB == null){
      IOHelper.log("Adding neo4j RW db to servletContext");
      graphDB = new EmbeddedGraphDatabase(Config.get().neo4jDbPath);
      servletContext.setAttribute(RW_NEO4J, graphDB);
    }
    return graphDB;
  }
View Full Code Here

  }

  // Search index
  public static Index<Node> getSearchIndex(ServletContext servletContext){
//    EmbeddedReadOnlyGraphDatabase graphDB = getReadOnlyGraphDatabase(servletContext);
    EmbeddedGraphDatabase graphDB = getGraphDatabase(servletContext);
    Index<Node> index = (Index<Node>)servletContext.getAttribute(SEARCH_IDX_GWT);
    if (index == null){
      IOHelper.log("Adding search index - " + SEARCH_IDX_GWT + "- to servletContext.");
      index = graphDB.index().forNodes(SEARCH_IDX_NEO4J,
          MapUtil.stringMap("analyzer", CustomTokenAnalyzer.class.getName())
          );
      ((LuceneIndex<Node>) index).setCacheCapacity("key", 300000);
      servletContext.setAttribute(SEARCH_IDX_GWT,index);
    }
View Full Code Here

 

  // URI index
  public static Index<Node> getUriIndex(ServletContext servletContext){
//    EmbeddedReadOnlyGraphDatabase graphDB = getReadOnlyGraphDatabase(servletContext);
    EmbeddedGraphDatabase graphDB = getGraphDatabase(servletContext);
    Index<Node> index = (Index<Node>)servletContext.getAttribute(URI_IDX);
    if (index == null){
      IOHelper.log("Adding uri index - " + URI_IDX + " - to servletContext");
      index = graphDB.index().forNodes(URI_IDX);
      ((LuceneIndex<Node>) index).setCacheCapacity(DBNodeProperties.URI, 300000);
      servletContext.setAttribute(URI_IDX,index);
    }
    return index;
  }
View Full Code Here

TOP

Related Classes of org.neo4j.kernel.EmbeddedGraphDatabase

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.