Java 类org.neo4j.graphdb.factory.GraphDatabaseSettings 实例源码

项目:neo4j-lucene5-index    文件:TestAutoIndexing.java   
@Test
public void testConfigAndAPICompatibility()
{
    stopDb();
    config = new HashMap<>();
    config.put( GraphDatabaseSettings.node_keys_indexable.name(), "nodeProp1, nodeProp2" );
    config.put( GraphDatabaseSettings.relationship_keys_indexable.name(), "relProp1, relProp2" );
    config.put( GraphDatabaseSettings.node_auto_indexing.name(), "true" );
    config.put( GraphDatabaseSettings.relationship_auto_indexing.name(), "true" );
    startDb();

    assertTrue( graphDb.index().getNodeAutoIndexer().isEnabled() );
    assertTrue( graphDb.index().getRelationshipAutoIndexer().isEnabled() );

    AutoIndexer<Node> autoNodeIndexer = graphDb.index().getNodeAutoIndexer();
    // Start auto indexing a new and an already auto indexed
    autoNodeIndexer.startAutoIndexingProperty( "nodeProp1" );
    autoNodeIndexer.startAutoIndexingProperty( "nodeProp3" );
    assertEquals( 3, autoNodeIndexer.getAutoIndexedProperties().size() );
    assertTrue( autoNodeIndexer.getAutoIndexedProperties().contains(
            "nodeProp1" ) );
    assertTrue( autoNodeIndexer.getAutoIndexedProperties().contains(
            "nodeProp2" ) );
    assertTrue( autoNodeIndexer.getAutoIndexedProperties().contains(
            "nodeProp3" ) );
}
项目:neo4j-lucene5-index    文件:TestAutoIndexing.java   
@Test
public void testDefaultIsOffIfExplicit() throws Exception
{
    stopDb();
    config = new HashMap<>();
    config.put( GraphDatabaseSettings.node_keys_indexable.name(), "nodeProp1, nodeProp2" );
    config.put( GraphDatabaseSettings.relationship_keys_indexable.name(), "relProp1, relProp2" );
    config.put( GraphDatabaseSettings.node_auto_indexing.name(), "false" );
    config.put( GraphDatabaseSettings.relationship_auto_indexing.name(), "false" );
    startDb();

    AutoIndexer<Node> autoIndexer = graphDb.index().getNodeAutoIndexer();
    autoIndexer.startAutoIndexingProperty( "testProp" );
    newTransaction();

    Node node1 = graphDb.createNode();
    node1.setProperty( "nodeProp1", "node1" );
    node1.setProperty( "nodeProp2", "node1" );
    node1.setProperty( "testProp", "node1" );

    newTransaction();

    assertFalse( autoIndexer.getAutoIndex().get( "nodeProp1", "node1" ).hasNext() );
    assertFalse( autoIndexer.getAutoIndex().get( "nodeProp2", "node1" ).hasNext() );
    assertFalse( autoIndexer.getAutoIndex().get( "testProp", "node1" ).hasNext() );
}
项目:neo4j-lucene5-index    文件:RecoveryTest.java   
@Test
public void recoveryForRelationshipCommandsOnly() throws Throwable
{
    // shutdown db here
    String storeDir = db.getStoreDir();
    File path = new File( storeDir );
    shutdownDB();

    // NB: AddRelToIndex will start and shutdown the db
    Process process = Runtime.getRuntime().exec( new String[]{
            "java", "-Xdebug", "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005", "-cp",
            System.getProperty( "java.class.path" ),
            AddRelToIndex.class.getName(), storeDir
    } );
    assertEquals( 0, new ProcessStreamHandler( process, false ).waitForResult() );

    FileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction();
    Config config = new Config( MapUtil.stringMap(), GraphDatabaseSettings.class );
    LuceneDataSource ds = new LuceneDataSource( path, config, new IndexConfigStore( path, fileSystem ), fileSystem );
    ds.start();
    ds.stop();
}
项目:octotron_core    文件:Neo4jGraph.java   
private void DBInit()
{
    graph_db = new GraphDatabaseFactory()
        .newEmbeddedDatabaseBuilder(db_name)
        .setConfig(GraphDatabaseSettings.keep_logical_logs, "false")
        .setConfig(GraphDatabaseSettings.use_memory_mapped_buffers, "true")
        .setConfig(ShellSettings.remote_shell_enabled, "true")
        .setConfig(ShellSettings.remote_shell_port, "1337")
        .setConfig(ShellSettings.remote_shell_read_only, "true")
        .newGraphDatabase();

    if(bootstrap)
        DoBootstrap();

    transaction = new NinjaTransaction(graph_db, Neo4jGraph.COUNT_THRESHOLD);
}
项目:jcypher    文件:InMemoryDBAccess.java   
@Override
    protected GraphDatabaseService createGraphDB() {
        GraphDatabaseBuilder builder = new TestGraphDatabaseFactory().newImpermanentDatabaseBuilder();
        if (this.properties != null) {
            if (this.properties
                    .getProperty(DBProperties.PAGECACHE_MEMORY) != null)
                builder.setConfig(
                        GraphDatabaseSettings.pagecache_memory,
                        DBProperties.PAGECACHE_MEMORY);
            if (this.properties.getProperty(DBProperties.STRING_BLOCK_SIZE) != null)
                builder.setConfig(GraphDatabaseSettings.string_block_size,
                        DBProperties.ARRAY_BLOCK_SIZE);
            if (this.properties.getProperty(DBProperties.STRING_BLOCK_SIZE) != null)
                builder.setConfig(GraphDatabaseSettings.array_block_size,
                        DBProperties.ARRAY_BLOCK_SIZE);
        }

//      builder.setConfig(GraphDatabaseSettings.cypher_planner, "RULE");

        return builder.newGraphDatabase();
    }
