goldengate.ftp.simpleimpl.control
Class SimpleBusinessHandler

java.lang.Object
  extended by goldengate.ftp.core.control.BusinessHandler
      extended by goldengate.ftp.simpleimpl.control.SimpleBusinessHandler

public class SimpleBusinessHandler
extends BusinessHandler

BusinessHandler implementation that allows pre and post actions on any operations and specifically on transfer operations

Author:
Frederic Bregier

Constructor Summary
SimpleBusinessHandler()
           
 
Method Summary
 void afterRunCommandKo(goldengate.common.command.exception.CommandAbstractException e)
          Run when a FTP exception is catch (the channel is not necessary closed after).
 void afterRunCommandOk()
          This method is called for every received message after the execution of the command but before the final reply to the client.
 void afterTransferDoneBeforeAnswer(FtpTransfer transfer)
          Run when a transfer is finished (eventually in error) but before answering.
 void beforeRunCommand()
          This method is called for every received message before the execution of the command.
protected  void cleanSession()
          To Clean the session attached objects
 void exceptionLocalCaught(org.jboss.netty.channel.ExceptionEvent e)
          Run when an exception is get before the channel is closed.
 void executeChannelClosed()
          Is executed when the channel is closed, just before cleaning and just after.
 void executeChannelConnected(org.jboss.netty.channel.Channel channel)
          Is executed when the channel is connected after the handler is on, before answering OK or not on connection, except if the global service is going to shutdown.
 FileBasedAuth getBusinessNewAuth()
          Create a new AuthInterface according to business choice
 FileBasedDir getBusinessNewDir()
          Create a new FtpDir according to business choice
 FilesystemBasedFtpRestart getBusinessNewRestart()
          Create a new Restart according to business choice
 String getFeatMessage()
           
 String getHelpMessage(String arg)
           
 String getOptsMessage(String[] args)
           
 AbstractCommand getSpecializedSiteCommand(FtpSession session, String line)
          Check if a command pass to SITE command is legal
 
Methods inherited from class goldengate.ftp.core.control.BusinessHandler
clear, getDefaultFeatMessage, getFtpSession, getMLSxOptsMessage, getNetworkHandler, setNetworkHandler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleBusinessHandler

public SimpleBusinessHandler()
Method Detail

afterRunCommandKo

public void afterRunCommandKo(goldengate.common.command.exception.CommandAbstractException e)
Description copied from class: BusinessHandler
Run when a FTP exception is catch (the channel is not necessary closed after). This must set a correct answer and a correct code of reply. If the code of reply is 421, then the channel will be closed after this call. This is the last call before finishing the command.

Specified by:
afterRunCommandKo in class BusinessHandler

afterRunCommandOk

public void afterRunCommandOk()
                       throws goldengate.common.command.exception.CommandAbstractException
Description copied from class: BusinessHandler
This method is called for every received message after the execution of the command but before the final reply to the client. If an exception is raised, the reply is immediate. This is the last call before finishing the command.

Specified by:
afterRunCommandOk in class BusinessHandler
Throws:
goldengate.common.command.exception.CommandAbstractException

beforeRunCommand

public void beforeRunCommand()
                      throws goldengate.common.command.exception.CommandAbstractException
Description copied from class: BusinessHandler
This method is called for every received message before the execution of the command. If an exception is raised, the reply is immediate and no action taken.

Specified by:
beforeRunCommand in class BusinessHandler
Throws:
goldengate.common.command.exception.CommandAbstractException

cleanSession

protected void cleanSession()
Description copied from class: BusinessHandler
To Clean the session attached objects

Specified by:
cleanSession in class BusinessHandler

exceptionLocalCaught

public void exceptionLocalCaught(org.jboss.netty.channel.ExceptionEvent e)
Description copied from class: BusinessHandler
Run when an exception is get before the channel is closed. This must set a correct answer.

Specified by:
exceptionLocalCaught in class BusinessHandler

executeChannelClosed

public void executeChannelClosed()
Description copied from class: BusinessHandler
Is executed when the channel is closed, just before cleaning and just after.
Note: In some circumstances, it could be a good idea to call the clean operation on FtpAuth in order to relax constraints on user authentication. It will be called however at least when the session will be clean just after this call.

Specified by:
executeChannelClosed in class BusinessHandler

executeChannelConnected

public void executeChannelConnected(org.jboss.netty.channel.Channel channel)
Description copied from class: BusinessHandler
Is executed when the channel is connected after the handler is on, before answering OK or not on connection, except if the global service is going to shutdown.

Specified by:
executeChannelConnected in class BusinessHandler

getBusinessNewAuth

public FileBasedAuth getBusinessNewAuth()
Description copied from class: BusinessHandler
Create a new AuthInterface according to business choice

Specified by:
getBusinessNewAuth in class BusinessHandler
Returns:
the new FtpAuth

getBusinessNewDir

public FileBasedDir getBusinessNewDir()
Description copied from class: BusinessHandler
Create a new FtpDir according to business choice

Specified by:
getBusinessNewDir in class BusinessHandler
Returns:
the new FtpDir

getBusinessNewRestart

public FilesystemBasedFtpRestart getBusinessNewRestart()
Description copied from class: BusinessHandler
Create a new Restart according to business choice

Specified by:
getBusinessNewRestart in class BusinessHandler
Returns:
the new Restart

getHelpMessage

public String getHelpMessage(String arg)
Specified by:
getHelpMessage in class BusinessHandler
Parameters:
arg - the argument from HELP command
Returns:
the string to return to the client for the HELP command

getFeatMessage

public String getFeatMessage()
Specified by:
getFeatMessage in class BusinessHandler
Returns:
the string to return to the client for the FEAT command

getOptsMessage

public String getOptsMessage(String[] args)
                      throws goldengate.common.command.exception.CommandAbstractException
Specified by:
getOptsMessage in class BusinessHandler
Returns:
the string to return to the client for the FEAT command
Throws:
goldengate.common.command.exception.CommandAbstractException

getSpecializedSiteCommand

public AbstractCommand getSpecializedSiteCommand(FtpSession session,
                                                 String line)
Description copied from class: BusinessHandler
Check if a command pass to SITE command is legal

Specified by:
getSpecializedSiteCommand in class BusinessHandler
Returns:
the AbstractCommand to execute if it is a Specialized Command, else Null

afterTransferDoneBeforeAnswer

public void afterTransferDoneBeforeAnswer(FtpTransfer transfer)
                                   throws goldengate.common.command.exception.CommandAbstractException
Description copied from class: BusinessHandler
Run when a transfer is finished (eventually in error) but before answering. Note that this is called only for a Transfer Request (or LIST) but called before afterRunCommandXX is called (Ok or Ko).

Specified by:
afterTransferDoneBeforeAnswer in class BusinessHandler
Throws:
goldengate.common.command.exception.CommandAbstractException


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