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);
}
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();
}
};
}
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;
}
Aggregations