Package org.duracloud.client
Interface ContentStore
-
- All Known Implementing Classes:
CachingContentStoreImpl,ContentStoreImpl
public interface ContentStoreProvides access to a content store- Author:
- Bill Branan
-
-
Field Summary
Fields Modifier and Type Field Description static StringCONTENT_CHECKSUMBasic content properties: MD5 checksumstatic StringCONTENT_FILE_ACCESSEDOriginal content file properties: Last accessed datestatic StringCONTENT_FILE_CREATEDOriginal content file properties: Creation datestatic StringCONTENT_FILE_MODIFIEDOriginal content file properties: Last modified datestatic StringCONTENT_MIMETYPEBasic content properties: MIME typestatic StringCONTENT_MODIFIEDBasic content properties: Last modified datestatic StringCONTENT_SIZEBasic content properties: Sizestatic StringHLS_STREAMING_HOSTstatic StringHLS_STREAMING_TYPEstatic StringSPACE_COUNTBasic space properties: Count of items in a spacestatic StringSPACE_CREATEDBasic space properties: Created datestatic StringSPACE_SIZEBasic space properties: Size of space
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringaddContent(String spaceId, String contentId, InputStream content, long contentSize, String contentMimeType, String contentChecksum, Map<String,String> contentProperties)Adds content to a space.booleancontentExists(String spaceId, String contentId)Determines if a content item exists in a given spaceStringcopyContent(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.StringcopyContent(String srcSpaceId, String srcContentId, String destStoreId, String destSpaceId, String destContentId)This method provides a way to copy a content item to another content provider.voidcreateSpace(String spaceId)Creates a new space.voiddeleteContent(String spaceId, String contentId)Removes content from a space.voiddeleteSpace(String spaceId)Deletes a space.InputStreamgetAuditLog(String spaceId)Gets an audit log for the specific space if one exists.StringgetBaseURL()Gets the base URL pointing to the DuraCloud DuraStore REST APIBitIntegrityReportgetBitIntegrityReport(String spaceId)Returns the most recent bit integrity report.BitIntegrityReportPropertiesgetBitIntegrityReportProperties(String spaceId)Returns the properties associated with the most recent bit integrity report.ContentgetContent(String spaceId, String contentId)Gets content from a space.ContentgetContent(String spaceId, String contentId, Long startByte, Long endByte)Gets a byte range of a content item from a space.Map<String,String>getContentProperties(String spaceId, String contentId)Retrieves the properties associated with content.InputStreamgetManifest(String spaceId, ManifestFormat format)Gets a manifest for the specific space if one exists.SpacegetSpace(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,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.SpaceStatsDTOListgetSpaceStats(String spaceId, Date from, Date to)Returns a space stats time series for presenting in a graph.SpaceStatsDTOListgetStorageProviderStats(Date from, Date to)Returns a base based series of stats for all spaces within a storage provider for the specified time range.SpaceStatsDTOListgetStorageProviderStatsByDay(Date date)Returns stats for all spaces within a storage provider for a particular day, averaging bit and object counts between 0:00:00 and 23:59:59 UTC.StringgetStorageProviderType()Gets the storage provider typeStorageProviderTypeStringgetStoreId()Gets the ID of this content storeList<String>getSupportedTasks()Gets a listing of the supported tasks.booleanisWritable()Indicates whether or not the content store is writable by non root users.StringmoveContent(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.StringmoveContent(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.StringperformTask(String taskName, String taskParameters)Perform a task (with retries on failure) which is outside of the standard set of storage activities but is available through one or more storage providers.StringperformTaskWithNoRetries(String taskName, String taskParameters)Perform a task (without retrying on failure) which is outside of the standard set of storage activities but is available through one or more storage providers.voidsetContentProperties(String spaceId, String contentId, Map<String,String> contentProperties)Sets the properties associated with content.voidsetRetryExceptionHandler(ExceptionHandler retryExceptionHandler)Sets the Exception Handler which will be used to process any Exceptions that are thrown when an action fails but will be retried.voidsetSpaceACLs(String spaceId, Map<String,AclType> spaceACLs)Sets the ACLs associated with a space.booleanspaceExists(String spaceId)Determines if a space existsvoidvalidateContentId(String contentId)Checks a content ID to ensure that it conforms to all restrictionsvoidvalidateSpaceId(String spaceId)Checks a space ID to ensure that it conforms to all restrictions
-
-
-
Field Detail
-
SPACE_CREATED
static final String SPACE_CREATED
Basic space properties: Created date- See Also:
- Constant Field Values
-
SPACE_COUNT
static final String SPACE_COUNT
Basic space properties: Count of items in a space- See Also:
- Constant Field Values
-
SPACE_SIZE
static final String SPACE_SIZE
Basic space properties: Size of space- See Also:
- Constant Field Values
-
CONTENT_MIMETYPE
static final String CONTENT_MIMETYPE
Basic content properties: MIME type- See Also:
- Constant Field Values
-
CONTENT_SIZE
static final String CONTENT_SIZE
Basic content properties: Size- See Also:
- Constant Field Values
-
CONTENT_CHECKSUM
static final String CONTENT_CHECKSUM
Basic content properties: MD5 checksum- See Also:
- Constant Field Values
-
CONTENT_MODIFIED
static final String CONTENT_MODIFIED
Basic content properties: Last modified date- See Also:
- Constant Field Values
-
CONTENT_FILE_CREATED
static final String CONTENT_FILE_CREATED
Original content file properties: Creation date- See Also:
- Constant Field Values
-
CONTENT_FILE_ACCESSED
static final String CONTENT_FILE_ACCESSED
Original content file properties: Last accessed date- See Also:
- Constant Field Values
-
CONTENT_FILE_MODIFIED
static final String CONTENT_FILE_MODIFIED
Original content file properties: Last modified date- See Also:
- Constant Field Values
-
HLS_STREAMING_HOST
static final String HLS_STREAMING_HOST
- See Also:
- Constant Field Values
-
HLS_STREAMING_TYPE
static final String HLS_STREAMING_TYPE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getBaseURL
String getBaseURL()
Gets the base URL pointing to the DuraCloud DuraStore REST API
-
getStoreId
String getStoreId()
Gets the ID of this content store
-
isWritable
boolean isWritable()
Indicates whether or not the content store is writable by non root users.- Returns:
-
getStorageProviderType
String getStorageProviderType()
Gets the storage provider typeStorageProviderType
-
getSpaces
List<String> getSpaces() throws ContentStoreException
Provides a listing of all spaces IDs.- Returns:
- Iterator listing spaceIds
- Throws:
ContentStoreException- if an error occurs
-
getSpaceContents
Iterator<String> getSpaceContents(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 existContentStoreException- if an error occurs
-
getSpaceContents
Iterator<String> getSpaceContents(String spaceId, 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 Spaceprefix- only retrieve content ids with this prefix (null for all content ids)- Returns:
- Iterator for content IDs
- Throws:
NotFoundException- if the space does not existContentStoreException- if an error occurs
-
getSpace
Space getSpace(String spaceId, String prefix, long maxResults, 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 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)- Returns:
- Space
- Throws:
NotFoundException- if the space does not existContentStoreException- if an error occurs
-
createSpace
void createSpace(String spaceId) 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- Throws:
InvalidIdException- if the space ID is not validContentStoreException- if the space already exists or cannot be created
-
deleteSpace
void deleteSpace(String spaceId) throws ContentStoreException
Deletes a space.- Parameters:
spaceId- the identifier of the DuraCloud Space- Throws:
NotFoundException- if the space does not existContentStoreException- if an error occurs
-
getSpaceProperties
Map<String,String> getSpaceProperties(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 empty map if no properties exists
- Throws:
NotFoundException- if the space does not existContentStoreException- if an error occurs
-
getSpaceACLs
Map<String,AclType> getSpaceACLs(String spaceId) throws ContentStoreException
Retrieves the ACLs associated with a space.- Parameters:
spaceId- the identifier of the DuraCloud Space- Returns:
- Map of space ACLs or empty map if no properties exists
- Throws:
NotFoundException- if the space does not existContentStoreException- if an error occurs
-
setSpaceACLs
void setSpaceACLs(String spaceId, Map<String,AclType> spaceACLs) throws ContentStoreException
Sets the ACLs associated with a space. Only values included in the ACLs map will be saved, others will be removed.- Parameters:
spaceId- the identifier of the DuraCloud SpacespaceACLs- a map of ACL entries for the space (user|group -> right)- Throws:
NotFoundException- if the space does not existContentStoreException- if an error occurs
-
spaceExists
boolean spaceExists(String spaceId) throws ContentStoreException
Determines if a space exists- Parameters:
spaceId- the identifier of the DuraCloud Space to check- Returns:
- true if the space exists, false otherwise
- Throws:
ContentStoreException- if an error occurs
-
addContent
String addContent(String spaceId, String contentId, InputStream content, long contentSize, String contentMimeType, String contentChecksum, Map<String,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 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 content- Returns:
- content checksum
- Throws:
InvalidIdException- if the content ID is not validNotFoundException- if the space does not existContentStoreException- if an error occurs
-
copyContent
String copyContent(String srcSpaceId, String srcContentId, String destSpaceId, 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 copysrcContentId- of content to copydestSpaceId- where copied content will end updestContentId- given to copied content- Returns:
- MD5 checksum of destination content item
- Throws:
ContentStoreException- on error
-
copyContent
String copyContent(String srcSpaceId, String srcContentId, String destStoreId, String destSpaceId, String destContentId) throws ContentStoreException
This method provides a way to copy a content item to another content provider.- Parameters:
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 content- Returns:
- MD5 checksum of destination content item
- Throws:
ContentStoreException- on error
-
moveContent
String moveContent(String srcSpaceId, String srcContentId, String destSpaceId, 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 movesrcContentId- of content to movedestSpaceId- where moved content will end updestContentId- given to moved content- Returns:
- MD5 checksum of destination content item
- Throws:
ContentStoreException- on error
-
moveContent
String moveContent(String srcSpaceId, String srcContentId, String destStoreId, String destSpaceId, 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 movesrcContentId- of content to movedestStoreId- where moved content will end updestSpaceId- where moved content will end updestContentId- given to moved content- Returns:
- MD5 checksum of destination content item
- Throws:
ContentStoreException- on error
-
getContent
Content getContent(String spaceId, String contentId) throws ContentStoreException
Gets content from a space.- Parameters:
spaceId- the identifier of the DuraCloud SpacecontentId- the identifier of the content item- Returns:
- the content stream
- Throws:
NotFoundException- if the space or content does not existContentStoreException- if an error occurs
-
getContent
Content getContent(String spaceId, String contentId, Long startByte, Long endByte) throws ContentStoreException
Gets a byte range of a content item from a space. The startByte must be greater than or equal to 0 and less than the content length. The endByte can be null which indicates you would like all bytes beginning with the specified start byte. Otherwise the endByte must be less than the content length and greater than the startByte.- Parameters:
spaceId- the identifier of the DuraCloud SpacecontentId- the identifier of the content itemstartByte- the starting byte of the range.endByte- The end byte of the range.- Returns:
- the content stream
- Throws:
NotFoundException- if the space or content does not existContentStoreException- if an error occurs
-
deleteContent
void deleteContent(String spaceId, String contentId) throws ContentStoreException
Removes content from a space.- Parameters:
spaceId- the identifier of the DuraCloud SpacecontentId- the identifier of the content item- Throws:
NotFoundException- if the space or content does not existContentStoreException- if an error occurs
-
setContentProperties
void setContentProperties(String spaceId, String contentId, Map<String,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 SpacecontentId- the identifier of the content itemcontentProperties- a map of properties values to be linked to this content- Throws:
NotFoundException- if the space or content does not existContentStoreException- if an error occurs
-
getContentProperties
Map<String,String> getContentProperties(String spaceId, 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 SpacecontentId- 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 existContentStoreException- if an error occurs
-
contentExists
boolean contentExists(String spaceId, String contentId) throws ContentStoreException
Determines if a content item exists in a given space- Parameters:
spaceId- the identifier of the DuraCloud SpacecontentId- the identifier of the content item to check- Returns:
- true if the content item exists, false otherwise
- Throws:
ContentStoreException- if an error occurs
-
validateSpaceId
void validateSpaceId(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(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
List<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
String performTask(String taskName, String taskParameters) throws ContentStoreException
Perform a task (with retries on failure) which is outside of the standard set of storage activities but is available through one or more storage providers.- Parameters:
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-specific- Returns:
- the return value of the task
- Throws:
ContentStoreException
-
performTaskWithNoRetries
String performTaskWithNoRetries(String taskName, String taskParameters) throws ContentStoreException
Perform a task (without retrying on failure) which is outside of the standard set of storage activities but is available through one or more storage providers.- Parameters:
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-specific- Returns:
- the return value of the task
- Throws:
ContentStoreException
-
setRetryExceptionHandler
void setRetryExceptionHandler(ExceptionHandler retryExceptionHandler)
Sets the Exception Handler which will be used to process any Exceptions that are thrown when an action fails but will be retried. The default Exception handler logs the exception messages at the WARN level.
-
getManifest
InputStream getManifest(String spaceId, ManifestFormat format) throws ContentStoreException
Gets a manifest for the specific space if one exists. If the space does not exist or the manifest is empty, an exception will be thrown.- Parameters:
spaceId- the space id of the desired manifestformat-- Returns:
- Throws:
ContentStoreException
-
getAuditLog
InputStream getAuditLog(String spaceId) throws ContentStoreException
Gets an audit log for the specific space if one exists. If the space does not exist or the audit is empty, an exception will be thrown.- Parameters:
spaceId- the space id- Returns:
- Throws:
ContentStoreException
-
getBitIntegrityReport
BitIntegrityReport getBitIntegrityReport(String spaceId) throws ContentStoreException
Returns the most recent bit integrity report. If no bit integrity reports exist for this space, a null value is returned.- Parameters:
spaceId-- Returns:
- Throws:
ContentStoreException
-
getBitIntegrityReportProperties
BitIntegrityReportProperties getBitIntegrityReportProperties(String spaceId) throws ContentStoreException
Returns the properties associated with the most recent bit integrity report. If no bit integrity reports exist for this space, a null value is returned.- Parameters:
spaceId-- Returns:
- Throws:
ContentStoreException
-
getSpaceStats
SpaceStatsDTOList getSpaceStats(String spaceId, Date from, Date to) throws ContentStoreException
Returns a space stats time series for presenting in a graph.- Parameters:
spaceId-from-to-- Returns:
- Throws:
ContentStoreException
-
getStorageProviderStats
SpaceStatsDTOList getStorageProviderStats(Date from, Date to) throws ContentStoreException
Returns a base based series of stats for all spaces within a storage provider for the specified time range.- Parameters:
from-to-- Returns:
- Throws:
ContentStoreException
-
getStorageProviderStatsByDay
SpaceStatsDTOList getStorageProviderStatsByDay(Date date) throws ContentStoreException
Returns stats for all spaces within a storage provider for a particular day, averaging bit and object counts between 0:00:00 and 23:59:59 UTC.- Parameters:
date-- Returns:
- Throws:
ContentStoreException
-
-