Packagecom.rosettastone.library.taskmanager
Classpublic class FactoryTask
InheritanceFactoryTask Inheritance InterruptibleTask Inheritance Task Inheritance flash.events.EventDispatcher
Implements IDecoratorTask

Decorates a Task returned by the specified factory method. This Task does not invoke the provided factory method until it is actually executed. This allows for just-in-time evaluation of data set by previous Tasks.



Public Properties
 PropertyDefined By
 Inheriteddata : *
[read-only] Optional data parameter passed to the Task complete/error/interruption method.
Task
  decoratedTask : ITask
[read-only] Inner (decorated) Task.
FactoryTask
 Inheritedid : Number
[read-only]
Task
 Inheritedinterruptible : Boolean
[override] [read-only] The current Task can be interrupted.
InterruptibleTask
 InheritedinterruptingTask : ITask
[read-only] The Task currently interrupting the composite Task's execution (or NULL if no such Task exists).
Task
 InheritedisComplete : Boolean
[read-only] The current task has successfully completed execution.
Task
 InheritedisErrored : Boolean
[read-only] The current task failed.
Task
 InheritedisInterrupted : Boolean
[read-only]
Task
 InheritedisRunning : Boolean
[read-only] The task is currently running.
Task
 Inheritedmessage : String
[read-only] Optional message parameter passed to the task complete/error/interruption method.
Task
 InheritednumInternalOperations : int
[read-only] Number of internal operations conducted by this task.
Task
 InheritednumInternalOperationsCompleted : int
[read-only] Number of internal operations that have completed.
Task
 InheritednumInternalOperationsPending : int
[read-only] Number of internal operations not yet completed.
Task
 InheritednumTimesCompleted : int
[read-only] Number of times this task has completed.
Task
 InheritednumTimesErrored : int
[read-only] Number of times this task has errored.
Task
 InheritednumTimesInterrupted : int
[read-only] Number of times this task has been interrupted.
Task
 InheritednumTimesReset : int
[read-only] Number of times this task has been reset.
Task
 InheritednumTimesStarted : int
[read-only] Number of times this task has been started.
Task
  reexecuteFactoryFunctionAfterError : Boolean
[read-only] If this FactoryTask is re-run after an error has occurred, this attribute controls whether it: (a) Reuses the decorated Task initially created during its first run, or (b) Reexecutes the factory method to create a new decorated Task.
FactoryTask
 Inheritedrunning : Boolean
[read-only] The task is currently running.
Task
 Inheritedsynchronous : Boolean
[read-only] The current task can be executed synchronously.
Task
 InheritedtaskIdentifier : String
(Optional) human-readable label for task.
Task
 InheriteduniqueID : Number
[read-only] Unique ID for a task.
Task
Protected Properties
 PropertyDefined By
  _args : Array
FactoryTask
 Inheritedlogger : ILogger
[read-only] Instance of ILogger to be used for any custom Task logging.
Task
  _recreateDecoratedTaskWhenNextRun : Boolean
FactoryTask
  _reexecuteFactoryFunctionAfterError : Boolean
FactoryTask
  _task : IInterruptibleTask
FactoryTask
  _taskFactoryFunction : Function
FactoryTask
  _taskWillBeInterruptible : Boolean
FactoryTask
  _thisObj : *
FactoryTask
Public Methods
 MethodDefined By
  
FactoryTask(taskFactoryFunction:Function, thisObj:* = null, args:Array = null, taskWillBeInterruptible:Boolean = false, taskIdentifier:String = null)
Constructor.
FactoryTask
 Inherited
and(... chainedTasks):ITask
Executes the specified tasks when the current task is executed.
Task
 Inherited
Task
 Inherited
interrupt():Boolean
[override] Interrupt the current Task.
InterruptibleTask
 Inherited
interruptForTask(interruptingTask:ITask):Boolean
Interrupts the current Task to wait on the Task specified.
Task
 Inherited
or(... chainedTasks):ITask
Executes the specified tasks if the current task fails.
Task
 Inherited
reset():void
Resets the task to it's pre-run state.
Task
 Inherited
Starts a task.
Task
  
FactoryTask
 Inherited
