Class FTPManagedConnection
- java.lang.Object
-
- org.ikasan.connector.base.command.TransactionalCommandConnection
-
- org.ikasan.connector.ftp.outbound.FTPManagedConnection
-
- All Implemented Interfaces:
com.arjuna.ats.jta.resources.LastResourceCommitOptimisation,java.io.Serializable,javax.transaction.xa.XAResource,org.ikasan.connector.listener.TransactionCommitFailureObserverable
public class FTPManagedConnection extends org.ikasan.connector.base.command.TransactionalCommandConnection implements java.io.SerializableThis EJB implements the ManagedConnection for the FTP resource adapter. This is a representation of a real, physical connection to the server, so it has an object instance variable which remains allocated to a server for the life of this object. This class is responsible for creating virtual connections, of class EISConnection, when the application server calls getConnection() It extends a (1 Phase Commit and 2 Phase commit) managed connection TODO Max retry attempts is really a client parameter, which brings us the question of whether we even want to open a connection at this stage- Author:
- Ikasan Development Team
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static org.slf4j.LoggerloggerThe logger instance.
-
Constructor Summary
Constructors Constructor Description FTPManagedConnection(FTPConnectionRequestInfo fcri)Constructor, sets the managed connection factory and the hibernate filter table client ID sits on EISManagedConnection
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancleanupJournalOnComplete()protected voidcloseSession()Close the FileTransferProtocolClient sessionvoidforget(javax.transaction.xa.Xid arg0)Deal with forgetting this unit of work as a txn, in this case do nothingjava.lang.StringgetClientID()java.lang.ObjectgetConnection(org.ikasan.connector.util.chunking.model.dao.FileChunkDao fileChunkDao, org.ikasan.connector.basefiletransfer.outbound.persistence.BaseFileTransferDao baseFileTransferDao, int testtodo)Create a virtual connection (a BaseFileTransferConnection object) and add it to the list of managed instances before returning it to the client.java.lang.ObjectgetConnection(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> duplicatesFileCache)Create a virtual connection (a BaseFileTransferConnection object) and add it to the list of managed instances before returning it to the client.protected org.ikasan.connector.base.command.TransactionalResourcegetTransactionalResource()intgetTransactionTimeout()Return the Transaction timeout, always set to 0javax.transaction.xa.XAResourcegetXAResource()Get the XA resource for this managed connection, in this case, itself.booleanisSameRM(javax.transaction.xa.XAResource arg0)Return whether or not this resource manager is the same, always return falsevoidopenSession()openSession initiates the physical connection to the server and logs us in.protected voidpostCommit(javax.transaction.xa.Xid arg0)Hook method to allow any connector specific post commit functionalityprotected voidpostRollback(javax.transaction.xa.Xid arg0)Hook method to allow any connector specific post rollback functionalitybooleansetTransactionTimeout(int arg0)Set the txn timeout, always return false-
Methods inherited from class org.ikasan.connector.base.command.TransactionalCommandConnection
addListener, addListenersToCommand, commit, commitCommands, end, executeCommand, preCommit, prepare, preRollback, recover, rollback, rollbackCommands, sendErrorEvent, setTransactionJournal, start, transactionInProgress
-
-
-
-
Constructor Detail
-
FTPManagedConnection
public FTPManagedConnection(FTPConnectionRequestInfo fcri)
Constructor, sets the managed connection factory and the hibernate filter table client ID sits on EISManagedConnection- Parameters:
fcri- connection request info
-
-
Method Detail
-
getConnection
public java.lang.Object getConnection(org.ikasan.connector.util.chunking.model.dao.FileChunkDao fileChunkDao, org.ikasan.connector.basefiletransfer.outbound.persistence.BaseFileTransferDao baseFileTransferDao, int testtodo)Create a virtual connection (a BaseFileTransferConnection object) and add it to the list of managed instances before returning it to the client.- Parameters:
fileChunkDao-baseFileTransferDao-- Returns:
-
getConnection
public java.lang.Object getConnection(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> duplicatesFileCache)Create a virtual connection (a BaseFileTransferConnection object) and add it to the list of managed instances before returning it to the client.- Parameters:
fileChunkDao-baseFileTransferDao-duplicatesFileCache-- Returns:
-
getClientID
public java.lang.String getClientID()
-
openSession
public void openSession() throws javax.resource.ResourceExceptionopenSession initiates the physical connection to the server and logs us in. This method is called by FTPManagedConnectionFactory immediately after creating the instance of this class. In this implementation of an FTP connector there is no real concept of a session (a connection is made per method call), openSession is left here as it initialises the ftpClient and also provides a starting point for true session functionality to be added if required- Throws:
javax.resource.ResourceException- Exception thrown by Connector
-
closeSession
protected void closeSession()
Close the FileTransferProtocolClient session
-
forget
public void forget(javax.transaction.xa.Xid arg0)
Deal with forgetting this unit of work as a txn, in this case do nothing- Specified by:
forgetin interfacejavax.transaction.xa.XAResource- See Also:
EISXAManagedConnection.forget(javax.transaction.xa.Xid)
-
getTransactionTimeout
public int getTransactionTimeout()
Return the Transaction timeout, always set to 0- Specified by:
getTransactionTimeoutin interfacejavax.transaction.xa.XAResource- Returns:
- 0
- See Also:
EISXAManagedConnection.getTransactionTimeout()
-
getXAResource
public javax.transaction.xa.XAResource getXAResource()
Get the XA resource for this managed connection, in this case, itself.- Specified by:
getXAResourcein classorg.ikasan.connector.base.command.TransactionalCommandConnection- See Also:
EISXAManagedConnection.getXAResource()
-
isSameRM
public boolean isSameRM(javax.transaction.xa.XAResource arg0)
Return whether or not this resource manager is the same, always return false- Specified by:
isSameRMin interfacejavax.transaction.xa.XAResource- Returns:
- false
- See Also:
EISXAManagedConnection.isSameRM(javax.transaction.xa.XAResource)
-
setTransactionTimeout
public boolean setTransactionTimeout(int arg0)
Set the txn timeout, always return false- Specified by:
setTransactionTimeoutin interfacejavax.transaction.xa.XAResource- Returns:
- false
- See Also:
EISXAManagedConnection.setTransactionTimeout(int)
-
getTransactionalResource
protected org.ikasan.connector.base.command.TransactionalResource getTransactionalResource()
- Specified by:
getTransactionalResourcein classorg.ikasan.connector.base.command.TransactionalCommandConnection
-
postRollback
protected void postRollback(javax.transaction.xa.Xid arg0)
Hook method to allow any connector specific post rollback functionality- Overrides:
postRollbackin classorg.ikasan.connector.base.command.TransactionalCommandConnection- Parameters:
arg0- Transaction Id
-
postCommit
protected void postCommit(javax.transaction.xa.Xid arg0)
Hook method to allow any connector specific post commit functionality- Overrides:
postCommitin classorg.ikasan.connector.base.command.TransactionalCommandConnection- Parameters:
arg0- Transaction Id
-
cleanupJournalOnComplete
protected boolean cleanupJournalOnComplete()
- Overrides:
cleanupJournalOnCompletein classorg.ikasan.connector.base.command.TransactionalCommandConnection
-
-