Search in sources :

Example 1 with BoltGraphDatabaseManagementServiceSPI

use of org.neo4j.bolt.dbapi.BoltGraphDatabaseManagementServiceSPI in project neo4j by neo4j.

the class SessionExtension method beforeEach.

@Override
public void beforeEach(ExtensionContext extensionContext) {
    managementService = builderFactory.get().impermanent().setConfig(GraphDatabaseSettings.auth_enabled, authEnabled).build();
    gdb = (GraphDatabaseAPI) managementService.database(GraphDatabaseSettings.DEFAULT_DATABASE_NAME);
    DependencyResolver resolver = gdb.getDependencyResolver();
    Authentication authentication = authentication(resolver.resolveDependency(AuthManager.class));
    Config config = resolver.resolveDependency(Config.class);
    SystemNanoClock clock = Clocks.nanoClock();
    DefaultDatabaseResolver defaultDatabaseResolver = new CommunityDefaultDatabaseResolver(config, () -> managementService.database(GraphDatabaseSettings.SYSTEM_DATABASE_NAME));
    BoltGraphDatabaseManagementServiceSPI databaseManagementService = new BoltKernelDatabaseManagementServiceProvider(managementService, new Monitors(), clock, ofSeconds(30));
    boltFactory = new BoltStateMachineFactoryImpl(databaseManagementService, authentication, clock, config, NullLogService.getInstance(), defaultDatabaseResolver);
}
Also used : BoltStateMachineFactoryImpl(org.neo4j.bolt.runtime.statemachine.impl.BoltStateMachineFactoryImpl) SystemNanoClock(org.neo4j.time.SystemNanoClock) AuthManager(org.neo4j.kernel.api.security.AuthManager) BoltKernelDatabaseManagementServiceProvider(org.neo4j.bolt.dbapi.impl.BoltKernelDatabaseManagementServiceProvider) Authentication(org.neo4j.bolt.security.auth.Authentication) BasicAuthentication(org.neo4j.bolt.security.auth.BasicAuthentication) Config(org.neo4j.configuration.Config) DefaultDatabaseResolver(org.neo4j.kernel.database.DefaultDatabaseResolver) CommunityDefaultDatabaseResolver(org.neo4j.server.security.systemgraph.CommunityDefaultDatabaseResolver) CommunityDefaultDatabaseResolver(org.neo4j.server.security.systemgraph.CommunityDefaultDatabaseResolver) Monitors(org.neo4j.monitoring.Monitors) DependencyResolver(org.neo4j.common.DependencyResolver) BoltGraphDatabaseManagementServiceSPI(org.neo4j.bolt.dbapi.BoltGraphDatabaseManagementServiceSPI)

Example 2 with BoltGraphDatabaseManagementServiceSPI

use of org.neo4j.bolt.dbapi.BoltGraphDatabaseManagementServiceSPI 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)

Example 3 with BoltGraphDatabaseManagementServiceSPI

use of org.neo4j.bolt.dbapi.BoltGraphDatabaseManagementServiceSPI in project neo4j by neo4j.

the class DatabaseManagementServiceFactory method build.

/**
 * Instantiate a graph database given configuration, dependencies, and a custom implementation of {@link org
 * .neo4j.kernel.impl.factory.GraphDatabaseFacade}.
 *
 * @param config configuration
 * @param dependencies the dependencies required to construct the {@link GraphDatabaseFacade}
 * @return the initialised {@link GraphDatabaseFacade}
 */
