com.googlecode.jpattern.core.command
Class ACommand

java.lang.Object
  extended by com.googlecode.jpattern.core.command.ICommand
      extended by com.googlecode.jpattern.core.command.ACommand
All Implemented Interfaces:
java.io.Serializable, java.lang.Runnable
Direct Known Subclasses:
FileCopyCommand, FileCreateCommand, FileDeleteCommand, FileRenameCommand, SendMailCommand, XmlReaderCommand, XmlWriterCommand

public abstract class ACommand
extends ICommand
implements java.lang.Runnable

Author:
Francesco Cina' 27/feb/2011
See Also:
Serialized Form

Constructor Summary
ACommand(ICommand previousCommand)
           
 
Method Summary
 ICommandResult exec()
          This method launch the execution of the command (or chain of commands) using the default DefaultCommandExecutor.
 ICommandResult exec(ICommandExecutor aCommandExecutor)
          This method launch the execution of the command (or chain of commands).
protected  ICommand getPreviousCommand()
           
protected  IProvider getProvider()
           
protected abstract  void internalRollBack(ICommandResult rollBackResult)
           
protected abstract  void result(ICommandResult result)
           
 ICommandResult rollback()
          This method launch the rollback of the command (or chain of commands) using the default DefaultCommandExecutor.
 ICommandResult rollback(ICommandExecutor aCommandExecutor)
          This method launch the rollback of the command (or chain of commands).
 ICommandResult rollback(ICommandResult execResult)
          This method launch the rollback of the command (or chain of commands) only if the ICommandExecutor passed as parameter is not valid.
 ICommandResult rollback(ICommandResult execResult, ICommandExecutor aCommandExecutor)
          This method launch the rollback of the command (or chain of commands) only if the ICommandExecutor passed as parameter is not valid.
 void run()
           
 void visit(IProvider provider)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ACommand

public ACommand(ICommand previousCommand)
Method Detail

exec

public final ICommandResult exec()
Description copied from class: ICommand
This method launch the execution of the command (or chain of commands) using the default DefaultCommandExecutor. This command is the same of: exec(new ConditionalCommandExecutor());

Specified by:
exec in class ICommand
Returns:
the result of the execution

exec

public final ICommandResult exec(ICommandExecutor aCommandExecutor)
Description copied from class: ICommand
This method launch the execution of the command (or chain of commands). Every command in the chain will be managed by an ICommandExecutor object

Specified by:
exec in class ICommand
Parameters:
aCommandExecutor - the pool in which the command will runs
Returns:
the result of the execution

rollback

public final ICommandResult rollback(ICommandExecutor aCommandExecutor)
Description copied from class: ICommand
This method launch the rollback of the command (or chain of commands). Every command in the chain will be managed by an ICommandExecutor object

Specified by:
rollback in class ICommand
Parameters:
aCommandExecutor - the pool in which the command will runs
Returns:
the result of the rollback

visit

public final void visit(IProvider provider)
Specified by:
visit in class ICommand

run

public final void run()
Specified by:
run in interface java.lang.Runnable

rollback

public final ICommandResult rollback()
Description copied from class: ICommand
This method launch the rollback of the command (or chain of commands) using the default DefaultCommandExecutor. This command is the same of: rollback(new ConditionalCommandExecutor());

Specified by:
rollback in class ICommand
Returns:
the result of the rollback

rollback

public final ICommandResult rollback(ICommandResult execResult)
Description copied from class: ICommand
This method launch the rollback of the command (or chain of commands) only if the ICommandExecutor passed as parameter is not valid. The DefaultCommandExecutor will be used This command is the same of: rollback(execResult, new ConditionalCommandExecutor());

Specified by:
rollback in class ICommand
Parameters:
execResult - the result of a Command execution
Returns:
the result of the rollback

rollback

public final ICommandResult rollback(ICommandResult execResult,
                                     ICommandExecutor aCommandExecutor)
Description copied from class: ICommand
This method launch the rollback of the command (or chain of commands) only if the ICommandExecutor passed as parameter is not valid. The ICommandExecutor passed as a parameter will be used.

Specified by:
rollback in class ICommand
Parameters:
execResult - the result of a Command execution
aCommandExecutor - the pool in which the command will runs
Returns:
the result of the rollback

result

protected abstract void result(ICommandResult result)

internalRollBack

protected abstract void internalRollBack(ICommandResult rollBackResult)

getPreviousCommand

protected ICommand getPreviousCommand()

getProvider

protected IProvider getProvider()


Copyright © 2011. All Rights Reserved.