then(... chainedTasks):ITask
Executes the specified tasks once the current task has completed successfully.
Task
 Inherited
withCompleteHandler(completeHandler:Function):ITask
Although tasks dispatch TaskEvents to indicate completion, this method may also be used for notification purposes.
Task
 Inherited
withErrorHandler(errorHandler:Function):ITask
Although tasks dispatch TaskEvents to indicate failure, this method may also be used for notification purposes.
Task
 Inherited
withFinalHandler(finalHandler:Function):ITask
This handler is invoked upon either success or failure of the Task.
Task
 Inherited
withInterruptionHandler(interruptionHandler:Function):ITask
Task
 Inherited
withStartedHandler(startedHandler:Function):ITask
Although tasks dispatch TaskEvents to indicate starting, this method may also be used for notification purposes.
Task
Protected Methods
 MethodDefined By
  
[override] Sub-classes should override this method to implement interruption behavior (removing event listeners, pausing objects, etc.).
FactoryTask
  
[override] Override this method to perform any custom reset operations.
FactoryTask
  
customRun():void
[override] Override this method to give your Task functionality.
FactoryTask
 Inherited
Task
 Inherited
getLoggerString(string:String):String
Returns a string for logging the specified task-state event.
Task
 Inherited
taskComplete(message:String, data:* = null):void
This method should be called upon Task completion.
Task
 Inherited
taskError(message:String, data:* = null):void
This method should be called upon Task failure.
Task
 Inherited
taskInterrupted(message:String, data:* = null):void
Call this method to interrupt the currently running Task.
Task
 Inherited
Task
Events
 Event Summary Defined By
 InheritedTask
 InheritedTask
 InheritedTask
 InheritedTask
 InheritedTask
 InheritedTask
Property Detail
_argsproperty
protected var _args:Array

_recreateDecoratedTaskWhenNextRunproperty 
protected var _recreateDecoratedTaskWhenNextRun:Boolean

_reexecuteFactoryFunctionAfterErrorproperty 
protected var _reexecuteFactoryFunctionAfterError:Boolean

_taskproperty 
protected var _task:IInterruptibleTask

_taskFactoryFunctionproperty 
protected var _taskFactoryFunction:Function

_taskWillBeInterruptibleproperty 
protected var _taskWillBeInterruptible:Boolean

_thisObjproperty 
protected var _thisObj:*

decoratedTaskproperty 
decoratedTask:ITask  [read-only]

Inner (decorated) Task.


Implementation
    public function get decoratedTask():ITask
reexecuteFactoryFunctionAfterErrorproperty 
reexecuteFactoryFunctionAfterError:Boolean  [read-only]

If this FactoryTask is re-run after an error has occurred, this attribute controls whether it: (a) Reuses the decorated Task initially created during its first run, or (b) Reexecutes the factory method to create a new decorated Task. By default this value is FALSE, meaning that the decorated task created initially will be reused.


Implementation
    public function get reexecuteFactoryFunctionAfterError():Boolean
Constructor Detail
FactoryTask()Constructor
public function FactoryTask(taskFactoryFunction:Function, thisObj:* = null, args:Array = null, taskWillBeInterruptible:Boolean = false, taskIdentifier:String = null)

Constructor.

Parameters
taskFactoryFunction:Function — Returns an ITask object
 
thisObj:* (default = null) — Optional object to which the function is applied.
 
args:Array (default = null) — Optional Array of parameters to be passed to the factory Function. If this value is specified a target "thisObj" must be provided as well.
 
taskWillBeInterruptible:Boolean (default = false) — Task returned by facotry function is interruptible
 
taskIdentifier:String (default = null) — Semantically meaningful task identifier (useful for automated testing or debugging)
Method Detail
customInterrupt()method
override protected function customInterrupt():void

Sub-classes should override this method to implement interruption behavior (removing event listeners, pausing objects, etc.).

customReset()method 
override protected function customReset():void

Override this method to perform any custom reset operations.

customRun()method 
override protected function customRun():void

Override this method to give your Task functionality.

setReexecuteFactoryFunctionAfterError()method 
public function setReexecuteFactoryFunctionAfterError(value:Boolean = false):FactoryTask

Parameters

value:Boolean (default = false)

Returns
FactoryTask