use of org.sonatype.nexus.repository.r.internal.AssetKind.ARCHIVE 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);
}
}
Aggregations