Package org.alfresco.repo.content
Class AbstractContentStore
java.lang.Object
org.alfresco.repo.content.AbstractContentStore
- All Implemented Interfaces:
ContentStore
- Direct Known Subclasses:
AggregatingContentStore,FileContentStore,HttpAlfrescoStore
@AlfrescoPublicApi
public abstract class AbstractContentStore
extends Object
implements ContentStore
Base class providing support for different types of content stores.
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;
getWriter(ContentContext) or getWriterInternal(ContentReader, String).
- Author:
- Derek Hulley
- See Also:
-
Field Summary
FieldsFields inherited from interface org.alfresco.repo.content.ContentStore
NEW_CONTENT_CONTEXT, PROTOCOL_DELIMITER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanOverride if the derived class supports the operation.booleanSimple implementation that uses thereader's existsmethod as its implementation.getContentUrlParts(String contentUrl) Splits the content URL into its component parts as separated byprotocol delimiter.longlonggetWriter(ContentContext context) An implementation that does some sanity checking before requesting a writer from the store.protected ContentWritergetWriterInternal(ContentReader existingContentReader, String newContentUrl) Implement to supply a store-specific writer for the given existing content and optional target content URL.booleanisContentUrlSupported(String contentUrl) Override this method to supply a efficient and direct check of the URL supplied.static final booleanisValidContentUrl(String contentUrl) Checks that the content conforms to the format protocol://identifier as specified in the contract of theContentStoreinterface.voidsetContentLimitProvider(ContentLimitProvider contentLimitProvider) An object that prevents abuse of the underlying store(s)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.alfresco.repo.content.ContentStore
getReader, getStorageProperties, isContentDirectUrlEnabled, isContentDirectUrlEnabled, isWriteSupported, requestContentDirectUrl, requestContentDirectUrl, requestContentDirectUrl, requestContentDirectUrl, requestRestoreContentFromArchive, requestSendContentToArchive
-
Field Details
-
contentLimitProvider
-
-
Constructor Details
-
AbstractContentStore
public AbstractContentStore()
-
-
Method Details
-
isValidContentUrl
Checks that the content conforms to the format protocol://identifier as specified in the contract of theContentStoreinterface.- Parameters:
contentUrl- the content URL to check- Returns:
- Returns true if the content URL is valid
- Since:
- 2.1
-
setContentLimitProvider
An object that prevents abuse of the underlying store(s) -
getContentUrlParts
Splits the content URL into its component parts as separated byprotocol delimiter.- Parameters:
contentUrl- the content URL to split- Returns:
- Returns the protocol and identifier portions of the content URL, both of which will not be null
- Throws:
UnsupportedContentUrlException- if the content URL is invalid- Since:
- 2.1
-
isContentUrlSupported
Override this method to supply a efficient and direct check of the URL supplied. The default implementation checks whetherContentStore.getReader(String)throws theUnsupportedContentUrlExceptionexception.- Specified by:
isContentUrlSupportedin interfaceContentStore- Since:
- 2.1
-
delete
Override if the derived class supports the operation.- Specified by:
deletein interfaceContentStore- Throws:
UnsupportedOperationException- always- Since:
- 2.1
-
getWriterInternal
protected ContentWriter getWriterInternal(ContentReader existingContentReader, String newContentUrl) Implement to supply a store-specific writer for the given existing content and optional target content URL.- Parameters:
existingContentReader- a reader onto any content to initialize the new writer withnewContentUrl- an optional target for the new content- Throws:
UnsupportedContentUrlException- if the content URL supplied is not supported by the storeContentExistsException- if the content URL is already in useContentIOException- if an IO error occurs- Since:
- 2.1
-
getWriter
An implementation that does some sanity checking before requesting a writer from the store. If this method is not overridden, then an implementation ofgetWriterInternal(ContentReader, String)must be supplied.- Specified by:
getWriterin interfaceContentStore- Since:
- 2.1
- See Also:
-
exists
Simple implementation that uses thereader's existsmethod as its implementation. Override this method if a more efficient implementation is possible.- Specified by:
existsin interfaceContentStore
-
getSpaceFree
public long getSpaceFree()- Specified by:
getSpaceFreein interfaceContentStore- Returns:
- Returns -1 always
-
getSpaceTotal
public long getSpaceTotal()- Specified by:
getSpaceTotalin interfaceContentStore- Returns:
- Returns -1 always
-
getRootLocation
- Specified by:
getRootLocationin interfaceContentStore- Returns:
- Returns a '.' (period) always
-