Sunbird-RC / open-saber

Database agnostic, readily scalable APIs to store data!
https://opensaber.io/
MIT License
10 stars 44 forks source link

Implement configurable graph database provider #60

Open steotia opened 6 years ago

steotia commented 6 years ago

Configuration of Storage Provider is not clear. It seems right now Neo4J needs to be installed but if it isn't, the app throws a runtime error. That is wrong. The app should check if there is a provider configured and working, if not, it should complain properly.

steotia commented 6 years ago

The following error should not happen:

Stacktrace was: java.lang.RuntimeException: java.io.IOException: Unable to create directory path [/var/lib/neo4j/data/databases/graph.db/logs] for Neo4j store. at org.neo4j.kernel.impl.factory.PlatformModule.createLogService(PlatformModule.java:269) at org.neo4j.kernel.impl.factory.PlatformModule.(PlatformModule.java:156) at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.createPlatform(GraphDatabaseFacadeFactory.java:242) at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.initFacade(GraphDatabaseFacadeFactory.java:156) at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.newFacade(GraphDatabaseFacadeFactory.java:124) at org.neo4j.graphdb.factory.GraphDatabaseFactory.newDatabase(GraphDatabaseFactory.java:140) at org.neo4j.graphdb.factory.GraphDatabaseFactory.newEmbeddedDatabase(GraphDatabaseFactory.java:133) at org.neo4j.graphdb.factory.GraphDatabaseFactory$1.newDatabase(GraphDatabaseFactory.java:108) at org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(GraphDatabaseBuilder.java:193) at org.neo4j.tinkerpop.api.impl.Neo4jFactoryImpl.newGraphDatabase(Neo4jFactoryImpl.java:46) at org.neo4j.tinkerpop.api.Neo4jFactory$Builder.open(Neo4jFactory.java:32) at org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph.(Neo4jGraph.java:125) at org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph.open(Neo4jGraph.java:139) at io.opensaber.registry.util.GraphDBFactory.initializeGraphDb(GraphDBFactory.java:22)

steotia commented 6 years ago

public static GraphDatabaseService getGraphDatabaseService() {
        if(graphDBService ==null || !graphDBService.isAvailable(0)){
            graphDBService = ((Neo4jGraphAPIImpl) getGraphDB().getBaseGraph()).getGraphDatabase();
        }
        return graphDBService;
    }
steotia commented 6 years ago

The above needs to be generic and not bound no neo4j