com.ibm.websphere.wsba
Interface UserBusinessActivity


public interface UserBusinessActivity

This interface allows the application programmer to access the Business Activity on the current thread. This API allows the user to pass compensation data to the runtime that will be used later by the CompensationHandler on completion of the Business Activity. The application programmer can also modify or check the completion direction of the current Business Activity.


Method Summary
 boolean isCompensateOnly()
           
 void setCompensateOnly()
          Calling setCompensateOnly will force the Business Activity to compensate all active CompensationHandlers that have been added.
 void setCompensationDataAtCommit(commonj.sdo.DataObject compensationData)
          Invoked to configure the CompensationHandler behaviour on completion of the underlying Business Activity.
 void setCompensationDataImmediate(commonj.sdo.DataObject compensationData)
          Invoked to configure the CompensationHandler behaviour on completion of the underlying Business Activity.
 

Method Detail

setCompensateOnly

void setCompensateOnly()
                       throws java.lang.IllegalStateException
Calling setCompensateOnly will force the Business Activity to compensate all active CompensationHandlers that have been added. This will occur upon the completion of the current Business Activity. Once setCompensateOnly() has been called, the Business Activity can will never complete successfully.

Throws:
java.lang.IllegalStateException - if there is no Business Activity available on thread

isCompensateOnly

boolean isCompensateOnly()
                         throws java.lang.IllegalStateException
Returns:
a boolean value, true if the Business Activity Scope has previously been called to setCompensateOnly() or the underlying UOW/BPEL has been marked to fail only (e.g. setRollbackOnly() has been called on a JTA transaction), false otherwise.
Throws:
java.lang.IllegalStateException - if there is no Business Activity available on thread

setCompensationDataAtCommit

void setCompensationDataAtCommit(commonj.sdo.DataObject compensationData)
                                 throws java.lang.IllegalStateException,
                                        java.io.NotSerializableException
Invoked to configure the CompensationHandler behaviour on completion of the underlying Business Activity. When this method is called for the first time any CompensationHandler configured by the calling component will be associated with the underlying Business Activity. The compensation data passed in as a parameter will be logged. A CompensationHandler can be in one of two states; active or inactive. Only active CompensationHandlers are driven as part of the completion process of a Business Activity. If there is a global transaction present when this method is called then the CompensationHandler will be inactive until the global transaction commits, when it will be made active. If the global transaction rolls back, the CompensationHandler will be discarded and never driven to compensate or close. If a global transaction not is present, the CompensationHandler will be marked as active immediately and will be driven compensate or close upon completion of the Business Activity. Subsequent calls to this method from within in the same application component and Business Activity cause any previous compensation data to be updated with the compensation data passed in on this invocation. A new CompensationHandler will not be added every time this method is invoked. Any CompensationHandler added using this method will never be overwritten by the setCompensationDataImmediate method. If both methods are called within the same application component and Business Activity, two CompensationHandlers will be added. If null is passed as a parameter, the CompensationHandler will be removed from the Business Activity and not driven to close or compensate during completion of the Business Activity.

Parameters:
compensationData - the data logged at runtime to be used at the time of Business Activity completion by the CompensationHandler. This is in the form of an SDO DataObject.
Throws:
java.lang.IllegalStateException - if there is no Business Activity available on thread.
java.io.NotSerializableException - if the compensationData cannot be serialized.

setCompensationDataImmediate

void setCompensationDataImmediate(commonj.sdo.DataObject compensationData)
                                  throws java.lang.IllegalStateException,
                                         java.io.NotSerializableException
Invoked to configure the CompensationHandler behaviour on completion of the underlying Business Activity. When this method is called for the first time any CompensationHandler configured by the calling component will be associated with the underlying Business Activity. The compensation data passed in as a parameter will be logged. A CompensationHandler can be in one of two states; active or inactive. Only active CompensationHandlers are driven as part of the completion process of a Business Activity. Any CompensationHandler added to a Business Activity through this method will be marked active immediately. This guarantees that the CompensationHandler added will be driven to compensate or close upon completion of the Business Activity. Subsequent calls to this method from within in the same application component and Business Activity cause any previous compensation data to be updated with the compensation data passed in on this invocation. A new CompensationHandler will not be added every time this method is invoked. Any CompensationHandler added using this method will never be overwritten by the setCompensationDataAtCommit method. If both methods are called within the same application component and Business Activity, two CompensationHandlers will be added. If null is passed as a parameter, the CompensationHandler will be removed from the Business Activity and not driven to close or compensate during completion of the Business Activity.

Parameters:
compensationData - the data logged at runtime to be used at the time of Business Activity completion by the CompensationHandler. This is in the form of an SDO DataObject.
Throws:
java.lang.IllegalStateException - if there is no Business Activity available on thread.
java.io.NotSerializableException - if the compensationData cannot be serialized.