org.duracloud.client
Interface ContentStore

All Known Implementing Classes:
CachingContentStoreImpl, ContentStoreCache, ContentStoreImpl

public interface ContentStore

Provides access to a content store

Author:
Bill Branan

Nested Class Summary
static class ContentStore.AccessType
           
 
Field Summary
static java.lang.String CONTENT_CHECKSUM
          Basic content properties: MD5 checksum
static java.lang.String CONTENT_MIMETYPE
          Basic content properties: MIME type
static java.lang.String CONTENT_MODIFIED
          Basic content properties: Last modified date
static java.lang.String CONTENT_SIZE
          Basic content properties: Size
static java.lang.String SPACE_ACCESS
          Basic space properties: Space access (OPEN or CLOSED)
static java.lang.String SPACE_COUNT
          Basic space properties: Count of items in a space
static java.lang.String SPACE_CREATED
          Basic space properties: Created date
static java.lang.String SPACE_SIZE
          Basic space properties: Size of space
 
Method Summary
 java.lang.String addContent(java.lang.String spaceId, java.lang.String contentId, java.io.InputStream content, long contentSize, java.lang.String contentMimeType, java.lang.String contentChecksum, java.util.Map<java.lang.String,java.lang.String> contentProperties)
          Adds content to a space.
 java.lang.String copyContent(java.lang.String srcSpaceId, java.lang.String srcContentId, 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, java.util.Map<java.lang.String,java.lang.String> spaceProperties)
          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.lang.String getBaseURL()
          Gets the base URL pointing to the DuraCloud DuraStore REST API
 Content 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.
 Space getSpace(java.lang.String spaceId, java.lang.String prefix, long maxResults, java.lang.String marker)
          Provides a space, including the id and properties of the space as well as a limited list of the content items within a space.
 ContentStore.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)
          Retrieves the complete list of content items within a space.
 java.util.Iterator<java.lang.String> getSpaceContents(java.lang.String spaceId, java.lang.String prefix)
          Retrieves the complete list of content items 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.List<java.lang.String> getSpaces()
          Provides a listing of all spaces IDs.
 java.lang.String getStorageProviderType()
          Gets the storage provider type StorageProviderType
 java.lang.String getStoreId()
          Gets the ID of this content store
 java.util.List<java.lang.String> getSupportedTasks()
          Gets a listing of the supported tasks.
 java.lang.String moveContent(java.lang.String srcSpaceId, java.lang.String srcContentId, java.lang.String destSpaceId, java.lang.String destContentId)
          This method moves the content item found in source-space with the id of source-content-id into the dest-space, naming it to dest-content-id.
 java.lang.String performTask(java.lang.String taskName, java.lang.String taskParameters)
          Perform a task which is outside of the standard set of storage activites but is available through one or more storage providers.
 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, ContentStore.AccessType spaceAccess)
          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.
 void validateContentId(java.lang.String contentId)
          Checks a content ID to ensure that it conforms to all restrictions
 void validateSpaceId(java.lang.String spaceId)
          Checks a space ID to ensure that it conforms to all restrictions
 

Field Detail

SPACE_CREATED

static final java.lang.String SPACE_CREATED
Basic space properties: Created date

See Also:
Constant Field Values

SPACE_COUNT

static final java.lang.String SPACE_COUNT
Basic space properties: Count of items in a space

See Also:
Constant Field Values

SPACE_SIZE

static final java.lang.String SPACE_SIZE
Basic space properties: Size of space

See Also:
Constant Field Values

SPACE_ACCESS

static final java.lang.String SPACE_ACCESS
Basic space properties: Space access (OPEN or CLOSED)

See Also:
Constant Field Values

CONTENT_MIMETYPE

static final java.lang.String CONTENT_MIMETYPE
Basic content properties: MIME type

See Also:
Constant Field Values

CONTENT_SIZE

static final java.lang.String CONTENT_SIZE
Basic content properties: Size

See Also:
Constant Field Values

CONTENT_CHECKSUM

static final java.lang.String CONTENT_CHECKSUM
Basic content properties: MD5 checksum

See Also:
Constant Field Values

CONTENT_MODIFIED

static final java.lang.String CONTENT_MODIFIED
Basic content properties: Last modified date

See Also:
Constant Field Values
Method Detail

getBaseURL

java.lang.String getBaseURL()
Gets the base URL pointing to the DuraCloud DuraStore REST API


getStoreId

java.lang.String getStoreId()
Gets the ID of this content store


getStorageProviderType

java.lang.String getStorageProviderType()
Gets the storage provider type StorageProviderType


getSpaces

java.util.List<java.lang.String> getSpaces()
                                           throws ContentStoreException
Provides a listing of all spaces IDs.

Returns:
Iterator listing spaceIds
Throws:
ContentStoreException - if an error occurs

getSpaceContents

java.util.Iterator<java.lang.String> getSpaceContents(java.lang.String spaceId)
                                                      throws ContentStoreException
Retrieves the complete list of content items within a space. For spaces with many content items, the list is paged and updated automatically in order to retrieve the entire list. This method is equivalent to getSpaceContents(spaceId, null)

Parameters:
spaceId - the identifier of the DuraCloud Space
Returns:
Iterator for content IDs
Throws:
NotFoundException - if the space does not exist
ContentStoreException - if an error occurs

getSpaceContents

java.util.Iterator<java.lang.String> getSpaceContents(java.lang.String spaceId,
                                                      java.lang.String prefix)
                                                      throws ContentStoreException
Retrieves the complete list of content items within a space. For spaces with many content items, the list is paged and updated automatically in order to retrieve the entire list. Allows for limiting the content id list to items which start with a given prefix.

Parameters:
spaceId - the identifier of the DuraCloud Space
prefix - only retrieve content ids with this prefix (null for all content ids)
Returns:
Iterator for content IDs
Throws:
NotFoundException - if the space does not exist
ContentStoreException - if an error occurs

getSpace

Space getSpace(java.lang.String spaceId,
               java.lang.String prefix,
               long maxResults,
               java.lang.String marker)
               throws ContentStoreException
Provides a space, including the id and properties of the space as well as a limited list of the content items within a space. This call allows for manual paging of content IDs using the maxResults and marker parameters.

Parameters:
spaceId - the identifier of the DuraCloud 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 - which is 1000)
marker - the content id marking the last item in the previous set (null to specify first set of ids)
Returns:
Space
Throws:
NotFoundException - if the space does not exist
ContentStoreException - if an error occurs

createSpace

void createSpace(java.lang.String spaceId,
                 java.util.Map<java.lang.String,java.lang.String> spaceProperties)
                 throws ContentStoreException
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 - the identifier of the DuraCloud Space
spaceProperties - a map of properties entries for the space
Throws:
InvalidIdException - if the space ID is not valid
ContentStoreException - if the space already exists or cannot be created

deleteSpace

void deleteSpace(java.lang.String spaceId)
                 throws ContentStoreException
Deletes a space.

Parameters:
spaceId - the identifier of the DuraCloud Space
Throws:
NotFoundException - if the space does not exist
ContentStoreException - if an error occurs

getSpaceProperties

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

Parameters:
spaceId - the identifier of the DuraCloud Space
Returns:
Map of space properties or null if no properties exists
Throws:
NotFoundException - if the space does not exist
ContentStoreException - if an error occurs

setSpaceProperties

void setSpaceProperties(java.lang.String spaceId,
                        java.util.Map<java.lang.String,java.lang.String> spaceProperties)
                        throws ContentStoreException
Sets the properties associated with a space. Only values included in the properties map will be updated, others will remain unchanged.

Parameters:
spaceId - the identifier of the DuraCloud Space
spaceProperties - a map of properties entries for the space
Throws:
NotFoundException - if the space does not exist
ContentStoreException - if an error occurs

getSpaceAccess

ContentStore.AccessType getSpaceAccess(java.lang.String spaceId)
                                       throws ContentStoreException
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 - the identifier of the DuraCloud Space
Returns:
AccessType - OPEN or CLOSED
Throws:
NotFoundException - if the space does not exist
ContentStoreException - if an error occurs

setSpaceAccess

void setSpaceAccess(java.lang.String spaceId,
                    ContentStore.AccessType spaceAccess)
                    throws ContentStoreException
Sets the accessibility of a space to either OPEN or CLOSED.

Parameters:
spaceId - the identifier of the DuraCloud Space
spaceAccess - the access setting for this space - OPEN or CLOSED
Throws:
NotFoundException - if the space does not exist
ContentStoreException - if an error occurs

addContent

java.lang.String addContent(java.lang.String spaceId,
                            java.lang.String contentId,
                            java.io.InputStream content,
                            long contentSize,
                            java.lang.String contentMimeType,
                            java.lang.String contentChecksum,
                            java.util.Map<java.lang.String,java.lang.String> contentProperties)
                            throws ContentStoreException
