This is a generic interface that is used by other platform services that expose asynchronous operations and their results to applications.
Example of services that implement this interface can be found in ToiAssetManagerService::getAssetOperationManager() and ToiStorageService::getStorageOperationManager().
import "ToiOperationManager.idl";
Public Member Functions | |
TToiOperationId | createOperation (in string userData) raises (TToiNotEnoughResourcesException) |
void | cancelOperation (in TToiOperationId operationId) raises (TToiInvalidArgumentException) |
void | releaseOperation (in TToiOperationId operationId) raises (TToiInvalidArgumentException) |
ToiOperationManagerOperationInfo | getOperationInfo (in TToiOperationId operationId) raises (TToiInvalidArgumentException) |
void | addEventListener (in long type, in ToiEventListener listener) raises (TToiInvalidArgumentException) |
void | removeEventListener (in long type, in ToiEventListener listener) raises (TToiInvalidArgumentException) |
Public Attributes | |
Events | |
const long | ON_OPERATION_RESULT = 2000 |
Operation error codes | |
const TToiOperationError | OP_ERROR_FAILED = -1 |
const TToiOperationError | OP_ERROR_CANCELLED = -2 |
TToiOperationState | |
const TToiOperationState | OPERATION_PENDING = 0 |
const TToiOperationState | OPERATION_COMPLETED = 1 |
const TToiOperationState | OPERATION_FAILED = 2 |
Operation results | |
const TToiOperationResult | OP_RESULT_NONE = 0 |
Public Types | |
typedef long | TToiOperationId |
typedef long | TToiOperationResult |
typedef long | TToiOperationError |
typedef long | TToiPropertyId |
typedef string | TToiPropertyValue |
typedef sequence < ToiOperationManagerProperty > | TToiPropertySequence |
typedef long | TToiOperationState |
typedef long ToiOperationManager::TToiOperationError |
Type for operation errors.
typedef long ToiOperationManager::TToiOperationId |
Type for operation identifier.
typedef long ToiOperationManager::TToiOperationResult |
Type for operation results.
typedef long ToiOperationManager::TToiOperationState |
State identifier used to identify the operation state.
typedef long ToiOperationManager::TToiPropertyId |
Identifier for a metadata property. This with ToiOperationManager::TToiPropertyValue forms a key-value pair that is used by the ToiOperationManagerOperationInfo to provide additional information about operation informaiton .
typedef sequence< ToiOperationManagerProperty > ToiOperationManager::TToiPropertySequence |
Sequence of property tags.
typedef string ToiOperationManager::TToiPropertyValue |
Value for a metadata property. This with ToiOperationManager::TToiPropertyId forms a key-value pair that is used by the ToiOperationManagerOperationInfo toprovide additional information about operation informaiton .
void ToiEventTarget::addEventListener | ( | in long | type, | |
in ToiEventListener | listener | |||
) | raises (TToiInvalidArgumentException) [inherited] |
This method registers an event listener for a specific event. Multiple listeners can be added for the same event. Events are broadcast to all registered listeners.
type | The event type of the event to subscribe to. | |
listener | The JavaScript function that will receive events. |
TInvalidArgumentException | Raised if the event type is not supported by this object or if the listener is not a valid JavaScript function. This exception is also raised if the application calls addEventListener with the same combination of type and listener twice. |
void ToiOperationManager::cancelOperation | ( | in TToiOperationId | operationId | ) | raises (TToiInvalidArgumentException) |
Requests an operation to stop execution.
operationId | Operation identifier. |
TToiInvalidArgumentException | Raised if any of the parameters to the call are invalid. |
TToiOperationId ToiOperationManager::createOperation | ( | in string | userData | ) | raises (TToiNotEnoughResourcesException) |
Creates a new operation. The operation identifier is used when starting a asynchronous request. When the operation is completed the operation shall either be released by calling ToiOperationManager::releaseOperation() or reused for another request.
userData | The user defined data to be passed as parameter for identification in all operation callbacks. |
operationId | Operation identifier. |
TToiNotEnoughResourcesException | Raised if too many operations are active and the system cannot create another operation. |
ToiOperationManagerOperationInfo ToiOperationManager::getOperationInfo | ( | in TToiOperationId | operationId | ) | raises (TToiInvalidArgumentException) |
Returns information about given operation. This method is normally not useful for an application that is listening to operation events since the same information is provided in the callback.
In some circumstances it may still be relevant to use this method and that is when the application is using a polled approach to handle operation results instead of callbacks. But also if the application do not handle an incoming callback directly and want to get the latest updated operation information.
operationId | Operation identifier. |
operationInfo | The current operation information. |
TToiInvalidArgumentException | Raised if any of the parameters to the call are invalid. |
void ToiOperationManager::releaseOperation | ( | in TToiOperationId | operationId | ) | raises (TToiInvalidArgumentException) |
Releases any system resources associated with the operation and if needed cancels the operation as well. This method shall be called when the application is done with the operation and will use it no more.
operationId | Operation identifier. |
TToiInvalidArgumentException | Raised if any of the parameters to the call are invalid. |
void ToiEventTarget::removeEventListener | ( | in long | type, | |
in ToiEventListener | listener | |||
) | raises (TToiInvalidArgumentException) [inherited] |
This method removes an event listener for a specific event.
type | The event type of the event to remove the listener from. | |
listener | The JavaScript function that was previously added as an event listener. |
TInvalidArgumentException | Raised if the event type is not supported by this object or if the listener is not a valid JavaScript function. This exception is also raised if the listener had not previously been added. |
const long ToiOperationManager::ON_OPERATION_RESULT = 2000 |
This is an Event identifier for ToiOperationOperationResultEvent.
This constant can also be accessed from toi.consts.ToiOperationManager.ON_OPERATION_RESULT.
Operation was canceled by user.
This constant can also be accessed from toi.consts.ToiOperationManager.OP_ERROR_CANCELLED.
Operation failed for unknown reason.
This constant can also be accessed from toi.consts.ToiOperationManager.OP_ERROR_FAILED.
The operation has no result. Can be used for operations that perform some action and only indicate progress, success and failure.
This constant can also be accessed from toi.consts.ToiOperationManager.OP_RESULT_NONE.
Asynchronous operation has finished and completed the request.
This constant can also be accessed from toi.consts.ToiOperationManager.OPERATION_COMPLETED.
Asynchronous operation has failed.
This constant can also be accessed from toi.consts.ToiOperationManager.OPERATION_FAILED.
Asynchronous operation is currently in progress.
This constant can also be accessed from toi.consts.ToiOperationManager.OPERATION_PENDING.