goldengate.ftp.core.data
Class FtpTransferControl

java.lang.Object
  extended by goldengate.ftp.core.data.FtpTransferControl

public class FtpTransferControl
extends Object

Main class that handles transfers and their execution

Author:
Frederic Bregier

Constructor Summary
FtpTransferControl(FtpSession session)
           
 
Method Summary
 void clear()
          Clear the FtpTransferControl (called when the data connection must be over like from clear of FtpDataAsyncConn, abort from ABOR or ending control connection from NetworkHandler.
 FtpTransfer getExecutingFtpTransfer()
           
 boolean isFtpTransferExecuting()
          Is a command currently executing (called from NetworkHandler when a message is received to see if another transfer command is already in execution, which is not allowed)
 boolean openDataConnection()
          Wait for the client to be connected (Passive) or Wait for the server to be connected to the client (Active)
 void runTrueRetrieve()
          Run the retrieve operation if necessary (called from channelInterestChanged in DataNetworkHandler)
 void setClosedDataChannel()
          Set the closed Channel (from channelClosed of DataNetworkHandler)
 void setEndOfTransfer()
          Set the current transfer as finished.
 void setNewFtpTransfer(FtpCommandCode command, FtpFile file)
          Add a new transfer to be executed.
 void setNewFtpTransfer(FtpCommandCode command, List<String> list, String path)
          Add a new transfer to be executed.
 void setOpenedDataChannel(org.jboss.netty.channel.Channel channel, DataNetworkHandler dataNetworkHandler)
          Set the new opened Channel (from channelConnected of DataNetworkHandler)
 void setPreEndOfTransfer()
          Called by messageReceived, channelClosed (from DataNetworkHandler ) and trueRetrieve (from FtpFile) when the transfer is over or by channelClosed
 void setTransferAbortedFromInternal(boolean write)
          To enable abort from internal error
 void waitForDataNetworkHandlerReady()
          Wait for the DataNetworkHandler to be ready (from trueRetrieve of FtpFile)
 void waitForEndOfTransfer()
          Wait for the current transfer to finish, called from FtpTransferExecutor
 org.jboss.netty.channel.Channel waitForOpenedDataChannel()
          Wait that the new opened connection is ready (same method in FtpDataAsyncConn from openConnection)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FtpTransferControl

public FtpTransferControl(FtpSession session)
Parameters:
session -
Method Detail

waitForDataNetworkHandlerReady

public void waitForDataNetworkHandlerReady()
                                    throws InterruptedException
Wait for the DataNetworkHandler to be ready (from trueRetrieve of FtpFile)

Throws:
InterruptedException

setOpenedDataChannel

public void setOpenedDataChannel(org.jboss.netty.channel.Channel channel,
                                 DataNetworkHandler dataNetworkHandler)
Set the new opened Channel (from channelConnected of DataNetworkHandler)

Parameters:
channel -
dataNetworkHandler -

waitForOpenedDataChannel

public org.jboss.netty.channel.Channel waitForOpenedDataChannel()
                                                         throws InterruptedException
Wait that the new opened connection is ready (same method in FtpDataAsyncConn from openConnection)

Returns:
the new opened Channel
Throws:
InterruptedException

setClosedDataChannel

public void setClosedDataChannel()
Set the closed Channel (from channelClosed of DataNetworkHandler)


openDataConnection

public boolean openDataConnection()
                           throws goldengate.common.command.exception.Reply425Exception
Wait for the client to be connected (Passive) or Wait for the server to be connected to the client (Active)

Returns:
True if the connection is OK
Throws:
goldengate.common.command.exception.Reply425Exception

setNewFtpTransfer

public void setNewFtpTransfer(FtpCommandCode command,
                              FtpFile file)
Add a new transfer to be executed. This is to be called from Command after connection is opened and before answering to the client that command is ready to be executed (for Store or Retrieve like operations).

Parameters:
command -
file -

setNewFtpTransfer

public void setNewFtpTransfer(FtpCommandCode command,
                              List<String> list,
                              String path)
Add a new transfer to be executed. This is to be called from Command after connection is opened and before answering to the client that command is ready to be executed (for List like operations).

Parameters:
command -
list -
path - as Original Path

isFtpTransferExecuting

public boolean isFtpTransferExecuting()
Is a command currently executing (called from NetworkHandler when a message is received to see if another transfer command is already in execution, which is not allowed)

Returns:
True if a command is currently executing

getExecutingFtpTransfer

public FtpTransfer getExecutingFtpTransfer()
                                    throws FtpNoTransferException
Returns:
the current executing FtpTransfer
Throws:
FtpNoTransferException

runTrueRetrieve

public void runTrueRetrieve()
Run the retrieve operation if necessary (called from channelInterestChanged in DataNetworkHandler)


setEndOfTransfer

public void setEndOfTransfer()
Set the current transfer as finished. Called from FtpTransferExecutor when a transfer is over.


setTransferAbortedFromInternal

public void setTransferAbortedFromInternal(boolean write)
To enable abort from internal error

Parameters:
write - True means the message is write back to the control command, false it is only prepared

setPreEndOfTransfer

public void setPreEndOfTransfer()
Called by messageReceived, channelClosed (from DataNetworkHandler ) and trueRetrieve (from FtpFile) when the transfer is over or by channelClosed


waitForEndOfTransfer

public void waitForEndOfTransfer()
                          throws InterruptedException
Wait for the current transfer to finish, called from FtpTransferExecutor

Throws:
InterruptedException

clear

public void clear()
Clear the FtpTransferControl (called when the data connection must be over like from clear of FtpDataAsyncConn, abort from ABOR or ending control connection from NetworkHandler.



Copyright © 2009-2012 Frederic Bregier. All Rights Reserved.