项目:checklistbank    文件:NeoConfiguration.java   
/**
 * Creates a new embedded db in the neoRepository folder.
 *
 * @param eraseExisting if true deletes previously existing db
 */
public GraphDatabaseBuilder newEmbeddedDb(File storeDir, boolean eraseExisting) {
  if (eraseExisting && storeDir.exists()) {
    // erase previous db
    LOG.debug("Removing previous neo4j database from {}", storeDir.getAbsolutePath());
    FileUtils.deleteQuietly(storeDir);
  }
  GraphDatabaseBuilder builder = new GraphDatabaseFactory()
      .setUserLogProvider(new Slf4jLogProvider())
      .newEmbeddedDatabaseBuilder(storeDir)
      .setConfig(GraphDatabaseSettings.keep_logical_logs, "false")
      .setConfig(GraphDatabaseSettings.pagecache_memory, mappedMemory + "m");
  if (shell) {
    LOG.info("Enable neo4j shell on port " + port);
    builder.setConfig(ShellSettings.remote_shell_enabled, "true")
        .setConfig(ShellSettings.remote_shell_port, String.valueOf(port))
        // listen to all IPs, not localhost only
        .setConfig(ShellSettings.remote_shell_host, "0.0.0.0");
  }
  return builder;
}
项目:visitmeta    文件:Neo4JConnection.java   
/**
 * Clears all data in the DB and reconnects to it afterwards.
 */
