org.duracloud.durastore.test
Class MockVerifyDeleteStorageProvider

java.lang.Object
  extended by org.duracloud.durastore.test.MockVerifyDeleteStorageProvider
All Implemented Interfaces:
StorageProvider

public class MockVerifyDeleteStorageProvider
extends Object
implements StorageProvider

Storage Provider implementation used for testing verify deletion AOP


Field Summary
 
Fields inherited from interface org.duracloud.storage.provider.StorageProvider
DEFAULT_MAX_RESULTS, DEFAULT_MIMETYPE, PROPERTIES_CONTENT_CHECKSUM, PROPERTIES_CONTENT_CREATOR, PROPERTIES_CONTENT_MD5, PROPERTIES_CONTENT_MIMETYPE, PROPERTIES_CONTENT_MODIFIED, PROPERTIES_CONTENT_SIZE, PROPERTIES_COPY_SOURCE, PROPERTIES_COPY_SOURCE_STORE, PROPERTIES_SPACE_ACL, PROPERTIES_SPACE_ACL_PUBLIC, PROPERTIES_SPACE_COUNT, PROPERTIES_SPACE_CREATED, PROPERTIES_SPACE_SIZE, RFC822_DATE_FORMAT, SPACE_PROPERTIES_SUFFIX
 
Constructor Summary
MockVerifyDeleteStorageProvider()
           
 
Method Summary
 String addContent(String spaceId, String contentId, String contentMimeType, Map<String,String> userProperties, long contentSize, String contentChecksum, InputStream content)
          Adds content to a space.
 String copyContent(String sourceSpaceId, String sourceContentId, 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.
 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.
 InputStream getContent(String spaceId, String contentId)
          Gets content from a space.
 Map<String,String> getContentProperties(String spaceId, String contentId)
          Retrieves the properties associated with content.
 Map<String,AclType> getSpaceACLs(String spaceId)
          Retrieves the ACLs associated with a space.
 Iterator<String> getSpaceContents(String spaceId, String prefix)
          Provides access to the content files within a space.
 List<String> getSpaceContentsChunked(String spaceId, String prefix, long maxResults, String marker)
          Provides a listing of the content files within a space.
 Map<String,String> getSpaceProperties(String spaceId)
          Provides a successful response the number of times indicated by the spaceId.
 Iterator<String> getSpaces()
          Provides a listing of all spaces owned by a customer.
 void setContentProperties(String spaceId, String contentId, Map<String,String> contentProperties)
          Sets the properties associated with content.
 void setSpaceACLs(String spaceId, Map<String,AclType> spaceACLs)
          Sets the ACLs associated with a space.
 void setSpaceProperties(String spaceId, Map<String,String> spaceProperties)
          Sets the properties associated with a space.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockVerifyDeleteStorageProvider

public MockVerifyDeleteStorageProvider()
Method Detail

getSpaces

public Iterator<String> getSpaces()
Description copied from interface: StorageProvider
Provides a listing of all spaces owned by a customer.

Specified by:
getSpaces in interface StorageProvider
Returns:
Iterator listing spaceIds

getSpaceContents

public Iterator<String> getSpaceContents(String spaceId,
                                         String prefix)
Description copied from interface: StorageProvider
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.

Specified by:
getSpaceContents in interface StorageProvider
Parameters:
spaceId - - ID of the space
prefix - - The prefix of the content id (null for no constraints)
Returns:
Iterator of contentIds

getSpaceContentsChunked

public List<String> getSpaceContentsChunked(String spaceId,
                                            String prefix,
                                            long maxResults,
                                            String marker)
Description copied from interface: StorageProvider
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.

Specified by:
getSpaceContentsChunked in interface StorageProvider
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

createSpace

public void createSpace(String spaceId)
Description copied from interface: StorageProvider
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.

Specified by:
createSpace in interface StorageProvider
Parameters:
spaceId - - ID of the space

deleteSpace

public void deleteSpace(String spaceId)
Description copied from interface: StorageProvider
Deletes a space.

Specified by:
deleteSpace in interface StorageProvider
Parameters:
spaceId - - ID of the space

getSpaceProperties

public Map<String,String> getSpaceProperties(String spaceId)
Provides a successful response the number of times indicated by the spaceId. After which the next request fails and resets the count.

Specified by:
getSpaceProperties in interface StorageProvider
Parameters:
spaceId - - ID of the space
Returns:
Map of space properties or empty map if no properties exists

setSpaceProperties

public void setSpaceProperties(String spaceId,
                               Map<String,String> spaceProperties)
Description copied from interface: StorageProvider
Sets the properties associated with a space.

Specified by:
setSpaceProperties in interface StorageProvider
Parameters:
spaceId - - ID of the space
spaceProperties - - Updated space properties

getSpaceACLs

public Map<String,AclType> getSpaceACLs(String spaceId)
Description copied from interface: StorageProvider
Retrieves the ACLs associated with a space.

Specified by:
getSpaceACLs in interface StorageProvider
Parameters:
spaceId - - ID of the space
Returns:
Map of space ACLs or empty map if none exists

setSpaceACLs

public void setSpaceACLs(String spaceId,
                         Map<String,AclType> spaceACLs)
Description copied from interface: StorageProvider
Sets the ACLs associated with a space.

Specified by:
setSpaceACLs in interface StorageProvider
Parameters:
spaceId - - ID of the space
spaceACLs - - Updated space ACL. Note, null or empty arg spaceACLs will 'clear' the space ACLs.

addContent

public String addContent(String spaceId,
                         String contentId,
                         String contentMimeType,
                         Map<String,String> userProperties,
                         long contentSize,
                         String contentChecksum,
                         InputStream content)
Description copied from interface: StorageProvider
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.

Specified by:
addContent in interface StorageProvider
Parameters:
spaceId - - ID of the space
contentId - - ID of the content in the space
contentMimeType - - the MIME type of the content being added
userProperties - - the metadata associated with the content
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

copyContent

public String copyContent(String sourceSpaceId,
                          String sourceContentId,
                          String destSpaceId,
                          String destContentId)
Description copied from interface: StorageProvider
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.

Specified by:
copyContent in interface StorageProvider
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

public InputStream getContent(String spaceId,
                              String contentId)
Description copied from interface: StorageProvider
Gets content from a space.

Specified by:
getContent in interface StorageProvider
Parameters:
spaceId - - ID of the space
contentId - - ID of the content in the space
Returns:
the content stream

deleteContent

public void deleteContent(String spaceId,
                          String contentId)
Description copied from interface: StorageProvider
Removes content from a space.

Specified by:
deleteContent in interface StorageProvider
Parameters:
spaceId - - ID of the space
contentId - - ID of the content in the space

setContentProperties

public void setContentProperties(String spaceId,
                                 String contentId,
                                 Map<String,String> contentProperties)
Description copied from interface: StorageProvider
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

Specified by:
setContentProperties in interface StorageProvider
Parameters:
spaceId - - ID of the space
contentId - - ID of the content in the space
contentProperties - - new content properties

getContentProperties

public Map<String,String> getContentProperties(String spaceId,
                                               String contentId)
Description copied from interface: StorageProvider
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.

Specified by:
getContentProperties in interface StorageProvider
Parameters:
spaceId - - ID of the space
contentId - - ID of the content in the space
Returns:
content properties


Copyright © 2009-2012 DuraSpace. All Rights Reserved.