Package | com.rosettastone.library.taskmanager |
Class | public class FactoryTask |
Inheritance | FactoryTask ![]() ![]() ![]() |
Implements | IDecoratorTask |
Property | Defined By | ||
---|---|---|---|
![]() | data : * [read-only]
Optional data parameter passed to the Task complete/error/interruption method. | Task | |
decoratedTask : ITask [read-only]
Inner (decorated) Task. | FactoryTask | ||
![]() | id : Number [read-only]
| Task | |
![]() | interruptible : Boolean [override] [read-only]
The current Task can be interrupted. | InterruptibleTask | |
![]() | interruptingTask : ITask [read-only]
The Task currently interrupting the composite Task's execution (or NULL if no such Task exists). | Task | |
![]() | isComplete : Boolean [read-only]
The current task has successfully completed execution. | Task | |
![]() | isErrored : Boolean [read-only]
The current task failed. | Task | |
![]() | isInterrupted : Boolean [read-only]
| Task | |
![]() | isRunning : Boolean [read-only]
The task is currently running. | Task | |
![]() | message : String [read-only]
Optional message parameter passed to the task complete/error/interruption method. | Task | |
![]() | numInternalOperations : int [read-only]
Number of internal operations conducted by this task. | Task | |
![]() | numInternalOperationsCompleted : int [read-only]
Number of internal operations that have completed. | Task | |
![]() | numInternalOperationsPending : int [read-only]
Number of internal operations not yet completed. | Task | |
![]() | numTimesCompleted : int [read-only]
Number of times this task has completed. | Task | |
![]() | numTimesErrored : int [read-only]
Number of times this task has errored. | Task | |
![]() | numTimesInterrupted : int [read-only]
Number of times this task has been interrupted. | Task | |
![]() | numTimesReset : int [read-only]
Number of times this task has been reset. | Task | |
![]() | numTimesStarted : 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 | ||
![]() | running : Boolean [read-only]
The task is currently running. | Task | |
![]() | synchronous : Boolean [read-only]
The current task can be executed synchronously. | Task | |
![]() | taskIdentifier : String
(Optional) human-readable label for task. | Task | |
![]() | uniqueID : Number [read-only]
Unique ID for a task. | Task |
Property | Defined By | ||
---|---|---|---|
_args : Array | FactoryTask | ||
![]() | logger : 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 |
Method | Defined By | ||
---|---|---|---|
FactoryTask(taskFactoryFunction:Function, thisObj:* = null, args:Array = null, taskWillBeInterruptible:Boolean = false, taskIdentifier:String = null)
Constructor. | FactoryTask | ||
![]() |
Executes the specified tasks when the current task is executed. | Task | |
![]() | Task | ||
![]() | interrupt():Boolean [override]
Interrupt the current Task. | InterruptibleTask | |
![]() | interruptForTask(interruptingTask:ITask):Boolean
Interrupts the current Task to wait on the Task specified. | Task | |
![]() |
Executes the specified tasks if the current task fails. | Task | |
![]() | reset():void
Resets the task to it's pre-run state. | Task | |
![]() |
Starts a task. | Task | |
setReexecuteFactoryFunctionAfterError(value:Boolean = false):FactoryTask | FactoryTask | ||
![]() |
Executes the specified tasks once the current task has completed successfully. | Task | |
![]() | withCompleteHandler(completeHandler:Function):ITask
Although tasks dispatch TaskEvents to indicate completion, this method may also be used for notification purposes. | Task | |
![]() | withErrorHandler(errorHandler:Function):ITask
Although tasks dispatch TaskEvents to indicate failure, this method may also be used for notification purposes. | Task | |
![]() | withFinalHandler(finalHandler:Function):ITask
This handler is invoked upon either success or failure of the Task. | Task | |
![]() | withInterruptionHandler(interruptionHandler:Function):ITask | Task | |
![]() | withStartedHandler(startedHandler:Function):ITask
Although tasks dispatch TaskEvents to indicate starting, this method may also be used for notification purposes. | Task |
Method | Defined By | ||
---|---|---|---|
customInterrupt():void [override]
Sub-classes should override this method to implement interruption behavior (removing event listeners, pausing objects, etc.). | FactoryTask | ||
customReset():void [override]
Override this method to perform any custom reset operations. | FactoryTask | ||
customRun():void [override]
Override this method to give your Task functionality. | FactoryTask | ||
![]() | dispatchProgressEvent():void | Task | |
![]() | getLoggerString(string:String):String
Returns a string for logging the specified task-state event. | Task | |
![]() | taskComplete(message:String, data:* = null):void
This method should be called upon Task completion. | Task | |
![]() | taskError(message:String, data:* = null):void
This method should be called upon Task failure. | Task | |
![]() | taskInterrupted(message:String, data:* = null):void
Call this method to interrupt the currently running Task. | Task | |
![]() | throwErrorIfAnyObjectInArrayIsNotATask(tasks:Array):void | Task |
_args | property |
protected var _args:Array
_recreateDecoratedTaskWhenNextRun | property |
protected var _recreateDecoratedTaskWhenNextRun:Boolean
_reexecuteFactoryFunctionAfterError | property |
protected var _reexecuteFactoryFunctionAfterError:Boolean
_task | property |
protected var _task:IInterruptibleTask
_taskFactoryFunction | property |
protected var _taskFactoryFunction:Function
_taskWillBeInterruptible | property |
protected var _taskWillBeInterruptible:Boolean
_thisObj | property |
protected var _thisObj:*
decoratedTask | property |
decoratedTask:ITask
[read-only] Inner (decorated) Task.
public function get decoratedTask():ITask
reexecuteFactoryFunctionAfterError | property |
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.
public function get reexecuteFactoryFunctionAfterError():Boolean
FactoryTask | () | Constructor |
public function FactoryTask(taskFactoryFunction:Function, thisObj:* = null, args:Array = null, taskWillBeInterruptible:Boolean = false, taskIdentifier:String = null)
Constructor.
ParameterstaskFactoryFunction: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)
|
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 )
|
FactoryTask |