@Override
public void initialize(final StructrConf config) {
final String dbPath = config.getProperty(Services.DATABASE_PATH);
final GraphDatabaseBuilder builder = new GraphDatabaseFactory().newEmbeddedDatabaseBuilder(dbPath);
logger.log(Level.INFO, "Initializing database ({0}) ...", dbPath);
if (graphDb != null) {
logger.log(Level.INFO, "Database already running ({0}) ...", dbPath);
return;
}
final File confFile = new File(dbPath + "/neo4j.conf");
if (confFile.exists()) {
builder.loadPropertiesFromFile(confFile.getAbsolutePath());
}
// neo4j remote shell configuration
builder.setConfig(ShellSettings.remote_shell_enabled, config.getProperty(Services.NEO4J_SHELL_ENABLED, "false"));
builder.setConfig(ShellSettings.remote_shell_port, config.getProperty(Services.NEO4J_SHELL_PORT, "1337"));
// create graph database instance
graphDb = builder.newGraphDatabase();
// success?
if (graphDb == null) {
logger.log(Level.SEVERE, "Database could not be started ({0}) ...", dbPath);