Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.txbridge.ba.participant
Class Participant

    java.lang.Object
      org.jboss.txbridge.ba.participant.Participant

Direct Known Subclasses:
  CoordinatorCompletionParticipant, ParticipantCompletionParticipant

    public abstract class Participant

extends java.lang.Object

This is an abstract class for Participant. It provides the implemention of methods that are related to compensation and completing the work and are common for following participants: - Coordinator Completion Participant - Participant Completion Participant

Version:
  0.1
Author:
  Maciej P. Machulak (mmachulak@redhat.com)

Field Summary
`private static BATransactionManager` | `baTransactionManager`
`private CompensationDataFactory` | `cdf`
`private java.util.concurrent.ConcurrentMap<java.lang.String,CompensationData>` | `compensationData`
`private static org.apache.log4j.Logger` | `log`
`protected java.lang.String` | `serviceId`
`protected ServiceInformationManager` | `sim`
`protected SingleTransactionManager` | `stm`
`protected java.util.List<java.lang.String>` | `taskList`
`private java.lang.String` | `txId`

Constructor Summary
`Participant(java.lang.String txId, java.lang.String serviceId, SingleTransactionManager stm, CompensationDataFactory cdf)` Constructor.

Method Summary
`void` | `associateTask(java.lang.String taskId)` This method associates a new task with the existing participant.
`(package private) void` | `closeTransaction()` This method is invoked by the participant object if a transaction is finished.
`void` | `compensateTask(java.lang.String taskId)` This method provides the implementation for executing the compensation action.
`(package private) void` | `compensateTransaction()` This method is invoked by the participant object if a transaction should compensate.
`java.lang.Object` | `get(java.lang.String taskId, java.lang.Object objectId)` This method retrieves an object with a given identifier from the compensation data that is stored for a given task id.
`java.lang.Object[]` | `getArguments(java.lang.String taskId)` This method retrieves a list of arguments that was passed for method's invocation.
`java.lang.Object[]` | `getReturn(java.lang.String taskId)` This method gets the return value that will be used as an argument when executing compensation action (when BACompensationType is set to RETURN_VALUE)
`void` | `put(java.lang.String taskId, java.lang.Object objectId, java.lang.Object object)` This method stores an object withing the compensation data for a given task.
`void` | `putArguments(java.lang.String taskId, java.lang.Object[] arguments)` This method stores a list of arguments that was passed for method's invocation.
`void` | `putReturn(java.lang.String taskId, java.lang.Object returnObject)` This method stores the return value that will be used as an argument when executing compensation action (when BACompensationType is set to RETURN_VALUE)
`void` | `removeTask(java.lang.String taskId)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### log

    private static org.apache.log4j.Logger log

### sim

    protected ServiceInformationManager sim

### baTransactionManager

    private static BATransactionManager baTransactionManager

### cdf

    private CompensationDataFactory cdf

### stm

    protected SingleTransactionManager stm

### txId

    private java.lang.String txId

### serviceId

    protected java.lang.String serviceId

### taskList

    protected java.util.List<java.lang.String> taskList

### compensationData

    private java.util.concurrent.ConcurrentMap<java.lang.String,CompensationData> compensationData

Constructor Detail

### Participant

    public Participant(java.lang.String txId,
                       java.lang.String serviceId,
                       SingleTransactionManager stm,
                       CompensationDataFactory cdf)

  Constructor.

  Parameters:
    `txId` - is the transaction identifier.
    `serviceId` - is the service identifier.
    `cdf` - is the compensation data factory that should be used.
    `stm` - is the single transaction manager.

Method Detail

### put

    public void put(java.lang.String taskId,
                    java.lang.Object objectId,
                    java.lang.Object object)

  This method stores an object withing the compensation data for a given task. The object is assigned an ID.

  Parameters:
    `taskId` - is the ID of the task.
    `objectId` - is the ID of the object.
    `object` - is the object to be stored.

### get

    public java.lang.Object get(java.lang.String taskId,
                                java.lang.Object objectId)

  This method retrieves an object with a given identifier from the compensation data that is stored for a given task id.

  Parameters:
    `taskId` - is the ID of the task.
    `objectId` - is the ID of the object.
  Returns:
    the object with a given ID.

### associateTask

    public void associateTask(java.lang.String taskId)
                       throws TaskAssociationFailedException

  This method associates a new task with the existing participant.

  Parameters:
    `taskId` - is the task identifier.
  Throws:
    `TaskAssociationFailedException` - if task association fails.

### removeTask

    public void removeTask(java.lang.String taskId)

  Parameters:
    `taskId` - is the ID of a task that should be removed from the list.

### compensateTransaction

    void compensateTransaction()

  This method is invoked by the participant object if a transaction should compensate. It asks the BA Transaction Manager to compensate the transaction.

### closeTransaction

    void closeTransaction()

  This method is invoked by the participant object if a transaction is finished. It asks the BA Transaction Manager to forget about the transaction.

### compensateTask

    public void compensateTask(java.lang.String taskId)
                        throws CompensationActionUnsuccessfulException

  This method provides the implementation for executing the compensation action. It uses the Executor class for executing a single method/service.

  Parameters:
    `taskId` - is the ID of the task that is supposed to be compensated.
  Throws:
    `CompensationActionUnsuccessfulException` - if compensation was not successful.

### putArguments

    public void putArguments(java.lang.String taskId,
                             java.lang.Object[] arguments)

  This method stores a list of arguments that was passed for method's invocation. It is used if the service has its BACompensationType set to PARAM_MATCH.

  Parameters:
    `taskId` - is the ID of the task.
    `arguments` - is the list of arguments.

### getArguments

    public java.lang.Object[] getArguments(java.lang.String taskId)

  This method retrieves a list of arguments that was passed for method's invocation. It is used when executing the compensation action if the BACompensationType is set to PARAM_MATCH.

  Parameters:
    `taskId` - is the task ID.
  Returns:
    the list of arguments.

### putReturn

    public void putReturn(java.lang.String taskId,
                          java.lang.Object returnObject)

  This method stores the return value that will be used as an argument when executing compensation action (when BACompensationType is set to RETURN_VALUE)

  Parameters:
    `taskId` - is the task identifier.
    `returnObject` - is the return object.

### getReturn

    public java.lang.Object[] getReturn(java.lang.String taskId)

  This method gets the return value that will be used as an argument when executing compensation action (when BACompensationType is set to RETURN_VALUE)

  Parameters:
    `taskId` - is the task ID.
  Returns:
    the return object.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD