|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.alfresco.repo.content.AbstractContentStore
org.alfresco.repo.content.replication.ReplicatingContentStore
public class ReplicatingContentStore
Replicating Content Store
A content store implementation that is able to replicate content between stores.
Content is not persisted by this store, but rather it relies on any number of
child stores
to provide access to
content readers and writers.
The order in which the stores appear in the list of stores participating is important. The first store in the list is known as the primary store. When the replicator goes to fetch content, the stores are searched from first to last. The stores should therefore be arranged in order of speed.
It supports the notion of inbound and/or outbound replication, both of which can be operational at the same time. Outbound Replication
When this is enabled, then the primary store is used for writes. When the content write completes (i.e. the write channel is closed) then the content is synchronously copied to all other stores. The write is therefore slowed down, but the content replication will occur in-transaction.
The outboundThreadPoolExecutor
property to enable asynchronous replication.
With asynchronous replication, there is always a risk that a failure
occurs during the replication. Depending on the configuration of the server,
further action may need to be taken to rectify the problem manually.
Inbound Replication
This can be used to lazily replicate content onto the primary store. When
content can't be found in the primary store, the other stores are checked
in order. If content is found, then it is copied into the local store
before being returned. Subsequent accesses will use the primary store.
This should be used where the secondary stores are much slower, such as in
the case of a store against some kind of archival mechanism.
Content is written to the primary store only. The other stores are only used to retrieve content and the primary store is not updated with the content.
Nested Class Summary | |
---|---|
static class |
ReplicatingContentStore.ReplicatingWriteListener
Replicates the content upon stream closure. |
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 | |
---|---|
ReplicatingContentStore()
Default constructor set inbound = false and outbound = true ; |
Method Summary | |
---|---|
boolean |
delete(java.lang.String contentUrl)
Performs a delete on the local store and if outbound replication is on, propogates the delete to the other stores too. |
org.alfresco.service.cmr.repository.ContentReader |
getReader(java.lang.String contentUrl)
Forwards the call directly to the first store in the list of stores. |
void |
getUrls(java.util.Date createdAfter,
java.util.Date createdBefore,
ContentStore.ContentUrlHandler handler)
Iterates over results as given by the primary store and all secondary stores. |
org.alfresco.service.cmr.repository.ContentWriter |
getWriter(ContentContext ctx)
An implementation that does some sanity checking before requesting a writer from the store. |
boolean |
isContentUrlSupported(java.lang.String contentUrl)
Override this method to supply a efficient and direct check of the URL supplied. |
boolean |
isWriteSupported()
Check if the store supports write requests. |
void |
setInbound(boolean inbound)
Set whether or not this component should replicate content to the primary store if not found. |
void |
setOutbound(boolean outbound)
Set whether or not this component should replicate content to all stores as it is written. |
void |
setOutboundThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor outboundThreadPoolExecutor)
Set the thread pool executer |
void |
setPrimaryStore(ContentStore primaryStore)
Set the primary store that content will be replicated to or from |
void |
setRetryingTransactionHelper(RetryingTransactionHelper helper)
Set the retrying transaction helper. |
void |
setSecondaryStores(java.util.List secondaryStores)
Set the secondary stores that this component will replicate to or from |
void |
setTransactionService(TransactionService transactionService)
Deprecated. Replaced with ReplicatingContentStore.setRetryingTransactionHelper(RetryingTransactionHelper) |
Methods inherited from class org.alfresco.repo.content.AbstractContentStore |
---|
exists, getContentUrlParts, getRootLocation, getSpaceFree, getSpaceTotal, getSpaceUsed, getTotalSize, getUrls, getWriter, getWriterInternal, isValidContentUrl |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ReplicatingContentStore()
inbound = false
and outbound = true
;
Method Detail |
---|
public void setTransactionService(TransactionService transactionService)
ReplicatingContentStore.setRetryingTransactionHelper(RetryingTransactionHelper)
public void setRetryingTransactionHelper(RetryingTransactionHelper helper)
public void setPrimaryStore(ContentStore primaryStore)
primaryStore
- the primary content storepublic void setSecondaryStores(java.util.List secondaryStores)
stores
- a list of stores to replicate to or frompublic void setInbound(boolean inbound)
inbound
- true to pull content onto the primary store when found
on one of the other storespublic void setOutbound(boolean outbound)
outbound
- true to enable synchronous replication to all storespublic void setOutboundThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor outboundThreadPoolExecutor)
outboundThreadPoolExecutor
- set this to have the synchronization occur in a separate
threadpublic boolean isWriteSupported()
ContentStore
public boolean isContentUrlSupported(java.lang.String contentUrl)
AbstractContentStore
ContentStore.getReader(String)
throws the UnsupportedContentUrlException
exception.
isContentUrlSupported
in interface ContentStore
isContentUrlSupported
in class AbstractContentStore
contentUrl
- the content URL to check
public org.alfresco.service.cmr.repository.ContentReader getReader(java.lang.String contentUrl) throws org.alfresco.service.cmr.repository.ContentIOException
contentUrl
- the path to where the content is located
org.alfresco.service.cmr.repository.ContentIOException
- if an IO error occursContentStore.exists(String)
,
ContentReader.exists()
,
EmptyContentReader
public org.alfresco.service.cmr.repository.ContentWriter getWriter(ContentContext ctx)
AbstractContentStore
AbstractContentStore.getWriterInternal(ContentReader, String)
must be supplied.
getWriter
in interface ContentStore
getWriter
in class AbstractContentStore
ctx
- the context of content.
AbstractContentStore.getWriterInternal(ContentReader, String)
public boolean delete(java.lang.String contentUrl) throws org.alfresco.service.cmr.repository.ContentIOException
delete
in interface ContentStore
delete
in class AbstractContentStore
contentUrl
- the URL of the content to delete
org.alfresco.service.cmr.repository.ContentIOException
- if an error occurs
if an IO error occurspublic void getUrls(java.util.Date createdAfter, java.util.Date createdBefore, ContentStore.ContentUrlHandler handler) throws org.alfresco.service.cmr.repository.ContentIOException
getUrls
in interface ContentStore
getUrls
in class AbstractContentStore
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 occurs
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |