@AlfrescoPublicApi
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. See
TimeBasedFileContentUrlProvider
and
VolumeAwareContentUrlProvider
implementations of
FileContentUrlProvider
For example, default 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 | Field and Description |
---|---|
static ContentContext |
NEW_CONTENT_CONTEXT
An empty content context used to retrieve completely new content.
|
static String |
PROTOCOL_DELIMITER
The delimiter that must be found in all URLS, i.e ://
|
Modifier and Type | Method and Description |
---|---|
boolean |
delete(String contentUrl)
Deletes the content at the given URL.
|
boolean |
exists(String contentUrl)
Check for the existence of content in the store.
|
ContentReader |
getReader(String contentUrl)
Get the accessor with which to read from the content at the given URL.
|
String |
getRootLocation()
Get the location where the store is rooted.
|
long |
getSpaceFree()
Calculates the remaning free space in the underlying store.
|
long |
getSpaceTotal()
Calculates the total storage space of the underlying store.
|
ContentWriter |
getWriter(ContentContext context)
Get an accessor with which to write content to a location
within the store.
|
boolean |
isContentUrlSupported(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
getWriter(ContentContext)
static final String PROTOCOL_DELIMITER
boolean isContentUrlSupported(String contentUrl)
contentUrl
- the content URL to checkUnsupportedContentUrlException
when given
this URL.boolean isWriteSupported()
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.
String getRootLocation()
boolean exists(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 contentorg.alfresco.repo.content.UnsupportedContentUrlException
- if the content URL supplied is not supported by the storeContentIOException
- if an IO error occursContentReader.exists()
ContentReader getReader(String contentUrl)
contentUrl
- the path to where the content is locatedorg.alfresco.repo.content.UnsupportedContentUrlException
- if the content URL supplied is not supported by the storeContentIOException
- if an IO error occursexists(String)
,
ContentReader.exists()
,
org.alfresco.repo.content.EmptyContentReader
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.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 useContentIOException
- if an IO error occursContentAccessor.addListener(ContentStreamListener)
,
ContentAccessor.getContentUrl()
boolean delete(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 deleteUnsupportedOperationException
- if the store is unable to perform the actionUnsupportedContentUrlException
- if the content URL supplied is not supported by the storeContentIOException
- if an error occurs
if an IO error occursCopyright © 2005–2019 Alfresco Software. All rights reserved.