Class Index
static org.cote.js.task.TaskService
version 1.9.18
Static instance of TaskServiceImpl.
This class participates in the engine library.
org.cote.js.task.TaskServiceImpl
version 1.9.18
A service for managing asynchronous and dependency-driven actions.
This class participates in the engine library.
Index
Object Index
Property Index
- public object_config (internal): Object API structure for storing sub structures: object_config.pointers and object_config.status.
- public object_id (internal): Unique instance identifier.
- public object_type (internal): The type of this object.
- public object_version (internal): Version of the object class.
- public ready_state (internal): Object load and execution state. Follows: 0 unitialized, 1 through 3 variant, 4 ready, 5 destroyed.
Method Index
- public addTask: Adds a new task.
- public addTaskDependency: Adds a dependency to a Task object.
- public addTaskLoader: Convenience method for adding a task that overrides the default task loader name.
- public clearDependency: Removes the specified dependency, regardless of whether it was resolved or completed.
- public clearTask: Clears the specified task and removes the TaskObject. If the task is still in operation, auto destroy is enabled and the task will continue to function.
- public clearTasks: Clears all tasks. Any task that is still in operation will be unceremoniously removed from operation, as opposed to clearTask which allows the task to continue current operation until it's finished.
- public destroy: Prepares this object for destruction. All tasks will be cleared.
- public doTransaction (internal): Invoked by TransactionService as a TransactionParticipant.
- public endTransaction (internal): Invoked by TransactionService as a TransactionParticipant.
- public executeTask: Forces the task action to be executed.
- public executeTaskByName: Forces the task action to be executed.
- public executeTaskHandler: Forces the task handler to be executed, and positioning the task to be in a completed state.
- public executeTaskHandlerByName: Forces the task handler to be executed, and positioning the task to be in a completed state.
- public executeTaskLoader: Convenience method for adding and immediately executing a task. Used as a driver to launch other task lists by the Engine service. Invokes addTaskLoader.
- public getObjectId: Returns the unique id of the object.
- public getObjectType: Returns the type of the object.
- public getObjectVersion: Returns the version of the object.
- public getPointers: Returns the object_config.pointers sub structure.
- public getReadyState: Returns the state of the object.
- public getStatus: Returns the object_config.status sub structure.
- public getTask: Returns the specified Task object.
- public getTaskByName: Returns the specified Task object.
- public getTaskDepends: Returns a copy of the dependency names for this task.
- public getTasks: Returns an array of Task objects.
- public importTaskFromXML: Creates a TaskObject from the specified XML Node.
- public isExternalLoaded: Returns true if any external task list has been loaded, false otherwise.
- public isTask: Returns true if the specified name exists.
- public isTaskComplete: Returns whether or not the task was completed.
- public returnDependency: Returns the specified depency name or dependent task name, causing all tasks identifying this dependency to be updated. If the returned dependency is a task, the task is forced closed regardless of whether its action or handler were executed.
- public serveTaskTransaction: Forces the transaction that drives the Task object to serve the corresponding TransactionPacket. This is used when a Task object is thought to be stuck due to some uncaught exception in its action, handler, or dependencies.
- public sigterm: Sends a termination signal to this object.
- public startTransaction (internal): Invoked by TransactionService as a TransactionParticipant.
Objects
Task
Properties
- task_state as int: Current state of the task. State ranges from 0 to 5.
- handled as boolean: Bit indicating the task has been handled.
- task_id as String: The unique task identifier.
- transaction_id as String: The transaction identifier for this task.
- index as int: The index of this task in the TaskService tasks array.
- task_name as String: The name of the task.
- action_type as String: The type of action this task performs. Supported types are: xml, task, import-task, event, script, and function.
- action as String: The action this task performs, based on the
- handler_type as String: The type of handler this task performs. Supported types are: xml, task, import-task, event, script, and function.
- handler as String: The handler this task performs, based on the
- data as variant: The data associated with the task.
- depends as array: Array of identifiers representing dependencies that must be completed before the task can be handled.
- executed as boolean: Bit indicating the task has been executed.
- busy as boolean: Bit indicating the task is busy working on its action or handler.
- parent_id as String: The identifier of the parent task, which depends on this task to complete.
Methods
Properties
object_config
Object API structure for storing sub structures: object_config.pointers and object_config.status.
Syntax
object = object.object_config
object_id
Unique instance identifier.
Syntax
String = object.object_id
object_type
The type of this object.
Syntax
String = object.object_type
object_version
Version of the object class.
Syntax
String = object.object_version
ready_state
Object load and execution state. Follows: 0 unitialized, 1 through 3 variant, 4 ready, 5 destroyed.
Syntax
int = object.ready_state
Methods
addTask
Adds a new task.
Syntax
o = addTask(
n, at, a, ht, h
)
Parameters
- n as String : Task name.
- at as String : Action type. Supported types are: xml, task, import-task, event, script, and function.
- a as variant : Task action, based on specified action type.
- ht as String : Handler type. Supported types are: xml, task, import-task, event, script, and function.
- h as variant : Task handler, based on specified action type.
Returns
o as TaskObject: New Task object.
addTaskDependency
Adds a dependency to a Task object.
Syntax
a = addTaskDependency(
t, d
)
Parameters
- t as TaskObject : A Task object.
- d as String : Name of the dependency.
Returns
a as boolean: Bit indicating whether the dependency was added.
addTaskLoader
Convenience method for adding a task that overrides the default task loader name.
Syntax
o = addTaskLoader(
n, at, a, ht, h
)
Parameters
- n as String : Task name.
- at as String : Action type. Supported types are: xml, task, import-task, event, script, and function.
- a as variant : Task action, based on specified action type.
- ht as String : Handler type. Supported types are: xml, task, import-task, event, script, and function.
- h as variant : Task handler, based on specified action type.
Returns
o as TaskObject: New Task object.
clearDependency
Removes the specified dependency, regardless of whether it was resolved or completed.
Syntax
void clearDependency(
v
)
Parameters
- v as variant : A Task object, task name, or dependency name.
clearTask
Clears the specified task and removes the TaskObject. If the task is still in operation, auto destroy is enabled and the task will continue to function.
Syntax
t = clearTask(
i
)
Parameters
- i as String : Identifier of a TaskObject.
Returns
t as boolean: Returns true if the task was cleared or slated to be cleared, or otherwise false.
clearTasks
Clears all tasks. Any task that is still in operation will be unceremoniously removed from operation, as opposed to clearTask which allows the task to continue current operation until it's finished.
Syntax
void clearTasks(
)
destroy
Prepares this object for destruction. All tasks will be cleared.
Syntax
void destroy(
)
doTransaction
Invoked by TransactionService as a TransactionParticipant.
Syntax
void doTransaction(
s, p
)
Parameters
- s as TransactionService : TransactionService managing this transaction.
- p as TransactionPacket : TransactionPacket used to monitor the task state.
endTransaction
Invoked by TransactionService as a TransactionParticipant.
Syntax
void endTransaction(
s, p
)
Parameters
- s as TransactionService : TransactionService managing this transaction.
- p as TransactionPacket : TransactionPacket used to monitor the task state.
executeTask
Forces the task action to be executed.
Syntax
b = executeTask(
o
)
Parameters
- o as Task : A Task object.
Returns
b as boolean: Bit indicating whether the task action was executed.
executeTaskByName
Forces the task action to be executed.
Syntax
b = executeTaskByName(
n
)
Parameters
- n as String : The name of a task object.
Returns
b as boolean: Bit indicating whether the task action was executed.
executeTaskHandler
Forces the task handler to be executed, and positioning the task to be in a completed state.
Syntax
b = executeTaskHandler(
o
)
Parameters
- o as Task : A Task object.
Returns
b as boolean: Bit indicating whether the handler was executed.
executeTaskHandlerByName
Forces the task handler to be executed, and positioning the task to be in a completed state.
Syntax
b = executeTaskHandlerByName(
n
)
Parameters
- n as String : The name of a task object.
Returns
b as boolean: Bit indicating whether the handler was executed.
executeTaskLoader
Convenience method for adding and immediately executing a task. Used as a driver to launch other task lists by the Engine service. Invokes addTaskLoader.
Syntax
o = executeTaskLoader(
n, at, a, ht, h
)
Parameters
- n as String : Task name.
- at as String : Action type. Supported types are: xml, task, import-task, event, script, and function.
- a as variant : Task action, based on specified action type.
- ht as String : Handler type. Supported types are: xml, task, import-task, event, script, and function.
- h as variant : Task handler, based on specified action type.
Returns
o as TaskObject: New Task object.
getObjectId
Returns the unique id of the object.
Syntax
i = getObjectId(
)
Returns
i as String: The unique object instance id.
getObjectType
Returns the type of the object.
Syntax
t = getObjectType(
)
Returns
t as String: The type of the object instance.
getObjectVersion
Returns the version of the object.
Syntax
v = getObjectVersion(
)
Returns
v as String: The version of the object instance.
getPointers
Returns the object_config.pointers sub structure.
Syntax
o = getPointers(
)
Returns
o as object: The object_config.pointers substructure.
getReadyState
Returns the state of the object.
Syntax
s = getReadyState(
)
Returns
s as int: The object ready state.
getStatus
Returns the object_config.status sub structure.
Syntax
o = getStatus(
)
Returns
o as object: The object_config.status substructure.
getTask
Returns the specified Task object.
Syntax
e = getTask(
i
)
Parameters
- i as int : Index of the Task object..
Returns
e as Task: XHTMLForm object.
getTaskByName
Returns the specified Task object.
Syntax
e = getTaskByName(
n
)
Parameters
- n as String : Name of the element.
Returns
e as Task: Task object.
getTaskDepends
Returns a copy of the dependency names for this task.
Syntax
a = getTaskDepends(
t
)
Parameters
- t as TaskObject : A Task object.
Returns
a as array: Array of task dependency names.
getTasks
Returns an array of Task objects.
Syntax
a = getTasks(
)
Returns
a as array: Array of Task objects.
importTaskFromXML
Creates a TaskObject from the specified XML Node.
Syntax
void importTaskFromXML(
n, o, d, b
)
Parameters
- n as DOMNode : XML Node representing a task.
- o as TaskObject (optional): Parent task, which would be made dependent on this task.
- d as DOMDocument : The XML Document from which the XML Node originated.
- b as boolean : Bit indicating the task should be executed immediately.
isExternalLoaded
Returns true if any external task list has been loaded, false otherwise.
Syntax
b = isExternalLoaded(
)
Returns
b as boolean: Bit indicating whether an external task list has been loaded.
isTask
Returns true if the specified name exists.
Syntax
b = isTask(
i
)
Parameters
- i as variant : Name or index of the Task object..
Returns
b as boolean: Bit indicating whether the specified object name exists.
isTaskComplete
Returns whether or not the task was completed.
Syntax
c = isTaskComplete(
o
)
Parameters
- o as Task : A Task object.
Returns
c as boolean: Bit indicating whether the task was completed.
returnDependency
Returns the specified depency name or dependent task name, causing all tasks identifying this dependency to be updated. If the returned dependency is a task, the task is forced closed regardless of whether its action or handler were executed.
Syntax
void returnDependency(
v
)
Parameters
- v as variant : A Task object, task name, or dependency name.
serveTaskTransaction
Forces the transaction that drives the Task object to serve the corresponding TransactionPacket. This is used when a Task object is thought to be stuck due to some uncaught exception in its action, handler, or dependencies.
Syntax
void serveTaskTransaction(
o
)
Parameters
- o as Task : A Task object.
sigterm
Sends a termination signal to this object.
Syntax
void sigterm(
)
startTransaction
Invoked by TransactionService as a TransactionParticipant.
Syntax
void startTransaction(
s, p
)
Parameters
- s as TransactionService : TransactionService managing this transaction.
- p as TransactionPacket : TransactionPacket used to monitor the task state.