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