public class CachingContentStore extends java.lang.Object implements ContentStore, org.springframework.context.ApplicationEventPublisherAware, org.springframework.beans.factory.BeanNameAware
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,
e.g. org.alfresco.enterprise.repo.content.xam.XAMContentStore
ContentStore.ContentUrlHandlerNEW_CONTENT_CONTEXT, PROTOCOL_DELIMITER| Constructor and Description |
|---|
CachingContentStore() |
CachingContentStore(ContentStore backingStore,
ContentCache cache,
boolean cacheOnInbound) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
delete(java.lang.String contentUrl)
Deletes the content at the given URL.
|
boolean |
exists(java.lang.String contentUrl)
Check for the existence of content in the store.
|
java.lang.String |
getBackingStoreDescription() |
java.lang.String |
getBackingStoreType() |
java.lang.String |
getBeanName() |
ContentCache |
getCache() |
int |
getMaxCacheTries() |
QuotaManagerStrategy |
getQuota() |
org.alfresco.service.cmr.repository.ContentReader |
getReader(java.lang.String contentUrl)
Get the accessor with which to read from the content at the given URL.
|
java.lang.String |
getRootLocation()
Get the location where the store is rooted.
|
long |
getSpaceFree()
Calcualates the remaing free space in the underlying store.
|
long |
getSpaceTotal()
Calculates the total storage space of the underlying store.
|
long |
getSpaceUsed()
Calculates the total size of stored content, excluding any other data in the underlying
storage.
|
long |
getTotalSize() |
void |
getUrls(ContentStore.ContentUrlHandler handler)
Get all URLs for the store, regardless of creation time.
|
void |
getUrls(java.util.Date createdAfter,
java.util.Date createdBefore,
ContentStore.ContentUrlHandler handler)
Get a set of all content URLs in the store.
|
org.alfresco.service.cmr.repository.ContentWriter |
getWriter(ContentContext context)
Get an accessor with which to write content to a location
within the store.
|
org.alfresco.service.cmr.repository.ContentWriter |
getWriter(org.alfresco.service.cmr.repository.ContentReader existingContentReader,
java.lang.String newContentUrl)
Shortcut method to
ContentStore.getWriter(ContentContext). |
void |
init()
Initialisation method, should be called once the CachingContentStore has been constructed.
|
boolean |
isCacheOnInbound() |
boolean |
isContentUrlSupported(java.lang.String contentUrl)
Check if the content URL format is supported by the store.
|
boolean |
isWriteSupported()
Check if the store supports write requests.
|
java.util.concurrent.locks.ReentrantReadWriteLock |
readWriteLock(java.lang.String url)
Get a ReentrantReadWriteLock for a given URL.
|
void |
setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) |
void |
setBackingStore(ContentStore backingStore) |
void |
setBeanName(java.lang.String name) |
void |
setCache(ContentCache cache) |
void |
setCacheOnInbound(boolean cacheOnInbound) |
void |
setMaxCacheTries(int maxCacheTries) |
void |
setQuota(QuotaManagerStrategy quota)
Sets the QuotaManagerStrategy that will be used.
|
public CachingContentStore()
public CachingContentStore(ContentStore backingStore, ContentCache cache, boolean cacheOnInbound)
public void init()
public boolean isContentUrlSupported(java.lang.String contentUrl)
ContentStoreisContentUrlSupported in interface ContentStorecontentUrl - the content URL to checkUnsupportedContentUrlException when given
this URL.public boolean isWriteSupported()
ContentStoreisWriteSupported in interface ContentStorepublic long getTotalSize()
getTotalSize in interface ContentStoreContentStore.getSpaceFree(),
ContentStore.getSpaceTotal()public long getSpaceUsed()
ContentStoregetSpaceUsed in interface ContentStorepublic long getSpaceFree()
ContentStoreNOTE: For efficiency, some implementations may provide a guess.
Implementations should focus on calculating a size value quickly, rather than accurately.
getSpaceFree in interface ContentStorepublic long getSpaceTotal()
ContentStoreNOTE: For efficiency, some implementations may provide a guess.
Implementations should focus on calculating a size value quickly, rather than accurately.
getSpaceTotal in interface ContentStorepublic java.lang.String getRootLocation()
ContentStoregetRootLocation in interface ContentStorepublic boolean exists(java.lang.String contentUrl)
ContentStore
The implementation of this may be more efficient than first getting a
reader to check for existence, although
that check should also be performed.
exists in interface ContentStorecontentUrl - the path to the contentContentReader.exists()public org.alfresco.service.cmr.repository.ContentReader getReader(java.lang.String contentUrl)
ContentStoregetReader in interface ContentStorecontentUrl - the path to where the content is locatedContentStore.exists(String),
ContentReader.exists(),
EmptyContentReaderpublic org.alfresco.service.cmr.repository.ContentWriter getWriter(ContentContext context)
ContentStore
The store will ensure that the new content URL will
be valid for all subsequent read attempts.
By supplying a reader to existing content, the store implementation may
enable random access. The store implementation
can enable this by copying the existing content into the new location
before supplying a writer onto the new content.
getWriter in interface ContentStorecontext - the context of content.#getWriteSupport(),
ContentAccessor.addListener(ContentStreamListener),
ContentAccessor.getContentUrl()public org.alfresco.service.cmr.repository.ContentWriter getWriter(org.alfresco.service.cmr.repository.ContentReader existingContentReader,
java.lang.String newContentUrl)
ContentStoreContentStore.getWriter(ContentContext).getWriter in interface ContentStoreContentStore.getWriter(ContentContext)public void getUrls(ContentStore.ContentUrlHandler handler) throws org.alfresco.service.cmr.repository.ContentIOException
ContentStoregetUrls in interface ContentStoreorg.alfresco.service.cmr.repository.ContentIOException - if an IO error occurs#getUrls(Date, Date)public void getUrls(java.util.Date createdAfter,
java.util.Date createdBefore,
ContentStore.ContentUrlHandler handler)
throws org.alfresco.service.cmr.repository.ContentIOException
ContentStoregetUrls in interface ContentStorecreatedAfter - all URLs returned must have been created after this date. May be null.createdBefore - all URLs returned must have been created before this date. May be null.handler - the callback that will passed each URLorg.alfresco.service.cmr.repository.ContentIOException - if an error occurspublic boolean delete(java.lang.String contentUrl)
ContentStoreA delete cannot be forced since it is much better to have the file remain longer than desired rather than deleted prematurely.
delete in interface ContentStorecontentUrl - the URL of the content to deletepublic java.util.concurrent.locks.ReentrantReadWriteLock readWriteLock(java.lang.String url)
url - public void setBackingStore(ContentStore backingStore)
public java.lang.String getBackingStoreType()
public java.lang.String getBackingStoreDescription()
public void setCache(ContentCache cache)
public ContentCache getCache()
public void setCacheOnInbound(boolean cacheOnInbound)
public boolean isCacheOnInbound()
public int getMaxCacheTries()
public void setMaxCacheTries(int maxCacheTries)
public void setQuota(QuotaManagerStrategy quota)
quota - public QuotaManagerStrategy getQuota()
public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
setApplicationEventPublisher in interface org.springframework.context.ApplicationEventPublisherAwarepublic void setBeanName(java.lang.String name)
setBeanName in interface org.springframework.beans.factory.BeanNameAwarepublic java.lang.String getBeanName()
Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.