public DatabaseManagementService build(Config config, final ExternalDependencies dependencies) {
    GlobalModule globalModule = createGlobalModule(config, dependencies);
    AbstractEditionModule edition = editionFactory.apply(globalModule);
    Dependencies globalDependencies = globalModule.getGlobalDependencies();
    LifeSupport globalLife = globalModule.getGlobalLife();
    LogService logService = globalModule.getLogService();
    Log internalLog = logService.getInternalLog(getClass());
    DatabaseManager<?> databaseManager = edition.createDatabaseManager(globalModule);
    DatabaseManagementService managementService = createManagementService(globalModule, globalLife, internalLog, databaseManager);
    globalDependencies.satisfyDependencies(managementService);
    edition.bootstrapFabricServices();
    setupProcedures(globalModule, edition, databaseManager);
    edition.registerSystemGraphComponents(globalModule.getSystemGraphComponents(), globalModule);
    globalLife.add(edition.createSystemGraphInitializer(globalModule));
    var dbmsRuntimeSystemGraphComponent = new DbmsRuntimeSystemGraphComponent(globalModule.getGlobalConfig());
    globalModule.getSystemGraphComponents().register(dbmsRuntimeSystemGraphComponent);
    edition.createDefaultDatabaseResolver(globalModule);
    globalDependencies.satisfyDependency(edition.getDefaultDatabaseResolver());
    edition.createSecurityModule(globalModule);
    SecurityProvider securityProvider = edition.getSecurityProvider();
    globalDependencies.satisfyDependencies(securityProvider.authManager());
    var dbmsRuntimeRepository = edition.createAndRegisterDbmsRuntimeRepository(globalModule, databaseManager, globalDependencies, dbmsRuntimeSystemGraphComponent);
    globalDependencies.satisfyDependency(dbmsRuntimeRepository);
    globalLife.add(new DefaultDatabaseInitializer(databaseManager));
    globalLife.add(globalModule.getGlobalExtensions());
    BoltGraphDatabaseManagementServiceSPI boltGraphDatabaseManagementServiceSPI = edition.createBoltDatabaseManagementServiceProvider(globalDependencies, managementService, globalModule.getGlobalMonitors(), globalModule.getGlobalClock(), logService);
    globalLife.add(createBoltServer(globalModule, edition, boltGraphDatabaseManagementServiceSPI, databaseManager.databaseIdRepository()));
    var webServer = createWebServer(edition, managementService, globalDependencies, config, globalModule.getLogService().getUserLogProvider());
    globalDependencies.satisfyDependency(webServer);
    globalLife.add(webServer);
    globalLife.add(globalModule.getCapabilitiesService());
    startDatabaseServer(globalModule, globalLife, internalLog, databaseManager, managementService);
    return managementService;
}
Also used : GlobalModule(org.neo4j.graphdb.factory.module.GlobalModule) DefaultDatabaseInitializer(org.neo4j.dbms.database.DefaultDatabaseInitializer) Log(org.neo4j.logging.Log) AbstractEditionModule(org.neo4j.graphdb.factory.module.edition.AbstractEditionModule) BoltGraphDatabaseManagementServiceSPI(org.neo4j.bolt.dbapi.BoltGraphDatabaseManagementServiceSPI) DbmsRuntimeSystemGraphComponent(org.neo4j.dbms.database.DbmsRuntimeSystemGraphComponent) SecurityProvider(org.neo4j.kernel.api.security.provider.SecurityProvider) LifeSupport(org.neo4j.kernel.lifecycle.LifeSupport) Dependencies(org.neo4j.collection.Dependencies) DatabaseManagementService(org.neo4j.dbms.api.DatabaseManagementService) LogService(org.neo4j.logging.internal.LogService)

Aggregations

BoltGraphDatabaseManagementServiceSPI (org.neo4j.bolt.dbapi.BoltGraphDatabaseManagementServiceSPI)3 CustomBookmarkFormatParser (org.neo4j.bolt.dbapi.CustomBookmarkFormatParser)1 BoltKernelDatabaseManagementServiceProvider (org.neo4j.bolt.dbapi.impl.BoltKernelDatabaseManagementServiceProvider)1 BoltStateMachineFactoryImpl (org.neo4j.bolt.runtime.statemachine.impl.BoltStateMachineFactoryImpl)1 Authentication (org.neo4j.bolt.security.auth.Authentication)1 BasicAuthentication (org.neo4j.bolt.security.auth.BasicAuthentication)1 TransactionIdTracker (org.neo4j.bolt.txtracking.TransactionIdTracker)1 Dependencies (org.neo4j.collection.Dependencies)1 DependencyResolver (org.neo4j.common.DependencyResolver)1 Config (org.neo4j.configuration.Config)1 DatabaseManagementService (org.neo4j.dbms.api.DatabaseManagementService)1 DatabaseManager (org.neo4j.dbms.database.DatabaseManager)1 DbmsRuntimeSystemGraphComponent (org.neo4j.dbms.database.DbmsRuntimeSystemGraphComponent)1 DefaultDatabaseInitializer (org.neo4j.dbms.database.DefaultDatabaseInitializer)1 FabricDatabaseManager (org.neo4j.fabric.FabricDatabaseManager)1 BoltFabricDatabaseManagementService (org.neo4j.fabric.bolt.BoltFabricDatabaseManagementService)1 LocalGraphTransactionIdTracker (org.neo4j.fabric.bookmark.LocalGraphTransactionIdTracker)1 FabricExecutor (org.neo4j.fabric.executor.FabricExecutor)1 TransactionManager (org.neo4j.fabric.transaction.TransactionManager)1 GlobalModule (org.neo4j.graphdb.factory.module.GlobalModule)1