Adds content to a space. The contentId of the new content item can include "/" symbols to indicate a folder heirarchy. Returns the checksum of the content as computed by the underlying storage provider to facilitate comparison

Parameters:
spaceId - the identifier of the DuraCloud Space
contentId - the identifier of the new content item
content - the new content as a stream
contentSize - the size of the content
contentMimeType - the MIME type of the content
contentChecksum - the MD5 checksum of the content, or null if the checksum is not known
contentProperties - a map of properties values to be linked to this content
Returns:
content checksum
Throws:
InvalidIdException - if the content ID is not valid
NotFoundException - if the space does not exist
ContentStoreException - if an error occurs

copyContent

java.lang.String copyContent(java.lang.String srcSpaceId,
                             java.lang.String srcContentId,
                             java.lang.String destSpaceId,
                             java.lang.String destContentId)
                             throws ContentStoreException
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:
srcSpaceId - of content to copy
srcContentId - of content to copy
destSpaceId - where copied content will end up
destContentId - given to copied content
Returns:
MD5 checksum of destination content item
Throws:
ContentStoreException - on error

moveContent

java.lang.String moveContent(java.lang.String srcSpaceId,
                             java.lang.String srcContentId,
                             java.lang.String destSpaceId,
                             java.lang.String destContentId)
                             throws ContentStoreException
This method moves 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:
srcSpaceId - of content to move
srcContentId - of content to move
destSpaceId - where moved content will end up
destContentId - given to moved content
Returns:
MD5 checksum of destination content item
Throws:
ContentStoreException - on error

getContent

Content getContent(java.lang.String spaceId,
                   java.lang.String contentId)
                   throws ContentStoreException
Gets content from a space.

Parameters:
spaceId - the identifier of the DuraCloud Space
contentId - the identifier of the content item
Returns:
the content stream
Throws:
NotFoundException - if the space or content does not exist
ContentStoreException - if an error occurs

deleteContent

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

Parameters:
spaceId - the identifier of the DuraCloud Space
contentId - the identifier of the content item
Throws:
NotFoundException - if the space or content does not exist
ContentStoreException - if an error occurs

setContentProperties

void setContentProperties(java.lang.String spaceId,
                          java.lang.String contentId,
                          java.util.Map<java.lang.String,java.lang.String> contentProperties)
                          throws ContentStoreException
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-checksum, content-modified, content-size

Parameters:
spaceId - the identifier of the DuraCloud Space
contentId - the identifier of the content item
contentProperties - a map of properties values to be linked to this content
Throws:
NotFoundException - if the space or content does not exist
ContentStoreException - if an error occurs

getContentProperties

java.util.Map<java.lang.String,java.lang.String> getContentProperties(java.lang.String spaceId,
                                                                      java.lang.String contentId)
                                                                      throws ContentStoreException
Retrieves the properties associated with content. This includes both properties generated by the underlying storage system and user defined properties

Parameters:
spaceId - the identifier of the DuraCloud Space
contentId - the identifier of the content item
Returns:
the map of properties values linked to the given contentId
Throws:
NotFoundException - if the space or content does not exist
ContentStoreException - if an error occurs

validateSpaceId

void validateSpaceId(java.lang.String spaceId)
                     throws InvalidIdException
Checks a space ID to ensure that it conforms to all restrictions

Parameters:
spaceId - ID to validate
Throws:
InvalidIdException - if the space ID is invalid

validateContentId

void validateContentId(java.lang.String contentId)
                       throws InvalidIdException
Checks a content ID to ensure that it conforms to all restrictions

Parameters:
contentId - ID to validate
Throws:
InvalidIdException - if the content ID is invalid

getSupportedTasks

java.util.List<java.lang.String> getSupportedTasks()
                                                   throws ContentStoreException
Gets a listing of the supported tasks. A task is an activity which is outside of the standard set of storage activites but is available through one or more storage providers.

Returns:
the return value of the task
Throws:
ContentStoreException

performTask

java.lang.String performTask(java.lang.String taskName,
                             java.lang.String taskParameters)
                             throws ContentStoreException
Perform a task which is outside of the standard set of storage activites but is available through one or more storage providers.

Parameters:
taskName - the name of the task to be performed
taskParameters - the parameters of the task, what is included here and how the information is formatted is task-specific
Returns:
the return value of the task
Throws:
ContentStoreException


Copyright © 2009-2011 DuraSpace. All Rights Reserved.