goldengate.ftp.core.session
Class FtpSession

java.lang.Object
  extended by goldengate.ftp.core.session.FtpSession
All Implemented Interfaces:
goldengate.common.file.SessionInterface

public class FtpSession
extends Object
implements goldengate.common.file.SessionInterface

Main class that stores any information that must be accessible from anywhere during the connection of one user.

Author:
Frederic Bregier

Constructor Summary
FtpSession(FtpConfiguration configuration, BusinessHandler handler)
          Constructor
 
Method Summary
 void clear()
           
 String getAnswer()
           
 FtpAuth getAuth()
           
static String getBasename(String path)
           
 int getBlockSize()
           
 BusinessHandler getBusinessHandler()
           
 FtpConfiguration getConfiguration()
          Get the configuration
 org.jboss.netty.channel.Channel getControlChannel()
           
 AbstractCommand getCurrentCommand()
           
 FtpDataAsyncConn getDataConn()
           
 FtpDir getDir()
           
 goldengate.common.file.FileParameterInterface getFileParameter()
           
 NetworkHandler getNetworkHandler()
           
 AbstractCommand getPreviousCommand()
           
 goldengate.common.command.ReplyCode getReplyCode()
           
 goldengate.common.file.Restart getRestart()
           
 String getUniqueExtension()
           
 boolean isCurrentCommandFinished()
           
 boolean isReady()
           
 void openDataConnection()
          Try to open a connection.
 void reinitFtpAuth()
          Reinitialize the authentication to the connection step
 void setControlConnected()
          This function is called when the Command Channel is connected (from channelConnected of the NetworkHandler)
 void setCurrentCommandFinished()
          Set the Current Command as finished
 void setExitErrorCode(String answer)
          Set Exit code after an error
 void setExitNormalCode(String answer)
          Set Exit normal code
 void setNextCommand(goldengate.common.command.CommandInterface command)
          Set the new current command
 void setPreviousAsCurrentCommand()
          Set the previous command as the new current command (used after a incorrect sequence of commands or unknown command)
 void setReady(boolean isReady)
           
 void setReplyCode(goldengate.common.command.exception.CommandAbstractException exception)
           
 void setReplyCode(goldengate.common.command.ReplyCode replyCode, String answer)
           
 void setSpecialInit(FtpAuth auth, FtpDir dir, goldengate.common.file.Restart restart)
          Special initialization (FtpExec with Https session)
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FtpSession

public FtpSession(FtpConfiguration configuration,
                  BusinessHandler handler)
Constructor

Parameters:
configuration -
handler -
Method Detail

getBusinessHandler

public BusinessHandler getBusinessHandler()
Returns:
the businessHandler

getConfiguration

public FtpConfiguration getConfiguration()
Get the configuration

Returns:
the configuration

getDir

public FtpDir getDir()
Specified by:
getDir in interface goldengate.common.file.SessionInterface

getDataConn

public FtpDataAsyncConn getDataConn()
Returns:
the Data Connection

getAuth

public FtpAuth getAuth()
Specified by:
getAuth in interface goldengate.common.file.SessionInterface

getRestart

public goldengate.common.file.Restart getRestart()
Specified by:
getRestart in interface goldengate.common.file.SessionInterface

setControlConnected

public void setControlConnected()
This function is called when the Command Channel is connected (from channelConnected of the NetworkHandler)


setSpecialInit

public void setSpecialInit(FtpAuth auth,
                           FtpDir dir,
                           goldengate.common.file.Restart restart)
Special initialization (FtpExec with Https session)

Parameters:
auth -
dir -
restart -

getControlChannel

public org.jboss.netty.channel.Channel getControlChannel()
Returns:
the Control channel

getNetworkHandler

public NetworkHandler getNetworkHandler()
Returns:
The network handler associated with control

setNextCommand

public void setNextCommand(goldengate.common.command.CommandInterface command)
Set the new current command

Parameters:
command -

getCurrentCommand

public AbstractCommand getCurrentCommand()
Returns:
the currentCommand

getPreviousCommand

public AbstractCommand getPreviousCommand()
Returns:
the previousCommand

setPreviousAsCurrentCommand

public void setPreviousAsCurrentCommand()
Set the previous command as the new current command (used after a incorrect sequence of commands or unknown command)


isCurrentCommandFinished

public boolean isCurrentCommandFinished()
Returns:
True if the Current Command is already Finished (ready to accept a new one)

setCurrentCommandFinished

public void setCurrentCommandFinished()
Set the Current Command as finished


getAnswer

public String getAnswer()
Returns:
the answer

setReplyCode

public void setReplyCode(goldengate.common.command.ReplyCode replyCode,
                         String answer)
Parameters:
replyCode - the replyCode to set
answer -

setReplyCode

public void setReplyCode(goldengate.common.command.exception.CommandAbstractException exception)
Parameters:
exception -

setExitErrorCode

public void setExitErrorCode(String answer)
Set Exit code after an error

Parameters:
answer -

setExitNormalCode

public void setExitNormalCode(String answer)
Set Exit normal code

Parameters:
answer -

getReplyCode

public goldengate.common.command.ReplyCode getReplyCode()
Returns:
the replyCode

clear

public void clear()
Specified by:
clear in interface goldengate.common.file.SessionInterface

isReady

public boolean isReady()
Returns:
True if the Control is ready to accept command

setReady

public void setReady(boolean isReady)
Parameters:
isReady - the isReady to set

toString

public String toString()
Overrides:
toString in class Object

getBlockSize

public int getBlockSize()
Specified by:
getBlockSize in interface goldengate.common.file.SessionInterface

getFileParameter

public goldengate.common.file.FileParameterInterface getFileParameter()
Specified by:
getFileParameter in interface goldengate.common.file.SessionInterface

getBasename

public static String getBasename(String path)
Parameters:
path -
Returns:
the basename from the given path

reinitFtpAuth

public void reinitFtpAuth()
Reinitialize the authentication to the connection step


openDataConnection

public void openDataConnection()
                        throws goldengate.common.command.exception.Reply425Exception
Try to open a connection. Do the intermediate reply if any (150) and the final one (125)

Throws:
goldengate.common.command.exception.Reply425Exception - if the connection cannot be opened

getUniqueExtension

public String getUniqueExtension()
Specified by:
getUniqueExtension in interface goldengate.common.file.SessionInterface


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