use of org.sonatype.nexus.repository.r.RFacet in project nexus-repository-r by sonatype-nexus-community.
the class RHostedFacetImpl method doPutPackagesGz.
@TransactionalStoreBlob
protected Content doPutPackagesGz(final StorageTx tx, final String basePath, final TempBlob tempPackagesGz) throws IOException {
RFacet rFacet = facet(RFacet.class);
Asset asset = rFacet.findOrCreateAsset(tx, buildPath(basePath, PACKAGES_GZ_FILENAME));
return saveAsset(tx, asset, tempPackagesGz, "", null);
}
use of org.sonatype.nexus.repository.r.RFacet in project nexus-repository-r by sonatype-nexus-community.
the class RHostedFacetImpl method doPutArchive.
@TransactionalStoreBlob
protected Asset doPutArchive(final String path, final TempBlob archiveContent, final Payload payload) throws IOException {
StorageTx tx = UnitOfWork.currentTx();
RFacet rFacet = facet(RFacet.class);
Map<String, String> attributes;
try (InputStream is = archiveContent.get()) {
attributes = extractDescriptionFromArchive(path, is);
}
Component component = rFacet.findOrCreateComponent(tx, path, attributes);
Asset asset = rFacet.findOrCreateAsset(tx, component, path, attributes);
saveAsset(tx, asset, archiveContent, payload);
return asset;
}
use of org.sonatype.nexus.repository.r.RFacet in project nexus-repository-r by sonatype-nexus-community.
the class RProxyFacetImpl method doPutMetadata.
@TransactionalStoreBlob
protected Content doPutMetadata(final String path, final TempBlob packagesContent, final Payload payload) throws IOException {
StorageTx tx = UnitOfWork.currentTx();
RFacet rFacet = facet(RFacet.class);
Asset asset = rFacet.findOrCreateAsset(tx, path);
return saveAsset(tx, asset, packagesContent, payload);
}
use of org.sonatype.nexus.repository.r.RFacet in project nexus-repository-r by sonatype-nexus-community.
the class RProxyFacetImpl method doPutArchive.
@TransactionalStoreBlob
protected Content doPutArchive(final String path, final TempBlob archiveContent, final Content content) throws IOException {
RFacet rFacet = facet(RFacet.class);
StorageTx tx = UnitOfWork.currentTx();
Map<String, String> attributes;
try (InputStream is = archiveContent.get()) {
attributes = extractDescriptionFromArchive(path, is);
}
Component component = rFacet.findOrCreateComponent(tx, path, attributes);
Asset asset = rFacet.findOrCreateAsset(tx, component, path, attributes);
return saveAsset(tx, asset, archiveContent, content);
}
use of org.sonatype.nexus.repository.r.RFacet in project nexus-repository-r by sonatype-nexus-community.
the class RRestoreFacetImpl method restore.
@Override
@TransactionalTouchBlob
public void restore(final AssetBlob assetBlob, final String path) throws IOException {
StorageTx tx = UnitOfWork.currentTx();
RFacet facet = facet(RFacet.class);
Asset asset;
if (componentRequired(path)) {
Map<String, String> attributes;
try (InputStream is = assetBlob.getBlob().getInputStream()) {
attributes = extractDescriptionFromArchive(path, is);
}
Component component = facet.findOrCreateComponent(tx, path, attributes);
asset = facet.findOrCreateAsset(tx, component, path, attributes);
} else {
asset = facet.findOrCreateAsset(tx, path);
}
tx.attachBlob(asset, assetBlob);
Content.applyToAsset(asset, Content.maintainLastModified(asset, new AttributesMap()));
tx.saveAsset(asset);
}
Aggregations