public void ClearDatabase(){
    // Shutdown database before erasing it
    log.debug("Shutting down the database");
    mGraphDb.shutdown();
    try
       {
        log.debug("Erasing the database files");
           FileUtils.deleteRecursively( new File( mDbPath ) );
       }
       catch ( IOException e )
       {
           throw new RuntimeException( e );
       }
    // Restart database
    log.debug("Reconnecting to database");
    mGraphDb = new GraphDatabaseFactory().
            newEmbeddedDatabaseBuilder(mDbPath).
            setConfig( GraphDatabaseSettings.node_keys_indexable, KEY_HASH ).
            setConfig( GraphDatabaseSettings.node_auto_indexing, "true" ).
            newGraphDatabase();
    registerShutdownHook(mGraphDb);
}
项目:codemodel-rifle    文件:EmbeddedTestkitDriver.java   
public EmbeddedTestkitDriver(final File storeDir) {
        GraphDatabaseSettings.BoltConnector bolt = GraphDatabaseSettings.boltConnector( "0" );

        String host = "localhost";
        int port = 7687; // this is the default Neo4j port - we start one higher than this
        GraphDatabaseService graphDb = null;
        String address = null;
        while (port < 65000) {
            port++;
            address = String.format("%s:%d", host, port);
            try {
                graphDb = new TestGraphDatabaseFactory()
                    .newImpermanentDatabaseBuilder()
//                    .newEmbeddedDatabaseBuilder(storeDir)
                    .setConfig(bolt.type, "BOLT")
                    .setConfig(bolt.enabled, "true")
                    .setConfig(bolt.address, address)
                    .newGraphDatabase();
            } catch (RuntimeException e) {
                // this is usually a org.neo4j.kernel.lifecycle.LifecycleException
                // caused by org.neo4j.helpers.PortBindException
                e.printStackTrace();
                System.out.println("Cannot connect on port " + port + ", retrying on a higher port.");
                continue;
            }
            break;
        }

        gds = graphDb;
        driver = GraphDatabase.driver("bolt://" + address);
    }
项目:neo4j-lucene5-index    文件:LuceneDataSource.java   
void force()
{
    for ( IndexReference index : getAllIndexes() )
    {
        try
        {
            index.getWriter().commit();
        }
        catch ( IOException e )
        {
            throw new RuntimeException( "Unable to commit changes to " + index.getIdentifier() + " in " +
                    config.get( GraphDatabaseSettings.store_dir ).getAbsolutePath(), e );
        }
    }
}
项目:neo4j-lucene5-index    文件:TestLuceneBatchInsert.java   
@Test
public void shouldCreateAutoIndexThatIsUsableInEmbedded() throws Exception
{
    BatchInserterIndexProvider provider = new LuceneBatchInserterIndexProviderNewImpl( inserter );
    BatchInserterIndex index = provider.nodeIndex( "node_auto_index", EXACT_CONFIG );

    long id = inserter.createNode( null );
    Map<String, Object> props = new HashMap<>();
    props.put( "name", "peter" );
    index.add( id, props );
    index.flush();
    provider.shutdown();
    shutdownInserter();

    switchToGraphDatabaseService( configure( GraphDatabaseSettings.node_keys_indexable, "name" ),
            configure( GraphDatabaseSettings.relationship_keys_indexable, "relProp1,relProp2" ),
            configure( GraphDatabaseSettings.node_auto_indexing, "true" ),
            configure( GraphDatabaseSettings.relationship_auto_indexing, "true" ) );
    try ( Transaction tx = db.beginTx() )
    {
        // Create the primitives
        Node node1 = db.createNode();

        // Add indexable and non-indexable properties
        node1.setProperty( "name", "bob" );

        // Make things persistent
        tx.success();
    }

    try ( Transaction tx = db.beginTx() )
    {
        assertTrue( db.index().getNodeAutoIndexer().getAutoIndex().get( "name", "peter" ).hasNext() );
        assertTrue( db.index().getNodeAutoIndexer().getAutoIndex().get( "name", "bob" ).hasNext() );
        assertFalse( db.index().getNodeAutoIndexer().getAutoIndex().get( "name", "joe" ).hasNext() );
        tx.success();
    }
}
项目:neo4j-lucene5-index    文件:AutoIndexerTest.java   
@Override
protected void configure( GraphDatabaseBuilder builder )
{
    super.configure( builder );
    builder.setConfig( GraphDatabaseSettings.relationship_keys_indexable, "Type" );
    builder.setConfig( GraphDatabaseSettings.relationship_auto_indexing, "true" );
}
项目:neo4j-lucene5-index    文件:TestAutoIndexing.java   
@Test
public void testDefaultsAreSeparateForNodesAndRelationships()
        throws Exception
{
    stopDb();
    config = new HashMap<>();
    config.put( GraphDatabaseSettings.node_keys_indexable.name(), "propName" );
    config.put( GraphDatabaseSettings.node_auto_indexing.name(), "true" );
    // Now only node properties named propName should be indexed.
    startDb();

    newTransaction();

    Node node1 = graphDb.createNode();
    Node node2 = graphDb.createNode();
    node1.setProperty( "propName", "node1" );
    node2.setProperty( "propName", "node2" );
    node2.setProperty( "propName_", "node2" );

    Relationship rel = node1.createRelationshipTo( node2,
            DynamicRelationshipType.withName( "DYNAMIC" ) );
    rel.setProperty( "propName", "rel1" );

    newTransaction();

    ReadableIndex<Node> autoIndex = graphDb.index().getNodeAutoIndexer().getAutoIndex();
    assertEquals( node1, autoIndex.get( "propName", "node1" ).getSingle() );
    assertEquals( node2, autoIndex.get( "propName", "node2" ).getSingle() );
    assertFalse( graphDb.index().getRelationshipAutoIndexer().getAutoIndex().get(
            "propName", "rel1" ).hasNext() );
}
项目:neo4j-lucene5-index    文件:TestAutoIndexing.java   
@Test
public void testStartStopAutoIndexing() throws Exception
{
    stopDb();
    config = new HashMap<>();
    config.put( GraphDatabaseSettings.node_keys_indexable.name(), "propName" );
    config.put( GraphDatabaseSettings.node_auto_indexing.name(), "true" );
    // Now only node properties named propName should be indexed.
    startDb();

    AutoIndexer<Node> autoIndexer = graphDb.index().getNodeAutoIndexer();
    assertTrue( autoIndexer.isEnabled() );

    autoIndexer.setEnabled( false );
    assertFalse( autoIndexer.isEnabled() );
    newTransaction();

    Node node1 = graphDb.createNode();
    Node node2 = graphDb.createNode();
    node1.setProperty( "propName", "node" );
    newTransaction();

    assertFalse( autoIndexer.getAutoIndex().get( "nodeProp1", "node1" ).hasNext() );
    autoIndexer.setEnabled( true );
    node2.setProperty( "propName", "node" );

    newTransaction();

    assertEquals( node2,
            autoIndexer.getAutoIndex().get( "propName", "node" ).getSingle() );
}
项目:neo4j-lucene5-index    文件:LuceneDataSourceTest.java   
@Test
public void testShouldReturnIndexWriterFromLRUCache() throws Throwable
{
    Config config = new Config( config(), GraphDatabaseSettings.class );
    dataSource = life.add( new LuceneDataSource( directory.graphDbDir(), config, indexStore, new DefaultFileSystemAbstraction() ) );
    IndexIdentifier identifier = identifier( "foo" );
    IndexWriter writer = dataSource.getIndexSearcher( identifier ).getWriter();
    assertSame( writer, dataSource.getIndexSearcher( identifier ).getWriter() );
}
项目:neo4j-lucene5-index    文件:LuceneDataSourceTest.java   
@Test
public void testShouldReturnIndexSearcherFromLRUCache() throws Throwable
{
    Config config = new Config( config(), GraphDatabaseSettings.class );
    dataSource = life.add( new LuceneDataSource( directory.graphDbDir(), config, indexStore, new DefaultFileSystemAbstraction() ) );
    IndexIdentifier identifier = identifier( "foo" );
    IndexReference searcher = dataSource.getIndexSearcher( identifier );
    assertSame( searcher, dataSource.getIndexSearcher( identifier ) );
    searcher.close();
}
项目:mondo-hawk    文件:Neo4JBatchUtil.java   
public static GraphDatabaseService createGraphService(String databaseloc) {

        long x = Runtime.getRuntime().maxMemory() / 1000000 / 60 * 2;

        GraphDatabaseService s = new GraphDatabaseFactory()
                .newEmbeddedDatabaseBuilder(databaseloc)
                .setConfig(GraphDatabaseSettings.nodestore_mapped_memory_size,
                        5 * x + "M")
                .setConfig(
                        GraphDatabaseSettings.relationshipstore_mapped_memory_size,
                        15 * x + "M")
                .setConfig(
                        GraphDatabaseSettings.nodestore_propertystore_mapped_memory_size,
                        2 * x + "M")
                .setConfig(GraphDatabaseSettings.strings_mapped_memory_size,
                        2 * x + "M")
                .setConfig(GraphDatabaseSettings.arrays_mapped_memory_size,
                        x + "M")
                .setConfig(GraphDatabaseSettings.keep_logical_logs, "false")
                .setConfig(GraphDatabaseSettings.allow_store_upgrade, "true")
                // .setConfig( config )
                .newGraphDatabase();

        registerShutdownHook(s);

        return s;

    }
