com.atomikos.icatch.jaxws
Class GenericSOAPImportingTransactionManager

java.lang.Object
  extended by com.atomikos.icatch.jaxws.GenericSOAPImportingTransactionManager
All Implemented Interfaces:
SOAPImportingTransactionManager
Direct Known Subclasses:
SOAPImportingTransactionManagerImp, SOAPImportingTransactionManagerImp

public abstract class GenericSOAPImportingTransactionManager
extends Object
implements SOAPImportingTransactionManager

A generic superclass to implement the common import logic. All the transaction preference logic is implemented here, so each protocol can reuse it.


Field Summary
 
Fields inherited from interface com.atomikos.icatch.jaxws.SOAPImportingTransactionManager
PROPAGATION_MANDATORY, PROPAGATION_NEVER, PROPAGATION_NOT_SUPPORTED, PROPAGATION_REQUIRED, PROPAGATION_REQUIRES_NEW, PROPAGATION_SUPPORTS
 
Constructor Summary
GenericSOAPImportingTransactionManager()
           
 
Method Summary
protected  CompositeTransaction createNewTransaction(long timeout)
          Creates a new transaction (and suspends any existing transaction if needed).
protected abstract  javax.xml.soap.SOAPHeaderElement findPropagationHeader(javax.xml.soap.SOAPMessage msg)
          Finds a (protocol-specific) propagation header.
protected  CompositeTransaction findTransaction(String tid)
          Finds a given transaction
protected  String getParentTid(CompositeTransaction ct)
          Finds the parent of a given transaction.
protected  Properties getProperties()
           
 CompositeTransaction importTransaction(int preference, long newTransactionTimeout, javax.xml.soap.SOAPMessage msg, boolean orphancheck, boolean heur_commit)
          Extracts the portable propagation information contained in an incoming SOAP message and creates a local transaction for it.
protected abstract  CompositeTransaction importTransactionFromHeader(javax.xml.soap.SOAPHeaderElement header, boolean orphanCheck, boolean heurCommit)
          Does the actual import
protected abstract  void insertExtentHeader(javax.xml.soap.SOAPMessage msg, String tid, String parentTid, String rootTid, HeuristicMessage[] tags, Hashtable table, long timeout)
          Inserts the appropriate extent header into the message.
protected abstract  void removePropagationHeader(javax.xml.soap.SOAPMessage msg)
          Removes the propagation header from the message.
protected  void setProperties(Properties p)
          Sets the properties to use for NEW transactions.
 void terminated(String tid, javax.xml.soap.SOAPMessage msg, boolean commit)
          Terminates the local work and inserts the extent information into a SOAP message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericSOAPImportingTransactionManager

public GenericSOAPImportingTransactionManager()
Method Detail

setProperties

protected void setProperties(Properties p)
Sets the properties to use for NEW transactions.

Parameters:
p -

getProperties

protected Properties getProperties()

findTransaction

protected CompositeTransaction findTransaction(String tid)
                                        throws RollbackException
Finds a given transaction

Parameters:
tid -
Returns:
The transaction
Throws:
RollbackException - If not found

createNewTransaction

protected CompositeTransaction createNewTransaction(long timeout)
Creates a new transaction (and suspends any existing transaction if needed).

Parameters:
timeout - The timeout in millis.
Returns:
The transaction, suspended from the calling thread.

getParentTid

protected String getParentTid(CompositeTransaction ct)
Finds the parent of a given transaction.

Parameters:
ct -
Returns:
The parent ID

importTransaction

public CompositeTransaction importTransaction(int preference,
                                              long newTransactionTimeout,
                                              javax.xml.soap.SOAPMessage msg,
                                              boolean orphancheck,
                                              boolean heur_commit)
                                       throws javax.xml.soap.SOAPException,
                                              javax.xml.ws.soap.SOAPFaultException,
                                              PropagationException
Description copied from interface: SOAPImportingTransactionManager
Extracts the portable propagation information contained in an incoming SOAP message and creates a local transaction for it. This is an alternative to the normal import of a portable propagation.

NOTE: this method does not need nor guarantee any thread associations for the transaction.

Specified by:
importTransaction in interface SOAPImportingTransactionManager
Parameters:
preference - The propagation preference, being one of the predefined PROPAGATION_* values.
newTransactionTimeout - Timeout (in millis) of new transactions (that may or may not be created according to the preference parameter).
msg - The incoming SOAP message.
orphancheck - True if orphan checks need to be enabled.
heur_commit - True if heuristic means commit. False otherwise.
Returns:
CompositeTransaction The new transaction, or null if none was created.
Throws:
javax.xml.soap.SOAPException - On SOAP parsing errors.
javax.xml.ws.soap.SOAPFaultException - If the message header could not be parsed.
PropagationException - If the message contents are incompatible with the supplied propagation preference.
See Also:
SOAPImportingTransactionManager

terminated

public void terminated(String tid,
                       javax.xml.soap.SOAPMessage msg,
                       boolean commit)
                throws SysException,
                       RollbackException
Description copied from interface: SOAPImportingTransactionManager
Terminates the local work and inserts the extent information into a SOAP message. An extent is only inserted if the local work was done in the transaction propagation context of the caller (this also depends on the preference with which the import was done).

NOTE: this method does not need nor guarantee any thread associations for the transaction.

Specified by:
terminated in interface SOAPImportingTransactionManager
Parameters:
tid - The id of the transation from which to take the extent.
msg - The SOAP message, which is about to be returned to the remote client.
commit - True iff the invocation had no errors. Implies that the local subtx is committed. If false, then the local work will be rolled back and NO extent will be added to the response message.
Throws:
SysException - Unexpected error.
RollbackException - If the transaction has timed out.
See Also:
SOAPImportingTransactionManager

findPropagationHeader

protected abstract javax.xml.soap.SOAPHeaderElement findPropagationHeader(javax.xml.soap.SOAPMessage msg)
                                                                   throws javax.xml.soap.SOAPException
Finds a (protocol-specific) propagation header. This method merely returns the header, without processing it.

Parameters:
msg -
Returns:
The header, or null if no propagation is present.
Throws:
javax.xml.soap.SOAPException

importTransactionFromHeader

protected abstract CompositeTransaction importTransactionFromHeader(javax.xml.soap.SOAPHeaderElement header,
                                                                    boolean orphanCheck,
                                                                    boolean heurCommit)
                                                             throws javax.xml.ws.soap.SOAPFaultException,
                                                                    javax.xml.soap.SOAPException,
                                                                    PropagationException
Does the actual import

Parameters:
header -
Returns:
The transaction as recreated from the header
Throws:
javax.xml.ws.soap.SOAPFaultException
javax.xml.soap.SOAPException
PropagationException

removePropagationHeader

protected abstract void removePropagationHeader(javax.xml.soap.SOAPMessage msg)
                                         throws javax.xml.soap.SOAPException
Removes the propagation header from the message.

Parameters:
msg -
Throws:
javax.xml.soap.SOAPException

insertExtentHeader

protected abstract void insertExtentHeader(javax.xml.soap.SOAPMessage msg,
                                           String tid,
                                           String parentTid,
                                           String rootTid,
                                           HeuristicMessage[] tags,
                                           Hashtable table,
                                           long timeout)
                                    throws javax.xml.soap.SOAPException
Inserts the appropriate extent header into the message.

Parameters:
msg - The message
tid - The local TID of the imported tx
parentTid - The parent TID at the sender
rootTid - The root TID
tags - The tags
table - The count-> participant information
timeout - The timeout in millis to wait (if applicable)
Throws:
javax.xml.soap.SOAPException


Copyright © 2012. All Rights Reserved.