Class CachingContentStore
java.lang.Object
org.alfresco.repo.content.caching.CachingContentStore
- All Implemented Interfaces:
ContentStore,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.context.ApplicationEventPublisherAware
public class CachingContentStore
extends Object
implements ContentStore, org.springframework.context.ApplicationEventPublisherAware, org.springframework.beans.factory.BeanNameAware
Implementation of ContentStore that wraps any other ContentStore (the backing store) transparently providing caching of content in that backing store.
CachingContentStore should only be used to wrap content stores that are significantly slower that FileContentStore - otherwise performance may actually degrade from its use.
It is important that cacheOnInbound is set to true for exceptionally slow backing stores.
This store handles the FileContentStore.SPOOF_PROTOCOL and can be used to wrap stores that do not handle the protocol out of the box e.g. the S3 connector's store.
- Author:
- Matt Ward
-
Field Summary
Fields inherited from interface org.alfresco.repo.content.ContentStore
NEW_CONTENT_CONTEXT, PROTOCOL_DELIMITER -
Constructor Summary
ConstructorsConstructorDescriptionCachingContentStore(ContentStore backingStore, ContentCache cache, boolean cacheOnInbound) -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleangetCache()intgetQuota()longlonggetStorageProperties(String contentUrl) getWriter(ContentContext context) voidinit()Initialisation method, should be called once the CachingContentStore has been constructed.booleanbooleanbooleanisContentDirectUrlEnabled(String contentUrl) booleanisContentUrlSupported(String contentUrl) booleanreadWriteLock(String url) Get a ReentrantReadWriteLock for a given URL.requestContentDirectUrl(String contentUrl, boolean attachment, String fileName) requestContentDirectUrl(String contentUrl, boolean attachment, String fileName, Long validFor) requestContentDirectUrl(String contentUrl, boolean attachment, String fileName, String mimeType, Long validFor) booleanrequestRestoreContentFromArchive(String contentUrl, Map<String, Serializable> restoreParams) booleanrequestSendContentToArchive(String contentUrl, Map<String, Serializable> archiveParams) voidsetApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) voidsetBackingStore(ContentStore backingStore) voidsetBeanName(String name) voidsetCache(ContentCache cache) voidsetCacheOnInbound(boolean cacheOnInbound) voidsetMaxCacheTries(int maxCacheTries) voidsetQuota(QuotaManagerStrategy quota) Sets the QuotaManagerStrategy that will be used.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.alfresco.repo.content.ContentStore
requestContentDirectUrl
-
Constructor Details
-
CachingContentStore
public CachingContentStore() -
CachingContentStore
-
-
Method Details
-
init
public void init()Initialisation method, should be called once the CachingContentStore has been constructed. -
isContentUrlSupported
- Specified by:
isContentUrlSupportedin interfaceContentStore
-
isWriteSupported
public boolean isWriteSupported()- Specified by:
isWriteSupportedin interfaceContentStore
-
getSpaceFree
public long getSpaceFree()- Specified by:
getSpaceFreein interfaceContentStore
-
getSpaceTotal
public long getSpaceTotal()- Specified by:
getSpaceTotalin interfaceContentStore
-
getRootLocation
- Specified by:
getRootLocationin interfaceContentStore
-
exists
For
spoofedURLs, the URL always exists.- Specified by:
existsin interfaceContentStore
-
getReader
This store handles the
FileContentStore.SPOOF_PROTOCOLso that underlying stores do not need to implement anything related to spoofing.- Specified by:
getReaderin interfaceContentStore
-
getWriter
- Specified by:
getWriterin interfaceContentStore
-
delete
- Specified by:
deletein interfaceContentStore
-
getStorageProperties
- Specified by:
getStoragePropertiesin interfaceContentStore
-
requestSendContentToArchive
public boolean requestSendContentToArchive(String contentUrl, Map<String, Serializable> archiveParams) - Specified by:
requestSendContentToArchivein interfaceContentStore
-
requestRestoreContentFromArchive
public boolean requestRestoreContentFromArchive(String contentUrl, Map<String, Serializable> restoreParams) - Specified by:
requestRestoreContentFromArchivein interfaceContentStore
-
readWriteLock
Get a ReentrantReadWriteLock for a given URL. The lock is from a pool rather than per URL, so some contention is expected.- Parameters:
url- String- Returns:
- ReentrantReadWriteLock
-
setBackingStore
-
getBackingStoreType
-
getBackingStoreDescription
-
setCache
-
getCache
-
setCacheOnInbound
public void setCacheOnInbound(boolean cacheOnInbound) -
isCacheOnInbound
public boolean isCacheOnInbound() -
getMaxCacheTries
public int getMaxCacheTries() -
setMaxCacheTries
public void setMaxCacheTries(int maxCacheTries) -
setQuota
Sets the QuotaManagerStrategy that will be used.- Parameters:
quota- QuotaManagerStrategy
-
getQuota
-
setApplicationEventPublisher
public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) - Specified by:
setApplicationEventPublisherin interfaceorg.springframework.context.ApplicationEventPublisherAware
-
setBeanName
- Specified by:
setBeanNamein interfaceorg.springframework.beans.factory.BeanNameAware
-
getBeanName
-
isContentDirectUrlEnabled
public boolean isContentDirectUrlEnabled()- Specified by:
isContentDirectUrlEnabledin interfaceContentStore
-
isContentDirectUrlEnabled
- Specified by:
isContentDirectUrlEnabledin interfaceContentStore
-
requestContentDirectUrl
public DirectAccessUrl requestContentDirectUrl(String contentUrl, boolean attachment, String fileName) - Specified by:
requestContentDirectUrlin interfaceContentStore
-
requestContentDirectUrl
public DirectAccessUrl requestContentDirectUrl(String contentUrl, boolean attachment, String fileName, Long validFor) - Specified by:
requestContentDirectUrlin interfaceContentStore
-
requestContentDirectUrl
public DirectAccessUrl requestContentDirectUrl(String contentUrl, boolean attachment, String fileName, String mimeType, Long validFor) - Specified by:
requestContentDirectUrlin interfaceContentStore
-