Search in sources :

Example 6 with TransactionalStoreBlob

use of org.sonatype.nexus.repository.transaction.TransactionalStoreBlob 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);
}
Also used : RFacet(org.sonatype.nexus.repository.r.RFacet) StorageTx(org.sonatype.nexus.repository.storage.StorageTx) RFacetUtils.saveAsset(org.sonatype.nexus.repository.r.internal.util.RFacetUtils.saveAsset) RFacetUtils.findAsset(org.sonatype.nexus.repository.r.internal.util.RFacetUtils.findAsset) Asset(org.sonatype.nexus.repository.storage.Asset) TransactionalStoreBlob(org.sonatype.nexus.repository.transaction.TransactionalStoreBlob)

Example 7 with TransactionalStoreBlob

use of org.sonatype.nexus.repository.transaction.TransactionalStoreBlob 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);
}
Also used : RFacet(org.sonatype.nexus.repository.r.RFacet) StorageTx(org.sonatype.nexus.repository.storage.StorageTx) InputStream(java.io.InputStream) RFacetUtils.saveAsset(org.sonatype.nexus.repository.r.internal.util.RFacetUtils.saveAsset) RFacetUtils.findAsset(org.sonatype.nexus.repository.r.internal.util.RFacetUtils.findAsset) Asset(org.sonatype.nexus.repository.storage.Asset) Component(org.sonatype.nexus.repository.storage.Component) TransactionalStoreBlob(org.sonatype.nexus.repository.transaction.TransactionalStoreBlob)

Aggregations

Asset (org.sonatype.nexus.repository.storage.Asset)7 TransactionalStoreBlob (org.sonatype.nexus.repository.transaction.TransactionalStoreBlob)7 StorageTx (org.sonatype.nexus.repository.storage.StorageTx)6 InputStream (java.io.InputStream)4 RFacet (org.sonatype.nexus.repository.r.RFacet)4 RFacetUtils.findAsset (org.sonatype.nexus.repository.r.internal.util.RFacetUtils.findAsset)4 RFacetUtils.saveAsset (org.sonatype.nexus.repository.r.internal.util.RFacetUtils.saveAsset)4 Component (org.sonatype.nexus.repository.storage.Component)4 RFacetUtils.findAsset (org.sonatype.nexus.repository.r.internal.RFacetUtils.findAsset)3 RFacetUtils.saveAsset (org.sonatype.nexus.repository.r.internal.RFacetUtils.saveAsset)3 Bucket (org.sonatype.nexus.repository.storage.Bucket)3 RFacetUtils.findComponent (org.sonatype.nexus.repository.r.internal.RFacetUtils.findComponent)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1