Package org.duracloud.durastore.rest
Class ContentResourceImpl
- java.lang.Object
-
- org.duracloud.durastore.rest.ContentResourceImpl
-
- All Implemented Interfaces:
ContentResource
public class ContentResourceImpl extends Object implements ContentResource
Provides interaction with content- Author:
- Bill Branan
-
-
Constructor Summary
Constructors Constructor Description ContentResourceImpl(StorageProviderFactory storageProviderFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringaddContent(String spaceID, String contentID, InputStream content, String contentMimeType, Map<String,String> userProperties, long contentSize, String checksum, String storeID)Adds content to a space.StringcopyContent(String srcStoreID, String srcSpaceID, String srcContentID, String destStoreID, String destSpaceID, String destContentID)This method copies the content found in space srcSpaceID with id srcContentID to the space destSpaceID within the same content store (storeID) to the id of destContentID.voiddeleteContent(String spaceID, String contentID, String storeID)Removes a piece of content.RetrievedContentgetContent(String spaceID, String contentID, String storeID, String range)Retrieves content from a space.Map<String,String>getContentProperties(String spaceID, String contentID, String storeID)Retrieves the properties of a piece of content.voidupdateContentProperties(String spaceID, String contentID, String contentMimeType, Map<String,String> userProperties, String storeID)Updates the properties of a piece of content.
-
-
-
Constructor Detail
-
ContentResourceImpl
public ContentResourceImpl(StorageProviderFactory storageProviderFactory)
-
-
Method Detail
-
getContent
public RetrievedContent getContent(String spaceID, String contentID, String storeID, String range) throws InvalidRequestException, ResourceException
Retrieves content from a space.- Specified by:
getContentin interfaceContentResource- Parameters:
spaceID-contentID-- Returns:
- InputStream which can be used to read content.
- Throws:
InvalidRequestExceptionResourceException
-
getContentProperties
public Map<String,String> getContentProperties(String spaceID, String contentID, String storeID) throws ResourceException
Retrieves the properties of a piece of content.- Specified by:
getContentPropertiesin interfaceContentResource- Parameters:
spaceID-contentID-- Returns:
- Map of content properties
- Throws:
ResourceException
-
updateContentProperties
public void updateContentProperties(String spaceID, String contentID, String contentMimeType, Map<String,String> userProperties, String storeID) throws ResourceException
Updates the properties of a piece of content.- Specified by:
updateContentPropertiesin interfaceContentResource- Throws:
ResourceException
-
addContent
public String addContent(String spaceID, String contentID, InputStream content, String contentMimeType, Map<String,String> userProperties, long contentSize, String checksum, String storeID) throws ResourceException, InvalidIdException, ResourcePropertiesInvalidException
Adds content to a space.- Specified by:
addContentin interfaceContentResource- Returns:
- the checksum of the content as computed by the storage provider
- Throws:
ResourceExceptionInvalidIdExceptionResourcePropertiesInvalidException
-
copyContent
public String copyContent(String srcStoreID, String srcSpaceID, String srcContentID, String destStoreID, String destSpaceID, String destContentID) throws ResourceException
This method copies the content found in space srcSpaceID with id srcContentID to the space destSpaceID within the same content store (storeID) to the id of destContentID.- Specified by:
copyContentin interfaceContentResource- Parameters:
srcStoreID- of content to copysrcSpaceID- of content to copysrcContentID- of content to copydestSpaceID- of copied contentdestContentID- of copied contentdestStoreID- of copied content- Returns:
- MD5 checksum of the content as computed by the storage provider
- Throws:
ResourceException
-
deleteContent
public void deleteContent(String spaceID, String contentID, String storeID) throws ResourceException
Removes a piece of content.- Specified by:
deleteContentin interfaceContentResource- Parameters:
spaceID-contentID-- Throws:
ResourceException
-
-