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 voidaddDownloadArtifact(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.voidaddUserAccess(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.StringcreateDownload(ResourceResolver resourceResolver)Creates and persists a new download, returning the ID of the newly generated item.java.lang.StringcreateDownload(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.DownloadProgressgetProgress(java.lang.String downloadId, ResourceResolver resourceResolver)Retrieves the current progress of a given download ID.voidpurgeDownload(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 DownloadExceptionAdds 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 DownloadExceptionPurges 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 DownloadExceptionAdds 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.
-
-