public interface ContentStore
readers and
writers.
Implementations of this interface should be soley responsible for
providing persistence and retrieval of the content against a
content URL.
Content URLs must consist of a prefix or protocol followed by an
implementation-specific identifier. For example, the content URL format
for file stores is store://year/month/day/hour/minute/GUID.bin
Where the store cannot handle a particular content URL request, the
UnsupportedContentUrlException must be generated. This will allow
various implementations to provide fallback code to other stores where
possible.
Where a store cannot serve a particular request because the functionality
is just not available, the UnsupportedOperationException should
be thrown. Once again, there may be fallback handling provided for these
situations.
| Modifier and Type | Interface and Description |
|---|---|
static interface |
ContentStore.ContentUrlHandler
Iterface for to use during iteration over content URLs.
|
| Modifier and Type | Field and Description |
|---|---|
static ContentContext |
NEW_CONTENT_CONTEXT
An empty content context used to retrieve completely new content.
|
static java.lang.String |
PROTOCOL_DELIMITER
The delimiter that must be found in all URLS, i.e ://
|
| 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.
|
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()
Deprecated.
This method takes too long to complete in many situations (see ALF-12410).
|
long |
getTotalSize()
Deprecated.
Since 3.3.3 use
ContentStore.getSpaceUsed(). |
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)
Deprecated.
|
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.
|
static final ContentContext NEW_CONTENT_CONTEXT
static final java.lang.String PROTOCOL_DELIMITER
boolean isContentUrlSupported(java.lang.String contentUrl)
contentUrl - the content URL to checkUnsupportedContentUrlException when given
this URL.boolean isWriteSupported()
long getTotalSize()
ContentStore.getSpaceUsed().long getSpaceUsed()
long getSpaceFree()
NOTE: For efficiency, some implementations may provide a guess.
Implementations should focus on calculating a size value quickly, rather than accurately.
long getSpaceTotal()
NOTE: For efficiency, some implementations may provide a guess.
Implementations should focus on calculating a size value quickly, rather than accurately.
java.lang.String getRootLocation()
boolean exists(java.lang.String contentUrl)
The implementation of this may be more efficient than first getting a
reader to check for existence, although
that check should also be performed.
contentUrl - the path to the contentUnsupportedContentUrlException - if the content URL supplied is not supported by the storeorg.alfresco.service.cmr.repository.ContentIOException - if an IO error occursContentReader.exists()org.alfresco.service.cmr.repository.ContentReader getReader(java.lang.String contentUrl)
contentUrl - the path to where the content is locatedUnsupportedContentUrlException - if the content URL supplied is not supported by the storeorg.alfresco.service.cmr.repository.ContentIOException - if an IO error occursContentStore.exists(String),
ContentReader.exists(),
EmptyContentReaderorg.alfresco.service.cmr.repository.ContentWriter getWriter(ContentContext context)
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.
context - the context of content.java.lang.UnsupportedOperationException - if the store is unable to provide the informationUnsupportedContentUrlException - if the content URL supplied is not supported by the storeContentExistsException - if the content URL is already in useorg.alfresco.service.cmr.repository.ContentIOException - if an IO error occurs#getWriteSupport(),
ContentAccessor.addListener(ContentStreamListener),
ContentAccessor.getContentUrl()org.alfresco.service.cmr.repository.ContentWriter getWriter(org.alfresco.service.cmr.repository.ContentReader existingContentReader,
java.lang.String newContentUrl)
ContentStore.getWriter(ContentContext).void getUrls(ContentStore.ContentUrlHandler handler) throws org.alfresco.service.cmr.repository.ContentIOException
org.alfresco.service.cmr.repository.ContentIOException - if an IO error occursjava.lang.UnsupportedOperationException - if the store is unable to provide the information#getUrls(Date, Date)void getUrls(java.util.Date createdAfter,
java.util.Date createdBefore,
ContentStore.ContentUrlHandler handler)
throws org.alfresco.service.cmr.repository.ContentIOException
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 URLorg.alfresco.service.cmr.repository.ContentIOException - if an error occursjava.lang.UnsupportedOperationException - if the store is unable to provide the informationboolean delete(java.lang.String contentUrl)
A delete cannot be forced since it is much better to have the file remain longer than desired rather than deleted prematurely.
contentUrl - the URL of the content to deletejava.lang.UnsupportedOperationException - if the store is unable to perform the actionUnsupportedContentUrlException - if the content URL supplied is not supported by the storeorg.alfresco.service.cmr.repository.ContentIOException - if an error occurs
if an IO error occursCopyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.