Package org.alfresco.repo.transfer
Class TransferServiceImpl
java.lang.Object
org.alfresco.repo.transfer.TransferServiceImpl
- All Implemented Interfaces:
TransferService
Implementation of the Transfer Service.
Note: The TransferService interface is now deprecated (replaced by TransferService2). This implementation
delegates to the implementation of TransferService2.
- Author:
- davidc
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcancelAsync(String transferId) Asynchronously cancel an in-progress transfer This method tells an in-process transfer to give up, rollback and stop as soon as possible.createAndSaveTransferTarget(String name, String title, String description, String endpointProtocol, String endpointHost, int endpointPort, String endpointPath, String username, char[] password) Create and save a new transfer target.createTransferTarget(String name) Creates an in memory transfer target.voiddeleteTransferTarget(String name) Delete a transfer target.voidenableTransferTarget(String name, boolean enable) Enables/Disables the named transfer targetgetTransferTarget(String name) Get a transfer target by its nameGet all the transfer targetsgetTransferTargets(String groupName) Get All the transfer targets for a particular transfer target group.saveTransferTarget(TransferTarget update) Save TransferTarget, will create a transfer target if it does not already exist or update an existing transfer target.voidsetTransferServiceImpl2(TransferServiceImpl2 transferServiceImpl2) booleantargetExists(String name) Test to see if the target with the specified name existstransfer(String targetName, TransferDefinition definition) Transfer nodes, sync.transfer(String targetName, TransferDefinition definition, Collection<TransferCallback> callbacks) Transfer nodes sync, with callback.transfer(String targetName, TransferDefinition definition, TransferCallback... callbacks) Transfer nodes sync, with callback.voidtransferAsync(String targetName, TransferDefinition definition, Collection<TransferCallback> callbacks) Transfer nodes async with callback.voidtransferAsync(String targetName, TransferDefinition definition, TransferCallback... callbacks) Transfer nodes async with callback.voidverify(TransferTarget target) Verify a target is available and that the configured credentials are valid.
-
Constructor Details
-
TransferServiceImpl
public TransferServiceImpl()
-
-
Method Details
-
setTransferServiceImpl2
-
createTransferTarget
Description copied from interface:TransferServiceCreates an in memory transfer target. Before it is used it must be populated with the following values and saved with the saveTransferTarget method. The name of the transfer target must be unique.- title
- description
- endpointProtocol
- endpointHost
- endpointPort
- endpointPath
- username
- password
- Specified by:
createTransferTargetin interfaceTransferService- Returns:
- an in memory transfer target
-
createAndSaveTransferTarget
public TransferTarget createAndSaveTransferTarget(String name, String title, String description, String endpointProtocol, String endpointHost, int endpointPort, String endpointPath, String username, char[] password) Description copied from interface:TransferServiceCreate and save a new transfer target. Creates and saves a new transfer target with a single, but long, method call.- Specified by:
createAndSaveTransferTargetin interfaceTransferService- Parameters:
name- the name of this transfer target, which must be uniquetitle- the display name of this transfer targetdescription- StringendpointProtocol- either http or httpsendpointHost- StringendpointPort- intendpointPath- Stringusername- Stringpassword- char[]- Returns:
- the newly created transfer target.
-
getTransferTargets
Description copied from interface:TransferServiceGet all the transfer targets- Specified by:
getTransferTargetsin interfaceTransferService
-
getTransferTargets
Description copied from interface:TransferServiceGet All the transfer targets for a particular transfer target group.- Specified by:
getTransferTargetsin interfaceTransferService- Parameters:
groupName- the name of the transfer group
-
deleteTransferTarget
Description copied from interface:TransferServiceDelete a transfer target. After calling this method the transfer target will no longer exist.- Specified by:
deleteTransferTargetin interfaceTransferService- Parameters:
name- the name of this transfer target,
-
enableTransferTarget
Description copied from interface:TransferServiceEnables/Disables the named transfer target- Specified by:
enableTransferTargetin interfaceTransferService- Parameters:
name- the name of the transfer targetenable- (or false=disable)
-
targetExists
Description copied from interface:TransferServiceTest to see if the target with the specified name exists- Specified by:
targetExistsin interfaceTransferService- Parameters:
name- String- Returns:
- true if the specified target exists, and false otherwise
-
getTransferTarget
Description copied from interface:TransferServiceGet a transfer target by its name- Specified by:
getTransferTargetin interfaceTransferService
-
saveTransferTarget
Description copied from interface:TransferServiceSave TransferTarget, will create a transfer target if it does not already exist or update an existing transfer target. The following properties may be updated: endpointHost, endpointPort, endpointProtocol, endpointPath, username, password, title, description The following properties may not be updated: name, must be specified. nodeRef, if specified will be ignored.- Specified by:
saveTransferTargetin interfaceTransferService- Parameters:
update- TransferTarget
-
transferAsync
public void transferAsync(String targetName, TransferDefinition definition, TransferCallback... callbacks) Description copied from interface:TransferServiceTransfer nodes async with callback. The asynchronous version of the transfer method starts a transfer and returns as soon as possible. The transfer callbacks will be called by a different thread to that used to call the transferAsync method so transaction context will be different to the calling context. The asychronous transfer does not have access to uncommitted data in the calling transaction.- Specified by:
transferAsyncin interfaceTransferService- Parameters:
targetName- the name of the target to transfer todefinition- - the definition of the transfer. Specifies which nodes to transfer. The following properties must be set, nodescallbacks- - a collection of callback handlers that will be called as transfer proceeds. May be null.
-
transferAsync
public void transferAsync(String targetName, TransferDefinition definition, Collection<TransferCallback> callbacks) Description copied from interface:TransferServiceTransfer nodes async with callback. The asynchronous version of the transfer method starts a transfer and returns as soon as possible. The transfer callbacks will be called by a different thread to that used to call the transferAsync method so transaction context will be different to the calling context. The asychronous transfer does not have access to uncommitted data in the calling transaction.- Specified by:
transferAsyncin interfaceTransferService- Parameters:
targetName- the name of the target to transfer todefinition- - the definition of the transfer. Specifies which nodes to transfer. The following properties must be set, nodescallbacks- - a collection of callback handlers that will be called as transfer proceeds. May be null.
-
transfer
Description copied from interface:TransferServiceTransfer nodes, sync. This synchronous version of the transfer method waits for the transfer to complete before returning to the caller. Callbacks are called in the current thread context, so will be associated with the current transaction and user.- Specified by:
transferin interfaceTransferService- Parameters:
targetName- the name of the target to transfer to The following properties must be set, nodesdefinition- the definition of the transfer. Specifies which nodes to transfer.- Returns:
- the node reference of the transfer report
-
transfer
public NodeRef transfer(String targetName, TransferDefinition definition, TransferCallback... callbacks) Description copied from interface:TransferServiceTransfer nodes sync, with callback. This synchronous version of the transfer method waits for the transfer to complete before returning to the caller. Callbacks are called in the current thread context, so will be associated with the current transaction and user.- Specified by:
transferin interfaceTransferService- Parameters:
targetName- the name of the target to transfer todefinition- - the definition of the transfer. Specifies which nodes to transfer. The following properties must be set, nodescallbacks- - a list of callback handlers that will be called as transfer proceeds. May be null.- Returns:
- the node reference of the transfer report
-
transfer
public NodeRef transfer(String targetName, TransferDefinition definition, Collection<TransferCallback> callbacks) Description copied from interface:TransferServiceTransfer nodes sync, with callback. This synchronous version of the transfer method waits for the transfer to complete before returning to the caller. Callbacks are called in the current thread context, so will be associated with the current transaction and user.- Specified by:
transferin interfaceTransferService- Parameters:
targetName- the name of the target to transfer todefinition- - the definition of the transfer. Specifies which nodes to transfer. The following properties must be set, nodescallbacks- - a set of callback handlers that will be called as transfer proceeds. May be null.- Returns:
- the node reference of the transfer report
-
verify
Description copied from interface:TransferServiceVerify a target is available and that the configured credentials are valid.- Specified by:
verifyin interfaceTransferService- Throws:
TransferException
-
cancelAsync
Description copied from interface:TransferServiceAsynchronously cancel an in-progress transfer This method tells an in-process transfer to give up, rollback and stop as soon as possible. Depending upon the state of the in-progress transfer, the transfer may still complete, despite calling this method, however in most cases the transfer will not complete. Calling this method for a transfer that does not exist, possibly because it has already finished, has no effect and will not throw an exception. The transfer identifier can be obtained from the TransferEventBegin event that is passed to registered callbacks when transfer starts.- Specified by:
cancelAsyncin interfaceTransferService- Parameters:
transferId- the unique identifier of the transfer to cancel.- See Also:
-