use of org.neo4j.collection.Dependencies 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;
}
use of org.neo4j.collection.Dependencies in project neo4j by neo4j.
the class DefaultIndexProviderMapTest method shouldNotSupportMultipleProvidersWithSameDescriptor.
@Test
void shouldNotSupportMultipleProvidersWithSameDescriptor() {
// given
IndexProvider provider;
Dependencies dependencies = new Dependencies();
dependencies.satisfyDependency(provider = provider("provider", "1.2"));
dependencies.satisfyDependency(provider("provider", "1.2"));
dependencies.satisfyDependency(fulltext());
dependencies.satisfyDependency(tokenProvider());
// when
assertThrows(IllegalArgumentException.class, () -> createDefaultProviderMap(dependencies, provider.getProviderDescriptor()).init());
}
use of org.neo4j.collection.Dependencies in project neo4j by neo4j.
the class DefaultIndexProviderMapTest method shouldInitializeTokenIndexProvider.
@Test
void shouldInitializeTokenIndexProvider() {
// given
IndexProvider tokenIndexProvider = tokenProvider();
IndexProvider provider;
Dependencies dependencies = new Dependencies();
dependencies.satisfyDependency(provider = provider("provider", "1.2"));
dependencies.satisfyDependency(tokenIndexProvider);
// when
DefaultIndexProviderMap defaultIndexProviderMap = new DefaultIndexProviderMap(dependencies, Config.newBuilder().set(GraphDatabaseSettings.default_schema_provider, provider.getProviderDescriptor().name()).build());
defaultIndexProviderMap.init();
Assertions.assertThat(defaultIndexProviderMap.getTokenIndexProvider()).isEqualTo(tokenIndexProvider);
}
use of org.neo4j.collection.Dependencies in project neo4j by neo4j.
the class LogFilesBuilderTest method buildDefaultContextWithDependencies.
@Test
void buildDefaultContextWithDependencies() throws IOException {
SimpleLogVersionRepository logVersionRepository = new SimpleLogVersionRepository(2);
SimpleTransactionIdStore transactionIdStore = new SimpleTransactionIdStore();
DatabaseHealth databaseHealth = new DatabaseHealth(PanicEventGenerator.NO_OP, NullLog.getInstance());
Dependencies dependencies = new Dependencies();
dependencies.satisfyDependency(logVersionRepository);
dependencies.satisfyDependency(transactionIdStore);
dependencies.satisfyDependency(databaseHealth);
TransactionLogFilesContext context = builder(databaseLayout, fileSystem).withDependencies(dependencies).withLogEntryReader(logEntryReader()).buildContext();
assertEquals(fileSystem, context.getFileSystem());
assertNotNull(context.getLogEntryReader());
assertEquals(ByteUnit.mebiBytes(250), context.getRotationThreshold().get());
assertEquals(databaseHealth, context.getDatabaseHealth());
assertEquals(1, context.getLastCommittedTransactionId());
assertEquals(2, context.getLogVersionRepository().getCurrentLogVersion());
}
use of org.neo4j.collection.Dependencies in project neo4j by neo4j.
the class NeoStoresTest method reinitializeStores.
private void reinitializeStores(DatabaseLayout databaseLayout) {
Dependencies dependencies = new Dependencies();
Config config = Config.defaults(GraphDatabaseSettings.fail_on_missing_files, false);
dependencies.satisfyDependency(config);
closeStorageEngine();
IdGeneratorFactory idGeneratorFactory = new DefaultIdGeneratorFactory(fs, immediate(), databaseLayout.getDatabaseName());
TokenHolders tokenHolders = new TokenHolders(createReadOnlyTokenHolder(TokenHolder.TYPE_PROPERTY_KEY), createReadOnlyTokenHolder(TokenHolder.TYPE_LABEL), createReadOnlyTokenHolder(TokenHolder.TYPE_RELATIONSHIP_TYPE));
storageEngine = new RecordStorageEngine(databaseLayout, config, pageCache, fs, nullLogProvider(), tokenHolders, new DatabaseSchemaState(nullLogProvider()), new StandardConstraintRuleAccessor(), i -> i, NO_LOCK_SERVICE, mock(Health.class), idGeneratorFactory, new DefaultIdController(), immediate(), PageCacheTracer.NULL, true, INSTANCE, writable(), CommandLockVerification.Factory.IGNORE, LockVerificationMonitor.Factory.IGNORE);
life = new LifeSupport();
life.add(storageEngine);
life.add(storageEngine.schemaAndTokensLifecycle());
life.start();
NeoStores neoStores = storageEngine.testAccessNeoStores();
pStore = neoStores.getPropertyStore();
nodeStore = neoStores.getNodeStore();
storageReader = storageEngine.newReader();
}
Aggregations