Package org.duracloud.storage.provider
Class StorageProviderBase
- java.lang.Object
-
- org.duracloud.storage.provider.StorageProviderBase
-
- All Implemented Interfaces:
StorageProvider
public abstract class StorageProviderBase extends Object implements StorageProvider
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classStorageProviderBase.SpaceDeleteWorker
-
Field Summary
Fields Modifier and Type Field Description protected static StringACL_DELIMprotected static StringACL_GROUP_READprotected static StringACL_GROUP_WRITEprotected static StringACL_USER_READprotected static StringACL_USER_WRITEprotected org.slf4j.Loggerlog-
Fields inherited from interface org.duracloud.storage.provider.StorageProvider
DEFAULT_MAX_RESULTS, DEFAULT_MIMETYPE, ISO8601_DATE_FORMAT, PROPERTIES_BUCKET, PROPERTIES_CONTENT_CHECKSUM, PROPERTIES_CONTENT_CREATOR, PROPERTIES_CONTENT_FILE_CREATED, PROPERTIES_CONTENT_FILE_LAST_ACCESSED, PROPERTIES_CONTENT_FILE_MODIFIED, PROPERTIES_CONTENT_FILE_PATH, PROPERTIES_CONTENT_MD5, PROPERTIES_CONTENT_MIMETYPE, PROPERTIES_CONTENT_MODIFIED, PROPERTIES_CONTENT_SIZE, PROPERTIES_COPY_SOURCE, PROPERTIES_COPY_SOURCE_STORE, PROPERTIES_HLS_STREAMING_HOST, PROPERTIES_HLS_STREAMING_TYPE, PROPERTIES_SPACE_ACL, PROPERTIES_SPACE_ACL_GROUP, PROPERTIES_SPACE_ACL_PUBLIC, PROPERTIES_SPACE_COUNT, PROPERTIES_SPACE_CREATED, PROPERTIES_SPACE_SIZE
-
-
Constructor Summary
Constructors Constructor Description StorageProviderBase()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voiddeleteSpace(String spaceId)Deletes a space.voiddeleteSpaceSync(String spaceId)This method is only intended to be used by tests!protected abstract voiddoSetSpaceProperties(String spaceId, Map<String,String> spaceProps)protected abstract Map<String,String>getAllSpaceProperties(String spaceId)Map<String,AclType>getSpaceACLs(String spaceId)Retrieves the ACLs associated with a space.StorageProviderBase.SpaceDeleteWorkergetSpaceDeleteWorker(String spaceId)Map<String,String>getSpaceProperties(String spaceId)This method returns all of the space properties EXCEPT the ACLsprotected Map<String,String>packACLs(Map<String,AclType> spaceACLs)protected Map<String,String>removeCalculatedProperties(Map<String,String> properties)protected abstract voidremoveSpace(String spaceId)voidsetNewSpaceProperties(String spaceId, Map<String,String> spaceProperties)Sets the properties on this space.voidsetNewSpaceProperties(String spaceId, Map<String,String> spaceProperties, Map<String,AclType> spaceACLs)Sets the properties of this space.voidsetSpaceACLs(String spaceId, Map<String,AclType> spaceACLs)Sets the ACLs associated with a space.voidsetWrappedStorageProvider(StorageProvider wrappedStorageProvider)Sets an alternate storage provider that can be used for select operations.protected abstract booleanspaceExists(String spaceId)protected voidthrowIfSpaceNotExist(String spaceId)protected voidthrowIfSpaceNotExist(String spaceId, boolean wait)protected Map<String,AclType>unpackACLs(Map<String,String> spaceProps)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.duracloud.storage.provider.StorageProvider
addContent, copyContent, createSpace, deleteContent, getContent, getContent, getContentProperties, getSpaceContents, getSpaceContentsChunked, getSpaces, getStorageProviderType, setContentProperties
-
-
-
-
Field Detail
-
ACL_USER_READ
protected static final String ACL_USER_READ
- See Also:
- Constant Field Values
-
ACL_USER_WRITE
protected static final String ACL_USER_WRITE
- See Also:
- Constant Field Values
-
ACL_GROUP_READ
protected static final String ACL_GROUP_READ
- See Also:
- Constant Field Values
-
ACL_GROUP_WRITE
protected static final String ACL_GROUP_WRITE
- See Also:
- Constant Field Values
-
ACL_DELIM
protected static final String ACL_DELIM
- See Also:
- Constant Field Values
-
log
protected final org.slf4j.Logger log
-
-
Method Detail
-
spaceExists
protected abstract boolean spaceExists(String spaceId)
-
removeSpace
protected abstract void removeSpace(String spaceId)
-
doSetSpaceProperties
protected abstract void doSetSpaceProperties(String spaceId, Map<String,String> spaceProps)
-
getSpaceProperties
public Map<String,String> getSpaceProperties(String spaceId)
This method returns all of the space properties EXCEPT the ACLs- Specified by:
getSpacePropertiesin interfaceStorageProvider- Parameters:
spaceId- - ID of the space- Returns:
- map of space properties
-
setNewSpaceProperties
public void setNewSpaceProperties(String spaceId, Map<String,String> spaceProperties)
Sets the properties on this space. Maintains the current ACL settings.- Parameters:
spaceId-spaceProperties-
-
setNewSpaceProperties
public void setNewSpaceProperties(String spaceId, Map<String,String> spaceProperties, Map<String,AclType> spaceACLs)
Sets the properties of this space. Note that this method is intentionally not exposed to users, as it is not meant to be used for user properties, but only for system-level properties. The names and values need to be kept short, and the overall number of properties needs to be tightly limited, or there will be issues due to provider-specific limitation. This method allows for Space Access control details to be updated at the same time as space properties.- Parameters:
spaceId-spaceProperties-spaceACLs-
-
getSpaceACLs
public Map<String,AclType> getSpaceACLs(String spaceId)
Description copied from interface:StorageProviderRetrieves the ACLs associated with a space.- Specified by:
getSpaceACLsin interfaceStorageProvider- 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:StorageProviderSets the ACLs associated with a space.- Specified by:
setSpaceACLsin interfaceStorageProvider- Parameters:
spaceId- - ID of the spacespaceACLs- - Updated space ACL. Note, null or empty arg spaceACLs will 'clear' the space ACLs.
-
throwIfSpaceNotExist
protected void throwIfSpaceNotExist(String spaceId)
-
throwIfSpaceNotExist
protected void throwIfSpaceNotExist(String spaceId, boolean wait)
-
deleteSpace
public void deleteSpace(String spaceId)
Deletes a space.- Specified by:
deleteSpacein interfaceStorageProvider- Parameters:
spaceId- - ID of the space
-
deleteSpaceSync
public void deleteSpaceSync(String spaceId)
This method is only intended to be used by tests!- Parameters:
spaceId-
-
getSpaceDeleteWorker
public StorageProviderBase.SpaceDeleteWorker getSpaceDeleteWorker(String spaceId)
-
removeCalculatedProperties
protected Map<String,String> removeCalculatedProperties(Map<String,String> properties)
-
setWrappedStorageProvider
public void setWrappedStorageProvider(StorageProvider wrappedStorageProvider)
Sets an alternate storage provider that can be used for select operations. The motivation for adding this method came from a need to have the deleteSpace operation generate audit events for content items as they were deleted before the space itself was deleted.- Parameters:
wrappedStorageProvider-
-
-