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

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
  • Constructor Details

    • RepoTransferReceiverImpl

      public RepoTransferReceiverImpl()
  • Method Details

    • init

      public void init()
    • getStagingFolder

      public File getStagingFolder(String transferId)
      Specified by:
      getStagingFolder in interface TransferReceiver
      Parameters:
      transferId - String
      Returns:
      File
    • getTempFolder

      public NodeRef getTempFolder(String transferId)
      Specified by:
      getTempFolder in interface TransferReceiver
      Parameters:
      transferId - String
      Returns:
      NodeRef
    • start

      public String start(String fromRepositoryId, boolean transferToSelf, TransferVersion fromVersion)
      Description copied from interface: TransferReceiver
      Asks the receiver to setup a new transfer.
      Specified by:
      start in interface TransferReceiver
      Parameters:
      fromRepositoryId - the repositoryId of the sending system
      transferToSelf - are transfers to the same repository allowed?
      fromVersion - the version sending
      Returns:
      The identifier of the new transfer
    • end

      public void end(String transferId)
      Description copied from interface: TransferReceiver
      Asks the receiver to end (and clean up) the specified transfer
      Specified by:
      end in interface TransferReceiver
      Parameters:
      transferId - The transfer to end
    • cancel

      public void cancel(String transferId) throws TransferException
      Description copied from interface: TransferReceiver
      Abort
      Specified by:
      cancel in interface TransferReceiver
      Parameters:
      transferId - String
      Throws:
      TransferException
    • prepare

      public void prepare(String transferId) throws TransferException
      Description copied from interface: TransferReceiver
      Prepare
      Specified by:
      prepare in interface TransferReceiver
      Parameters:
      transferId - String
      Throws:
      TransferException
    • checkLock

      public org.alfresco.repo.transfer.RepoTransferReceiverImpl.Lock checkLock(String transferId) throws TransferException
      Throws:
      TransferException
    • saveSnapshot

      public void saveSnapshot(String transferId, InputStream openStream) throws TransferException
      Description copied from interface: TransferReceiver
      Store 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:
      saveSnapshot in interface TransferReceiver
      Parameters:
      transferId - The identifier of the transfer with which this snapshot is associated
      openStream - The open stream that holds the snapshot file.
      Throws:
      TransferException - If an error occurs while saving the snapshot file.
    • saveContent

      public void saveContent(String transferId, String contentFileId, InputStream contentStream) throws TransferException
      Description copied from interface: TransferReceiver
      Save a content item
      Specified by:
      saveContent in interface TransferReceiver
      Parameters:
      transferId - String
      contentFileId - String
      contentStream - InputStream
      Throws:
      TransferException
    • commitAsync

      public void commitAsync(String transferId)
      Description copied from interface: TransferReceiver
      Commit asynchronously
      Specified by:
      commitAsync in interface TransferReceiver
      Parameters:
      transferId - String
    • commit

      public void commit(String transferId) throws TransferException
      Description copied from interface: TransferReceiver
      Commit
      Specified by:
      commit in interface TransferReceiver
      Parameters:
      transferId - String
      Throws:
      TransferException
    • getStatus

      public TransferProgress getStatus(String transferId) throws TransferException
      Specified by:
      getStatus in interface TransferReceiver
      Parameters:
      transferId - String
      Returns:
      the trabsfer progress
      Throws:
      TransferException
    • setSearchService

      public void setSearchService(SearchService searchService)
      Parameters:
      searchService - the searchService to set
    • setTransactionService

      public void setTransactionService(TransactionService transactionService)
      Parameters:
      transactionService - the transactionService to set
    • setTenantService

      public void setTenantService(TenantService tenantService)
    • setSingletonCache

      public void setSingletonCache(SimpleCache<String,NodeRef> singletonCache)
    • setTransferLockFolderPath

      public void setTransferLockFolderPath(String transferLockFolderPath)
      Parameters:
      transferLockFolderPath - the transferLockFolderPath to set
    • setTransferTempFolderPath

      public void setTransferTempFolderPath(String transferTempFolderPath)
      Parameters:
      transferTempFolderPath - the transferTempFolderPath to set
    • setRootStagingDirectory

      public void setRootStagingDirectory(String rootStagingDirectory)
      Parameters:
      rootStagingDirectory - the rootTransferFolder to set
    • setInboundTransferRecordsPath

      public void setInboundTransferRecordsPath(String inboundTransferRecordsPath)
      Parameters:
      inboundTransferRecordsPath - the inboundTransferRecordsPath to set
    • setNodeService

      public void setNodeService(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:
      getProgressMonitor in interface TransferReceiver
      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(NamespaceService namespaceService)
    • generateRequsite

      public void generateRequsite(String transferId, OutputStream out) throws TransferException
      Generate the requsite
      Specified by:
      generateRequsite in interface TransferReceiver
      out - an open stream to receive the requisite
      Throws:
      TransferException
    • getTransferReport

      public InputStream getTransferReport(String transferId)
      Description copied from interface: TransferReceiver
      get the transfer report for the specified transfer
      Specified by:
      getTransferReport in interface TransferReceiver
      Parameters:
      transferId - String
    • setPolicyComponent

      public void setPolicyComponent(PolicyComponent policyComponent)
    • getPolicyComponent

      public PolicyComponent getPolicyComponent()
    • onCreateChildAssociation

      public void onCreateChildAssociation(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:
      onCreateChildAssociation in interface NodeServicePolicies.OnCreateChildAssociationPolicy
      Parameters:
      childAssocRef - the child association that has been created
      isNewNode - true if the node is new or false if the node is being linked in
    • beforeDeleteNode

      public void beforeDeleteNode(NodeRef deletedNodeRef)
      When an alien node is deleted the it may be the last alien invader

      Walk the tree checking the invasion status!

      Specified by:
      beforeDeleteNode in interface NodeServicePolicies.BeforeDeleteNodePolicy
      Parameters:
      deletedNodeRef - the node reference
    • onRestoreNode

      public void onRestoreNode(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:
      onRestoreNode in interface NodeServicePolicies.OnRestoreNodePolicy
      Parameters:
      childAssocRef - the newly created child association reference
    • onMoveNode

      public void onMoveNode(ChildAssociationRef oldChildAssocRef, 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:
      onMoveNode in interface NodeServicePolicies.OnMoveNodePolicy
      Parameters:
      oldChildAssocRef - the child association reference prior to the move
      newChildAssocRef - the child association reference after the move
    • onCopyTransferred

      public CopyBehaviourCallback onCopyTransferred(QName classRef, CopyDetails copyDetails)
      When a transferred node is copied, don't copy the transferred aspect.
    • onCopyAlien

      public CopyBehaviourCallback onCopyAlien(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(NodeRef nodeRef, boolean newContent)
      Specified by:
      onContentUpdate in interface ContentServicePolicies.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: TransferReceiver
      Get the version that we are transfering to.
      Specified by:
      getVersion in interface TransferReceiver
    • setTransferRootNode

      public void setTransferRootNode(String rootFileSystem)
      Description copied from interface: TransferReceiver
      set the root node for the file system receiver
      Specified by:
      setTransferRootNode in interface TransferReceiver
      Parameters:
      rootFileSystem - String