Class ResourceDescriptor

java.lang.Object
org.apache.commons.release.plugin.slsa.v1_2.ResourceDescriptor

public class ResourceDescriptor extends Object
Description of an artifact or resource referenced in the build, identified by URI and cryptographic digest.

Used to represent inputs to, outputs from, or byproducts of the build process.

Since:
1.10.0
See Also:
  • Constructor Details

    • ResourceDescriptor

      Creates a new ResourceDescriptor instance.
    • ResourceDescriptor

      public ResourceDescriptor(String uri, Map<String,String> digest)
      Creates a new ResourceDescriptor with the given URI and digest.
      Parameters:
      uri - URI identifying the resource.
      digest - map of digest algorithm names to their hex-encoded values.
  • Method Details

    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • getAnnotations

      Gets additional key-value metadata about the resource, such as filename, size, or builder-specific attributes.
      Returns:
      The annotations map, or null if not set.
    • getContent

      public byte[] getContent()
      Gets the raw contents of the resource, base64-encoded when serialized to JSON.
      Returns:
      The resource content, or null if not set.
    • getDigest

      Gets the map of cryptographic digest algorithms to their corresponding hex-encoded values for this resource.

      Common keys include "sha256" and "sha512".

      Returns:
      The digest map, or null if not set.
    • getDownloadLocation

      Gets the download URI for the resource, if different from getUri().
      Returns:
      The download location URI, or null if not set.
    • getMediaType

      public String getMediaType()
      Gets the media type of the resource (for example, "application/octet-stream").
      Returns:
      The media type, or null if not set.
    • getName

      public String getName()
      Gets the name of the resource.
      Returns:
      The resource name, or null if not set.
    • getUri

      public String getUri()
      Gets the URI identifying the resource.
      Returns:
      The resource URI, or null if not set.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • setAnnotations

      Sets additional key-value metadata about the resource.
      Parameters:
      annotations - The annotations map.
      Returns:
      this for chaining.
    • setContent

      public ResourceDescriptor setContent(byte[] content)
      Sets the raw contents of the resource.
      Parameters:
      content - The resource content.
      Returns:
      this for chaining.
    • setDigest

      Sets the map of cryptographic digest algorithms to their hex-encoded values.
      Parameters:
      digest - The digest map.
      Returns:
      this for chaining.
    • setDownloadLocation

      public ResourceDescriptor setDownloadLocation(String downloadLocation)
      Sets the download URI for the resource.
      Parameters:
      downloadLocation - The download location URI.
      Returns:
      this for chaining.
    • setMediaType

      Sets the media type of the resource.
      Parameters:
      mediaType - The media type.
      Returns:
      this for chaining.
    • setName

      Sets the name of the resource.
      Parameters:
      name - The resource name.
      Returns:
      this for chaining.
    • setUri

      Sets the URI identifying the resource.
      Parameters:
      uri - The resource URI.
      Returns:
      this for chaining.
    • toString

      public String toString()
      Overrides:
      toString in class Object