Engine for Web Applications

org.cote.js.task

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

Method Index

Objects

Task

Properties

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

Returns

o as TaskObject: New Task object.

addTaskDependency

Adds a dependency to a Task object.

Syntax

a = addTaskDependency( t, d )

Parameters

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

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

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

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

endTransaction

Invoked by TransactionService as a TransactionParticipant.

Syntax

void endTransaction( s, p )

Parameters

executeTask

Forces the task action to be executed.

Syntax

b = executeTask( o )

Parameters

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

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

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

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

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

Returns

e as Task: XHTMLForm object.

getTaskByName

Returns the specified Task object.

Syntax

e = getTaskByName( n )

Parameters

Returns

e as Task: Task object.

getTaskDepends

Returns a copy of the dependency names for this task.

Syntax

a = getTaskDepends( t )

Parameters

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

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

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

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

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

sigterm

Sends a termination signal to this object.

Syntax

void sigterm( )

startTransaction

Invoked by TransactionService as a TransactionParticipant.

Syntax

void startTransaction( s, p )

Parameters