Search in sources :

Example 1 with DatabaseManagementServiceImpl

use of org.neo4j.dbms.database.DatabaseManagementServiceImpl in project neo4j by neo4j.

the class TestFabricDatabaseManagementServiceFactory method createManagementService.

@Override
protected DatabaseManagementService createManagementService(GlobalModule globalModule, LifeSupport globalLife, Log internalLog, DatabaseManager<?> databaseManager) {
    return new DatabaseManagementServiceImpl(databaseManager, globalModule.getGlobalAvailabilityGuard(), globalLife, globalModule.getDatabaseEventListeners(), globalModule.getTransactionEventListeners(), internalLog, globalModule.getGlobalConfig()) {

        @Override
        public GraphDatabaseService database(String name) throws DatabaseNotFoundException {
            BoltFabricDatabaseManagementService fabricBoltDbms = globalModule.getGlobalDependencies().resolveDependency(BoltFabricDatabaseManagementService.class);
            var baseDb = databaseManager.getDatabaseContext(name).orElseThrow(() -> new DatabaseNotFoundException(name)).databaseFacade();
            // Therefore the lookup of Bolt API representation of a database has to be done lazily.
            return new TestFabricGraphDatabaseService(baseDb, config, () -> {
                try {
                    return fabricBoltDbms.getDatabase(name, EmptyMemoryTracker.INSTANCE);
                } catch (UnavailableException e) {
                    throw new RuntimeException(e);
                }
            });
        }
    };
}
Also used : BoltFabricDatabaseManagementService(org.neo4j.fabric.bolt.BoltFabricDatabaseManagementService) DatabaseManagementServiceImpl(org.neo4j.dbms.database.DatabaseManagementServiceImpl) DatabaseNotFoundException(org.neo4j.dbms.api.DatabaseNotFoundException) UnavailableException(org.neo4j.kernel.availability.UnavailableException)

Aggregations

DatabaseNotFoundException (org.neo4j.dbms.api.DatabaseNotFoundException)1 DatabaseManagementServiceImpl (org.neo4j.dbms.database.DatabaseManagementServiceImpl)1 BoltFabricDatabaseManagementService (org.neo4j.fabric.bolt.BoltFabricDatabaseManagementService)1 UnavailableException (org.neo4j.kernel.availability.UnavailableException)1