Search in sources :

Example 1 with DefaultDatabaseInitializer

use of org.neo4j.dbms.database.DefaultDatabaseInitializer 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)1 Dependencies (org.neo4j.collection.Dependencies)1 DatabaseManagementService (org.neo4j.dbms.api.DatabaseManagementService)1 DbmsRuntimeSystemGraphComponent (org.neo4j.dbms.database.DbmsRuntimeSystemGraphComponent)1 DefaultDatabaseInitializer (org.neo4j.dbms.database.DefaultDatabaseInitializer)1 GlobalModule (org.neo4j.graphdb.factory.module.GlobalModule)1 AbstractEditionModule (org.neo4j.graphdb.factory.module.edition.AbstractEditionModule)1 SecurityProvider (org.neo4j.kernel.api.security.provider.SecurityProvider)1 LifeSupport (org.neo4j.kernel.lifecycle.LifeSupport)1 Log (org.neo4j.logging.Log)1 LogService (org.neo4j.logging.internal.LogService)1