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 Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addDownloadArtifact​(java.lang.String downloadId, java.lang.String artifactName, java.lang.String asyncJobId, java.util.Collection<DownloadFile> files, ResourceResolver resolver)
      Adds an artifact to an existing download.
      void addParameters​(java.lang.String downloadId, java.util.Map<java.lang.String,​java.lang.Object> parameters, ResourceResolver resourceResolver)
      Add the passed parameters to the passed download
      void addUserAccess​(java.lang.String downloadId, java.lang.String[] usernames, ResourceResolver resourceResolver)
      Adds access to the download identified by the given downloadId for the user names passed
      void completePostProcessing​(java.lang.String downloadId, java.lang.String artifactId)
      Complete an archive which has been sent for post processing.
      void completePostProcessing​(java.lang.String downloadId, java.lang.String artifactId, java.net.URI binaryURL)
      Complete an archive which has been sent for post processing, overriding download url with the value provided.
      java.lang.String createDownload​(ResourceResolver resourceResolver)
      Creates and persists a new download, returning the ID of the newly generated item.
      java.lang.String createDownload​(ResourceResolver resourceResolver, java.util.Map<java.lang.String,​java.lang.Object> parameters)
      Creates and persists a new download, returning the ID of the newly generated item.
      java.util.Collection<java.lang.String> getDownloadIds​(ResourceResolver resourceResolver)
      Retrieves all download IDs available to a given user.
      java.util.Map<java.lang.String,​java.lang.Object> getParameters​(java.lang.String downloadId, ResourceResolver resourceResolver)
      Get the parameters of the passed download
      DownloadProgress getProgress​(java.lang.String downloadId, ResourceResolver resourceResolver)
      Retrieves the current progress of a given download ID.
      void purgeDownload​(java.lang.String downloadId, ResourceResolver resourceResolver)
      Purges the download identified by the given download ID (assuming the current user has permissions to do so)
    • Method Detail

      • createDownload

        java.lang.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

        java.lang.String createDownload​(ResourceResolver resourceResolver,
                                        java.util.Map<java.lang.String,​java.lang.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​(java.lang.String downloadId,
                                 java.lang.String artifactName,
                                 java.lang.String asyncJobId,
                                 java.util.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​(java.lang.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

        java.util.Collection<java.lang.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​(java.lang.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​(java.lang.String downloadId,
                           java.lang.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​(java.lang.String downloadId,
                           java.util.Map<java.lang.String,​java.lang.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

        java.util.Map<java.lang.String,​java.lang.Object> getParameters​(java.lang.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​(java.lang.String downloadId,
                                    java.lang.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​(java.lang.String downloadId,
                                    java.lang.String artifactId,
                                    java.net.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