org.sonatype.nexus.blobstore.api.BlobStoreManager Java Examples

The following examples show how to use org.sonatype.nexus.blobstore.api.BlobStoreManager. 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: P2RestoreBlobIT.java    From nexus-repository-p2 with Eclipse Public License 1.0 6 votes vote down vote up
private void runBlobRestore(final boolean isDryRun) {
  Asset asset;
  Blob blob;
  try (StorageTx tx = getStorageTx(proxyRepository)) {
    tx.begin();
    asset = tx.findAssetWithProperty(AssetEntityAdapter.P_NAME, VALID_PACKAGE_URL,
        tx.findBucket(proxyRepository));
    assertThat(asset, Matchers.notNullValue());
    blob = tx.getBlob(asset.blobRef());
  }
  testHelper.simulateAssetMetadataLoss();
  Properties properties = new Properties();
  properties.setProperty(HEADER_PREFIX + REPO_NAME_HEADER, proxyRepository.getName());
  properties.setProperty(HEADER_PREFIX + BLOB_NAME_HEADER, asset.name());
  properties.setProperty(HEADER_PREFIX + CONTENT_TYPE_HEADER, asset.contentType());

  p2RestoreBlobStrategy.restore(properties, blob, BlobStoreManager.DEFAULT_BLOBSTORE_NAME, isDryRun);
}
 
Example #2
Source File: HelmRestoreBlobIT.java    From nexus-repository-helm with Eclipse Public License 1.0 6 votes vote down vote up
private void runBlobRestore(final boolean isDryRun) {
  Asset asset;
  Blob blob;
  try (StorageTx tx = getStorageTx(proxyRepository)) {
    tx.begin();
    asset = tx.findAssetWithProperty(AssetEntityAdapter.P_NAME, MONGO_PATH_FULL_728_TARGZ,
        tx.findBucket(proxyRepository));
    assertThat(asset, Matchers.notNullValue());
    blob = tx.getBlob(asset.blobRef());
  }
  testHelper.simulateAssetMetadataLoss();
  Properties properties = new Properties();
  properties.setProperty(HEADER_PREFIX + REPO_NAME_HEADER, proxyRepository.getName());
  properties.setProperty(HEADER_PREFIX + BLOB_NAME_HEADER, asset.name());
  properties.setProperty(HEADER_PREFIX + CONTENT_TYPE_HEADER, asset.contentType());

  helmRestoreBlobStrategy.restore(properties, blob, BlobStoreManager.DEFAULT_BLOBSTORE_NAME, isDryRun);
}
 
Example #3
Source File: RestoreMetadataTask.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
@Inject
public RestoreMetadataTask(final BlobStoreManager blobStoreManager,
                           final RepositoryManager repositoryManager,
                           final Map<String, RestoreBlobStrategy> restoreBlobStrategies,
                           final BlobStoreUsageChecker blobStoreUsageChecker,
                           final DryRunPrefix dryRunPrefix,
                           final Map<String, IntegrityCheckStrategy> integrityCheckStrategies,
                           final BucketStore bucketStore,
                           final MaintenanceService maintenanceService)
{
  this.blobStoreManager = checkNotNull(blobStoreManager);
  this.repositoryManager = checkNotNull(repositoryManager);
  this.restoreBlobStrategies = checkNotNull(restoreBlobStrategies);
  this.blobStoreUsageChecker = checkNotNull(blobStoreUsageChecker);
  this.dryRunPrefix = checkNotNull(dryRunPrefix);
  this.defaultIntegrityCheckStrategy = checkNotNull(integrityCheckStrategies.get(DEFAULT_NAME));
  this.integrityCheckStrategies = checkNotNull(integrityCheckStrategies);
  this.bucketStore = checkNotNull(bucketStore);
  this.maintenanceService = checkNotNull(maintenanceService);
}
 
Example #4
Source File: RRestoreBlobIT.java    From nexus-repository-r with Eclipse Public License 1.0 6 votes vote down vote up
private void runBlobRestore(final boolean isDryRun) {
  Asset asset;
  Blob blob;
  try (StorageTx tx = getStorageTx(proxyRepository)) {
    tx.begin();
    asset = tx.findAssetWithProperty(AssetEntityAdapter.P_NAME, AGRICOLAE_131_TARGZ.fullPath,
        tx.findBucket(proxyRepository));
    assertThat(asset, Matchers.notNullValue());
    blob = tx.getBlob(asset.blobRef());
  }
  testHelper.simulateAssetMetadataLoss();
  Properties properties = new Properties();
  properties.setProperty(HEADER_PREFIX + REPO_NAME_HEADER, proxyRepository.getName());
  properties.setProperty(HEADER_PREFIX + BLOB_NAME_HEADER, asset.name());
  properties.setProperty(HEADER_PREFIX + CONTENT_TYPE_HEADER, asset.contentType());

  rRestoreBlobStrategy.restore(properties, blob, BlobStoreManager.DEFAULT_BLOBSTORE_NAME, isDryRun);
}
 
