jPOS 1.6.5 API Documentation

org.jpos.bsh
Class BSHTransactionParticipant

java.lang.Object
  extended by org.jpos.util.SimpleLogSource
      extended by org.jpos.bsh.BSHTransactionParticipant
All Implemented Interfaces:
XmlConfigurable, AbortParticipant, TransactionConstants, TransactionParticipant, LogSource
Direct Known Subclasses:
BSHGroupSelector

public class BSHTransactionParticipant
extends SimpleLogSource
implements TransactionParticipant, AbortParticipant, XmlConfigurable

A TransactionParticipant which�s prepare, commit and abort methods can be specified through beanshell scripts.
To indicate what code to execute for any of the methods just add an element named 'prepare', 'commit' or 'abort' contained in that of the participant.
See BSHMethod for details on the syntax of these elemets. The value to return in the prepare method should be stored in the script variable named "result". None of these tags are mandatory.
You can subclass BSHTransactionParticipant and override the default... methods. That way you can provide default behaviour for a participant and override it at deploy time through scripts.

Author:
AMarques
See Also:
BSHMethod

Field Summary
 
Fields inherited from interface org.jpos.transaction.TransactionConstants
ABORTED, NO_JOIN, PAUSE, PREPARED, READONLY, RETRY
 
Constructor Summary
BSHTransactionParticipant()
          Creates a new instance of BSHTransactionParticipant
 
Method Summary
 void abort(long id, java.io.Serializable context)
          Called by TransactionManager upon transaction commit.
 void commit(long id, java.io.Serializable context)
          Called by TransactionManager upon transaction commit.
 int prepare(long id, java.io.Serializable context)
          Called by TransactionManager in preparation for a transaction
 int prepareForAbort(long id, java.io.Serializable context)
          Called by TransactionManager in preparation for a transaction that is known to abort.
 void setConfiguration(org.jdom.Element e)
           
 
Methods inherited from class org.jpos.util.SimpleLogSource
error, error, getLogger, getRealm, info, info, setLogger, setRealm, warning, warning
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BSHTransactionParticipant

public BSHTransactionParticipant()
Creates a new instance of BSHTransactionParticipant

Method Detail

abort

public void abort(long id,
                  java.io.Serializable context)
Description copied from interface: TransactionParticipant
Called by TransactionManager upon transaction commit. Warning: implementation should be able to handle multiple calls with the same transaction id (rare crash recovery)

Specified by:
abort in interface TransactionParticipant
Parameters:
id - the Transaction identifier
context - transaction context

commit

public void commit(long id,
                   java.io.Serializable context)
Description copied from interface: TransactionParticipant
Called by TransactionManager upon transaction commit. Warning: implementation should be able to handle multiple calls with the same transaction id (rare crash recovery)

Specified by:
commit in interface TransactionParticipant
Parameters:
id - the Transaction identifier
context - transaction context

prepare

public int prepare(long id,
                   java.io.Serializable context)
Description copied from interface: TransactionParticipant
Called by TransactionManager in preparation for a transaction

Specified by:
prepare in interface TransactionParticipant
Parameters:
id - the Transaction identifier
context - transaction context
Returns:
PREPARED or ABORTED (| NO_JOIN | READONLY)

prepareForAbort

public int prepareForAbort(long id,
                           java.io.Serializable context)
Description copied from interface: AbortParticipant
Called by TransactionManager in preparation for a transaction that is known to abort.

Specified by:
prepareForAbort in interface AbortParticipant
Parameters:
id - the Transaction identifier
context - transaction context
Returns:
0 [| NO_JOIN | READONLY)

setConfiguration

public void setConfiguration(org.jdom.Element e)
                      throws ConfigurationException
Specified by:
setConfiguration in interface XmlConfigurable
Throws:
ConfigurationException

jPOS.org