Created
July 15, 2012 19:50
-
-
Save psuman/3118359 to your computer and use it in GitHub Desktop.
Neo4j Bootstrapper which registers TransactionEventHandler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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