org.sonatype.nexus.orient.DatabaseInstance Java Examples
The following examples show how to use
org.sonatype.nexus.orient.DatabaseInstance.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UpgradeManagerTest.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
@Test public void testPrivateUpgrades() { List<Checkpoint> checkpoints = ImmutableList.of( new org.sonatype.nexus.upgrade.example.CheckpointFoo() ); List<Upgrade> upgrades = ImmutableList.of( new org.sonatype.nexus.upgrade.example.UpgradePrivateModel_1_1(Providers.of(mock(DatabaseInstance.class))) ); UpgradeManager upgradeManager = createUpgradeManager(checkpoints, upgrades); List<Upgrade> plan = upgradeManager.selectUpgrades(ImmutableMap.of(), false); assertThat(plan, contains( instanceOf(org.sonatype.nexus.upgrade.example.UpgradePrivateModel_1_1.class) )); }
Example #2
Source File: IndexSyncService.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
@Inject public IndexSyncService(@Named(COMPONENT) final Provider<DatabaseInstance> componentDatabase, final ComponentEntityAdapter componentEntityAdapter, final AssetEntityAdapter assetEntityAdapter, final ApplicationDirectories directories, final NodeAccess nodeAccess, final IndexRequestProcessor indexRequestProcessor, final IndexRebuildManager indexRebuildManager) { this.componentDatabase = checkNotNull(componentDatabase); this.componentEntityAdapter = checkNotNull(componentEntityAdapter); this.nodeAccess = checkNotNull(nodeAccess); this.indexRequestProcessor = checkNotNull(indexRequestProcessor); this.indexRebuildManager = checkNotNull(indexRebuildManager); this.entityLog = new EntityLog(componentDatabase, componentEntityAdapter, assetEntityAdapter); this.checkpointFile = new File(directories.getWorkDirectory("elasticsearch"), "nexus.lsn"); }
Example #3
Source File: OrientBrowseNodeStoreImpl.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
@Inject public OrientBrowseNodeStoreImpl( @Named("component") final Provider<DatabaseInstance> databaseInstance, final BrowseNodeEntityAdapter entityAdapter, final SecurityHelper securityHelper, final SelectorManager selectorManager, final BrowseNodeConfiguration configuration, final RepositoryManager repositoryManager, final Map<String, BrowseNodeFilter> browseNodeFilters, final Map<String, BrowseNodeComparator> browseNodeComparators) { this.databaseInstance = checkNotNull(databaseInstance); this.entityAdapter = checkNotNull(entityAdapter); this.securityHelper = checkNotNull(securityHelper); this.selectorManager = checkNotNull(selectorManager); this.browseNodeFilters = checkNotNull(browseNodeFilters); this.browseNodeComparators = checkNotNull(browseNodeComparators); this.repositoryManager = checkNotNull(repositoryManager); this.deletePageSize = configuration.getDeletePageSize(); this.defaultBrowseNodeComparator = checkNotNull(browseNodeComparators.get(DefaultBrowseNodeComparator.NAME)); }
Example #4
Source File: DatabaseFreezeServiceImplTest.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
@Test public void isFrozenChecksAllDatabases() { DatabaseInstance instance = mock(DatabaseInstance.class); underTest = new DatabaseFreezeServiceImpl(Sets.newHashSet( () -> instance, () -> instance, () -> instance, () -> instance ), eventManager, databaseFrozenStateManager, () -> server, nodeAccess, securityHelper, ImmutableList.of()); when(instance.isFrozen()) .thenReturn(true, true, true, false); assertThat(underTest.isFrozen(), is(false)); verify(instance, times(4)).isFrozen(); }
Example #5
Source File: OrientSecurityConfigurationSource.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
@Inject public OrientSecurityConfigurationSource( @Named(DatabaseInstanceNames.SECURITY) final Provider<DatabaseInstance> databaseInstance, @Named("static") final SecurityConfigurationSource defaults, final OrientCUserEntityAdapter userEntityAdapter, final OrientCRoleEntityAdapter roleEntityAdapter, final OrientCPrivilegeEntityAdapter privilegeEntityAdapter, final OrientCUserRoleMappingEntityAdapter userRoleMappingEntityAdapter) { this.databaseInstance = checkNotNull(databaseInstance); this.securityDefaults = checkNotNull(defaults); this.userEntityAdapter = checkNotNull(userEntityAdapter); this.roleEntityAdapter = checkNotNull(roleEntityAdapter); this.privilegeEntityAdapter = checkNotNull(privilegeEntityAdapter); this.userRoleMappingEntityAdapter = checkNotNull(userRoleMappingEntityAdapter); }
Example #6
Source File: StorageFacetManagerImpl.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
@Inject public StorageFacetManagerImpl(@Named(ComponentDatabase.NAME) final Provider<DatabaseInstance> databaseInstanceProvider, final BucketEntityAdapter bucketEntityAdapter, final BucketDeleter bucketDeleter, final RetryController retryController) { this.databaseInstanceProvider = checkNotNull(databaseInstanceProvider); this.bucketEntityAdapter = checkNotNull(bucketEntityAdapter); this.bucketDeleter = checkNotNull(bucketDeleter); // extend retry delay when blobs are missing to account for slow blob-stores retryController.majorExceptionFilter().addException(MissingBlobException.class); // mark BrowseNodeCollisionException as potentially noisy so it doesn't skew retry stats retryController.noisyExceptionFilter().addException(BrowseNodeCollisionException.class); }
Example #7
Source File: DatabaseFreezeServiceImplTest.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
@Test public void isFrozenShortcircuit() { DatabaseInstance instance = mock(DatabaseInstance.class); underTest = new DatabaseFreezeServiceImpl(Sets.newHashSet( () -> instance, () -> instance, () -> instance, () -> instance ), eventManager, databaseFrozenStateManager, () -> server, nodeAccess, securityHelper, ImmutableList.of()); when(instance.isFrozen()) .thenReturn(false, true, true, true); assertThat(underTest.isFrozen(), is(false)); verify(instance, times(1)).isFrozen(); }
Example #8
Source File: DatabaseFreezeServiceImplTest.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
/** * Utility method to check the status of the databases by attempting writes. * Note: this method only works in non-HA simulations in this test class. * * @param errorExpected if true, this method will still pass the test when a write fails, and fail if no error is * encountered. If false, it will fail a test if the write fails. */ void verifyWriteFails(boolean errorExpected) { for (Provider<DatabaseInstance> provider : providerSet) { try (ODatabaseDocumentTx db = provider.get().connect()) { db.begin(); ODocument document = db.newInstance(DB_CLASS); document.field(P_NAME, "test"); document.save(); try { db.commit(); if (errorExpected) { fail("Expected OModificationOperationProhibitedException"); } } catch (OModificationOperationProhibitedException e) { if (!errorExpected) { throw e; } } } } }
Example #9
Source File: UpgradeManagerTest.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
@Test public void testPrivateUpgradesWithMissingCheckpointDependenciesAreIllegal() { List<Checkpoint> checkpoints = ImmutableList.of( new org.sonatype.nexus.upgrade.example.CheckpointFoo() ); List<Upgrade> upgrades = ImmutableList.of( new org.sonatype.nexus.upgrade.bad.UpgradePrivateModel_1_2(Providers.of(mock(DatabaseInstance.class))) ); UpgradeManager upgradeManager = createUpgradeManager(checkpoints, upgrades); thrown.expect(IllegalStateException.class); thrown.expectMessage("Found 2 problem(s) with upgrades:" + lineSeparator() + "Upgrade step org.sonatype.nexus.upgrade.bad.UpgradePrivateModel_1_2 " + "has undeclared model dependencies: [foo]" + lineSeparator() + "Upgrade step org.sonatype.nexus.upgrade.bad.UpgradePrivateModel_1_2 " + "does not trigger a checkpoint"); upgradeManager.selectUpgrades(ImmutableMap.of(), false); }
Example #10
Source File: ComponentDatabaseUpgrade_1_9.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public ComponentDatabaseUpgrade_1_9( @Named(DatabaseInstanceNames.CONFIG) final Provider<DatabaseInstance> configDatabaseInstance, @Named(DatabaseInstanceNames.COMPONENT) final Provider<DatabaseInstance> componentDatabaseInstance) { this.configDatabaseInstance = checkNotNull(configDatabaseInstance); this.componentDatabaseInstance = checkNotNull(componentDatabaseInstance); }
Example #11
Source File: OrientDeploymentAccessImpl.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public OrientDeploymentAccessImpl(@Named(CONFIG) final Provider<DatabaseInstance> databaseInstance, final NodeAccess nodeAccess) { this.databaseInstance = checkNotNull(databaseInstance); this.entityAdapter = new OrientDeploymentIdentifierEntityAdapter(); this.nodeAccess = nodeAccess; }
Example #12
Source File: ComponentDatabaseUpgrade_1_1.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public ComponentDatabaseUpgrade_1_1( @Named(DatabaseInstanceNames.CONFIG) final Provider<DatabaseInstance> configDatabaseInstance, @Named(DatabaseInstanceNames.COMPONENT) final Provider<DatabaseInstance> componentDatabaseInstance) { this.configDatabaseInstance = checkNotNull(configDatabaseInstance); this.componentDatabaseInstance = checkNotNull(componentDatabaseInstance); }
Example #13
Source File: JobStoreImpl.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public JobStoreImpl(@Named(DatabaseInstanceNames.CONFIG) final Provider<DatabaseInstance> databaseInstance, final JobDetailEntityAdapter jobDetailEntityAdapter, final TriggerEntityAdapter triggerEntityAdapter, final CalendarEntityAdapter calendarEntityAdapter, final NodeAccess nodeAccess, @Named("${nexus.quartz.jobStore.acquireRetryDelay:-15s}") final Time acquireRetryDelay) { this.databaseInstance = checkNotNull(databaseInstance); this.jobDetailEntityAdapter = checkNotNull(jobDetailEntityAdapter); this.triggerEntityAdapter = checkNotNull(triggerEntityAdapter); this.calendarEntityAdapter = checkNotNull(calendarEntityAdapter); this.nodeAccess = checkNotNull(nodeAccess); this.acquireRetryDelay = acquireRetryDelay; }
Example #14
Source File: ConfigDatabaseUpgrade_1_2.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public ConfigDatabaseUpgrade_1_2( @Named(DatabaseInstanceNames.CONFIG) final Provider<DatabaseInstance> databaseInstance, @Named(DatabaseInstanceNames.COMPONENT) final Provider<DatabaseInstance> componentDatabaseInstance) { this.configDatabaseInstance = checkNotNull(databaseInstance); this.componentDatabaseInstance = checkNotNull(componentDatabaseInstance); }
Example #15
Source File: OrientRoutingRuleStore.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public OrientRoutingRuleStore(@Named(DatabaseInstanceNames.CONFIG) final Provider<DatabaseInstance> databaseInstance, final OrientRoutingRuleEntityAdapter entityAdapter) { this.databaseInstance = databaseInstance; this.entityAdapter = entityAdapter; }
Example #16
Source File: OrientRealmConfigurationStore.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public OrientRealmConfigurationStore(@Named(DatabaseInstanceNames.SECURITY) final Provider<DatabaseInstance> databaseInstance, final OrientRealmConfigurationEntityAdapter entityAdapter) { this.databaseInstance = checkNotNull(databaseInstance); this.entityAdapter = checkNotNull(entityAdapter); }
Example #17
Source File: P2Upgrade_1_1.java From nexus-repository-p2 with Eclipse Public License 1.0 | 5 votes |
@Inject public P2Upgrade_1_1( @Named(DatabaseInstanceNames.CONFIG) final Provider<DatabaseInstance> configDatabaseInstance, @Named(DatabaseInstanceNames.COMPONENT) final Provider<DatabaseInstance> componentDatabaseInstance) { this.configDatabaseInstance = checkNotNull(configDatabaseInstance); this.componentDatabaseInstance = checkNotNull(componentDatabaseInstance); }
Example #18
Source File: ConfigDatabaseUpgrade_1_4.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public ConfigDatabaseUpgrade_1_4(@Named(CONFIG) final Provider<DatabaseInstance> databaseInstance, final ApplicationDirectories applicationDirectories) { this.databaseInstance = checkNotNull(databaseInstance); this.applicationDirectories = checkNotNull(applicationDirectories); }
Example #19
Source File: RebuildBrowseNodesManager.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public RebuildBrowseNodesManager(@Named(ComponentDatabase.NAME) final Provider<DatabaseInstance> componentDatabaseInstanceProvider, final TaskScheduler taskScheduler, final BrowseNodeConfiguration configuration, final BucketEntityAdapter bucketEntityAdapter) { this.componentDatabaseInstanceProvider = checkNotNull(componentDatabaseInstanceProvider); this.taskScheduler = checkNotNull(taskScheduler); this.automaticRebuildEnabled = checkNotNull(configuration).isAutomaticRebuildEnabled(); this.bucketEntityAdapter = bucketEntityAdapter; }
Example #20
Source File: BucketDeleter.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public BucketDeleter(@Named(ComponentDatabase.NAME) final Provider<DatabaseInstance> databaseInstanceProvider, final BucketEntityAdapter bucketEntityAdapter, final ComponentEntityAdapter componentEntityAdapter, final AssetEntityAdapter assetEntityAdapter, final BlobStoreManager blobStoreManager) { this.databaseInstanceProvider = checkNotNull(databaseInstanceProvider); this.bucketEntityAdapter = checkNotNull(bucketEntityAdapter); this.componentEntityAdapter = checkNotNull(componentEntityAdapter); this.assetEntityAdapter = checkNotNull(assetEntityAdapter); this.blobStoreManager = checkNotNull(blobStoreManager); }
Example #21
Source File: StorageFacetImpl.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public StorageFacetImpl(final NodeAccess nodeAccess, final BlobStoreManager blobStoreManager, @Named(ComponentDatabase.NAME) final Provider<DatabaseInstance> databaseInstanceProvider, final BucketEntityAdapter bucketEntityAdapter, final ComponentEntityAdapter componentEntityAdapter, final AssetEntityAdapter assetEntityAdapter, final ClientInfoProvider clientInfoProvider, final ContentValidatorSelector contentValidatorSelector, final MimeRulesSourceSelector mimeRulesSourceSelector, final StorageFacetManager storageFacetManager, final ComponentFactory componentFactory, final ConstraintViolationFactory constraintViolationFactory) { this.nodeAccess = checkNotNull(nodeAccess); this.blobStoreManager = checkNotNull(blobStoreManager); this.databaseInstanceProvider = checkNotNull(databaseInstanceProvider); this.bucketEntityAdapter = checkNotNull(bucketEntityAdapter); this.componentEntityAdapter = checkNotNull(componentEntityAdapter); this.assetEntityAdapter = checkNotNull(assetEntityAdapter); this.clientInfoProvider = checkNotNull(clientInfoProvider); this.contentValidatorSelector = checkNotNull(contentValidatorSelector); this.mimeRulesSourceSelector = checkNotNull(mimeRulesSourceSelector); this.storageFacetManager = checkNotNull(storageFacetManager); this.componentFactory = checkNotNull(componentFactory); this.constraintViolationFactory = checkNotNull(constraintViolationFactory); this.txSupplier = () -> openStorageTx(databaseInstanceProvider.get().acquire()); }
Example #22
Source File: ModelVersionStore.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public ModelVersionStore(final UpgradeManager upgradeManager, @Named(DatabaseInstanceNames.CONFIG) final Provider<DatabaseInstance> databaseInstance, final ClusteredModelVersionsEntityAdapter entityAdapter, final ApplicationDirectories applicationDirectories) { this.upgradeManager = checkNotNull(upgradeManager); this.databaseInstance = checkNotNull(databaseInstance); this.entityAdapter = checkNotNull(entityAdapter); localModelVersions = new PropertiesFile(new File(applicationDirectories.getWorkDirectory("db"), MODEL_PROPERTIES)); }
Example #23
Source File: AssetStoreImpl.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public AssetStoreImpl(@Named("component") final Provider<DatabaseInstance> databaseInstance, final AssetEntityAdapter entityAdapter) { this.databaseInstance = checkNotNull(databaseInstance); this.entityAdapter = checkNotNull(entityAdapter); }
Example #24
Source File: OrientCapabilityStorage.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public OrientCapabilityStorage(@Named(DatabaseInstanceNames.CONFIG) final Provider<DatabaseInstance> databaseInstance, final OrientCapabilityStorageItemEntityAdapter entityAdapter) { this.databaseInstance = checkNotNull(databaseInstance); this.entityAdapter = checkNotNull(entityAdapter); }
Example #25
Source File: ComponentSchemaRegistration.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public ComponentSchemaRegistration(@Named(ComponentDatabase.NAME) final Provider<DatabaseInstance> databaseInstance, final BucketEntityAdapter bucketEntityAdapter, final ComponentEntityAdapter componentEntityAdapter, final AssetEntityAdapter assetEntityAdapter, final BrowseNodeEntityAdapter browseNodeEntityAdapter) { this.databaseInstance = checkNotNull(databaseInstance); this.bucketEntityAdapter = checkNotNull(bucketEntityAdapter); this.componentEntityAdapter = checkNotNull(componentEntityAdapter); this.assetEntityAdapter = checkNotNull(assetEntityAdapter); this.browseNodeEntityAdapter = checkNotNull(browseNodeEntityAdapter); }
Example #26
Source File: ComponentStoreImpl.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public ComponentStoreImpl(@Named("component") final Provider<DatabaseInstance> databaseInstance, final ComponentEntityAdapter entityAdapter) { this.databaseInstance = checkNotNull(databaseInstance); this.entityAdapter = checkNotNull(entityAdapter); }
Example #27
Source File: BucketStoreImpl.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public BucketStoreImpl(@Named("component") final Provider<DatabaseInstance> databaseInstance, final BucketEntityAdapter entityAdapter) { this.databaseInstance = checkNotNull(databaseInstance); this.entityAdapter = checkNotNull(entityAdapter); }
Example #28
Source File: OrientApiKeyStore.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public OrientApiKeyStore( @Named(DatabaseInstanceNames.SECURITY) final Provider<DatabaseInstance> databaseInstance, final OrientApiKeyEntityAdapter entityAdapter, final UserPrincipalsHelper principalsHelper, final Map<String, ApiKeyFactory> apiKeyFactories, final DefaultApiKeyFactory defaultApiKeyFactory) { this.databaseInstance = checkNotNull(databaseInstance); this.entityAdapter = checkNotNull(entityAdapter); this.principalsHelper = checkNotNull(principalsHelper); this.apiKeyFactories = checkNotNull(apiKeyFactories); this.defaultApiKeyFactory = checkNotNull(defaultApiKeyFactory); }
Example #29
Source File: OrientEmailConfigurationStore.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public OrientEmailConfigurationStore(@Named(DatabaseInstanceNames.CONFIG) final Provider<DatabaseInstance> databaseInstance, final OrientEmailConfigurationEntityAdapter entityAdapter) { this.databaseInstance = checkNotNull(databaseInstance); this.entityAdapter = checkNotNull(entityAdapter); }
Example #30
Source File: OrientHttpClientConfigurationStore.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public OrientHttpClientConfigurationStore(@Named(DatabaseInstanceNames.CONFIG) final Provider<DatabaseInstance> databaseInstance, final OrientHttpClientConfigurationEntityAdapter entityAdapter) { this.databaseInstance = checkNotNull(databaseInstance); this.entityAdapter = checkNotNull(entityAdapter); }