com.ibm.mashups.enabler
Interface DeferredOperation

All Superinterfaces:
Deferred

public DeferredOperation
extends Deferred

In addition to the Deferred interface, which allows to trigger callbacks after the entire action has finished, the DeferredOperation interface allows to trigger a callback for each involved operation.


Field Summary
 String OPERATION_GET
           Mode of operation: retrieving a resource
 String OPERATION_CREATE
           Mode of operation: creating a resource
 String OPERATION_MODIFY
           Mode of operation: modifying a resource
 String OPERATION_DELETE
           Mode of operation: deleting a resource
 
Method Summary
 Deferred setFinishedCallback(Object callback, Object parameter, Boolean verbose)
           Sets the handler of the deferred action.
 Deferred setOperationCallback(Object callback, Object parameter, Boolean verbose)
           Sets the operation handler of the deferred action.
 
Methods inherited from interface com.ibm.mashups.enabler.Deferred
setFinishedCallback, start
 

Field Detail

OPERATION_GET

String OPERATION_GET
Mode of operation: retrieving a resource


OPERATION_CREATE

String OPERATION_CREATE
Mode of operation: creating a resource


OPERATION_MODIFY

String OPERATION_MODIFY
Mode of operation: modifying a resource


OPERATION_DELETE

String OPERATION_DELETE
Mode of operation: deleting a resource

Method Detail

setFinishedCallback

Deferred setFinishedCallback(Object callback,
                             Object parameter,
                             Boolean verbose)
Sets the handler of the deferred action. It is called when the entire action has finished.
Notes:

Parameters:
callback - the callback function in either one of the following flavors:
  • verbose mode: function(Object verboseFinishResult), where:
    verboseFinishResult = {
        resource: resource object or id string of the related resource,
        statusCode: overall HTTP status code,
        parameter: the parameter passed into setFinishedCallback,
        operations: array of verboseOperationResult, see setOperationCallback
    }
  • non-verbose mode: function(Object resource, int statusCode, Object parameter), where:
    • resource - resource object or id string of the related resource,
    • statusCode - overall HTTP status code,
    • parameter - the parameter passed into setFinishedCallback
Note that the overall HTTP status code of both the verbose and the non-verbose finished callback is the highest status code of all involved operations.
parameter - optional parameter to be passed on to the callback function; may be null
verbose - flag to indicate if the callback function is invoked in verbose or non-verbose mode; optional, defaults to false
Returns:
the deferred object

setOperationCallback

Deferred setOperationCallback(Object callback,
                              Object parameter,
                              Boolean verbose)
Sets the operation handler of the deferred action. It is called every time an operation of the action has finished.
Notes:

Parameters:
callback - the callback function in either one of the following flavors:
  • verbose mode: function(Object verboseOperationResult), where
    verboseOperationResult = {
        resource: resource object or id string of the related resource,
        parameter: the parameter passed into setOperationCallback,
        mode: OPERATION_GET | OPERATION_CREATE | OPERATION_MODIFIY | OPERATION_DELETE,
        request: {
            statusCode: HTTP status code,
            responseText: server response text
        }
    }
  • non-verbose mode: function(Object resource, String mode, int statusCode, Object parameter), where
    • resource: resource object or id string of the related resource,
    • mode: OPERATION_GET | OPERATION_CREATE | OPERATION_MODIFIY | OPERATION_DELETE,
    • statusCode: HTTP status code,
    • parameter: the parameter passed into setOperationCallback
parameter - optional parameter to be passed on to the callback function; may be null
verbose - flag to indicate if the callback function is invoked in verbose or non-verbose mode; optional, defaults to false
Returns:
the deferred object


Copyright IBM Corp. 2010 All Rights Reserved.