
com.tinkerpop.blueprints.impls.neo4j2.Neo4j2HaGraph Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of blueprints-neo4j2-graph Show documentation
Show all versions of blueprints-neo4j2-graph Show documentation
Blueprints property graph implementation for the Neo4j 2 graph database
The newest version!
package com.tinkerpop.blueprints.impls.neo4j2;
import org.apache.commons.configuration.Configuration;
import org.neo4j.graphdb.factory.HighlyAvailableGraphDatabaseFactory;
import org.neo4j.kernel.ha.HighlyAvailableGraphDatabase;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
/**
* A Blueprints implementation of the graph database Neo4j (http://neo4j.org) with High Availability mode.
*
* @author Stephen Mallette
*/
public class Neo4j2HaGraph extends Neo4j2Graph {
public Neo4j2HaGraph(final String directory) {
super(new HighlyAvailableGraphDatabaseFactory().newHighlyAvailableDatabase(directory));
}
public Neo4j2HaGraph(final String directory, final Map configuration) {
super(new HighlyAvailableGraphDatabaseFactory().newHighlyAvailableDatabaseBuilder(directory).setConfig(configuration).newGraphDatabase());
}
public Neo4j2HaGraph(final HighlyAvailableGraphDatabase rawGraph) {
super(rawGraph);
}
public Neo4j2HaGraph(final Configuration configuration) {
this(configuration.getString("blueprints.neo4jha.directory", null),
convertConfiguration(configuration.subset("blueprints.neo4jha.conf")));
}
private static Map convertConfiguration(final Configuration configuration) {
final Map c = new HashMap();
final Iterator keys = configuration.getKeys();
while (keys.hasNext()) {
final String k = keys.next();
c.put(k, configuration.getString(k));
}
return c;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy