Search in sources :

Example 1 with RRestoreFacet

use of org.sonatype.nexus.repository.r.RRestoreFacet in project nexus-repository-r by sonatype-nexus-community.

the class RRestoreBlobStrategy method componentRequired.

@Override
protected boolean componentRequired(final RRestoreBlobData data) {
    RRestoreFacet facet = getRestoreFacet(data);
    final String path = data.getBlobData().getBlobName();
    return facet.componentRequired(path);
}
Also used : RRestoreFacet(org.sonatype.nexus.repository.r.RRestoreFacet)

Example 2 with RRestoreFacet

use of org.sonatype.nexus.repository.r.RRestoreFacet in project nexus-repository-r by sonatype-nexus-community.

the class RRestoreBlobStrategy method getComponentQuery.

@Override
protected Query getComponentQuery(final RRestoreBlobData data) throws IOException {
    RRestoreFacet facet = getRestoreFacet(data);
    RestoreBlobData blobData = data.getBlobData();
    Map<String, String> attributes;
    try (InputStream inputStream = blobData.getBlob().getInputStream()) {
        attributes = facet.extractComponentAttributesFromArchive(blobData.getBlobName(), inputStream);
    }
    return facet.getComponentQuery(attributes);
}
Also used : InputStream(java.io.InputStream) RestoreBlobData(org.sonatype.nexus.blobstore.restore.RestoreBlobData) RRestoreFacet(org.sonatype.nexus.repository.r.RRestoreFacet)

Example 3 with RRestoreFacet

use of org.sonatype.nexus.repository.r.RRestoreFacet in project nexus-repository-r by sonatype-nexus-community.

the class RRestoreBlobStrategy method canAttemptRestore.

@Override
protected boolean canAttemptRestore(@Nonnull final RRestoreBlobData rRestoreBlobData) {
    Repository repository = getRepository(rRestoreBlobData);
    Optional<RRestoreFacet> rRestoreFacetFacet = repository.optionalFacet(RRestoreFacet.class);
    if (!rRestoreFacetFacet.isPresent()) {
        log.warn("Skipping as R Restore Facet not found on repository: {}", repository.getName());
        return false;
    }
    return true;
}
Also used : Repository(org.sonatype.nexus.repository.Repository) RRestoreFacet(org.sonatype.nexus.repository.r.RRestoreFacet)

Example 4 with RRestoreFacet

use of org.sonatype.nexus.repository.r.RRestoreFacet in project nexus-repository-r by sonatype-nexus-community.

the class RRestoreBlobStrategy method createAssetFromBlob.

@Override
protected void createAssetFromBlob(@Nonnull final AssetBlob assetBlob, @Nonnull final RRestoreBlobData rRestoreBlobData) throws IOException {
    RRestoreFacet facet = getRestoreFacet(rRestoreBlobData);
    final String path = getAssetPath(rRestoreBlobData);
    facet.restore(assetBlob, path);
}
Also used : RRestoreFacet(org.sonatype.nexus.repository.r.RRestoreFacet)

Aggregations

RRestoreFacet (org.sonatype.nexus.repository.r.RRestoreFacet)4 InputStream (java.io.InputStream)1 RestoreBlobData (org.sonatype.nexus.blobstore.restore.RestoreBlobData)1 Repository (org.sonatype.nexus.repository.Repository)1