Skip to content

Instantly share code, notes, and snippets.

@psuman psuman/gist:3118359
Created Jul 15, 2012

Embed
What would you like to do?
Neo4j Bootstrapper which registers TransactionEventHandler
package org.sample
import java.util.Map;
import org.apache.commons.configuration.Configuration;
import org.neo4j.kernel.EmbeddedGraphDatabase;
import org.neo4j.kernel.GraphDatabaseAPI;
import org.neo4j.server.Bootstrapper;
import org.neo4j.server.NeoServerBootstrapper;
import org.neo4j.server.database.GraphDatabaseFactory;
import org.neo4j.server.logging.Logger;
public class MyBootstrapper extends NeoServerBootstrapper {
private static Logger log = Logger.getLogger(MyBootstrapper.class);
@Override
protected GraphDatabaseFactory getGraphDatabaseFactory(
Configuration configuration) {
log.info("called getGraphDatabaseFactory in MyBoostrapper:",
new Object());
return new GraphDatabaseFactory() {
public GraphDatabaseAPI createDatabase(String databaseStoreDirectory,
Map<String, String> databaseProperties) {
GraphDatabaseAPI api = new EmbeddedGraphDatabase(databaseStoreDirectory, databaseProperties);
api.registerTransactionEventHandler(new MyTransactionEventHandler());
return api;
}
};
}
@Override
protected boolean isMoreDerivedThan(Bootstrapper other) {
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.