Package org.alfresco.repo.content
Class AbstractRoutingContentStore
- java.lang.Object
-
- org.alfresco.repo.content.AbstractRoutingContentStore
-
- All Implemented Interfaces:
org.alfresco.repo.content.ContentStore
- Direct Known Subclasses:
AbstractTenantRoutingContentStore
public abstract class AbstractRoutingContentStore extends java.lang.Object implements org.alfresco.repo.content.ContentStoreA store providing support for content store implementations that provide routing of content read and write requests based on context.- Since:
- 2.1
- Author:
- Derek Hulley
- See Also:
ContentContext
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractRoutingContentStore()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleandelete(java.lang.String contentUrl)This operation has to be performed on all the stores in order to maintain theContentStore.exists(String)contract.booleanexists(java.lang.String contentUrl)protected abstract java.util.List<org.alfresco.repo.content.ContentStore>getAllStores()org.alfresco.service.cmr.repository.ContentReadergetReader(java.lang.String contentUrl)java.lang.StringgetRootLocation()longgetSpaceFree()longgetSpaceTotal()org.alfresco.service.cmr.repository.ContentWritergetWriter(org.alfresco.repo.content.ContentContext context)Selects a store for the given context and caches store that was used.org.alfresco.service.cmr.repository.ContentWritergetWriter(org.alfresco.service.cmr.repository.ContentReader existingContentReader, java.lang.String newContentUrl)booleanisContentUrlSupported(java.lang.String contentUrl)booleanisWriteSupported()protected abstract org.alfresco.repo.content.ContentStoreselectWriteStore(org.alfresco.repo.content.ContentContext ctx)Get a content store based on the context provided.voidsetStoresCache(org.alfresco.repo.cache.SimpleCache<org.alfresco.util.Pair<java.lang.String,java.lang.String>,org.alfresco.repo.content.ContentStore> storesCache)
-
-
-
Method Detail
-
setStoresCache
public void setStoresCache(org.alfresco.repo.cache.SimpleCache<org.alfresco.util.Pair<java.lang.String,java.lang.String>,org.alfresco.repo.content.ContentStore> storesCache)
- Parameters:
storesCache- cache of stores used to access URLs
-
getAllStores
protected abstract java.util.List<org.alfresco.repo.content.ContentStore> getAllStores()
- Returns:
- Returns a list of all possible stores available for reading or writing
-
selectWriteStore
protected abstract org.alfresco.repo.content.ContentStore selectWriteStore(org.alfresco.repo.content.ContentContext ctx)
Get a content store based on the context provided. The applicability of the context and even the types of context allowed are up to the implementation, but normally there should be a fallback case for when the parameters are not adequate to make a decision.- Parameters:
ctx- the context to use to make the choice- Returns:
- Returns the store most appropriate for the given context and never null
-
isContentUrlSupported
public boolean isContentUrlSupported(java.lang.String contentUrl)
- Specified by:
isContentUrlSupportedin interfaceorg.alfresco.repo.content.ContentStore- Returns:
- Returns true if the URL is supported by any of the stores.
-
isWriteSupported
public boolean isWriteSupported()
- Specified by:
isWriteSupportedin interfaceorg.alfresco.repo.content.ContentStore- Returns:
- Returns true if write is supported by any of the stores.
-
getRootLocation
public java.lang.String getRootLocation()
- Specified by:
getRootLocationin interfaceorg.alfresco.repo.content.ContentStore- Returns:
- Returns . always
-
getSpaceFree
public long getSpaceFree()
- Specified by:
getSpaceFreein interfaceorg.alfresco.repo.content.ContentStore- Returns:
- Returns -1 always
-
getSpaceTotal
public long getSpaceTotal()
- Specified by:
getSpaceTotalin interfaceorg.alfresco.repo.content.ContentStore- Returns:
- Returns -1 always
-
exists
public boolean exists(java.lang.String contentUrl) throws org.alfresco.service.cmr.repository.ContentIOException- Specified by:
existsin interfaceorg.alfresco.repo.content.ContentStore- Throws:
org.alfresco.service.cmr.repository.ContentIOException- See Also:
selectReadStore(String)
-
getReader
public org.alfresco.service.cmr.repository.ContentReader getReader(java.lang.String contentUrl) throws org.alfresco.service.cmr.repository.ContentIOException- Specified by:
getReaderin interfaceorg.alfresco.repo.content.ContentStore- Returns:
- Returns a valid reader from one of the stores otherwise
a
EmptyContentReaderis returned. - Throws:
org.alfresco.service.cmr.repository.ContentIOException
-
getWriter
public org.alfresco.service.cmr.repository.ContentWriter getWriter(org.alfresco.repo.content.ContentContext context) throws org.alfresco.service.cmr.repository.ContentIOExceptionSelects a store for the given context and caches store that was used.- Specified by:
getWriterin interfaceorg.alfresco.repo.content.ContentStore- Throws:
org.alfresco.service.cmr.repository.ContentIOException- See Also:
selectWriteStore(ContentContext)
-
getWriter
public org.alfresco.service.cmr.repository.ContentWriter getWriter(org.alfresco.service.cmr.repository.ContentReader existingContentReader, java.lang.String newContentUrl) throws org.alfresco.service.cmr.repository.ContentIOException- Throws:
org.alfresco.service.cmr.repository.ContentIOException
-
delete
public boolean delete(java.lang.String contentUrl) throws org.alfresco.service.cmr.repository.ContentIOExceptionThis operation has to be performed on all the stores in order to maintain theContentStore.exists(String)contract.- Specified by:
deletein interfaceorg.alfresco.repo.content.ContentStore- Throws:
org.alfresco.service.cmr.repository.ContentIOException
-
-