public class ContentStoreImpl extends Object implements ContentStore
Modifier and Type | Class and Description |
---|---|
protected static interface |
ContentStoreImpl.Retryable
An interface which defines a single method which will be retried on error
|
CONTENT_CHECKSUM, CONTENT_FILE_ACCESSED, CONTENT_FILE_CREATED, CONTENT_FILE_MODIFIED, CONTENT_MIMETYPE, CONTENT_MODIFIED, CONTENT_SIZE, SPACE_COUNT, SPACE_CREATED, SPACE_SIZE, STREAMING_HOST
Constructor and Description |
---|
ContentStoreImpl(String baseURL,
org.duracloud.storage.domain.StorageProviderType type,
String storeId,
org.duracloud.common.web.RestHttpHelper restHelper)
Creates a ContentStore.
|
ContentStoreImpl(String baseURL,
org.duracloud.storage.domain.StorageProviderType type,
String storeId,
org.duracloud.common.web.RestHttpHelper restHelper,
int maxRetries)
Creates a ContentStore with a specific number of retries.
|
Modifier and Type | Method and Description |
---|---|
String |
addContent(String spaceId,
String contentId,
InputStream content,
long contentSize,
String contentMimeType,
String contentChecksum,
Map<String,String> contentProperties)
Adds content to a space.
|
String |
copyContent(String srcSpaceId,
String srcContentId,
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.
|
String |
copyContent(String srcSpaceId,
String srcContentId,
String destStoreId,
String destSpaceId,
String destContentId)
This method provides a way to copy a content item to another content provider.
|
void |
createSpace(String spaceId)
Creates a new space.
|
void |
deleteContent(String spaceId,
String contentId)
Removes content from a space.
|
void |
deleteSpace(String spaceId)
Deletes a space.
|
protected <T> T |
execute(ContentStoreImpl.Retryable retryable)
Provides a way to execute a variety of methods and allow a retry to
occur on method failure.
|
String |
getBaseURL()
Gets the base URL pointing to the DuraCloud DuraStore REST API
|
Content |
getContent(String spaceId,
String contentId)
Gets content from a space.
|
Map<String,String> |
getContentProperties(String spaceId,
String contentId)
Retrieves the properties associated with content.
|
Space |
getSpace(String spaceId,
String prefix,
long maxResults,
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.
|
Map<String,org.duracloud.common.model.AclType> |
getSpaceACLs(String spaceId)
Retrieves the ACLs associated with a space.
|
Iterator<String> |
getSpaceContents(String spaceId)
Retrieves the complete list of content items within a space.
|
Iterator<String> |
getSpaceContents(String spaceId,
String prefix)
Retrieves the complete list of content items within a space.
|
Map<String,String> |
getSpaceProperties(String spaceId)
Retrieves the properties associated with a space.
|
List<String> |
getSpaces()
Provides a listing of all spaces IDs.
|
String |
getStorageProviderType()
Gets the storage provider type
StorageProviderType |
String |
getStoreId()
Gets the ID of this content store
|
List<String> |
getSupportedTasks()
Gets a listing of the supported tasks.
|
String |
moveContent(String srcSpaceId,
String srcContentId,
String destSpaceId,
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.
|
String |
moveContent(String srcSpaceId,
String srcContentId,
String destStoreId,
String destSpaceId,
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.
|
String |
performTask(String taskName,
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(String spaceId,
String contentId,
Map<String,String> contentProperties)
Sets the properties associated with content.
|
void |
setSpaceACLs(String spaceId,
Map<String,org.duracloud.common.model.AclType> spaceACLs)
Sets the ACLs associated with a space.
|
void |
validateContentId(String contentId)
Checks a content ID to ensure that it conforms to all restrictions
|
void |
validateSpaceId(String spaceId)
Checks a space ID to ensure that it conforms to all restrictions
|
void |
validateStoreId(String storeId) |
public ContentStoreImpl(String baseURL, org.duracloud.storage.domain.StorageProviderType type, String storeId, org.duracloud.common.web.RestHttpHelper restHelper)
public String getBaseURL()
ContentStore
getBaseURL
in interface ContentStore
public String getStoreId()
getStoreId
in interface ContentStore
public String getStorageProviderType()
StorageProviderType
getStorageProviderType
in interface ContentStore
protected <T> T execute(ContentStoreImpl.Retryable retryable) throws ContentStoreException
retryable
- ContentStoreException
public List<String> getSpaces() throws ContentStoreException
getSpaces
in interface ContentStore
ContentStoreException
- if an error occurspublic Iterator<String> getSpaceContents(String spaceId) throws ContentStoreException
getSpaceContents
in interface ContentStore
spaceId
- the identifier of the DuraCloud SpaceNotFoundException
- if the space does not existContentStoreException
- if an error occurspublic Iterator<String> getSpaceContents(String spaceId, String prefix) throws ContentStoreException
getSpaceContents
in interface ContentStore
spaceId
- the identifier of the DuraCloud Spaceprefix
- only retrieve content ids with this prefix (null for all content ids)NotFoundException
- if the space does not existContentStoreException
- if an error occurspublic Space getSpace(String spaceId, String prefix, long maxResults, String marker) throws ContentStoreException
getSpace
in interface ContentStore
spaceId
- the identifier of the DuraCloud 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 - which is 1000)marker
- the content id marking the last item in the previous set (null to specify first set of ids)NotFoundException
- if the space does not existContentStoreException
- if an error occurspublic void createSpace(String spaceId) throws ContentStoreException
createSpace
in interface ContentStore
spaceId
- the identifier of the DuraCloud SpaceInvalidIdException
- if the space ID is not validContentStoreException
- if the space already exists or cannot be createdpublic void deleteSpace(String spaceId) throws ContentStoreException
deleteSpace
in interface ContentStore
spaceId
- the identifier of the DuraCloud SpaceNotFoundException
- if the space does not existContentStoreException
- if an error occurspublic Map<String,String> getSpaceProperties(String spaceId) throws ContentStoreException
getSpaceProperties
in interface ContentStore
spaceId
- the identifier of the DuraCloud SpaceNotFoundException
- if the space does not existContentStoreException
- if an error occurspublic Map<String,org.duracloud.common.model.AclType> getSpaceACLs(String spaceId) throws ContentStoreException
getSpaceACLs
in interface ContentStore
spaceId
- the identifier of the DuraCloud SpaceNotFoundException
- if the space does not existContentStoreException
- if an error occurspublic void setSpaceACLs(String spaceId, Map<String,org.duracloud.common.model.AclType> spaceACLs) throws ContentStoreException
setSpaceACLs
in interface ContentStore
spaceId
- the identifier of the DuraCloud SpacespaceACLs
- a map of ACL entries for the space (user|group -> right)NotFoundException
- if the space does not existContentStoreException
- if an error occurspublic String addContent(String spaceId, String contentId, InputStream content, long contentSize, String contentMimeType, String contentChecksum, Map<String,String> contentProperties) throws ContentStoreException
addContent
in interface ContentStore
spaceId
- the identifier of the DuraCloud SpacecontentId
- the identifier of the new content itemcontent
- the new content as a streamcontentSize
- the size of the contentcontentMimeType
- the MIME type of the contentcontentChecksum
- the MD5 checksum of the content, or null if the checksum is not knowncontentProperties
- a map of properties values to be linked to this contentInvalidIdException
- if the content ID is not validNotFoundException
- if the space does not existContentStoreException
- if an error occurspublic String copyContent(String srcSpaceId, String srcContentId, String destStoreId, String destSpaceId, String destContentId) throws ContentStoreException
copyContent
in interface ContentStore
srcSpaceId
- of content to copysrcContentId
- of content to copydestStoreId
- where the copied content will end updestSpaceId
- where copied content will end updestContentId
- given to copied contentContentStoreException
- on errorpublic String copyContent(String srcSpaceId, String srcContentId, String destSpaceId, String destContentId) throws ContentStoreException
copyContent
in interface ContentStore
srcSpaceId
- of content to copysrcContentId
- of content to copydestSpaceId
- where copied content will end updestContentId
- given to copied contentContentStoreException
- on errorpublic String moveContent(String srcSpaceId, String srcContentId, String destSpaceId, String destContentId) throws ContentStoreException
moveContent
in interface ContentStore
srcSpaceId
- of content to movesrcContentId
- of content to movedestSpaceId
- where moved content will end updestContentId
- given to moved contentContentStoreException
- on errorpublic String moveContent(String srcSpaceId, String srcContentId, String destStoreId, String destSpaceId, String destContentId) throws ContentStoreException
moveContent
in interface ContentStore
srcSpaceId
- of content to movesrcContentId
- of content to movedestStoreId
- where moved content will end updestSpaceId
- where moved content will end updestContentId
- given to moved contentContentStoreException
- on errorpublic Content getContent(String spaceId, String contentId) throws ContentStoreException
getContent
in interface ContentStore
spaceId
- the identifier of the DuraCloud SpacecontentId
- the identifier of the content itemNotFoundException
- if the space or content does not existContentStoreException
- if an error occurspublic void deleteContent(String spaceId, String contentId) throws ContentStoreException
deleteContent
in interface ContentStore
spaceId
- the identifier of the DuraCloud SpacecontentId
- the identifier of the content itemNotFoundException
- if the space or content does not existContentStoreException
- if an error occurspublic void setContentProperties(String spaceId, String contentId, Map<String,String> contentProperties) throws ContentStoreException
setContentProperties
in interface ContentStore
spaceId
- the identifier of the DuraCloud SpacecontentId
- the identifier of the content itemcontentProperties
- a map of properties values to be linked to this contentNotFoundException
- if the space or content does not existContentStoreException
- if an error occurspublic Map<String,String> getContentProperties(String spaceId, String contentId) throws ContentStoreException
getContentProperties
in interface ContentStore
spaceId
- the identifier of the DuraCloud SpacecontentId
- the identifier of the content itemNotFoundException
- if the space or content does not existContentStoreException
- if an error occurspublic void validateStoreId(String storeId) throws InvalidIdException
InvalidIdException
public void validateSpaceId(String spaceId) throws InvalidIdException
validateSpaceId
in interface ContentStore
spaceId
- ID to validateInvalidIdException
- if the space ID is invalidpublic void validateContentId(String contentId) throws InvalidIdException
validateContentId
in interface ContentStore
contentId
- ID to validateInvalidIdException
- if the content ID is invalidpublic List<String> getSupportedTasks() throws ContentStoreException
getSupportedTasks
in interface ContentStore
ContentStoreException
public String performTask(String taskName, String taskParameters) throws ContentStoreException
performTask
in interface ContentStore
taskName
- the name of the task to be performedtaskParameters
- the parameters of the task, what is included here
and how the information is formatted is
task-specificContentStoreException
Copyright © 2009–2014 DuraSpace. All rights reserved.