goldengate.common.command
Interface CommandInterface


public interface CommandInterface

Interface for Command

Author:
Frederic Bregier

Method Summary
 void exec()
          Execute the command.
 String getArg()
           
 String[] getArgs()
           
 Enum<?> getCode()
           
 String getCommand()
           
 Object getObject()
           
 SessionInterface getSession()
           
 int getValue(String argx)
          Get an integer value from argument
 boolean hasArg()
          Does this command has an argument
 void invalidCurrentCommand()
          Set the previous command as the new current command (used after a incorrect sequence of commands or unknown command).
 boolean isNextCommandValid(CommandInterface newCommand)
          This function is called when a new command is received to check if this new command is positive according to the previous command and status.
 void setArgs(SessionInterface session, String command, String arg, Enum code)
          Set the Command from the args
 void setExtraNextCommand(Enum extraNextCommand)
          This function is intend to allow to force USER->PASS->ACCT->CDW for instance
 void setObject(Object object)
           
 

Method Detail

setArgs

void setArgs(SessionInterface session,
             String command,
             String arg,
             Enum code)
Set the Command from the args

Parameters:
session -
command -
arg -
code -

exec

void exec()
          throws CommandAbstractException
Execute the command. This execution must set the replyCode in the session to a correct value before returning.

Throws:
CommandAbstractException - in case of an FTP Error occurs

setExtraNextCommand

void setExtraNextCommand(Enum extraNextCommand)
This function is intend to allow to force USER->PASS->ACCT->CDW for instance

Parameters:
extraNextCommand - the extraNextCommand to set

isNextCommandValid

boolean isNextCommandValid(CommandInterface newCommand)
This function is called when a new command is received to check if this new command is positive according to the previous command and status.

Parameters:
newCommand -
Returns:
True if this new command is OK, else False

getObject

Object getObject()
Returns:
the object

setObject

void setObject(Object object)
Parameters:
object - the object to set

getArg

String getArg()
Returns:
the arg

getArgs

String[] getArgs()
Returns:
the list of arguments

getValue

int getValue(String argx)
             throws InvalidArgumentException
Get an integer value from argument

Parameters:
argx -
Returns:
the integer
Throws:
InvalidArgumentException - if the argument is not an integer

getCommand

String getCommand()
Returns:
the command

hasArg

boolean hasArg()
Does this command has an argument

Returns:
True if it has an argument

getSession

SessionInterface getSession()
Returns:
the current SessionInterface

invalidCurrentCommand

void invalidCurrentCommand()
Set the previous command as the new current command (used after a incorrect sequence of commands or unknown command). Also clear the Restart object.


getCode

Enum<?> getCode()
Returns:
The GgCommandCode associated with this command


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