Package org.alfresco.repo.content
Class AbstractRoutingContentStore
- java.lang.Object
-
- org.alfresco.repo.content.AbstractRoutingContentStore
-
- All Implemented Interfaces:
ContentStore
- Direct Known Subclasses:
AbstractTenantRoutingContentStore
public abstract class AbstractRoutingContentStore extends Object implements ContentStore
A 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
-
-
Field Summary
-
Fields inherited from interface org.alfresco.repo.content.ContentStore
NEW_CONTENT_CONTEXT, PROTOCOL_DELIMITER
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractRoutingContentStore()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleandelete(String contentUrl)This operation has to be performed on all the stores in order to maintain theContentStore.exists(String)contract.booleanexists(String contentUrl)protected abstract List<ContentStore>getAllStores()ContentReadergetReader(String contentUrl)StringgetRootLocation()longgetSpaceFree()longgetSpaceTotal()ContentWritergetWriter(ContentContext context)Selects a store for the given context and caches store that was used.ContentWritergetWriter(ContentReader existingContentReader, String newContentUrl)booleanisContentUrlSupported(String contentUrl)booleanisWriteSupported()protected abstract ContentStoreselectWriteStore(ContentContext ctx)Get a content store based on the context provided.voidsetStoresCache(SimpleCache<Pair<String,String>,ContentStore> storesCache)
-
-
-
Method Detail
-
setStoresCache
public void setStoresCache(SimpleCache<Pair<String,String>,ContentStore> storesCache)
- Parameters:
storesCache- cache of stores used to access URLs
-
getAllStores
protected abstract List<ContentStore> getAllStores()
- Returns:
- Returns a list of all possible stores available for reading or writing
-
selectWriteStore
protected abstract ContentStore selectWriteStore(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(String contentUrl)
- Specified by:
isContentUrlSupportedin interfaceContentStore- Returns:
- Returns true if the URL is supported by any of the stores.
-
isWriteSupported
public boolean isWriteSupported()
- Specified by:
isWriteSupportedin interfaceContentStore- Returns:
- Returns true if write is supported by any of the stores.
-
getRootLocation
public String getRootLocation()
- Specified by:
getRootLocationin interfaceContentStore- Returns:
- Returns . always
-
getSpaceFree
public long getSpaceFree()
- Specified by:
getSpaceFreein interfaceContentStore- Returns:
- Returns -1 always
-
getSpaceTotal
public long getSpaceTotal()
- Specified by:
getSpaceTotalin interfaceContentStore- Returns:
- Returns -1 always
-
exists
public boolean exists(String contentUrl) throws ContentIOException
- Specified by:
existsin interfaceContentStore- Throws:
ContentIOException- See Also:
selectReadStore(String)
-
getReader
public ContentReader getReader(String contentUrl) throws ContentIOException
- Specified by:
getReaderin interfaceContentStore- Returns:
- Returns a valid reader from one of the stores otherwise
a
EmptyContentReaderis returned. - Throws:
ContentIOException
-
getWriter
public ContentWriter getWriter(ContentContext context) throws ContentIOException
Selects a store for the given context and caches store that was used.- Specified by:
getWriterin interfaceContentStore- Throws:
ContentIOException- See Also:
selectWriteStore(ContentContext)
-
getWriter
public ContentWriter getWriter(ContentReader existingContentReader, String newContentUrl) throws ContentIOException
- Throws:
ContentIOException
-
delete
public boolean delete(String contentUrl) throws ContentIOException
This operation has to be performed on all the stores in order to maintain theContentStore.exists(String)contract.- Specified by:
deletein interfaceContentStore- Throws:
ContentIOException
-
-