Package org.alfresco.repo.transfer
Class RepoTransferReceiverImpl
- java.lang.Object
-
- org.alfresco.repo.transfer.RepoTransferReceiverImpl
-
- All Implemented Interfaces:
ContentServicePolicies.OnContentUpdatePolicy,NodeServicePolicies.BeforeDeleteNodePolicy,NodeServicePolicies.OnCreateChildAssociationPolicy,NodeServicePolicies.OnMoveNodePolicy,NodeServicePolicies.OnRestoreNodePolicy,AssociationPolicy,ClassPolicy,Policy,TransferReceiver
public class RepoTransferReceiverImpl extends java.lang.Object implements TransferReceiver, NodeServicePolicies.OnCreateChildAssociationPolicy, NodeServicePolicies.BeforeDeleteNodePolicy, NodeServicePolicies.OnRestoreNodePolicy, NodeServicePolicies.OnMoveNodePolicy, ContentServicePolicies.OnContentUpdatePolicy
The Repo Transfer Receiver is the "Back-End" for transfer subsystem.Provides the implementation of the transfer commands on the destination repository.
Provides callback handlers for Aliens and Transferred Aspects.
Calls transfer policies.
Co-ordinates locking and logging as the transfer progresses.
- Author:
- brian
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classRepoTransferReceiverImpl.AsyncCommitCommandThis embedded class is used to push requests for asynchronous commits onto a different thread-
Nested classes/interfaces inherited from interface org.alfresco.repo.policy.Policy
Policy.Arg
-
-
Field Summary
-
Fields inherited from interface org.alfresco.repo.content.ContentServicePolicies.OnContentUpdatePolicy
QNAME
-
Fields inherited from interface org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy
QNAME
-
Fields inherited from interface org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy
QNAME
-
Fields inherited from interface org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy
QNAME
-
Fields inherited from interface org.alfresco.repo.node.NodeServicePolicies.OnRestoreNodePolicy
QNAME
-
-
Constructor Summary
Constructors Constructor Description RepoTransferReceiverImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbeforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef deletedNodeRef)When an alien node is deleted the it may be the last alien invadervoidcancel(java.lang.String transferId)Abortorg.alfresco.repo.transfer.RepoTransferReceiverImpl.LockcheckLock(java.lang.String transferId)voidcommit(java.lang.String transferId)CommitvoidcommitAsync(java.lang.String transferId)Commit asynchronouslyvoidend(java.lang.String transferId)Asks the receiver to end (and clean up) the specified transfervoidgenerateRequsite(java.lang.String transferId, java.io.OutputStream out)Generate the requsiteAlienProcessorgetAlienProcessor()DescriptorServicegetDescriptorService()JobLockServicegetJobLockService()longgetLockRefreshTime()intgetLockRetryCount()longgetLockRetryWait()longgetLockTimeOut()PolicyComponentgetPolicyComponent()TransferProgressMonitorgetProgressMonitor()RuleServicegetRuleService()Get the rule servicejava.io.FilegetStagingFolder(java.lang.String transferId)TransferProgressgetStatus(java.lang.String transferId)org.alfresco.service.cmr.repository.NodeRefgetTempFolder(java.lang.String transferId)java.io.InputStreamgetTransferReport(java.lang.String transferId)get the transfer report for the specified transferTransferVersionCheckergetTransferVersionChecker()TransferVersiongetVersion()Get the version that we are transfering to.voidinit()voidonContentUpdate(org.alfresco.service.cmr.repository.NodeRef nodeRef, boolean newContent)CopyBehaviourCallbackonCopyAlien(org.alfresco.service.namespace.QName classRef, CopyDetails copyDetails)When an alien node is copied, don't copy the alien aspect.CopyBehaviourCallbackonCopyTransferred(org.alfresco.service.namespace.QName classRef, CopyDetails copyDetails)When a transferred node is copied, don't copy the transferred aspect.voidonCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef, boolean isNewNode)When a new node is created as a child of a Transferred or Alien node then the new node needs to be marked as an alien.voidonMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef oldChildAssocRef, org.alfresco.service.cmr.repository.ChildAssociationRef newChildAssocRef)When an alien node is moved it may un-invade its old location and invade a new location.voidonRestoreNode(org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef)When a transferred node is restored it may be a new invader or it may no longer be an invader.voidprepare(java.lang.String transferId)PreparevoidsaveContent(java.lang.String transferId, java.lang.String contentFileId, java.io.InputStream contentStream)Save a content itemvoidsaveSnapshot(java.lang.String transferId, java.io.InputStream openStream)Store the specified snapshot file into the transfer staging area.voidsetActionService(ActionService actionService)voidsetAlienProcessor(AlienProcessor alienProcessor)voidsetBehaviourFilter(BehaviourFilter behaviourFilter)voidsetDescriptorService(DescriptorService descriptorService)voidsetInboundTransferRecordsPath(java.lang.String inboundTransferRecordsPath)voidsetJobLockService(JobLockService jobLockService)voidsetLockRefreshTime(long lockRefreshTime)voidsetLockRetryCount(int lockRetryCount)voidsetLockRetryWait(long lockRetryWait)voidsetLockTimeOut(long lockTimeOut)voidsetManifestProcessorFactory(ManifestProcessorFactory manifestProcessorFactory)voidsetNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)voidsetNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)voidsetPolicyComponent(PolicyComponent policyComponent)voidsetProgressMonitor(TransferProgressMonitor progressMonitor)voidsetRootStagingDirectory(java.lang.String rootStagingDirectory)voidsetRuleService(RuleService ruleService)Set the ruleServicevoidsetSearchService(org.alfresco.service.cmr.search.SearchService searchService)voidsetSingletonCache(org.alfresco.repo.cache.SimpleCache<java.lang.String,org.alfresco.service.cmr.repository.NodeRef> singletonCache)voidsetTenantService(org.alfresco.repo.tenant.TenantService tenantService)voidsetTransactionService(TransactionService transactionService)voidsetTransferLockFolderPath(java.lang.String transferLockFolderPath)voidsetTransferRootNode(java.lang.String rootFileSystem)set the root node for the file system receivervoidsetTransferTempFolderPath(java.lang.String transferTempFolderPath)voidsetTransferVersionChecker(TransferVersionChecker transferVersionChecker)java.lang.Stringstart(java.lang.String fromRepositoryId, boolean transferToSelf, TransferVersion fromVersion)Asks the receiver to setup a new transfer.
-
-
-
Method Detail
-
init
public void init()
-
getStagingFolder
public java.io.File getStagingFolder(java.lang.String transferId)
- Specified by:
getStagingFolderin interfaceTransferReceiver- Parameters:
transferId- String- Returns:
- File
-
getTempFolder
public org.alfresco.service.cmr.repository.NodeRef getTempFolder(java.lang.String transferId)
- Specified by:
getTempFolderin interfaceTransferReceiver- Parameters:
transferId- String- Returns:
- NodeRef
-
start
public java.lang.String start(java.lang.String fromRepositoryId, boolean transferToSelf, TransferVersion fromVersion)Description copied from interface:TransferReceiverAsks the receiver to setup a new transfer.- Specified by:
startin interfaceTransferReceiver- Parameters:
fromRepositoryId- the repositoryId of the sending systemtransferToSelf- are transfers to the same repository allowed?fromVersion- the version sending- Returns:
- The identifier of the new transfer
-
end
public void end(java.lang.String transferId)
Description copied from interface:TransferReceiverAsks the receiver to end (and clean up) the specified transfer- Specified by:
endin interfaceTransferReceiver- Parameters:
transferId- The transfer to end
-
cancel
public void cancel(java.lang.String transferId) throws TransferExceptionDescription copied from interface:TransferReceiverAbort- Specified by:
cancelin interfaceTransferReceiver- Parameters:
transferId- String- Throws:
TransferException
-
prepare
public void prepare(java.lang.String transferId) throws TransferExceptionDescription copied from interface:TransferReceiverPrepare- Specified by:
preparein interfaceTransferReceiver- Parameters:
transferId- String- Throws:
TransferException
-
checkLock
public org.alfresco.repo.transfer.RepoTransferReceiverImpl.Lock checkLock(java.lang.String transferId) throws TransferException- Throws:
TransferException
-
saveSnapshot
public void saveSnapshot(java.lang.String transferId, java.io.InputStream openStream) throws TransferExceptionDescription copied from interface:TransferReceiverStore the specified snapshot file into the transfer staging area. The specified transfer must currently be the holder of the transfer lock, otherwise an exception is thrown. This operation does not close the supplied stream, so the caller must do it as appropriate. The caller should assume that the supplied stream has been fully read when this operation returns.- Specified by:
saveSnapshotin interfaceTransferReceiver- Parameters:
transferId- The identifier of the transfer with which this snapshot is associatedopenStream- The open stream that holds the snapshot file.- Throws:
TransferException- If an error occurs while saving the snapshot file.
-
saveContent
public void saveContent(java.lang.String transferId, java.lang.String contentFileId, java.io.InputStream contentStream) throws TransferExceptionDescription copied from interface:TransferReceiverSave a content item- Specified by:
saveContentin interfaceTransferReceiver- Parameters:
transferId- StringcontentFileId- StringcontentStream- InputStream- Throws:
TransferException
-
commitAsync
public void commitAsync(java.lang.String transferId)
Description copied from interface:TransferReceiverCommit asynchronously- Specified by:
commitAsyncin interfaceTransferReceiver- Parameters:
transferId- String
-
commit
public void commit(java.lang.String transferId) throws TransferExceptionDescription copied from interface:TransferReceiverCommit- Specified by:
commitin interfaceTransferReceiver- Parameters:
transferId- String- Throws:
TransferException
-
getStatus
public TransferProgress getStatus(java.lang.String transferId) throws TransferException
- Specified by:
getStatusin interfaceTransferReceiver- Parameters:
transferId- String- Returns:
- the trabsfer progress
- Throws:
TransferException
-
setSearchService
public void setSearchService(org.alfresco.service.cmr.search.SearchService searchService)
- Parameters:
searchService- the searchService to set
-
setTransactionService
public void setTransactionService(TransactionService transactionService)
- Parameters:
transactionService- the transactionService to set
-
setTenantService
public void setTenantService(org.alfresco.repo.tenant.TenantService tenantService)
-
setSingletonCache
public void setSingletonCache(org.alfresco.repo.cache.SimpleCache<java.lang.String,org.alfresco.service.cmr.repository.NodeRef> singletonCache)
-
setTransferLockFolderPath
public void setTransferLockFolderPath(java.lang.String transferLockFolderPath)
- Parameters:
transferLockFolderPath- the transferLockFolderPath to set
-
setTransferTempFolderPath
public void setTransferTempFolderPath(java.lang.String transferTempFolderPath)
- Parameters:
transferTempFolderPath- the transferTempFolderPath to set
-
setRootStagingDirectory
public void setRootStagingDirectory(java.lang.String rootStagingDirectory)
- Parameters:
rootStagingDirectory- the rootTransferFolder to set
-
setInboundTransferRecordsPath
public void setInboundTransferRecordsPath(java.lang.String inboundTransferRecordsPath)
- Parameters:
inboundTransferRecordsPath- the inboundTransferRecordsPath to set
-
setNodeService
public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
- Parameters:
nodeService- the nodeService to set
-
setManifestProcessorFactory
public void setManifestProcessorFactory(ManifestProcessorFactory manifestProcessorFactory)
- Parameters:
manifestProcessorFactory- the manifestProcessorFactory to set
-
setBehaviourFilter
public void setBehaviourFilter(BehaviourFilter behaviourFilter)
- Parameters:
behaviourFilter- the behaviourFilter to set
-
getProgressMonitor
public TransferProgressMonitor getProgressMonitor()
- Specified by:
getProgressMonitorin interfaceTransferReceiver- Returns:
- the progressMonitor
-
setProgressMonitor
public void setProgressMonitor(TransferProgressMonitor progressMonitor)
- Parameters:
progressMonitor- the progressMonitor to set
-
setActionService
public void setActionService(ActionService actionService)
-
setRuleService
public void setRuleService(RuleService ruleService)
Set the ruleService- Parameters:
ruleService- the ruleService to set
-
getRuleService
public RuleService getRuleService()
Get the rule service- Returns:
- the rule service
-
setNamespaceService
public void setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)
-
generateRequsite
public void generateRequsite(java.lang.String transferId, java.io.OutputStream out) throws TransferExceptionGenerate the requsite- Specified by:
generateRequsitein interfaceTransferReceiverout- an open stream to receive the requisite- Throws:
TransferException
-
getTransferReport
public java.io.InputStream getTransferReport(java.lang.String transferId)
Description copied from interface:TransferReceiverget the transfer report for the specified transfer- Specified by:
getTransferReportin interfaceTransferReceiver- Parameters:
transferId- String
-
setPolicyComponent
public void setPolicyComponent(PolicyComponent policyComponent)
-
getPolicyComponent
public PolicyComponent getPolicyComponent()
-
onCreateChildAssociation
public void onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef, boolean isNewNode)When a new node is created as a child of a Transferred or Alien node then the new node needs to be marked as an alien.Then the tree needs to be walked upwards to mark all parent transferred nodes as alien.
- Specified by:
onCreateChildAssociationin interfaceNodeServicePolicies.OnCreateChildAssociationPolicy- Parameters:
childAssocRef- the child association that has been createdisNewNode- true if the node is new or false if the node is being linked in
-
beforeDeleteNode
public void beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef deletedNodeRef)
When an alien node is deleted the it may be the last alien invaderWalk the tree checking the invasion status!
- Specified by:
beforeDeleteNodein interfaceNodeServicePolicies.BeforeDeleteNodePolicy- Parameters:
deletedNodeRef- the node reference
-
onRestoreNode
public void onRestoreNode(org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef)
When a transferred node is restored it may be a new invader or it may no longer be an invader.Walk the tree checking the invasion status!
- Specified by:
onRestoreNodein interfaceNodeServicePolicies.OnRestoreNodePolicy- Parameters:
childAssocRef- the newly created child association reference
-
onMoveNode
public void onMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef oldChildAssocRef, org.alfresco.service.cmr.repository.ChildAssociationRef newChildAssocRef)When an alien node is moved it may un-invade its old location and invade a new location. The node may also cease to be alien.- Specified by:
onMoveNodein interfaceNodeServicePolicies.OnMoveNodePolicy- Parameters:
oldChildAssocRef- the child association reference prior to the movenewChildAssocRef- the child association reference after the move
-
onCopyTransferred
public CopyBehaviourCallback onCopyTransferred(org.alfresco.service.namespace.QName classRef, CopyDetails copyDetails)
When a transferred node is copied, don't copy the transferred aspect.
-
onCopyAlien
public CopyBehaviourCallback onCopyAlien(org.alfresco.service.namespace.QName classRef, CopyDetails copyDetails)
When an alien node is copied, don't copy the alien aspect.
-
setDescriptorService
public void setDescriptorService(DescriptorService descriptorService)
-
getDescriptorService
public DescriptorService getDescriptorService()
-
setAlienProcessor
public void setAlienProcessor(AlienProcessor alienProcessor)
-
getAlienProcessor
public AlienProcessor getAlienProcessor()
-
onContentUpdate
public void onContentUpdate(org.alfresco.service.cmr.repository.NodeRef nodeRef, boolean newContent)- Specified by:
onContentUpdatein interfaceContentServicePolicies.OnContentUpdatePolicy- Parameters:
nodeRef- the node reference
-
setJobLockService
public void setJobLockService(JobLockService jobLockService)
-
getJobLockService
public JobLockService getJobLockService()
-
setLockRetryCount
public void setLockRetryCount(int lockRetryCount)
-
getLockRetryCount
public int getLockRetryCount()
-
setLockRetryWait
public void setLockRetryWait(long lockRetryWait)
-
getLockRetryWait
public long getLockRetryWait()
-
setLockTimeOut
public void setLockTimeOut(long lockTimeOut)
-
getLockTimeOut
public long getLockTimeOut()
-
setLockRefreshTime
public void setLockRefreshTime(long lockRefreshTime)
-
getLockRefreshTime
public long getLockRefreshTime()
-
setTransferVersionChecker
public void setTransferVersionChecker(TransferVersionChecker transferVersionChecker)
-
getTransferVersionChecker
public TransferVersionChecker getTransferVersionChecker()
-
getVersion
public TransferVersion getVersion()
Description copied from interface:TransferReceiverGet the version that we are transfering to.- Specified by:
getVersionin interfaceTransferReceiver
-
setTransferRootNode
public void setTransferRootNode(java.lang.String rootFileSystem)
Description copied from interface:TransferReceiverset the root node for the file system receiver- Specified by:
setTransferRootNodein interfaceTransferReceiver- Parameters:
rootFileSystem- String
-
-