goldengate.ftp.core.data
Class FtpDataAsyncConn

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

public class FtpDataAsyncConn
extends Object

Main class that handles Data connection using asynchronous connection with Netty

Author:
Frederic Bregier

Constructor Summary
FtpDataAsyncConn(FtpSession session)
          Constructor for Active session by default
 
Method Summary
 void clear()
          Clear the Data Connection
 org.jboss.netty.channel.Channel getCurrentDataChannel()
          Return the current Data Channel
 DataNetworkHandler getDataNetworkHandler()
           
 FtpTransferControl getFtpTransferControl()
           
 InetSocketAddress getLocalAddress()
           
 int getLocalPort()
           
 FtpArgumentCode.TransferMode getMode()
           
static int getNewPassivePort(FtpConfiguration configuration)
           
 InetSocketAddress getRemoteAddress()
           
 int getRemotePort()
           
 String getStatus()
           
 FtpArgumentCode.TransferStructure getStructure()
           
 FtpArgumentCode.TransferSubType getSubType()
           
 FtpArgumentCode.TransferType getType()
           
 boolean initPassiveConnection()
          Initialize the socket from Server side (only used in Passive)
 boolean isBind()
           
 boolean isConnected()
          Is the Data dataChannel connected
 boolean isFileStreamBlockAsciiImage()
           
 boolean isPassiveMode()
           
 boolean isStreamFile()
           
 void setActive(InetSocketAddress address)
          Change to active connection (reset localPort to default)
 void setDataNetworkHandler(DataNetworkHandler dataNetworkHandler)
           
 void setLocalPort(int localPort)
          Set the Local Port (Active or Passive)
 void setMode(FtpArgumentCode.TransferMode transferMode)
           
 void setNewOpenedDataChannel(org.jboss.netty.channel.Channel dataChannel)
          Set the new connected Data Channel
 void setPassive()
          Change to passive connection (all necessaries informations like local port should have been set)
 void setStructure(FtpArgumentCode.TransferStructure transferStructure)
           
 void setSubType(FtpArgumentCode.TransferSubType transferSubType)
           
 void setType(FtpArgumentCode.TransferType transferType)
           
 String toString()
           
 void unbindPassive()
          Unbind passive connection when close the Data Channel (from channelClosed())
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FtpDataAsyncConn

public FtpDataAsyncConn(FtpSession session)
Constructor for Active session by default

Parameters:
session -
Method Detail

clear

public void clear()
Clear the Data Connection


setLocalPort

public void setLocalPort(int localPort)
Set the Local Port (Active or Passive)

Parameters:
localPort -

getLocalAddress

public InetSocketAddress getLocalAddress()
Returns:
the local address

getRemoteAddress

public InetSocketAddress getRemoteAddress()
Returns:
the remote address

getRemotePort

public int getRemotePort()
Returns:
the remotePort

getLocalPort

public int getLocalPort()
Returns:
the localPort

setActive

public void setActive(InetSocketAddress address)
Change to active connection (reset localPort to default)

Parameters:
address - remote address

setPassive

public void setPassive()
Change to passive connection (all necessaries informations like local port should have been set)


isPassiveMode

public boolean isPassiveMode()
Returns:
the passiveMode

isBind

public boolean isBind()
Returns:
True if the connection is bind (active = connected, passive = not necessarily connected)

isConnected

public boolean isConnected()
Is the Data dataChannel connected

Returns:
True if the dataChannel is connected

getMode

public FtpArgumentCode.TransferMode getMode()
Returns:
the transferMode

setMode

public void setMode(FtpArgumentCode.TransferMode transferMode)
Parameters:
transferMode - the transferMode to set

getStructure

public FtpArgumentCode.TransferStructure getStructure()
Returns:
the transferStructure

setStructure

public void setStructure(FtpArgumentCode.TransferStructure transferStructure)
Parameters:
transferStructure - the transferStructure to set

getSubType

public FtpArgumentCode.TransferSubType getSubType()
Returns:
the transferSubType

setSubType

public void setSubType(FtpArgumentCode.TransferSubType transferSubType)
Parameters:
transferSubType - the transferSubType to set

getType

public FtpArgumentCode.TransferType getType()
Returns:
the transferType

setType

public void setType(FtpArgumentCode.TransferType transferType)
Parameters:
transferType - the transferType to set

isFileStreamBlockAsciiImage

public boolean isFileStreamBlockAsciiImage()
Returns:
True if the current mode for data connection is FileInterface + (Stream or Block) + (Ascii or Image)

isStreamFile

public boolean isStreamFile()
Returns:
True if the current mode for data connection is Stream

unbindPassive

public void unbindPassive()
Unbind passive connection when close the Data Channel (from channelClosed())


initPassiveConnection

public boolean initPassiveConnection()
                              throws goldengate.common.command.exception.Reply425Exception
Initialize the socket from Server side (only used in Passive)

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

getCurrentDataChannel

public org.jboss.netty.channel.Channel getCurrentDataChannel()
                                                      throws FtpNoConnectionException
Return the current Data Channel

Returns:
the current Data Channel
Throws:
FtpNoConnectionException

getDataNetworkHandler

public DataNetworkHandler getDataNetworkHandler()
                                         throws FtpNoConnectionException
Returns:
the DataNetworkHandler
Throws:
FtpNoConnectionException

setDataNetworkHandler

public void setDataNetworkHandler(DataNetworkHandler dataNetworkHandler)
Parameters:
dataNetworkHandler - the DataNetworkHandler to set

getNewPassivePort

public static int getNewPassivePort(FtpConfiguration configuration)
Parameters:
configuration -
Returns:
a new Passive Port

getStatus

public String getStatus()
Returns:
The current status in String of the different parameters

toString

public String toString()
Overrides:
toString in class Object

getFtpTransferControl

public FtpTransferControl getFtpTransferControl()
Returns:
the FtpTransferControl

setNewOpenedDataChannel

public void setNewOpenedDataChannel(org.jboss.netty.channel.Channel dataChannel)
                             throws InterruptedException,
                                    goldengate.common.command.exception.Reply425Exception
Set the new connected Data Channel

Parameters:
dataChannel - the new Data Channel
Throws:
InterruptedException
goldengate.common.command.exception.Reply425Exception


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