Package com.adobe.cq.dam.download.api
Interface DownloadStorageService
-
@ProviderType public interface DownloadStorageService
This service is responsible for persisting download information for aDownloadService
. 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
addUserAccess(java.lang.String downloadId, java.lang.String[] usernames, ResourceResolver resourceResolver)
Adds access to the download identified by the given downloadId for the usernames passedjava.lang.String
createDownload(ResourceResolver resourceResolver)
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.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.
-
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 inDownloadProgress
.- 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 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.
-
-