Tabnine Logo
Content.getAttributes
Code IndexAdd Tabnine to your IDE (free)

How to use
getAttributes
method
in
org.sonatype.nexus.repository.view.Content

Best Java code snippets using org.sonatype.nexus.repository.view.Content.getAttributes (Showing top 20 results out of 315)

origin: org.sonatype.nexus/nexus-repository

 private Asset getAssetFromPayload(final Payload payload) {
  if (payload instanceof Content) {
   return ((Content) payload).getAttributes().get(Asset.class);
  }
  return null;
 }
}
origin: org.sonatype.nexus/nexus-repository

 @Nullable
 private static EntityId extractComponentId(final Content content) {
  Optional<Asset> asset = Optional.ofNullable(content.getAttributes().get(Asset.class));
  return asset.map(Asset::componentId).orElse(null);
 }
}
origin: org.sonatype.nexus.plugins/nexus-repository-npm

@Nullable
private NestedAttributesMap getNestedAttributesMap(final Payload payload) {
 return nonNull(payload) ? ((Content) payload).getAttributes().get(NestedAttributesMap.class) : null;
}
origin: org.sonatype.nexus/nexus-repository

public TempContent(final Content remote) throws IOException {
 super(cachePayload(remote), remote.getAttributes());
}
origin: sonatype-nexus-community/nexus-repository-apt

private void addSignatureItem(StringBuilder builder, HashAlgorithm algo, Content content, String filename) {
 Map<HashAlgorithm, HashCode> hashMap = content.getAttributes().get(Content.CONTENT_HASH_CODES_MAP,
   Content.T_CONTENT_HASH_CODES_MAP);
 builder.append("\n ");
 builder.append(hashMap.get(algo).toString());
 builder.append(" ");
 builder.append(content.getSize());
 builder.append(" ");
 builder.append(filename);
}
origin: org.sonatype.nexus.plugins/nexus-repository-maven

private void putChecksumFiles(final MavenFacet facet, final MavenPath path, final Content content) throws IOException {
 DateTime dateTime = content.getAttributes().require(Content.CONTENT_LAST_MODIFIED, DateTime.class);
 Map<HashAlgorithm, HashCode> hashes = MavenFacetUtils.getHashAlgorithmFromContent(content.getAttributes());
 MavenFacetUtils.addHashes(facet, path, hashes, dateTime);
}
origin: org.sonatype.nexus/nexus-repository

/**
 * Returns {@code true} if the content is considered stale; otherwise {@code false}.
 */
protected boolean isStale(@Nullable final Content content) {
 return content == null || cacheController.isStale(content.getAttributes().require(CacheInfo.class));
}
origin: org.sonatype.nexus.plugins/nexus-repository-maven

/**
 * Performs a {@link MavenFacet#put(MavenPath, Payload)} for passed in {@link Content} and it's hashes too. Returns
 * the put content.
 */
public static void putWithHashes(final MavenFacet mavenFacet,
                 final MavenPath mavenPath,
                 final Content content) throws IOException
{
 final Map<HashAlgorithm, HashCode> hashCodes = getHashAlgorithmFromContent(content.getAttributes());
 final DateTime now = content.getAttributes().require(Content.CONTENT_LAST_MODIFIED, DateTime.class);
 mavenFacet.put(mavenPath, content);
 addHashes(mavenFacet, mavenPath, hashCodes, now);
}
origin: org.sonatype.nexus.plugins/nexus-repository-npm

/**
 * Creates a {@link Content} out of passed in package metadata.
 */
@Nonnull
static Content toContent(final Asset packageRootAsset, final NestedAttributesMap packageRoot) {
 Content content = new Content(new BytesPayload(NpmJsonUtils.bytes(packageRoot), ContentTypes.APPLICATION_JSON));
 Content.extractFromAsset(packageRootAsset, HASH_ALGORITHMS, content.getAttributes());
 content.getAttributes().set(NestedAttributesMap.class, packageRoot);
 return content;
}
origin: org.sonatype.nexus/nexus-repository

private boolean isStale(final Context context, final Content content) {
 if (content == null) {
  // not in cache, consider it stale
  return true;
 }
 final CacheInfo cacheInfo = content.getAttributes().get(CacheInfo.class);
 return cacheInfo == null || getCacheController(context).isStale(cacheInfo);
}
origin: org.sonatype.nexus.plugins/nexus-repository-npm