项目:SciGraph    文件:CypherUtilServiceTest.java   
@Test
public void guardAvailibityTest() {
  GraphDatabaseAPI db =
      (GraphDatabaseAPI) new TestGraphDatabaseFactory().newImpermanentDatabaseBuilder()
          .setConfig(GraphDatabaseSettings.execution_guard_enabled, Settings.TRUE)
          .newGraphDatabase();
  Guard guard = db.getDependencyResolver().resolveDependency(Guard.class);
  assertNotNull(guard);
}
项目:spring-security-acl-neo4j    文件:Neo4jTestConfig.java   
@Bean
public GraphDatabaseService graphDatabaseService() {
    GraphDatabaseService db = new TestGraphDatabaseFactory()
            .newImpermanentDatabaseBuilder()
            .setConfig(GraphDatabaseSettings.nodestore_mapped_memory_size,
                    "10M")
            .setConfig(GraphDatabaseSettings.string_block_size, "60")
            .setConfig(GraphDatabaseSettings.array_block_size, "300")
            .newGraphDatabase();
    return db;
}
项目:jcypher    文件:EmbeddedDBAccess.java   
@Override
    protected GraphDatabaseService createGraphDB() {
        // TODO the following applies to version 2.3.0 and above
//      File dbDir = new File(this.properties
//                      .getProperty(DBProperties.DATABASE_DIR));
//      GraphDatabaseBuilder builder = new GraphDatabaseFactory()
//              .newEmbeddedDatabaseBuilder(dbDir);

        GraphDatabaseBuilder builder = new GraphDatabaseFactory()
                .newEmbeddedDatabaseBuilder(new File(this.properties
                        .getProperty(DBProperties.DATABASE_DIR)));
        if (this.properties
                .getProperty(DBProperties.PAGECACHE_MEMORY) != null)
            builder.setConfig(
                    GraphDatabaseSettings.pagecache_memory,
                    DBProperties.PAGECACHE_MEMORY);
        if (this.properties.getProperty(DBProperties.STRING_BLOCK_SIZE) != null)
            builder.setConfig(GraphDatabaseSettings.string_block_size,
                    DBProperties.ARRAY_BLOCK_SIZE);
        if (this.properties.getProperty(DBProperties.STRING_BLOCK_SIZE) != null)
            builder.setConfig(GraphDatabaseSettings.array_block_size,
                    DBProperties.ARRAY_BLOCK_SIZE);

//      builder.setConfig(GraphDatabaseSettings.cypher_planner, "RULE");

        return builder.newGraphDatabase();
    }
