|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.alfresco.repo.content.caching.CachingContentStore
public class CachingContentStore
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,
e.g. org.alfresco.enterprise.repo.content.xam.XAMContentStore
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.alfresco.repo.content.ContentStore |
---|
ContentStore.ContentUrlHandler |
Field Summary |
---|
Fields inherited from interface org.alfresco.repo.content.ContentStore |
---|
NEW_CONTENT_CONTEXT, PROTOCOL_DELIMITER |
Constructor Summary | |
---|---|
CachingContentStore()
|
|
CachingContentStore(ContentStore backingStore,
ContentCache cache,
boolean cacheOnInbound)
|
Method Summary | |
---|---|
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. |
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) . |
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 |
setBackingStore(ContentStore backingStore)
|
void |
setCache(ContentCache cache)
|
void |
setCacheOnInbound(boolean cacheOnInbound)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CachingContentStore()
public CachingContentStore(ContentStore backingStore, ContentCache cache, boolean cacheOnInbound)
Method Detail |
---|
public boolean isContentUrlSupported(java.lang.String contentUrl)
ContentStore
isContentUrlSupported
in interface ContentStore
contentUrl
- the content URL to check
UnsupportedContentUrlException
when given
this URL.public boolean isWriteSupported()
ContentStore
isWriteSupported
in interface ContentStore
public long getTotalSize()
getTotalSize
in interface ContentStore
ContentStore.getSpaceFree()
,
ContentStore.getSpaceTotal()
public long getSpaceUsed()
ContentStore
getSpaceUsed
in interface ContentStore
public long getSpaceFree()
ContentStore
NOTE: For efficiency, some implementations may provide a guess.
Implementations should focus on calculating a size value quickly, rather than accurately.
getSpaceFree
in interface ContentStore
public long getSpaceTotal()
ContentStore
NOTE: For efficiency, some implementations may provide a guess.
Implementations should focus on calculating a size value quickly, rather than accurately.
getSpaceTotal
in interface ContentStore
public java.lang.String getRootLocation()
ContentStore
getRootLocation
in interface ContentStore
public 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 ContentStore
contentUrl
- the path to the content
ContentReader.exists()
public org.alfresco.service.cmr.repository.ContentReader getReader(java.lang.String contentUrl)
ContentStore
getReader
in interface ContentStore
contentUrl
- the path to where the content is located
ContentStore.exists(String)
,
ContentReader.exists()
,
EmptyContentReader
public 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 ContentStore
context
- 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)
ContentStore
ContentStore.getWriter(ContentContext)
.
getWriter
in interface ContentStore
ContentStore.getWriter(ContentContext)
public void getUrls(ContentStore.ContentUrlHandler handler) throws org.alfresco.service.cmr.repository.ContentIOException
ContentStore
getUrls
in interface ContentStore
org.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
ContentStore
getUrls
in interface ContentStore
createdAfter
- 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 URL
org.alfresco.service.cmr.repository.ContentIOException
- if an error occurspublic boolean delete(java.lang.String contentUrl)
ContentStore
A delete cannot be forced since it is much better to have the file remain longer than desired rather than deleted prematurely.
delete
in interface ContentStore
contentUrl
- the URL of the content to delete
public java.util.concurrent.locks.ReentrantReadWriteLock readWriteLock(java.lang.String url)
url
-
public void setBackingStore(ContentStore backingStore)
public void setCache(ContentCache cache)
public void setCacheOnInbound(boolean cacheOnInbound)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |