Search in sources :

Example 1 with BoltFabricDatabaseManagementService

use of org.neo4j.fabric.bolt.BoltFabricDatabaseManagementService 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)

Example 2 with BoltFabricDatabaseManagementService

use of org.neo4j.fabric.bolt.BoltFabricDatabaseManagementService in project neo4j by neo4j.

the class FabricServicesBootstrap method createBoltDatabaseManagementServiceProvider.

public BoltGraphDatabaseManagementServiceSPI createBoltDatabaseManagementServiceProvider(BoltGraphDatabaseManagementServiceSPI kernelDatabaseManagementService, DatabaseManagementService managementService, Monitors monitors, SystemNanoClock clock) {
    FabricExecutor fabricExecutor = dependencies.resolveDependency(FabricExecutor.class);
    TransactionManager transactionManager = dependencies.resolveDependency(TransactionManager.class);
    FabricDatabaseManager fabricDatabaseManager = dependencies.resolveDependency(FabricDatabaseManager.class);
    var serverConfig = dependencies.resolveDependency(Config.class);
    var transactionIdTracker = new TransactionIdTracker(managementService, monitors, clock);
    var databaseManager = (DatabaseManager<DatabaseContext>) dependencies.resolveDependency(DatabaseManager.class);
    var databaseIdRepository = databaseManager.databaseIdRepository();
    var transactionBookmarkManagerFactory = dependencies.resolveDependency(TransactionBookmarkManagerFactory.class);
    var localGraphTransactionIdTracker = new LocalGraphTransactionIdTracker(transactionIdTracker, databaseIdRepository, serverConfig);
    var fabricDatabaseManagementService = dependencies.satisfyDependency(new BoltFabricDatabaseManagementService(fabricExecutor, fabricConfig, transactionManager, fabricDatabaseManager, localGraphTransactionIdTracker, transactionBookmarkManagerFactory));
    return new BoltGraphDatabaseManagementServiceSPI() {

        @Override
        public BoltGraphDatabaseServiceSPI database(String databaseName, MemoryTracker memoryTracker) throws UnavailableException, DatabaseNotFoundException {
            if (fabricDatabaseManager.hasMultiGraphCapabilities(databaseName)) {
                return fabricDatabaseManagementService.database(databaseName, memoryTracker);
            }
            return kernelDatabaseManagementService.database(databaseName, memoryTracker);
        }

        @Override
        public Optional<CustomBookmarkFormatParser> getCustomBookmarkFormatParser() {
            return fabricDatabaseManagementService.getCustomBookmarkFormatParser();
        }
    };
}
Also used : BoltFabricDatabaseManagementService(org.neo4j.fabric.bolt.BoltFabricDatabaseManagementService) FabricExecutor(org.neo4j.fabric.executor.FabricExecutor) DatabaseManager(org.neo4j.dbms.database.DatabaseManager) FabricDatabaseManager(org.neo4j.fabric.FabricDatabaseManager) TransactionManager(org.neo4j.fabric.transaction.TransactionManager) CustomBookmarkFormatParser(org.neo4j.bolt.dbapi.CustomBookmarkFormatParser) FabricDatabaseManager(org.neo4j.fabric.FabricDatabaseManager) LocalGraphTransactionIdTracker(org.neo4j.fabric.bookmark.LocalGraphTransactionIdTracker) TransactionIdTracker(org.neo4j.bolt.txtracking.TransactionIdTracker) LocalGraphTransactionIdTracker(org.neo4j.fabric.bookmark.LocalGraphTransactionIdTracker) BoltGraphDatabaseManagementServiceSPI(org.neo4j.bolt.dbapi.BoltGraphDatabaseManagementServiceSPI) MemoryTracker(org.neo4j.memory.MemoryTracker)

Aggregations

BoltFabricDatabaseManagementService (org.neo4j.fabric.bolt.BoltFabricDatabaseManagementService)2 BoltGraphDatabaseManagementServiceSPI (org.neo4j.bolt.dbapi.BoltGraphDatabaseManagementServiceSPI)1 CustomBookmarkFormatParser (org.neo4j.bolt.dbapi.CustomBookmarkFormatParser)1 TransactionIdTracker (org.neo4j.bolt.txtracking.TransactionIdTracker)1 DatabaseNotFoundException (org.neo4j.dbms.api.DatabaseNotFoundException)1 DatabaseManagementServiceImpl (org.neo4j.dbms.database.DatabaseManagementServiceImpl)1 DatabaseManager (org.neo4j.dbms.database.DatabaseManager)1 FabricDatabaseManager (org.neo4j.fabric.FabricDatabaseManager)1 LocalGraphTransactionIdTracker (org.neo4j.fabric.bookmark.LocalGraphTransactionIdTracker)1 FabricExecutor (org.neo4j.fabric.executor.FabricExecutor)1 TransactionManager (org.neo4j.fabric.transaction.TransactionManager)1 UnavailableException (org.neo4j.kernel.availability.UnavailableException)1 MemoryTracker (org.neo4j.memory.MemoryTracker)1