Package org.duracloud.storage.provider
Interface StorageProvider
- All Known Implementing Classes:
BrokeredStorageProvider,MockStorageProvider,ProbedStorageProvider,StorageProviderBase
public interface StorageProvider
A Storage Provider provides services which allow content to be
stored in and retrieved from spaces.
- Author:
- Bill Branan
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longstatic final Stringstatic final DateFormatstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Method Summary
Modifier and TypeMethodDescriptionaddContent(String spaceId, String contentId, String contentMimeType, Map<String, String> userProperties, long contentSize, String contentChecksum, InputStream content) Adds content to a space.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.voidcreateSpace(String spaceId) Creates a new space.voiddeleteContent(String spaceId, String contentId) Removes content from a space.voiddeleteSpace(String spaceId) Deletes a space.getContent(String spaceId, String contentId) Gets content from a space.getContent(String spaceId, String contentId, String range) Gets a range of bytes from a content item in a space.getContentProperties(String spaceId, String contentId) Retrieves the properties associated with content.getSpaceACLs(String spaceId) Retrieves the ACLs associated with a space.getSpaceContents(String spaceId, String prefix) Provides access to the content files within a space.getSpaceContentsChunked(String spaceId, String prefix, long maxResults, String marker) Provides a listing of the content files within a space.getSpaceProperties(String spaceId) Retrieves the properties associated with a space.Provides a listing of all spaces owned by a customer.org.duracloud.storage.domain.StorageProviderTypeProvides the type of storage provider being used.voidSets the properties associated with content.voidsetSpaceACLs(String spaceId, Map<String, AclType> spaceACLs) Sets the ACLs associated with a space.
-
Field Details
-
PROPERTIES_SPACE_CREATED
- See Also:
-
PROPERTIES_SPACE_COUNT
- See Also:
-
PROPERTIES_SPACE_SIZE
- See Also:
-
PROPERTIES_SPACE_ACL
- See Also:
-
PROPERTIES_SPACE_ACL_GROUP
- See Also:
-
PROPERTIES_SPACE_ACL_PUBLIC
- See Also:
-
PROPERTIES_BUCKET
- See Also:
-
PROPERTIES_CONTENT_MIMETYPE
- See Also:
-
PROPERTIES_CONTENT_SIZE
- See Also:
-
PROPERTIES_CONTENT_CHECKSUM
- See Also:
-
PROPERTIES_CONTENT_MODIFIED
- See Also:
-
PROPERTIES_CONTENT_FILE_CREATED
- See Also:
-
PROPERTIES_CONTENT_FILE_MODIFIED
- See Also:
-
PROPERTIES_CONTENT_FILE_LAST_ACCESSED
- See Also:
-
PROPERTIES_CONTENT_FILE_PATH
- See Also:
-
PROPERTIES_COPY_SOURCE
- See Also:
-
PROPERTIES_COPY_SOURCE_STORE
- See Also:
-
PROPERTIES_CONTENT_CREATOR
- See Also:
-
PROPERTIES_CONTENT_MD5
- See Also:
-
DEFAULT_MIMETYPE
- See Also:
-
ISO8601_DATE_FORMAT
-
DEFAULT_MAX_RESULTS
static final long DEFAULT_MAX_RESULTS- See Also:
-
PROPERTIES_HLS_STREAMING_HOST
- See Also:
-
PROPERTIES_HLS_STREAMING_TYPE
- See Also:
-
-
Method Details
-
getStorageProviderType
org.duracloud.storage.domain.StorageProviderType getStorageProviderType()Provides the type of storage provider being used.- Returns:
- StorageProviderType type of provider
-
getSpaces
Provides a listing of all spaces owned by a customer.- Returns:
- Iterator listing spaceIds
-
getSpaceContents
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
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
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
Deletes a space.- Parameters:
spaceId- - ID of the space- Throws:
NotFoundException- if space with ID spaceId does not existStorageException- if errors occur
-
getSpaceProperties
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
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
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
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
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
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
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
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
-