Example #5
Source File: ContentFacetStores.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
public ContentFacetStores(final BlobStoreManager blobStoreManager,
                          final String blobStoreName,
                          final FormatStoreManager formatStoreManager,
                          final String contentStoreName)
{
  this.blobStoreName = checkNotNull(blobStoreName);
  this.blobStore = blobStoreManager.get(blobStoreName);

  this.contentStoreName = checkNotNull(contentStoreName);
  this.contentRepositoryStore = formatStoreManager.contentRepositoryStore(contentStoreName);
  this.componentStore = formatStoreManager.componentStore(contentStoreName);
  this.assetStore = formatStoreManager.assetStore(contentStoreName);
  this.assetBlobStore = formatStoreManager.assetBlobStore(contentStoreName);
}
 
Example #6
Source File: OrientPyPiRestoreBlobStrategy.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public OrientPyPiRestoreBlobStrategy(final NodeAccess nodeAccess,
                                     final RepositoryManager repositoryManager,
                                     final BlobStoreManager blobStoreManager,
                                     final DryRunPrefix dryRunPrefix,
                                     final OrientPyPiRepairIndexComponent pyPiRepairIndexComponent,
                                     final PyPiRestoreBlobDataFactory pyPiRestoreBlobDataFactory)
{
  super(nodeAccess, repositoryManager, blobStoreManager, dryRunPrefix);
  this.pyPiRepairIndexComponent = pyPiRepairIndexComponent;
  this.pyPiRestoreBlobDataFactory = pyPiRestoreBlobDataFactory;
}
 
Example #7
Source File: CompactBlobStoreTask.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public CompactBlobStoreTask(final BlobStoreManager blobStoreManager,
                            final BlobStoreUsageChecker blobStoreUsageChecker)
{
  this.blobStoreManager = checkNotNull(blobStoreManager);
  this.blobStoreUsageChecker = checkNotNull(blobStoreUsageChecker);
}
 
Example #8
Source File: MavenRestoreBlobStrategy.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public MavenRestoreBlobStrategy(
    final MavenPathParser mavenPathParser,
    final NodeAccess nodeAccess,
    final RepositoryManager repositoryManager,
    final BlobStoreManager blobStoreManager,
    final DryRunPrefix dryRunPrefix)
{
  super(nodeAccess, repositoryManager, blobStoreManager, dryRunPrefix);
  this.mavenPathParser = checkNotNull(mavenPathParser);
}
 
Example #9
Source File: BucketDeleter.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@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 #10
Source File: StorageFacetImpl.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@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 #11
Source File: RebuildAssetUploadMetadataTask.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public RebuildAssetUploadMetadataTask(final AssetStore assetStore,
                                      final BlobStoreManager blobStoreManager,
                                      final RebuildAssetUploadMetadataConfiguration configuration)
{
  this.assetStore = checkNotNull(assetStore);
  this.blobStoreManager = checkNotNull(blobStoreManager);
  this.limit = checkNotNull(configuration).getPageSize();
}
 
Example #12
Source File: ContentFacetDependencies.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public ContentFacetDependencies(final BlobStoreManager blobStoreManager,
                                final DataSessionSupplier dataSessionSupplier,
                                final ConstraintViolationFactory constraintViolationFactory,
                                final ClientInfoProvider clientInfoProvider,
                                final NodeAccess nodeAccess,
                                final AssetBlobValidators assetBlobValidators)
{
  this.blobStoreManager = checkNotNull(blobStoreManager);
  this.dataSessionSupplier = checkNotNull(dataSessionSupplier);
  this.constraintViolationFactory = checkNotNull(constraintViolationFactory);
  this.clientInfoProvider = checkNotNull(clientInfoProvider);
  this.nodeAccess = checkNotNull(nodeAccess);
  this.assetBlobValidators = checkNotNull(assetBlobValidators);
}
 
Example #13
Source File: BaseRestoreBlobStrategy.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
public BaseRestoreBlobStrategy(final NodeAccess nodeAccess,
                               final RepositoryManager repositoryManager,
                               final BlobStoreManager blobStoreManager,
                               final DryRunPrefix dryRunPrefix)
{
  this.nodeAccess = checkNotNull(nodeAccess);
  this.repositoryManager = checkNotNull(repositoryManager);
  this.blobStoreManager = checkNotNull(blobStoreManager);
  this.dryRunPrefix = checkNotNull(dryRunPrefix);
}
 