项目:visitmeta    文件:Neo4JConnection.java   
/**
* Establish a connection to the database.
* @param dbPath Path to the Neo4J database.
*/
public Neo4JConnection(String dbPath) {
    this();
    mDbPath = dbPath;
    mGraphDb = new GraphDatabaseFactory().
            newEmbeddedDatabaseBuilder(mDbPath).
            setConfig( GraphDatabaseSettings.node_keys_indexable, KEY_HASH ).
            setConfig( GraphDatabaseSettings.node_auto_indexing, "true" ).
            newGraphDatabase();
    registerShutdownHook(mGraphDb);

    log.trace("... new Neo4JConnection() OK");
}
项目:visitmeta    文件:Neo4JTestDatabaseFactory.java   
public static GraphDatabaseService createGraphDB() {
    GraphDatabaseService db = new TestGraphDatabaseFactory()
            .newImpermanentDatabaseBuilder()
            .setConfig(GraphDatabaseSettings.node_keys_indexable, KEY_HASH)
            .setConfig(GraphDatabaseSettings.node_auto_indexing, "true")
            .newGraphDatabase();

    return db;
}
项目:SciGraph    文件:Neo4jModule.java   
@Provides
@Singleton
GraphDatabaseService getGraphDatabaseService() throws IOException {
  try {
    GraphDatabaseBuilder graphDatabaseBuilder = new GraphDatabaseFactory()
        .newEmbeddedDatabaseBuilder(new File(configuration.getLocation()))
        .setConfig(configuration.getNeo4jConfig());
    if (readOnly) {
      graphDatabaseBuilder.setConfig(GraphDatabaseSettings.read_only, Settings.TRUE);
    }
    if (enableGuard) {
      graphDatabaseBuilder.setConfig(GraphDatabaseSettings.execution_guard_enabled,
          Settings.TRUE);
    }

    // #198 - do not keep transaction logs
    graphDatabaseBuilder.setConfig(GraphDatabaseSettings.keep_logical_logs, Settings.FALSE);

    final GraphDatabaseService graphDb = graphDatabaseBuilder.newGraphDatabase();
    Runtime.getRuntime().addShutdownHook(new Thread() {
      @Override
      public void run() {
        graphDb.shutdown();
      }
    });

    if (!readOnly) { // No need of auto-indexing in read-only mode
      setupAutoIndexing(graphDb, configuration);
    }

    setupSchemaIndexes(graphDb, configuration);

    return graphDb;
  } catch (Exception e) {
    if (Throwables.getRootCause(e).getMessage().contains("lock file")) {
      throw new IOException(format("The graph at \"%s\" is locked by another process",
          configuration.getLocation()));
    }
    throw e;
  }
}
项目:mod-neo4j-persistor    文件:Neo4jEmbedded.java   
public Neo4jEmbedded(JsonObject config, Logger logger) {
    GraphDatabaseBuilder gdbb = new GraphDatabaseFactory()
    .newEmbeddedDatabaseBuilder(config.getString("datastore-path"));
    JsonObject neo4jConfig = config.getObject("neo4j");
    if (neo4jConfig != null) {
        gdbb.setConfig(GraphDatabaseSettings.node_keys_indexable,
                neo4jConfig.getString("node_keys_indexable"));
        gdbb.setConfig(GraphDatabaseSettings.node_auto_indexing,
                neo4jConfig.getString("node_auto_indexing", "false"));
        gdbb.setConfig(GraphDatabaseSettings.relationship_keys_indexable,
                neo4jConfig.getString("relationship_keys_indexable"));
        gdbb.setConfig(GraphDatabaseSettings.relationship_auto_indexing,
                neo4jConfig.getString("relationship_auto_indexing", "false"));
        gdbb.setConfig(GraphDatabaseSettings.allow_store_upgrade,
                neo4jConfig.getString("allow_store_upgrade", "true"));
    }
    gdb = gdbb.newGraphDatabase();
    registerShutdownHook(gdb);
    if (neo4jConfig != null) {
        JsonArray legacyIndexes = neo4jConfig.getArray("legacy-indexes");
        if (legacyIndexes != null && legacyIndexes.size() > 0) {
            try (Transaction tx = gdb.beginTx()) {
                for (Object o : legacyIndexes) {
                    if (!(o instanceof JsonObject)) continue;
                    JsonObject j = (JsonObject) o;
                    if ("node".equals(j.getString("for"))) {
                        gdb.index().forNodes(j.getString("name"), MapUtil.stringMap(
                                IndexManager.PROVIDER, "lucene", "type", j.getString("type", "exact")));
                    } else if ("relationship".equals(j.getString("for"))) {
                        gdb.index().forRelationships(j.getString("name"), MapUtil.stringMap(
                                IndexManager.PROVIDER, "lucene", "type", j.getString("type", "exact")));
                    }
                }
                tx.success();
            } catch (Exception e) {
                logger.error(e.getMessage(), e);
            }
        }
    }
    engine = new ExecutionEngine(gdb);
    this.logger = logger;
}
项目:WiggleIndexer    文件:WiggleIndexerPlugin.java   
public void createDb() {

        this.wiggleDbPath = getDBPath();

        this.wiggleClearDb = System.getenv("WIGGLE_CLEAR_DB");
        if (wiggleClearDb != null && wiggleClearDb.equals("y")) {
            clearDb(wiggleDbPath);
        }


        graphDbBuilder = new GraphDatabaseFactory().newEmbeddedDatabaseBuilder(wiggleDbPath).
                setConfig(GraphDatabaseSettings.node_keys_indexable, "nodeType").
                setConfig(GraphDatabaseSettings.relationship_keys_indexable, "typeKind").
                setConfig(GraphDatabaseSettings.node_auto_indexing, "true").
                setConfig(GraphDatabaseSettings.relationship_auto_indexing, "true");

        //registerShutdownHook( graphDb );

    }
