Packageorg.spicefactory.lib.command.base
Classpublic class AbstractCommandExecutor
InheritanceAbstractCommandExecutor Inheritance AbstractSuspendableCommand Inheritance AbstractCancellableCommand Inheritance AbstractAsyncCommand Inheritance flash.events.EventDispatcher
Implements CommandExecutor
Subclasses CommandSequence, DefaultCommandFlow, DefaultCommandProxy, ParallelCommands

Abstract base class for all executor implementations. It knows how to execute other commands and deal with their events. Subclasses are expected to call the protected executeCommand method to start a command and override the protected template method commandComplete for dealing with the result.



Public Properties
 PropertyDefined By
 Inheritedactive : Boolean
[read-only] Indicates whether this command is currently executing.
AbstractAsyncCommand
  cancellable : Boolean
[read-only] Indicates whether this executor can be cancelled.
AbstractCommandExecutor
  domain : ApplicationDomain
The domain to use in case reflection on the command classes this exeutor deals with is required.
AbstractCommandExecutor
  suspendable : Boolean
[read-only] Indicates whether this executor can be suspended.
AbstractCommandExecutor
 Inheritedsuspended : Boolean
[read-only] Indicates whether this command is currently suspended.
AbstractSuspendableCommand
Protected Properties
 PropertyDefined By
  data : CommandData
[read-only] The data associated with this executor.
AbstractCommandExecutor
  lifecycle : CommandLifecycle
[read-only] The lifecycle hook to use for the commands executed by this instance.
AbstractCommandExecutor
Public Methods
 MethodDefined By
  
AbstractCommandExecutor(description:String = null, processErrors:Boolean = false, processCancellations:Boolean = false)
Creates a new instance.
AbstractCommandExecutor
  
addData(value:Object):void
Adds a value to this executor that can get passed to any command executed by this instance.
AbstractCommandExecutor
 Inherited
cancel():void
Cancels the command.
AbstractCancellableCommand
 Inherited
execute():void
Starts the execution of this command.
AbstractAsyncCommand
  
prepare(lifecycle:CommandLifecycle, data:CommandData):void
Method that may be called by frameworks before executing this command to hook into the lifecycle and data handling of this executor.
AbstractCommandExecutor
 Inherited
resume():void
Resumes the command.
AbstractSuspendableCommand
 Inherited
suspend():void
Suspends the command.
AbstractSuspendableCommand
Protected Methods
 MethodDefined By
  
Invoked when a child command has completed its operation successfully.
AbstractCommandExecutor
 Inherited
complete(result:Object = null):void
Signals that this command has completed.
AbstractAsyncCommand
  
Creates a new instance holding the data commands executed by this instance will produce.
AbstractCommandExecutor
  
Creates a new instance of the lifecycle hook.
AbstractCommandExecutor
 Inherited
doCancel():void
Invoked when this command gets cancelled.
AbstractCancellableCommand
 Inherited
doExecute():void
Invoked when the command starts executing.
AbstractAsyncCommand
 Inherited
doResume():void
Invoked when this command gets resumed.
AbstractSuspendableCommand
 Inherited
doSuspend():void
Invoked when this command gets suspended.
AbstractSuspendableCommand
 Inherited
error(cause:Object = null):void
Signals an error condition and cancels the command.
AbstractAsyncCommand
  
Executes the specified command.
AbstractCommandExecutor
Property Detail
cancellableproperty
cancellable:Boolean  [read-only]

Indicates whether this executor can be cancelled.

This property should be true when all currently active commands can be cancelled.


Implementation
    public function get cancellable():Boolean
dataproperty 
data:CommandData  [read-only]

The data associated with this executor. Contains any results from previously executed commands or data specified upfront.


Implementation
    protected function get data():CommandData
domainproperty 
domain:ApplicationDomain

The domain to use in case reflection on the command classes this exeutor deals with is required.


Implementation
    public function get domain():ApplicationDomain
    public function set domain(value:ApplicationDomain):void
lifecycleproperty 
lifecycle:CommandLifecycle  [read-only]

The lifecycle hook to use for the commands executed by this instance.


Implementation
    protected function get lifecycle():CommandLifecycle
suspendableproperty 
suspendable:Boolean  [read-only]

Indicates whether this executor can be suspended.

This property should be true when all currently active commands can be suspended.


Implementation
    public function get suspendable():Boolean
Constructor Detail
AbstractCommandExecutor()Constructor
public function AbstractCommandExecutor(description:String = null, processErrors:Boolean = false, processCancellations:Boolean = false)

Creates a new instance.

Parameters
description:String (default = null) — a description of this command
 
processErrors:Boolean (default = false) — if true an error in a command executed by this instance leads to commandComplete getting called, if false the executor will stop with an error result
 
processCancellations:Boolean (default = false) — if true the cancelleation of a command executed by this instance leads to commandComplete getting called, if false the executor will stop with an error result
Method Detail
addData()method
public function addData(value:Object):void

Adds a value to this executor that can get passed to any command executed by this instance.

Parameters

value:Object — the value to add to this executor

commandComplete()method 
protected function commandComplete(result:CommandResult):void

Invoked when a child command has completed its operation successfully. It may also get invoked when a child command has been cancelled (in case processCancellations is set to true) and commands that failed (in case the processErrors is set to true).

Parameters

result:CommandResult — the result of the command

createData()method 
protected function createData():CommandData

Creates a new instance holding the data commands executed by this instance will produce. Subclasses may override this method to provide specialized implementations. This method will only get invoked when the first command executed by this instance gets started without the prepare method being invoked upfront. The prepare method allows to pass down CommandData instances from the environment (like parent executors), in which case this instance should not use its own implementations.

Returns
CommandData — a new instance to use for holding the data commands executed by this instance will produce
createLifecycle()method 
protected function createLifecycle():CommandLifecycle

Creates a new instance of the lifecycle hook. Subclasses may override this method to provide specialized implementations. This method will only get invoked when the first command executed by this instance gets started without the prepare method being invoked upfront. The prepare method allows to pass down CommandLifecycle instances from the environment (like parent executors), in which case this instance should not create its own lifecycle.

Returns
CommandLifecycle — a new lifecycle instance to use when executing commands
executeCommand()method 
protected function executeCommand(com:Command):void

Executes the specified command. Upon completion the commandComplete method will get invoked which may be overridden by subclasses to deal with the result or decide on the next command to execute.

Parameters

com:Command — the command to execute

prepare()method 
public function prepare(lifecycle:CommandLifecycle, data:CommandData):void

Method that may be called by frameworks before executing this command to hook into the lifecycle and data handling of this executor.

Parameters

lifecycle:CommandLifecycle — the lifecycle hooks this executor should use
 
data:CommandData — data that can be passed to commands executed by this instance