org.duracloud.storage.provider
Interface StorageProvider

All Known Implementing Classes:
AzureStorageProvider, BrokeredStorageProvider, EMCStorageProvider, IrodsStorageProvider, MockRetryStorageProvider, MockStorageProvider, MockVerifyCreateStorageProvider, MockVerifyDeleteStorageProvider, ProbedStorageProvider, RackspaceStorageProvider, S3StorageProvider, SDSCStorageProvider, StorageProviderBase

public interface StorageProvider

A Storage Provider provides services which allow content to be stored in and retrieved from spaces.

Author:
Bill Branan

Nested Class Summary
static class StorageProvider.AccessType
           
 
Field Summary
static long DEFAULT_MAX_RESULTS
           
static java.lang.String DEFAULT_MIMETYPE
           
static java.lang.String PROPERTIES_CONTENT_CHECKSUM
           
static java.lang.String PROPERTIES_CONTENT_MD5
           
static java.lang.String PROPERTIES_CONTENT_MIMETYPE
           
static java.lang.String PROPERTIES_CONTENT_MODIFIED
           
static java.lang.String PROPERTIES_CONTENT_SIZE
           
static java.lang.String PROPERTIES_COPY_SOURCE
           
static java.lang.String PROPERTIES_SPACE_ACCESS
           
static java.lang.String PROPERTIES_SPACE_COUNT
           
static java.lang.String PROPERTIES_SPACE_CREATED
           
static java.lang.String PROPERTIES_SPACE_SIZE
           
static java.text.DateFormat RFC822_DATE_FORMAT
           