/**
 * Convert an asset blob to {@link Content}.
 *
 * @return content of asset blob
 */
@Nonnull
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;
}
origin: org.sonatype.nexus.plugins/nexus-repository-raw

 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;
 }
}
origin: org.sonatype.nexus.plugins/nexus-repository-npm

@TransactionalTouchMetadata
public void setCacheInfo(final Content content, final CacheInfo cacheInfo) throws IOException {
 StorageTx tx = UnitOfWork.currentTx();
 Asset asset = Content.findAsset(tx, tx.findBucket(getRepository()), content);
 if (asset == null) {
  log.debug(
    "Attempting to set cache info for non-existent npm asset {}", content.getAttributes().require(Asset.class)
  );
  return;
 }
 log.debug("Updating cacheInfo of {} to {}", asset, cacheInfo);
 CacheInfo.applyToAsset(asset, cacheInfo);
 tx.saveAsset(asset);
}
origin: org.sonatype.nexus.plugins/nexus-repository-maven

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;
}
origin: sonatype-nexus-community/nexus-repository-helm

@TransactionalTouchMetadata
public void setCacheInfo(final Content content, final CacheInfo cacheInfo) throws IOException {
 StorageTx tx = UnitOfWork.currentTx();
 Asset asset = Content.findAsset(tx, tx.findBucket(getRepository()), content);
 if (asset == null) {
  log.debug(
    "Attempting to set cache info for non-existent Helm asset {}", content.getAttributes().require(Asset.class)
  );
  return;
 }
 log.debug("Updating cacheInfo of {} to {}", asset, cacheInfo);
 CacheInfo.applyToAsset(asset, cacheInfo);
 tx.saveAsset(asset);
}
origin: sonatype-nexus-community/nexus-repository-apt

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;
}
origin: sonatype-nexus-community/nexus-repository-composer

 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;
 }
}
origin: sonatype-nexus-community/nexus-repository-helm

 /**
  * 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;
 }
}
origin: org.sonatype.nexus.plugins/nexus-repository-maven

private Response doGet(final MavenPath path, final MavenFacet mavenFacet) throws IOException {
 Content content = mavenFacet.get(path);
 if (content == null) {
  return HttpResponses.notFound(path.getPath());
 }
 AttributesMap attributesMap = content.getAttributes();
 MavenFacetUtils.mayAddETag(attributesMap, getHashAlgorithmFromContent(attributesMap));
 return HttpResponses.ok(content);
}
origin: org.sonatype.nexus.plugins/nexus-repository-npm

@TransactionalStoreBlob
protected Content doPutTarball(final NpmPackageId packageId,
                final String tarballName,
                final TempBlob tempBlob,
                final Content content) throws IOException
{
 StorageTx tx = UnitOfWork.currentTx();
 AssetBlob assetBlob = NpmFacetUtils.createTarballAssetBlob(tx, packageId, tarballName, tempBlob);
 NpmFacet npmFacet = facet(NpmFacet.class);
 npmFacet.putTarball(packageId.id(), tarballName, assetBlob, content.getAttributes());
 return NpmFacetUtils.getTarballContent(tx, tx.findBucket(getRepository()), packageId, tarballName);
}
org.sonatype.nexus.repository.viewContentgetAttributes

Popular methods of Content

  • <init>
  • applyToAsset
    Applies non-format specific content attributes onto passed in Asset from passed in AttributesMap(usu
  • extractFromAsset
    Extracts non-format specific content attributes into the passed in AttributesMap (usually originatin
  • findAsset
    Finds fresh Asset instance from passed in TX by entity ID of the Asset used to create passed in Cont
  • maintainLastModified
    Maintains the "last modified" attribute of the content by setting it to "now". It accepts nulls, and
  • openInputStream
  • getContentType
  • close
  • getSize

Popular in Java

  • Running tasks concurrently on multiple threads
  • requestLocationUpdates (LocationManager)
  • compareTo (BigDecimal)
  • notifyDataSetChanged (ArrayAdapter)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • JCheckBox (javax.swing)
  • JLabel (javax.swing)
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now