org.sonatype.nexus.repository.view.payloads.BlobPayload Java Examples
The following examples show how to use
org.sonatype.nexus.repository.view.payloads.BlobPayload.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OrientPyPiGroupFacet.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
@TransactionalStoreBlob public Content saveToCache(final String name, final Content content) throws IOException { StorageTx tx = UnitOfWork.currentTx(); Asset asset = getAsset(tx, name); AttributesMap contentAttributes = Content.maintainLastModified(asset, null); contentAttributes.set(CacheInfo.class, cacheController.current()); Content.applyToAsset(asset, contentAttributes); AssetBlob blob = updateAsset(tx, asset, content); Content response = new Content(new BlobPayload(blob.getBlob(), ContentTypes.TEXT_HTML)); Content.extractFromAsset(asset, HASH_ALGORITHMS, response.getAttributes()); return response; }
Example #2
Source File: NpmFacetUtils.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
/** * Returns the tarball content. */ @Nullable static Content getTarballContent(final StorageTx tx, final Bucket bucket, final NpmPackageId packageId, final String tarballName) { Asset asset = findTarballAsset(tx, bucket, packageId, tarballName); if (asset == null) { return null; } Blob blob = tx.requireBlob(asset.requireBlobRef()); Content content = new Content(new BlobPayload(blob, asset.requireContentType())); Content.extractFromAsset(asset, HASH_ALGORITHMS, content.getAttributes()); return content; }
Example #3
Source File: P2FacetImpl.java From nexus-repository-p2 with Eclipse Public License 1.0 | 5 votes |
/** * Convert an asset blob to {@link Content}. * * @return content of asset blob */ @Override public Content toContent(final Asset asset, final Blob blob) { Content content = new Content(new BlobPayload(blob, asset.requireContentType())); Content.extractFromAsset(asset, HASH_ALGORITHMS, content.getAttributes()); return content; }
Example #4
Source File: CocoapodsFacetImpl.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Override @TransactionalStoreBlob public Content getOrCreateAsset(final String path, final Content content, boolean toAttachComponent) throws IOException { StorageFacet storageFacet = facet(StorageFacet.class); try (final TempBlob tempBlob = storageFacet.createTempBlob(content, HASH_ALGORITHMS)) { StorageTx tx = UnitOfWork.currentTx(); Bucket bucket = tx.findBucket(getRepository()); Asset asset = tx.findAssetWithProperty(P_NAME, path, bucket); if (asset == null) { if (toAttachComponent) { Component component = findOrCreateComponent(tx, bucket, path); asset = tx.createAsset(bucket, component).name(path); } else { asset = tx.createAsset(bucket, getRepository().getFormat()).name(path); } } Content.applyToAsset(asset, content.getAttributes()); AssetBlob blob = tx.setBlob(asset, path, tempBlob, HASH_ALGORITHMS, null, null, false); tx.saveAsset(asset); final Content updatedContent = new Content(new BlobPayload(blob.getBlob(), asset.requireContentType())); Content.extractFromAsset(asset, HASH_ALGORITHMS, updatedContent.getAttributes()); return updatedContent; } }
Example #5
Source File: CocoapodsFacetImpl.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Override @Nullable @TransactionalTouchBlob public Content get(final String path) { final StorageTx tx = UnitOfWork.currentTx(); final Asset asset = tx.findAssetWithProperty(P_NAME, path, tx.findBucket(getRepository())); if (asset == null) { return null; } Content content = new Content(new BlobPayload(tx.requireBlob(asset.requireBlobRef()), asset.requireContentType())); Content.extractFromAsset(asset, HASH_ALGORITHMS, content.getAttributes()); return content; }
Example #6
Source File: CondaFacetImpl.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Override public Content toContent(final Asset asset, final Blob blob) { Content content = new Content(new BlobPayload(blob, asset.requireContentType())); Content.extractFromAsset(asset, HASH_ALGORITHMS, content.getAttributes()); return content; }
Example #7
Source File: FacetHelper.java From nexus-repository-apt with Eclipse Public License 1.0 | 4 votes |
public static Content toContent(final Asset asset, final Blob blob) { final Content content = new Content(new BlobPayload(blob, asset.requireContentType())); Content.extractFromAsset(asset, hashAlgorithms, content.getAttributes()); return content; }
Example #8
Source File: NpmFacetUtils.java From nexus-public with Eclipse Public License 1.0 | 4 votes |
/** * Convert an asset blob to {@link Content}. * * @return content of asset blob */ public static Content toContent(final Asset asset, final Blob blob) { Content content = new Content(new BlobPayload(blob, asset.requireContentType())); Content.extractFromAsset(asset, HASH_ALGORITHMS, content.getAttributes()); return content; }
Example #9
Source File: ConanProxyFacet.java From nexus-repository-conan with Eclipse Public License 1.0 | 4 votes |
static Content toContent(final Asset asset, final Blob blob) { Content content = new Content(new BlobPayload(blob, asset.requireContentType())); Content.extractFromAsset(asset, HASH_ALGORITHMS, content.getAttributes()); return content; }
Example #10
Source File: OrientPyPiDataUtils.java From nexus-public with Eclipse Public License 1.0 | 4 votes |
/** * Convert an asset blob to {@link Content}. * * @return content of asset blob */ static Content toContent(final Asset asset, final Blob blob) { Content content = new Content(new BlobPayload(blob, asset.requireContentType())); Content.extractFromAsset(asset, HASH_ALGORITHMS, content.getAttributes()); return content; }
Example #11
Source File: RFacetUtils.java From nexus-repository-r with Eclipse Public License 1.0 | 4 votes |
/** * Convert an asset blob to {@link Content}. * * @return content of asset blob */ public static Content toContent(final Asset asset, final Blob blob) { Content content = new Content(new BlobPayload(blob, asset.requireContentType())); Content.extractFromAsset(asset, HASH_ALGORITHMS, content.getAttributes()); return content; }
Example #12
Source File: RawContentFacetImpl.java From nexus-public with Eclipse Public License 1.0 | 4 votes |
private Content toContent(final Asset asset, final Blob blob) { final Content content = new Content(new BlobPayload(blob, asset.requireContentType())); Content.extractFromAsset(asset, hashAlgorithms, content.getAttributes()); return content; }
Example #13
Source File: GolangDataAccess.java From nexus-public with Eclipse Public License 1.0 | 4 votes |
/** * Convert an asset blob to {@link Content}. * * @return content of asset blob */ public Content toContent(final Asset asset, final Blob blob) { Content content = new Content(new BlobPayload(blob, asset.requireContentType())); Content.extractFromAsset(asset, HASH_ALGORITHMS, content.getAttributes()); return content; }
Example #14
Source File: GolangDataAccess.java From nexus-public with Eclipse Public License 1.0 | 4 votes |
public Payload getBlobAsPayload(final StorageTx tx, final Asset asset) { return new BlobPayload(tx.requireBlob(asset.requireBlobRef()), asset.requireContentType()); }
Example #15
Source File: MavenFacetImpl.java From nexus-public with Eclipse Public License 1.0 | 4 votes |
private Content toContent(final Asset asset, final Blob blob) { final String contentType = asset.contentType(); final Content content = new Content(new BlobPayload(blob, contentType)); Content.extractFromAsset(asset, HashType.ALGORITHMS, content.getAttributes()); return content; }
Example #16
Source File: FacetHelper.java From nexus-public with Eclipse Public License 1.0 | 4 votes |
public static Content toContent(final Asset asset, final Blob blob) { final Content content = new Content(new BlobPayload(blob, asset.requireContentType())); Content.extractFromAsset(asset, hashAlgorithms, content.getAttributes()); return content; }
Example #17
Source File: HelmFacetImpl.java From nexus-repository-helm with Eclipse Public License 1.0 | 4 votes |
/** * Convert an asset blob to {@link Content}. * * @return content of asset blob */ public Content toContent(final Asset asset, final Blob blob) { Content content = new Content(new BlobPayload(blob, asset.requireContentType())); Content.extractFromAsset(asset, HASH_ALGORITHMS, content.getAttributes()); return content; }
Example #18
Source File: ComposerContentFacetImpl.java From nexus-repository-composer with Eclipse Public License 1.0 | 4 votes |
private Content toContent(final Asset asset, final Blob blob) { final Content content = new Content(new BlobPayload(blob, asset.requireContentType())); Content.extractFromAsset(asset, hashAlgorithms, content.getAttributes()); return content; }