static java.lang.String SPACE_PROPERTIES_SUFFIX
           
 
Method Summary
 java.lang.String addContent(java.lang.String spaceId, java.lang.String contentId, java.lang.String contentMimeType, long contentSize, java.lang.String contentChecksum, java.io.InputStream content)
          Adds content to a space.
 java.lang.String copyContent(java.lang.String sourceSpaceId, java.lang.String sourceContentId, java.lang.String destSpaceId, java.lang.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.
 void createSpace(java.lang.String spaceId)
          Creates a new space.
 void deleteContent(java.lang.String spaceId, java.lang.String contentId)
          Removes content from a space.
 void deleteSpace(java.lang.String spaceId)
          Deletes a space.
 java.io.InputStream getContent(java.lang.String spaceId, java.lang.String contentId)
          Gets content from a space.
 java.util.Map<java.lang.String,java.lang.String> getContentProperties(java.lang.String spaceId, java.lang.String contentId)
          Retrieves the properties associated with content.
 StorageProvider.AccessType getSpaceAccess(java.lang.String spaceId)
          Gets the access setting of the space, either OPEN or CLOSED.
 java.util.Iterator<java.lang.String> getSpaceContents(java.lang.String spaceId, java.lang.String prefix)
          Provides access to the content files within a space.
 java.util.List<java.lang.String> getSpaceContentsChunked(java.lang.String spaceId, java.lang.String prefix, long maxResults, java.lang.String marker)
          Provides a listing of the content files within a space.
 java.util.Map<java.lang.String,java.lang.String> getSpaceProperties(java.lang.String spaceId)
          Retrieves the properties associated with a space.
 java.util.Iterator<java.lang.String> getSpaces()
          Provides a listing of all spaces owned by a customer.
 void setContentProperties(java.lang.String spaceId, java.lang.String contentId, java.util.Map<java.lang.String,java.lang.String> contentProperties)
          Sets the properties associated with content.
 void setSpaceAccess(java.lang.String spaceId, StorageProvider.AccessType access)
          Sets the accessibility of a space to either OPEN or CLOSED.
 void setSpaceProperties(java.lang.String spaceId, java.util.Map<java.lang.String,java.lang.String> spaceProperties)
          Sets the properties associated with a space.
 

Field Detail

PROPERTIES_SPACE_CREATED

static final java.lang.String PROPERTIES_SPACE_CREATED
See Also:
Constant Field Values

PROPERTIES_SPACE_COUNT

static final java.lang.String PROPERTIES_SPACE_COUNT
See Also:
Constant Field Values

PROPERTIES_SPACE_SIZE

static final java.lang.String PROPERTIES_SPACE_SIZE
See Also:
Constant Field Values

PROPERTIES_SPACE_ACCESS

static final java.lang.String PROPERTIES_SPACE_ACCESS
See Also:
Constant Field Values

PROPERTIES_CONTENT_MIMETYPE

static final java.lang.String PROPERTIES_CONTENT_MIMETYPE
See Also:
Constant Field Values

PROPERTIES_CONTENT_SIZE

static final java.lang.String PROPERTIES_CONTENT_SIZE
See Also:
Constant Field Values

PROPERTIES_CONTENT_CHECKSUM

static final java.lang.String PROPERTIES_CONTENT_CHECKSUM
See Also:
Constant Field Values

PROPERTIES_CONTENT_MODIFIED

static final java.lang.String PROPERTIES_CONTENT_MODIFIED
See Also:
Constant Field Values

PROPERTIES_COPY_SOURCE

static final java.lang.String PROPERTIES_COPY_SOURCE
See Also:
Constant Field Values

PROPERTIES_CONTENT_MD5

static final java.lang.String PROPERTIES_CONTENT_MD5
See Also:
Constant Field Values

SPACE_PROPERTIES_SUFFIX

static final java.lang.String SPACE_PROPERTIES_SUFFIX
See Also:
Constant Field Values

DEFAULT_MIMETYPE

static final java.lang.String DEFAULT_MIMETYPE
See Also:
Constant Field Values

RFC822_DATE_FORMAT

static final java.text.DateFormat RFC822_DATE_FORMAT

DEFAULT_MAX_RESULTS

static final long DEFAULT_MAX_RESULTS
See Also:
Constant Field Values
Method Detail

getSpaces

java.util.Iterator<java.lang.String> getSpaces()
Provides a listing of all spaces owned by a customer.

Returns:
Iterator listing spaceIds

getSpaceContents

java.util.Iterator<java.lang.String> getSpaceContents(java.lang.String spaceId,
                                                      java.lang.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 space
prefix - - The prefix of the content id (null for no constraints)
Returns:
Iterator of contentIds
Throws:
NotFoundException - if space with ID spaceId does not exist
StorageException - if errors occur

getSpaceContentsChunked

java.util.List<java.lang.String> getSpaceContentsChunked(java.lang.String spaceId,
                                                         java.lang.String prefix,
                                                         long maxResults,
                                                         java.lang.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 space
prefix - - 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 exist
StorageException - if errors occur

createSpace

void createSpace(java.lang.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(java.lang.String spaceId)
Deletes a space.

Parameters:
spaceId - - ID of the space
Throws:
NotFoundException - if space with ID spaceId does not exist
StorageException - if errors occur

getSpaceProperties

java.util.Map<java.lang.String,java.lang.String> getSpaceProperties(java.lang.String spaceId)
Retrieves the properties associated with a space.

Parameters:
spaceId - - ID of the space
Returns:
Map of space properties or null if no properties exists
Throws:
NotFoundException - if space with ID spaceId does not exist
StorageException - if errors occur

setSpaceProperties

void setSpaceProperties(java.lang.String spaceId,
                        java.util.Map<java.lang.String,java.lang.String> spaceProperties)
Sets the properties associated with a space.

Parameters:
spaceId - - ID of the space
spaceProperties - - Updated space properties
Throws:
NotFoundException - if space with ID spaceId does not exist
StorageException - if errors occur

getSpaceAccess

StorageProvider.AccessType getSpaceAccess(java.lang.String spaceId)
Gets the access setting of the space, either OPEN or CLOSED. An OPEN space is available for public viewing. A CLOSED space requires authentication prior to viewing any of the contents.

Parameters:
spaceId - - ID of the space
Returns:
the access type of the space, OPEN or CLOSED
Throws:
NotFoundException - if space with ID spaceId does not exist
StorageException - if errors occur

setSpaceAccess

void setSpaceAccess(java.lang.String spaceId,
                    StorageProvider.AccessType access)
Sets the accessibility of a space to either OPEN or CLOSED.

Parameters:
spaceId - - ID of the space
access - - New space access value
Throws:
NotFoundException - if space with ID spaceId does not exist
StorageException - if errors occur

addContent

java.lang.String addContent(java.lang.String spaceId,
                            java.lang.String contentId,
                            java.lang.String contentMimeType,
                            long contentSize,
                            java.lang.String contentChecksum,
                            java.io.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 space
contentId - - ID of the content in the space
contentMimeType - - the MIME type of the content being added
contentSize - - the file size (in bytes) of the content being added
contentChecksum - - 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 exist
StorageException - if errors occur

copyContent

java.lang.String copyContent(java.lang.String sourceSpaceId,
                             java.lang.String sourceContentId,
                             java.lang.String destSpaceId,
                             java.lang.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 copy
sourceContentId - of content to copy
destSpaceId - where copied content will end up
destContentId - given to copied content
Returns:
MD5 checksum of destination content item

getContent

java.io.InputStream getContent(java.lang.String spaceId,
                               java.lang.String contentId)
Gets content from a space.

Parameters:
spaceId - - ID of the space
contentId - - ID of the content in the space
Returns:
the content stream
Throws:
NotFoundException - if space with ID spaceId does not exist or the content item with ID contentId does not exist
StorageException - if errors occur

deleteContent

void deleteContent(java.lang.String spaceId,
                   java.lang.String contentId)
Removes content from a space.

Parameters:
spaceId - - ID of the space
contentId - - 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 exist
StorageException - if errors occur

setContentProperties

void setContentProperties(java.lang.String spaceId,
                          java.lang.String contentId,
                          java.util.Map<java.lang.String,java.lang.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 space
contentId - - ID of the content in the space
contentProperties - - new content properties
Throws:
NotFoundException - if space with ID spaceId does not exist or the content item with ID contentId does not exist
StorageException - if errors occur

getContentProperties

java.util.Map<java.lang.String,java.lang.String> getContentProperties(java.lang.String spaceId,
                                                                      java.lang.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 space
contentId - - 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 exist
StorageException - if errors occur


Copyright © 2009-2011 DuraSpace. All Rights Reserved.