项目:timbuctoo    文件:TinkerPopGraphManager.java   
protected void initGraphDatabaseService() {
  if (databasePath == null) {
    databasePath = new File(configuration.getDatabasePath());
  }
  if (graphDatabase == null) {
    if (configuration.hasHaconfig()) {
      TinkerPopConfig.HaConfig haconfig = configuration.getHaconfig();
      LOG.info(
        "Launching HA mode. Server id is " +
        haconfig.getServerId() +
        " database is at " +
        databasePath.getAbsolutePath() +
        ". allow init cluster is " +
        haconfig.allowInitCluster()
      );
      final GraphDatabaseBuilder graphDatabaseBuilder =
        new HighlyAvailableGraphDatabaseFactory()
          .setUserLogProvider(new Slf4jLogProvider())
          .newEmbeddedDatabaseBuilder(databasePath)
          .setConfig(GraphDatabaseSettings.allow_store_upgrade, "true")

          .setConfig(ClusterSettings.allow_init_cluster, haconfig.allowInitCluster())
          .setConfig(ClusterSettings.server_id, haconfig.getServerId())
          .setConfig(ClusterSettings.initial_hosts, haconfig.getInitialHosts())
          .setConfig(ClusterSettings.cluster_server, haconfig.getIp() + ":5001")
          .setConfig(HaSettings.ha_server, haconfig.getIp() + ":6001")
          /*
           * Neo4j synchronizes the slave databases via pulls of the master data. By default this property is not
           * activated (set to 0s). So this property has to be set. An alternative is to set 'ha.tx_push_factor'.
           * Since a network connection might be temporarily down, a pull is safer then a push. The push_factor is
           * meant for ensuring data duplication so that a master can safely crash
           */
          .setConfig(HaSettings.pull_interval, haconfig.getPullInterval())
          .setConfig(HaSettings.tx_push_factor, haconfig.getPushFactor());
      if (configuration.getPageCacheMemory().length() > 0) {
        graphDatabaseBuilder.setConfig(GraphDatabaseSettings.pagecache_memory, configuration.getPageCacheMemory());
      }
      graphDatabase = graphDatabaseBuilder.newGraphDatabase();
    } else {
      LOG.info("Launching local non-ha mode. Database at " + databasePath.getAbsolutePath());
      graphDatabase = new GraphDatabaseFactory()
        .setUserLogProvider( new Slf4jLogProvider() )
        .newEmbeddedDatabaseBuilder(databasePath)
        .setConfig(GraphDatabaseSettings.allow_store_upgrade, "true")
        .newGraphDatabase();
    }
  }
}