In older versions of Spring-Data-Neo4j it was possible to configure an embedded database, but enable remote access to it via the Neo4j-shell. This was done by using a GraphDatabaseFactory to construct a preconfigured GraphDatabaseService:
GraphDatabaseService newEmbeddedGraphDatabase(String dbDir) {
db = factory.newEmbeddedDatabaseBuilder(dbDir)
.setConfig(ShellSettings.remote_shell_enabled, "true")
.setConfig(ShellSettings.remote_shell_port, "5555")
.newGraphDatabase()
db
}
and then wire that as a dependency when initialising the spring beans:
beans {
graphDatabaseFactory(GraphDatabaseFactory)
trueDbGraphDatabaseFactory(OurGraphDatabaseFactory, graphDatabaseFactory)
graphDatabaseService(GraphDatabaseService, db) { bean ->
bean.factoryBean = "ourGraphDatabaseFactory"
bean.factoryMethod = "newEmbeddedGraphDatabase"
bean.destroyMethod = "shutdown"
}
}
I'm trying to work out how to achieve this in the new OGM project. Is it possible?
If I configure OGM using:
SessionFactory newSessionFactory() {
GraphDatabaseSettings
def configuration = new Configuration()
configuration.driverConfiguration()
.setDriverClassName("org.neo4j.ogm.drivers.embedded.driver.EmbeddedDriver")
.setURI("file:///var/tmp/neo4j.db")
new SessionFactory(configuration, "test.my.domain.path")
}
How do I inject my own instance of a GraphDatabaseService into the EmbeddedDriver? (There is a constructor to EmdeddedDriver that takes one, but it's not clear which constructor OGM is using).