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 Detail

      • 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 usernames 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 modidying 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.
        Throws:
        DownloadException - Thrown if there are issues reading parameters.