use of org.sonatype.nexus.repository.storage.TempBlob in project nexus-repository-r by sonatype-nexus-community.
the class RHostedFacetImpl method upload.
@Override
public void upload(final String path, final Payload payload) throws IOException {
checkNotNull(path);
checkNotNull(payload);
StorageFacet storageFacet = facet(StorageFacet.class);
try (TempBlob tempBlob = storageFacet.createTempBlob(payload, RFacetUtils.HASH_ALGORITHMS)) {
doPutArchive(path, tempBlob, payload);
}
}
use of org.sonatype.nexus.repository.storage.TempBlob in project nexus-repository-r by sonatype-nexus-community.
the class RHostedFacetImpl method buildAndPutPackagesGz.
@Override
@TransactionalTouchMetadata
public Content buildAndPutPackagesGz(final String basePath) throws IOException {
checkNotNull(basePath);
StorageTx tx = UnitOfWork.currentTx();
RPackagesBuilder packagesBuilder = new RPackagesBuilder();
Iterable<Asset> archiveAssets = browseAllAssetsByKind(tx, tx.findBucket(getRepository()), ARCHIVE);
// packageInfoBuilder doesn't support multithreading
StreamSupport.stream(archiveAssets.spliterator(), false).filter(asset -> basePath.equals(getBasePath(asset.name()))).forEach(packagesBuilder::append);
byte[] packagesBytes = packagesBuilder.buildPackagesGz();
StorageFacet storageFacet = getRepository().facet(StorageFacet.class);
try (InputStream is = new ByteArrayInputStream(packagesBytes)) {
TempBlob tempPackagesGz = storageFacet.createTempBlob(is, RFacetUtils.HASH_ALGORITHMS);
return doPutPackagesGz(tx, basePath, tempPackagesGz);
}
}
use of org.sonatype.nexus.repository.storage.TempBlob in project nexus-repository-r by sonatype-nexus-community.
the class RProxyFacetImpl method putArchive.
private Content putArchive(final String path, final Content content) throws IOException {
checkNotNull(path);
checkNotNull(content);
StorageFacet storageFacet = facet(StorageFacet.class);
try (TempBlob tempBlob = storageFacet.createTempBlob(content.openInputStream(), RFacetUtils.HASH_ALGORITHMS)) {
return doPutArchive(path, tempBlob, content);
}
}
use of org.sonatype.nexus.repository.storage.TempBlob in project nexus-repository-r by sonatype-nexus-community.
the class RHostedFacetImpl method upload.
@Override
public Asset upload(final String path, final Payload payload) throws IOException {
checkNotNull(path);
checkNotNull(payload);
StorageFacet storageFacet = facet(StorageFacet.class);
try (TempBlob tempBlob = storageFacet.createTempBlob(payload, RFacetUtils.HASH_ALGORITHMS)) {
return doPutArchive(path, tempBlob, payload);
}
}
Aggregations