Interface ArtifactStorage

All Known Implementing Classes:
AbstractArtifactStorage

public interface ArtifactStorage
Artifact Store service interface.
  • Method Details

    • store

      StoredArtifactInfo store(@NotEmpty @NotEmpty String tenant, @NotNull @NotNull InputStream content, @NotEmpty @NotEmpty String filename, String contentType, ArtifactHashes hash)
      Stores an artifact into the repository.
      Parameters:
      tenant - the tenant to store the artifact
      content - the content to store
      filename - the filename of the artifact
      contentType - the content type of the artifact
      hash - the hashes of the artifact to do hash-checks after storing the artifact, might be null
      Returns:
      the stored artifact
      Throws:
      UnsupportedOperationException - if implementation does not support the operation
      ArtifactStoreException - in case storing of the artifact was not successful
      HashNotMatchException - in case hash is provided and not matching to the calculated hashes during storing
    • getBySha1

      InputStream getBySha1(@NotEmpty @NotEmpty String tenant, @NotEmpty @NotEmpty String sha1Hash)
      Retrieves a StoredArtifactInfo from the store by its SHA1 hash. Throws ArtifactBinaryNotFoundException if not found. The caller is responsible to close the InputStream.
      Parameters:
      tenant - the tenant to store the artifact
      sha1Hash - the sha1-hash of the file to lookup.
      Returns:
      The artifact file object or null if no file exists.
      Throws:
      UnsupportedOperationException - if implementation does not support the operation
    • existsBySha1

      boolean existsBySha1(@NotEmpty @NotEmpty String tenant, @NotEmpty @NotEmpty String sha1Hash)
      Checks if an artifact exists for a given tenant by its sha1 hash
      Parameters:
      tenant - the tenant
      sha1Hash - the sha1-hash of the file to lookup.
      Returns:
      the boolean whether the artifact exists or not
    • deleteBySha1

      void deleteBySha1(@NotEmpty @NotEmpty String tenant, @NotEmpty @NotEmpty String sha1Hash)
      Deletes an artifact by its SHA1 hash.
      Parameters:
      tenant - the tenant to store the artifact
      sha1Hash - the sha1-hash of the artifact to delete
      Throws:
      UnsupportedOperationException - if implementation does not support the operation
    • deleteByTenant

      void deleteByTenant(@NotEmpty @NotEmpty String tenant)
      Deletes all artifacts of given tenant.
      Parameters:
      tenant - to erase