Class FTPConnectionImpl
- java.lang.Object
-
- org.ikasan.connector.basefiletransfer.outbound.BaseFileTransferConnectionImpl
-
- org.ikasan.connector.ftp.outbound.FTPConnectionImpl
-
- All Implemented Interfaces:
javax.resource.cci.Connection,org.ikasan.connector.BaseFileTransferConnection,org.ikasan.connector.listener.TransactionCommitFailureObserverable
public class FTPConnectionImpl extends org.ikasan.connector.basefiletransfer.outbound.BaseFileTransferConnectionImplThis class implements the virtual connection to the FTP server.
An instance of this class is returned to the clients via the getConnection() method called on
FTPConnectionFactory by the Application Server. All functionality for the FTP virtual connection is defined in the interface and implemented within this class. In reality much of the work is passed onto the FTPManagedConnection as that does the 'physical work' of talking to the FTP Server- Author:
- Ikasan Development Team
-
-
Field Summary
Fields Modifier and Type Field Description protected FTPManagedConnectionmanagedConnectionThe managed connection, overrides the definition in the EISConnectionImpl so that we don't have to cast back all of the time
-
Constructor Summary
Constructors Constructor Description FTPConnectionImpl(FTPManagedConnection mc, org.ikasan.connector.util.chunking.model.dao.FileChunkDao fileChunkDao, org.ikasan.connector.basefiletransfer.outbound.persistence.BaseFileTransferDao baseFileTransferDao)Constructor which takes ManagedConnection as a parameterFTPConnectionImpl(FTPManagedConnection mc, org.ikasan.connector.util.chunking.model.dao.FileChunkDao fileChunkDao, org.ikasan.connector.basefiletransfer.outbound.persistence.BaseFileTransferDao baseFileTransferDao, com.google.common.cache.Cache<java.lang.String,java.lang.Boolean> duplicateFilesCache)Constructor which takes ManagedConnection as a parameter
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Clients call this to indicate that they have finished with a connection.voiddeliverPayload(org.ikasan.filetransfer.Payload payload, java.lang.String outputDir, java.util.Map<java.lang.String,java.lang.String> outputTargets, boolean overwrite, java.lang.String renameExtension, boolean checksumDelivered, boolean unzip, boolean cleanup)Delivers the content of thisPayloadusing a File Transfer client for chunking use onlyprotected org.ikasan.connector.base.command.ExecutionOutputexecuteCommand(org.ikasan.connector.base.command.TransactionalResourceCommand command, org.ikasan.connector.base.command.ExecutionContext executionContext)Executes a command with a given ExecutionContextorg.ikasan.filetransfer.PayloadgetDiscoveredFile(java.lang.String sourceDir, java.lang.String filenamePattern, boolean renameOnSuccess, java.lang.String renameOnSuccessExtension, boolean moveOnSuccess, java.lang.String moveOnSuccessNewPath, boolean chunking, int chunkSize, boolean checksum, long minAge, boolean destructive, boolean filterDuplicates, boolean filterOnFilename, boolean filterOnLastModifiedDate, boolean chronological, boolean isRecursive, boolean provideRelativePath)org.ikasan.connector.base.command.TransactionalCommandConnectiongetManagedConnection()getManagedConnection is called by the FTPManagedConnection when the application server wants to re-associate a virtual connection with a new manager.voidhousekeep(int maxRows, int ageOfFiles)TODO Non trivial change but this too can go up one level to BaseFileTransferConnectionImplvoidsetManagedConnection(org.ikasan.connector.base.command.TransactionalCommandConnection managedConnection)setManagedConnection is called by the FTPManagedConnection when the application server wants to re-associate a virtual connection with a new manager.
-
-
-
Field Detail
-
managedConnection
protected FTPManagedConnection managedConnection
The managed connection, overrides the definition in the EISConnectionImpl so that we don't have to cast back all of the time
-
-
Constructor Detail
-
FTPConnectionImpl
public FTPConnectionImpl(FTPManagedConnection mc, org.ikasan.connector.util.chunking.model.dao.FileChunkDao fileChunkDao, org.ikasan.connector.basefiletransfer.outbound.persistence.BaseFileTransferDao baseFileTransferDao)
Constructor which takes ManagedConnection as a parameter- Parameters:
mc-fileChunkDao-baseFileTransferDao-
-
FTPConnectionImpl
public FTPConnectionImpl(FTPManagedConnection mc, org.ikasan.connector.util.chunking.model.dao.FileChunkDao fileChunkDao, org.ikasan.connector.basefiletransfer.outbound.persistence.BaseFileTransferDao baseFileTransferDao, com.google.common.cache.Cache<java.lang.String,java.lang.Boolean> duplicateFilesCache)
Constructor which takes ManagedConnection as a parameter- Parameters:
mc-fileChunkDao-baseFileTransferDao-duplicateFilesCache-
-
-
Method Detail
-
getManagedConnection
public org.ikasan.connector.base.command.TransactionalCommandConnection getManagedConnection()
getManagedConnection is called by the FTPManagedConnection when the application server wants to re-associate a virtual connection with a new manager.
-
setManagedConnection
public void setManagedConnection(org.ikasan.connector.base.command.TransactionalCommandConnection managedConnection)
setManagedConnection is called by the FTPManagedConnection when the application server wants to re-associate a virtual connection with a new manager.- Parameters:
managedConnection- - The managed connection
-
close
public void close()
Clients call this to indicate that they have finished with a connection. Of course, we aren't really going to close anything, we will simply indicate to the manager of this virtual connection that it is now defunct.
-
getDiscoveredFile
public org.ikasan.filetransfer.Payload getDiscoveredFile(java.lang.String sourceDir, java.lang.String filenamePattern, boolean renameOnSuccess, java.lang.String renameOnSuccessExtension, boolean moveOnSuccess, java.lang.String moveOnSuccessNewPath, boolean chunking, int chunkSize, boolean checksum, long minAge, boolean destructive, boolean filterDuplicates, boolean filterOnFilename, boolean filterOnLastModifiedDate, boolean chronological, boolean isRecursive, boolean provideRelativePath) throws javax.resource.ResourceException- Throws:
javax.resource.ResourceException
-
deliverPayload
public void deliverPayload(org.ikasan.filetransfer.Payload payload, java.lang.String outputDir, java.util.Map<java.lang.String,java.lang.String> outputTargets, boolean overwrite, java.lang.String renameExtension, boolean checksumDelivered, boolean unzip, boolean cleanup) throws javax.resource.ResourceExceptionDelivers the content of thisPayloadusing a File Transfer client for chunking use only- Parameters:
payload-Payloadeither containing, or refering to the file contentoutputDir- dir path on remote system to deliver the file or filesoutputTargets- map of output subdirectories for file delivery keyed by regular expression matches on the delivered file nameoverwrite- overwrite any existing files of the same name(s)renameExtension- temporary extension to use whilst delivering single filechecksumDelivered- if true, attempt to reload the delivered file to compare the checksum valueunzip- if true, attempt to unzip the payloadcleanup- if true, cleans up any chunked data- Throws:
javax.resource.ResourceException- -
-
executeCommand
protected org.ikasan.connector.base.command.ExecutionOutput executeCommand(org.ikasan.connector.base.command.TransactionalResourceCommand command, org.ikasan.connector.base.command.ExecutionContext executionContext) throws javax.resource.ResourceExceptionExecutes a command with a given ExecutionContext- Specified by:
executeCommandin classorg.ikasan.connector.basefiletransfer.outbound.BaseFileTransferConnectionImpl- Parameters:
command- - The command to executeexecutionContext- - The context of execution- Returns:
- ExecutionOutput - The output from executing the command
- Throws:
javax.resource.ResourceException- - Exception from the FTP connector
-
housekeep
public void housekeep(int maxRows, int ageOfFiles) throws javax.resource.ResourceExceptionTODO Non trivial change but this too can go up one level to BaseFileTransferConnectionImpl- Parameters:
maxRows- The maximum amount of rows to housekeepageOfFiles- The age of the files to housekeep- Throws:
javax.resource.ResourceException- Exception thrown by the FTP Connector
-
-