Interface DownloadStorageService


@ProviderType public interface DownloadStorageService
This service is responsible for persisting download information for a DownloadService. Provides the ability of creating a new download, as well as retrieving information for existing downloads.
  • Method Details

    • createDownload

      String createDownload(ResourceResolver resourceResolver) throws DownloadException
      Creates and persists a new download, returning the ID of the newly generated item.
      Parameters:
      resourceResolver - Used to persist data and determine the current user.
      Returns:
      The ID of the new download.
      Throws:
      DownloadException - Thrown if there are issues creating the download.
    • createDownload

      String createDownload(ResourceResolver resourceResolver, Map<String,Object> parameters) throws DownloadException
      Creates and persists a new download, returning the ID of the newly generated item.
      Parameters:
      resourceResolver - Used to persist data and determine the current user.
      parameters - to apply to download process
      Returns:
      The ID of the new download.
      Throws:
      DownloadException - Thrown if there are issues creating the download.
    • addDownloadArtifact

      void addDownloadArtifact(String downloadId, String artifactName, String asyncJobId, Collection<DownloadFile> files, ResourceResolver resolver) throws DownloadException
      Adds an artifact to an existing download. The artifact is the final item that will be returned as one of the service's download URIs, as specified in DownloadProgress.
      Parameters:
      downloadId - The download to which the new artifact should be added.
      artifactName - The name of the artifact that will be added.
      asyncJobId - The ID of the job that is generating this specific artifact. Can be used to identify this particular artifact within the download.
      files - List of all of the files that will be included in the artifact.
      resolver - Used to interact with the repository.
      Throws:
      DownloadException - Thrown if there are issues peristing the data.
    • getProgress

      DownloadProgress getProgress(String downloadId, ResourceResolver resourceResolver) throws DownloadException
      Retrieves the current progress of a given download ID.
      Parameters:
      downloadId - The ID of the download whose status should be retrieved.
      resourceResolver - Used to retrieve download information.
      Returns:
      Progress of a current download.
      Throws:
      DownloadException - Thrown if there are issues retrieving data.
    • getDownloadIds

      Collection<String> getDownloadIds(ResourceResolver resourceResolver) throws DownloadException
      Retrieves all download IDs available to a given user.
      Parameters:
      resourceResolver - User information will be used to retrieve data.
      Returns:
      List of download IDs.
      Throws:
      DownloadException - Thrown if there are issues retrieving the IDs.
    • purgeDownload

      void purgeDownload(String downloadId, ResourceResolver resourceResolver) throws DownloadException
      Purges the download identified by the given download ID (assuming the current user has permissions to do so)
      Parameters:
      downloadId - The ID of the download whose status should be purged.
      resourceResolver - Used to retrieve download information.
      Throws:
      DownloadException - Thrown if there are issues purging data.
    • addUserAccess

      void addUserAccess(String downloadId, String[] usernames, ResourceResolver resourceResolver) throws DownloadException
      Adds access to the download identified by the given downloadId for the user names passed
      Parameters:
      downloadId - The ID of the download whose permissions should be extended.
      usernames - Users that will be granted access to the download.
      resourceResolver - Used to retrieve download information.
      Throws:
      DownloadException - Thrown if there are issues modifying permissions.
    • addParameters

      void addParameters(String downloadId, Map<String,Object> parameters, ResourceResolver resourceResolver) throws DownloadException
      Add the passed parameters to the passed download
      Parameters:
      downloadId - The ID of the download to which the parameters should be added.
      parameters - The parameters to add; note, only supported parameters will be added.
      resourceResolver - Used to retrieve download information.
      Throws:
      DownloadException - Thrown if there are issues modifying parameters.
    • getParameters

      Map<String,Object> getParameters(String downloadId, ResourceResolver resourceResolver) throws DownloadException
      Get the parameters of the passed download
      Parameters:
      downloadId - The ID of the download to which the parameters should be returned.
      resourceResolver - Used to retrieve download information.
      Returns:
      A map of the parameters
      Throws:
      DownloadException - Thrown if there are issues reading parameters.
    • completePostProcessing

      void completePostProcessing(String downloadId, String artifactId) throws DownloadException
      Complete an archive which has been sent for post processing. This will trigger notifications containing the download url (unless notifications are suppressed).
      Parameters:
      downloadId - The ID of the download to complete.
      artifactId - The ID of the artifact (within the download) to complete.
      Throws:
      DownloadException - Thrown if there are issues completing the post-processing stage
    • completePostProcessing

      void completePostProcessing(String downloadId, String artifactId, URI binaryURL) throws DownloadException
      Complete an archive which has been sent for post processing, overriding download url with the value provided. This will trigger notifications with the updated download url (unless notifications are suppressed).
      Parameters:
      downloadId - The ID of the download to complete.
      artifactId - The ID of the artifact (within the download) to complete.
      binaryURL - A URI representing the download url to use in-preference to the current artifact download link
      Throws:
      DownloadException - Thrown if there are issues completing the post-processing stage