Package org.duracloud.storage.provider
Interface StorageProvider
-
- All Known Implementing Classes:
BrokeredStorageProvider,MockStorageProvider,ProbedStorageProvider,StorageProviderBase
public interface StorageProviderA Storage Provider provides services which allow content to be stored in and retrieved from spaces.- Author:
- Bill Branan
-
-
Field Summary
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringaddContent(String spaceId, String contentId, String contentMimeType, Map<String,String> userProperties, long contentSize, String contentChecksum, InputStream content)Adds content to a space.StringcopyContent(String sourceSpaceId, String sourceContentId, String destSpaceId, String destContentId)This method copies the content item found in source-space with the id of source-content-id into the dest-space, naming it to dest-content-id.voidcreateSpace(String spaceId)Creates a new space.voiddeleteContent(String spaceId, String contentId)Removes content from a space.voiddeleteSpace(String spaceId)Deletes a space.RetrievedContentgetContent(String spaceId, String contentId)Gets content from a space.RetrievedContentgetContent(String spaceId, String contentId, String range)Gets a range of bytes from a content item in a space.Map<String,String>getContentProperties(String spaceId, String contentId)Retrieves the properties associated with content.Map<String,AclType>getSpaceACLs(String spaceId)Retrieves the ACLs associated with a space.Iterator<String>getSpaceContents(String spaceId, String prefix)Provides access to the content files within a space.List<String>getSpaceContentsChunked(String spaceId, String prefix, long maxResults, String marker)Provides a listing of the content files within a space.Map<String,String>getSpaceProperties(String spaceId)Retrieves the properties associated with a space.Iterator<String>getSpaces()Provides a listing of all spaces owned by a customer.org.duracloud.storage.domain.StorageProviderTypegetStorageProviderType()Provides the type of storage provider being used.voidsetContentProperties(String spaceId, String contentId, Map<String,String> contentProperties)Sets the properties associated with content.voidsetSpaceACLs(String spaceId, Map<String,AclType> spaceACLs)Sets the ACLs associated with a space.
-
-
-
Field Detail
-
PROPERTIES_SPACE_CREATED
static final String PROPERTIES_SPACE_CREATED
- See Also:
- Constant Field Values
-
PROPERTIES_SPACE_COUNT
static final String PROPERTIES_SPACE_COUNT
- See Also:
- Constant Field Values
-
PROPERTIES_SPACE_SIZE
static final String PROPERTIES_SPACE_SIZE
- See Also:
- Constant Field Values
-
PROPERTIES_SPACE_ACL
static final String PROPERTIES_SPACE_ACL
- See Also:
- Constant Field Values
-
PROPERTIES_SPACE_ACL_GROUP
static final String PROPERTIES_SPACE_ACL_GROUP
- See Also:
- Constant Field Values
-
PROPERTIES_SPACE_ACL_PUBLIC
static final String PROPERTIES_SPACE_ACL_PUBLIC
- See Also:
- Constant Field Values
-
PROPERTIES_BUCKET
static final String PROPERTIES_BUCKET
- See Also:
- Constant Field Values
-
PROPERTIES_CONTENT_MIMETYPE
static final String PROPERTIES_CONTENT_MIMETYPE
- See Also:
- Constant Field Values
-
PROPERTIES_CONTENT_SIZE
static final String PROPERTIES_CONTENT_SIZE
- See Also:
- Constant Field Values
-
PROPERTIES_CONTENT_CHECKSUM
static final String PROPERTIES_CONTENT_CHECKSUM
- See Also:
- Constant Field Values
-
PROPERTIES_CONTENT_MODIFIED
static final String PROPERTIES_CONTENT_MODIFIED
- See Also:
- Constant Field Values
-
PROPERTIES_CONTENT_FILE_CREATED
static final String PROPERTIES_CONTENT_FILE_CREATED
- See Also:
- Constant Field Values
-
PROPERTIES_CONTENT_FILE_MODIFIED
static final String PROPERTIES_CONTENT_FILE_MODIFIED
- See Also:
- Constant Field Values
-
PROPERTIES_CONTENT_FILE_LAST_ACCESSED
static final String PROPERTIES_CONTENT_FILE_LAST_ACCESSED
- See Also:
- Constant Field Values
-
PROPERTIES_CONTENT_FILE_PATH
static final String PROPERTIES_CONTENT_FILE_PATH
- See Also:
- Constant Field Values
-
PROPERTIES_COPY_SOURCE
static final String PROPERTIES_COPY_SOURCE
- See Also:
- Constant Field Values
-
PROPERTIES_COPY_SOURCE_STORE
static final String PROPERTIES_COPY_SOURCE_STORE
- See Also:
- Constant Field Values
-
PROPERTIES_CONTENT_CREATOR
static final String PROPERTIES_CONTENT_CREATOR
- See Also:
- Constant Field Values
-
PROPERTIES_CONTENT_MD5
static final String PROPERTIES_CONTENT_MD5
- See Also:
- Constant Field Values
-
DEFAULT_MIMETYPE
static final String DEFAULT_MIMETYPE
- See Also:
- Constant Field Values
-
ISO8601_DATE_FORMAT
static final DateFormat ISO8601_DATE_FORMAT
-
DEFAULT_MAX_RESULTS
static final long DEFAULT_MAX_RESULTS
- See Also:
- Constant Field Values
-
PROPERTIES_HLS_STREAMING_HOST
static final String PROPERTIES_HLS_STREAMING_HOST
- See Also:
- Constant Field Values
-
PROPERTIES_HLS_STREAMING_TYPE
static final String PROPERTIES_HLS_STREAMING_TYPE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getStorageProviderType
org.duracloud.storage.domain.StorageProviderType getStorageProviderType()
Provides the type of storage provider being used.- Returns:
- StorageProviderType type of provider
-
getSpaces
Iterator<String> getSpaces()
Provides a listing of all spaces owned by a customer.- Returns:
- Iterator listing spaceIds
-
getSpaceContents
Iterator<String> getSpaceContents(String spaceId, String prefix)
Provides access to the content files within a space. Chunking of the list is handled internally. Prefix can be set to return only content IDs starting with the prefix value.- Parameters:
spaceId- - ID of the spaceprefix- - The prefix of the content id (null for no constraints)- Returns:
- Iterator of contentIds
- Throws:
NotFoundException- if space with ID spaceId does not existStorageException- if errors occur
-
getSpaceContentsChunked
List<String> getSpaceContentsChunked(String spaceId, String prefix, long maxResults, String marker)
Provides a listing of the content files within a space. The number of items returned is limited to maxResults (default is 1000). Retrieve further results by including the last content ID in the previous list as the marker. Set prefix to return only content IDs starting with the prefix value.- Parameters:
spaceId- - ID of the spaceprefix- - Only retrieve content IDs with this prefix (null for all content ids)maxResults- - The maximum number of content IDs to return in the list (0 indicates default (1000))marker- - The content ID marking the last item in the previous set (null indicates the first set of ids)- Returns:
- List of contentIds
- Throws:
NotFoundException- if space with ID spaceId does not existStorageException- if errors occur
-
createSpace
void createSpace(String spaceId)
Creates a new space. Depending on the storage implementation, the spaceId may be changed somewhat to comply with the naming rules of the underlying storage provider. The same spaceId value used here can be used in all other methods, as the conversion will be applied internally, however a call to getSpaces() may not include a space with exactly this same name.- Parameters:
spaceId- - ID of the space- Throws:
StorageException- if space with ID spaceId already exists
-
deleteSpace
void deleteSpace(String spaceId)
Deletes a space.- Parameters:
spaceId- - ID of the space- Throws:
NotFoundException- if space with ID spaceId does not existStorageException- if errors occur
-
getSpaceProperties
Map<String,String> getSpaceProperties(String spaceId)
Retrieves the properties associated with a space.- Parameters:
spaceId- - ID of the space- Returns:
- Map of space properties or empty map if no properties exists
- Throws:
NotFoundException- if space with ID spaceId does not existStorageException- if errors occur
-
getSpaceACLs
Map<String,AclType> getSpaceACLs(String spaceId)
Retrieves the ACLs associated with a space.- Parameters:
spaceId- - ID of the space- Returns:
- Map of space ACLs or empty map if none exists
- Throws:
NotFoundException- if space with ID spaceId does not existStorageException- if errors occur
-
setSpaceACLs
void setSpaceACLs(String spaceId, Map<String,AclType> spaceACLs)
Sets the ACLs associated with a space.- Parameters:
spaceId- - ID of the spacespaceACLs- - Updated space ACL. Note, null or empty arg spaceACLs will 'clear' the space ACLs.- Throws:
NotFoundException- if space with ID spaceId does not existStorageException- if errors occur
-
addContent
String addContent(String spaceId, String contentId, String contentMimeType, Map<String,String> userProperties, long contentSize, String contentChecksum, InputStream content)
Adds content to a space. Computes the checksum of the provided content and checks this against the checksum of the uploaded content to protect against loss or corruption during transfer.- Parameters:
spaceId- - ID of the spacecontentId- - ID of the content in the spacecontentMimeType- - the MIME type of the content being addeduserProperties- - the metadata associated with the contentcontentSize- - the file size (in bytes) of the content being addedcontentChecksum- - the MD5 checksum of the content being added (null if no checksum is known)content- - content to add- Returns:
- The checksum of the provided content
- Throws:
NotFoundException- if space with ID spaceId does not existStorageException- if errors occur
-
copyContent
String copyContent(String sourceSpaceId, String sourceContentId, String destSpaceId, String destContentId)
This method copies the content item found in source-space with the id of source-content-id into the dest-space, naming it to dest-content-id.- Parameters:
sourceSpaceId- of content to copysourceContentId- of content to copydestSpaceId- where copied content will end updestContentId- given to copied content- Returns:
- MD5 checksum of destination content item
-
getContent
RetrievedContent getContent(String spaceId, String contentId)
Gets content from a space.- Parameters:
spaceId- - ID of the spacecontentId- - ID of the content in the space- Returns:
- object containing metadata and the content stream
- Throws:
NotFoundException- if space with ID spaceId does not exist or the content item with ID contentId does not existStorageException- if errors occur
-
getContent
RetrievedContent getContent(String spaceId, String contentId, String range)
Gets a range of bytes from a content item in a space.- Parameters:
spaceId- - ID of the spacecontentId- - ID of the content in the spacerange- - Range of bytes to retrieve, as defined in: https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35, only one range is supported per request- Returns:
- object containing metadata and the specified bytes of the content stream
- Throws:
NotFoundException- if space with ID spaceId does not exist or the content item with ID contentId does not existIllegalArgumentException- if format of the range parameter is invalidStorageException- if errors occur
-
deleteContent
void deleteContent(String spaceId, String contentId)
Removes content from a space.- Parameters:
spaceId- - ID of the spacecontentId- - ID of the content in the space- Throws:
NotFoundException- if space with ID spaceId does not exist or the content item with ID contentId does not existStorageException- if errors occur
-
setContentProperties
void setContentProperties(String spaceId, String contentId, Map<String,String> contentProperties)
Sets the properties associated with content. This effectively removes all of the current content properties and adds a new set of properties. Some properties, such as system properties provided by the underlying storage system, cannot be updated or removed. Some of the values which cannot be updated or removed: Content-MD5 ETag Last-Modified Content-Type cannot be removed, but it can be updated- Parameters:
spaceId- - ID of the spacecontentId- - ID of the content in the spacecontentProperties- - new content properties- Throws:
NotFoundException- if space with ID spaceId does not exist or the content item with ID contentId does not existStorageException- if errors occur
-
getContentProperties
Map<String,String> getContentProperties(String spaceId, String contentId)
Retrieves the properties associated with content. This includes both properties generated by the underlying storage system as well as custom properties. Use the PROPERTIES_CONTENT_* constants to retrieve standard properties values.- Parameters:
spaceId- - ID of the spacecontentId- - ID of the content in the space- Returns:
- content properties
- Throws:
NotFoundException- if space with ID spaceId does not exist or the content item with ID contentId does not existStorageException- if errors occur
-
-