public abstract class AbstractContentStore extends java.lang.Object implements ContentStore
Since content URLs have to be consistent across all stores for reasons of replication and backup, the most important functionality provided is the generation of new content URLs and the checking of existing URLs.
Implementations must override either of the getWriter methods;
AbstractContentStore.getWriter(ContentContext) or AbstractContentStore.getWriterInternal(ContentReader, String).
ContentStore.ContentUrlHandler| Modifier and Type | Field and Description |
|---|---|
protected ContentLimitProvider |
contentLimitProvider |
NEW_CONTENT_CONTEXT, PROTOCOL_DELIMITER| Constructor and Description |
|---|
AbstractContentStore() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
delete(java.lang.String contentUrl)
Override if the derived class supports the operation.
|
boolean |
exists(java.lang.String contentUrl)
Simple implementation that uses the
reader's exists method as its implementation. |
protected org.alfresco.util.Pair |
getContentUrlParts(java.lang.String contentUrl)
Splits the content URL into its component parts as separated by
protocol delimiter. |
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()
Uses
AbstractContentStore.getSpaceUsed(), which is the equivalent method. |
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)
Override to provide an implementation.
|
org.alfresco.service.cmr.repository.ContentWriter |
getWriter(ContentContext context)
An implementation that does some sanity checking before requesting a writer from 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). |
protected org.alfresco.service.cmr.repository.ContentWriter |
getWriterInternal(org.alfresco.service.cmr.repository.ContentReader existingContentReader,
java.lang.String newContentUrl)
Implement to supply a store-specific writer for the given existing content
and optional target content URL.
|
boolean |
isContentUrlSupported(java.lang.String contentUrl)
Override this method to supply a efficient and direct check of the URL supplied.
|
static boolean |
isValidContentUrl(java.lang.String contentUrl)
Checks that the content conforms to the format protocol://identifier
as specified in the contract of the
ContentStore interface. |
void |
setContentLimitProvider(ContentLimitProvider contentLimitProvider) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetReader, isWriteSupportedprotected ContentLimitProvider contentLimitProvider
public static final boolean isValidContentUrl(java.lang.String contentUrl)
ContentStore interface.contentUrl - the content URL to checkprotected org.alfresco.util.Pair getContentUrlParts(java.lang.String contentUrl)
protocol delimiter.contentUrl - the content URL to splitUnsupportedContentUrlException - if the content URL is invalidpublic boolean isContentUrlSupported(java.lang.String contentUrl)
ContentStore.getReader(String)
throws the UnsupportedContentUrlException exception.isContentUrlSupported in interface ContentStorecontentUrl - the content URL to checkUnsupportedContentUrlException when given
this URL.public boolean delete(java.lang.String contentUrl)
delete in interface ContentStorecontentUrl - the URL of the content to deletejava.lang.UnsupportedOperationException - alwayspublic final 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 occursContentStore.getUrls(Date, Date, ContentUrlHandler)public void getUrls(java.util.Date createdAfter,
java.util.Date createdBefore,
ContentStore.ContentUrlHandler handler)
throws org.alfresco.service.cmr.repository.ContentIOException
getUrls 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 URLjava.lang.UnsupportedOperationException - alwaysorg.alfresco.service.cmr.repository.ContentIOException - if an error occursprotected org.alfresco.service.cmr.repository.ContentWriter getWriterInternal(org.alfresco.service.cmr.repository.ContentReader existingContentReader,
java.lang.String newContentUrl)
existingContentReader - a reader onto any content to initialize the new writer withnewContentUrl - an optional target for the new contentUnsupportedContentUrlException - 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 occurspublic org.alfresco.service.cmr.repository.ContentWriter getWriter(ContentContext context)
AbstractContentStore.getWriterInternal(ContentReader, String) must be supplied.getWriter in interface ContentStorecontext - the context of content.AbstractContentStore.getWriterInternal(ContentReader, String)public final org.alfresco.service.cmr.repository.ContentWriter getWriter(org.alfresco.service.cmr.repository.ContentReader existingContentReader,
java.lang.String newContentUrl)
ContentStoreContentStore.getWriter(ContentContext).getWriter in interface ContentStoreContentContext,
ContentStore.getWriter(ContentContext)public boolean exists(java.lang.String contentUrl)
reader's exists method as its implementation.
Override this method if a more efficient implementation is possible.exists in interface ContentStorecontentUrl - the path to the contentContentReader.exists()public final long getTotalSize()
AbstractContentStore.getSpaceUsed(), which is the equivalent method. This method is now
final in order to catch any implementations that should switch over to AbstractContentStore.getSpaceUsed().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()
getRootLocation in interface ContentStorepublic void setContentLimitProvider(ContentLimitProvider contentLimitProvider)
Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.