Example #14
Source File: AssetBlobCleanupTask.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public AssetBlobCleanupTask(
    final Map<String, FormatStoreManager> formatStoreManagers,
    final BlobStoreManager blobStoreManager)
{
  this.formatStoreManagers = checkNotNull(formatStoreManagers);
  this.blobStoreManager = checkNotNull(blobStoreManager);
}
 
Example #15
Source File: RepositoryManagerImpl.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public RepositoryManagerImpl(final EventManager eventManager,
                             final ConfigurationStore store,
                             final RepositoryFactory factory,
                             final Provider<ConfigurationFacet> configFacet,
                             final Map<String, Recipe> recipes,
                             final RepositoryAdminSecurityContributor securityContributor,
                             final List<DefaultRepositoriesContributor> defaultRepositoriesContributors,
                             final FreezeService freezeService,
                             @Named("${nexus.skipDefaultRepositories:-false}") final boolean skipDefaultRepositories,
                             final BlobStoreManager blobStoreManager,
                             final GroupMemberMappingCache groupMemberMappingCache,
                             final List<ConfigurationValidator> configurationValidators)
{
  this.eventManager = checkNotNull(eventManager);
  this.store = checkNotNull(store);
  this.factory = checkNotNull(factory);
  this.configFacet = checkNotNull(configFacet);
  this.recipes = checkNotNull(recipes);
  this.securityContributor = checkNotNull(securityContributor);
  this.defaultRepositoriesContributors = checkNotNull(defaultRepositoriesContributors);
  this.freezeService = checkNotNull(freezeService);
  this.skipDefaultRepositories = skipDefaultRepositories;
  this.blobStoreManager = checkNotNull(blobStoreManager);
  this.groupMemberMappingCache = checkNotNull(groupMemberMappingCache);
  this.configurationValidators = checkNotNull(configurationValidators);
}
 
Example #16
Source File: BlobStoreGroupDescriptor.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public BlobStoreGroupDescriptor(final BlobStoreManager blobStoreManager,
                                final BlobStoreUtil blobStoreUtil,
                                final Provider<BlobStoreGroupService> blobStoreGroupService,
                                final BlobStoreQuotaService quotaService)
{
  super(quotaService);
  this.blobStoreManager = checkNotNull(blobStoreManager);
  this.blobStoreUtil = checkNotNull(blobStoreUtil);
  this.blobStoreGroupService = checkNotNull(blobStoreGroupService);
  this.members = new ItemselectFormField(
      MEMBERS_KEY,
      messages.membersLabel(),
      null,
      MANDATORY
  );
  this.members.setStoreApi("coreui_Blobstore.readGroupable");
  this.members.setIdMapping("name");
  this.members.setButtons("up", "add", "remove", "down");
  this.members.setFromTitle("Available");
  this.members.setToTitle("Selected");
  this.fillPolicy = new ComboboxFormField<String>(
      BlobStoreGroup.FILL_POLICY_KEY,
      messages.fillPolicyLabel(),
      null,
      FormField.MANDATORY
  ).withStoreApi("coreui_Blobstore.fillPolicies");
}
 
Example #17
Source File: BlobStoreGroup.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public BlobStoreGroup(final BlobStoreManager blobStoreManager,
                      final Map<String, Provider<FillPolicy>> fillPolicyProviders,
                      final Provider<CacheHelper> cacheHelperProvider,
                      @Named("${nexus.blobstore.group.blobId.cache.timeToLive:-2d}") final Time blobIdCacheTimeout) {
  this.blobStoreManager = checkNotNull(blobStoreManager);
  this.fillPolicyProviders = checkNotNull(fillPolicyProviders);
  this.cacheHelperProvider = checkNotNull(cacheHelperProvider);
  this.blobIdCacheTimeout = checkNotNull(blobIdCacheTimeout);
}
 
Example #18
Source File: BlobStoreHealthCheck.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public BlobStoreHealthCheck(final Provider<BlobStoreManager> blobStoreManagerProvider,
                            final Provider<BlobStoreQuotaService> quotaServiceProvider)
{
  this.blobStoreManagerProvider = Preconditions.checkNotNull(blobStoreManagerProvider);
  this.quotaServiceProvider = Preconditions.checkNotNull(quotaServiceProvider);
}
 
Example #19
Source File: RawRestoreBlobStrategy.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public RawRestoreBlobStrategy(final NodeAccess nodeAccess,
                              final RepositoryManager repositoryManager,
                              final BlobStoreManager blobStoreManager,
                              final DryRunPrefix dryRunPrefix)
{
  super(nodeAccess, repositoryManager, blobStoreManager, dryRunPrefix);
}
 
Example #20
Source File: P2RestoreBlobStrategy.java    From nexus-repository-p2 with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public P2RestoreBlobStrategy(final NodeAccess nodeAccess,
                             final RepositoryManager repositoryManager,
                             final BlobStoreManager blobStoreManager,
                             final DryRunPrefix dryRunPrefix)
{
  super(nodeAccess, repositoryManager, blobStoreManager, dryRunPrefix);
}
 
Example #21
Source File: HelmRestoreBlobStrategy.java    From nexus-repository-helm with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public HelmRestoreBlobStrategy(final NodeAccess nodeAccess,
                               final RepositoryManager repositoryManager,
                               final BlobStoreManager blobStoreManager,
                               final DryRunPrefix dryRunPrefix)
{
  super(nodeAccess, repositoryManager, blobStoreManager, dryRunPrefix);
}
 
Example #22
Source File: RRestoreBlobStrategy.java    From nexus-repository-r with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public RRestoreBlobStrategy(final NodeAccess nodeAccess,
                            final RepositoryManager repositoryManager,
                            final BlobStoreManager blobStoreManager,
                            final DryRunPrefix dryRunPrefix)
{
  super(nodeAccess, repositoryManager, blobStoreManager, dryRunPrefix);
}
 
Example #23
Source File: AptRestoreBlobStrategy.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public AptRestoreBlobStrategy(final NodeAccess nodeAccess,
                              final RepositoryManager repositoryManager,
                              final BlobStoreManager blobStoreManager,
                              final DryRunPrefix dryRunPrefix)
{
  super(nodeAccess, repositoryManager, blobStoreManager, dryRunPrefix);
}
 
Example #24
Source File: S3BlobStoreApiResource.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
public S3BlobStoreApiResource(
    final BlobStoreManager blobStoreManager,
    final S3BlobStoreApiUpdateValidation validation)
{
  this.blobStoreManager = blobStoreManager;
  this.s3BlobStoreApiUpdateValidation = validation;
}
 
Example #25
Source File: NpmRestoreBlobStrategy.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public NpmRestoreBlobStrategy(final NodeAccess nodeAccess,
                              final RepositoryManager repositoryManager,
                              final BlobStoreManager blobStoreManager,
                              final DryRunPrefix dryRunPrefix,
                              final NpmRepairPackageRootComponent npmRepairPackageRootComponent)
{
  super(nodeAccess, repositoryManager, blobStoreManager, dryRunPrefix);
  this.npmRepairPackageRootComponent = checkNotNull(npmRepairPackageRootComponent);
}
 
Example #26
Source File: DatastoreDeadBlobFinder.java    From nexus-public with Eclipse Public License 1.0 4 votes vote down vote up
@Inject
public DatastoreDeadBlobFinder(final BlobStoreManager blobStoreManager) {
  this.blobStoreManager = blobStoreManager;
}
 
Example #27
Source File: GoogleCloudBlobstoreApiResource.java    From nexus-blobstore-google-cloud with Eclipse Public License 1.0 4 votes vote down vote up
@Inject
public GoogleCloudBlobstoreApiResource(BlobStoreManager blobStoreManager) {
  this.blobStoreManager = blobStoreManager;
}
 
Example #28
Source File: BlobStoreResourceBeta.java    From nexus-public with Eclipse Public License 1.0 4 votes vote down vote up
@Inject
public BlobStoreResourceBeta(final BlobStoreManager blobStoreManager,
                             final BlobStoreQuotaService quotaService)
{
  super(blobStoreManager, quotaService);
}
 
Example #29
Source File: BlobStoreResourceV1.java    From nexus-public with Eclipse Public License 1.0 4 votes vote down vote up
@Inject
public BlobStoreResourceV1(final BlobStoreManager blobStoreManager,
                           final BlobStoreQuotaService quotaService)
{
  super(blobStoreManager, quotaService);
}
 
Example #30
Source File: BlobStoreResource.java    From nexus-public with Eclipse Public License 1.0 4 votes vote down vote up
public BlobStoreResource(final BlobStoreManager blobStoreManager, final BlobStoreQuotaService quotaService)
{
  this.blobStoreManager = checkNotNull(blobStoreManager);
  this.quotaService = checkNotNull(quotaService);
}