[jboss-svn-commits] JBL Code SVN: r25421 - in labs/jbosstm/trunk/XTS/WSTX: classes11/com/arjuna/mw/wst11/service and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Feb 25 09:54:36 EST 2009


Author: adinn
Date: 2009-02-25 09:54:36 -0500 (Wed, 25 Feb 2009)
New Revision: 25421

Added:
   labs/jbosstm/trunk/XTS/WSTX/classes10/com/arjuna/mw/wst/service/JaxRPCSubordinateHeaderContextProcessor.java
   labs/jbosstm/trunk/XTS/WSTX/classes10/com/arjuna/mw/wst/service/JaxWSSubordinateHeaderContextProcessor.java
   labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mw/wst11/service/JaxWSSubordinateHeaderContextProcessor.java
Modified:
   labs/jbosstm/trunk/XTS/WSTX/classes10/com/arjuna/mw/wst/service/JaxBaseHeaderContextProcessor.java
   labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mw/wst11/service/JaxBaseHeaderContextProcessor.java
Log:
created server side header processors which install a subordinate TX -- fixes JBTM-495

Modified: labs/jbosstm/trunk/XTS/WSTX/classes10/com/arjuna/mw/wst/service/JaxBaseHeaderContextProcessor.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes10/com/arjuna/mw/wst/service/JaxBaseHeaderContextProcessor.java	2009-02-25 12:44:29 UTC (rev 25420)
+++ labs/jbosstm/trunk/XTS/WSTX/classes10/com/arjuna/mw/wst/service/JaxBaseHeaderContextProcessor.java	2009-02-25 14:54:36 UTC (rev 25421)
@@ -48,6 +48,18 @@
      */
     protected boolean handleInboundMessage(final SOAPMessage soapMessage)
     {
+        return handleInboundMessage(soapMessage, false);
+    }
+
+    /**
+     * Handle the request.
+     * @param soapMessage The current message context.
+     * @param installSubordinateTx true if a subordinate transaction should be interposed and false
+     * if the handler should just resume the incoming transaction. currently only works for AT
+     * transactions but will eventually be extended to work for BA transactions too.
+     */
+    protected boolean handleInboundMessage(final SOAPMessage soapMessage, boolean installSubordinateTx)
+    {
         if (soapMessage != null)
         {
             try
@@ -65,12 +77,24 @@
                         final TxContext txContext = new com.arjuna.mwlabs.wst.at.context.TxContextImple(cc) ;
                         TransactionManagerFactory.transactionManager().resume(txContext) ;
                         clearMustUnderstand(soapHeader, soapHeaderElement) ;
+                        if (installSubordinateTx) {
+                            // since we are now in an AT Tx  we just need to start a subordinate one using the
+                            // UserSubordinateTransaction instance. the begin call will register the
+                            // Tx on the thread
+                            UserTransaction ust = UserTransactionFactory.userSubordinateTransaction();
+                            ust.begin();
+                        }
                     }
                     else if (BusinessActivityConstants.WSBA_PROTOCOL_ATOMIC_OUTCOME.equals(coordinationType))
                     {
+                        // interposition is not yet implemented for business activities
+                        clearMustUnderstand(soapHeader, soapHeaderElement) ;
+                        if (installSubordinateTx) {
+                            // throw an exception to force logging of a warning below
+                            throw new Exception("com.arjuna.mw.wst11.service.JaxBaseHeaderContextProcessor : interposition is not yet implemented for the WSBA protocol");
+                        }
                         final TxContext txContext = new com.arjuna.mwlabs.wst.ba.context.TxContextImple(cc);
                         BusinessActivityManagerFactory.businessActivityManager().resume(txContext) ;
-                        clearMustUnderstand(soapHeader, soapHeaderElement) ;
                     }
                     else
                     {

Copied: labs/jbosstm/trunk/XTS/WSTX/classes10/com/arjuna/mw/wst/service/JaxRPCSubordinateHeaderContextProcessor.java (from rev 25158, labs/jbosstm/trunk/XTS/WSTX/classes10/com/arjuna/mw/wst/service/JaxRPCHeaderContextProcessor.java)
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes10/com/arjuna/mw/wst/service/JaxRPCSubordinateHeaderContextProcessor.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WSTX/classes10/com/arjuna/mw/wst/service/JaxRPCSubordinateHeaderContextProcessor.java	2009-02-25 14:54:36 UTC (rev 25421)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2002, 2003, 2004
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id$
+ */
+
+package com.arjuna.mw.wst.service;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.handler.Handler;
+import javax.xml.rpc.handler.HandlerInfo;
+import javax.xml.rpc.handler.MessageContext;
+import javax.xml.rpc.handler.soap.SOAPMessageContext;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPHeaderElement;
+import javax.xml.soap.SOAPMessage;
+
+
+import com.arjuna.webservices.wscoor.CoordinationConstants;
+
+/**
+ * The class is used to perform WS-Transaction context insertion
+ * and extraction for application level SOAP messages using JaxRPC.
+ */
+public class JaxRPCSubordinateHeaderContextProcessor extends JaxRPCHeaderContextProcessor implements Handler
+{
+    /**
+     * Handle the request.
+     * @param messageContext The current message context.
+     */
+    public boolean handleRequest(final MessageContext messageContext)
+    {
+		final SOAPMessageContext soapMessageContext = (SOAPMessageContext)messageContext ;
+        final SOAPMessage soapMessage = soapMessageContext.getMessage() ;
+
+        // the generic handler can do the job for us -- just pass the correct flag
+
+        return handleInboundMessage(soapMessage, false);
+    }
+}
\ No newline at end of file


Property changes on: labs/jbosstm/trunk/XTS/WSTX/classes10/com/arjuna/mw/wst/service/JaxRPCSubordinateHeaderContextProcessor.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Added: labs/jbosstm/trunk/XTS/WSTX/classes10/com/arjuna/mw/wst/service/JaxWSSubordinateHeaderContextProcessor.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes10/com/arjuna/mw/wst/service/JaxWSSubordinateHeaderContextProcessor.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WSTX/classes10/com/arjuna/mw/wst/service/JaxWSSubordinateHeaderContextProcessor.java	2009-02-25 14:54:36 UTC (rev 25421)
@@ -0,0 +1,30 @@
+package com.arjuna.mw.wst.service;
+
+import com.arjuna.mw.wst.service.*;
+
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+import javax.xml.soap.SOAPMessage;
+
+/**
+ * specialised version which creates and interposes a subordinate AT transaction when
+ * it finds an incoming AT context in the message headers
+ */
+public class JaxWSSubordinateHeaderContextProcessor extends JaxWSHeaderContextProcessor
+{
+    /**
+     * Process the tx context header that is attached to the received message.
+     *
+     * @param msgContext
+     * @return true
+     */
+    protected boolean handleInbound(MessageContext msgContext)
+    {
+        final SOAPMessageContext soapMessageContext = (SOAPMessageContext)msgContext ;
+        final SOAPMessage soapMessage = soapMessageContext.getMessage() ;
+
+        // the generic handler can do the job for us -- just pass the correct flag
+
+        return handleInboundMessage(soapMessage, false);
+    }
+}
\ No newline at end of file

Modified: labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mw/wst11/service/JaxBaseHeaderContextProcessor.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mw/wst11/service/JaxBaseHeaderContextProcessor.java	2009-02-25 12:44:29 UTC (rev 25420)
+++ labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mw/wst11/service/JaxBaseHeaderContextProcessor.java	2009-02-25 14:54:36 UTC (rev 25421)
@@ -20,13 +20,10 @@
  */
 package com.arjuna.mw.wst11.service;
 
-import com.arjuna.mw.wst.*;
 import com.arjuna.mw.wst11.common.CoordinationContextHelper;
 import com.arjuna.mw.wst.common.SOAPUtil;
-import com.arjuna.mw.wst11.BusinessActivityManager;
-import com.arjuna.mw.wst11.BusinessActivityManagerFactory;
-import com.arjuna.mw.wst11.TransactionManager;
-import com.arjuna.mw.wst11.TransactionManagerFactory;
+import com.arjuna.mw.wst.TxContext;
+import com.arjuna.mw.wst11.*;
 import com.arjuna.mw.wstx.logging.wstxLogger;
 import com.arjuna.webservices11.wsat.AtomicTransactionConstants;
 import com.arjuna.webservices11.wsba.BusinessActivityConstants;
@@ -53,6 +50,18 @@
      */
     protected boolean handleInboundMessage(final SOAPMessage soapMessage)
     {
+        return handleInboundMessage(soapMessage, false);
+    }
+
+    /**
+     * Handle the request.
+     * @param soapMessage The current message context.
+     * @param installSubordinateTx true if a subordinate transaction should be interposed and false
+     * if the handler should just resume the incoming transaction. currently only works for AT
+     * transactions but will eventually be extended to work for BA transactions too.
+     */
+    protected boolean handleInboundMessage(final SOAPMessage soapMessage, boolean installSubordinateTx)
+    {
         if (soapMessage != null)
         {
             try
@@ -70,12 +79,24 @@
                         final TxContext txContext = new TxContextImple(cc) ;
                         TransactionManagerFactory.transactionManager().resume(txContext) ;
                         clearMustUnderstand(soapHeader, soapHeaderElement) ;
+                        if (installSubordinateTx) {
+                            // since we are now in an AT Tx  we just need to start a subordinate one using the
+                            // UserSubordinateTransaction instance. the begin call will register the
+                            // Tx on the thread
+                            UserTransaction ust = UserTransactionFactory.userSubordinateTransaction();
+                            ust.begin();
+                        }
                     }
                     else if (BusinessActivityConstants.WSBA_PROTOCOL_ATOMIC_OUTCOME.equals(coordinationType))
                     {
+                        // interposition is not yet implemented for business activities
+                        clearMustUnderstand(soapHeader, soapHeaderElement) ;
+                        if (installSubordinateTx) {
+                            // throw an exception to force logging of a warning below
+                            throw new Exception("com.arjuna.mw.wst11.service.JaxBaseHeaderContextProcessor : interposition is not yet implemented for the WSBA protocol");
+                        }
                         final TxContext txContext = new com.arjuna.mwlabs.wst11.ba.context.TxContextImple(cc);
                         BusinessActivityManagerFactory.businessActivityManager().resume(txContext) ;
-                        clearMustUnderstand(soapHeader, soapHeaderElement) ;
                     }
                     else
                     {

Added: labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mw/wst11/service/JaxWSSubordinateHeaderContextProcessor.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mw/wst11/service/JaxWSSubordinateHeaderContextProcessor.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mw/wst11/service/JaxWSSubordinateHeaderContextProcessor.java	2009-02-25 14:54:36 UTC (rev 25421)
@@ -0,0 +1,28 @@
+package com.arjuna.mw.wst11.service;
+
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+import javax.xml.soap.SOAPMessage;
+
+/**
+ * specialised version which creates and interposes a subordinate AT transaction when
+ * it finds an incoming AT context in the message headers
+ */
+public class JaxWSSubordinateHeaderContextProcessor extends JaxWSHeaderContextProcessor
+{
+    /**
+     * Process the tx context header that is attached to the received message.
+     *
+     * @param msgContext
+     * @return true
+     */
+    protected boolean handleInbound(SOAPMessageContext msgContext)
+    {
+        final SOAPMessageContext soapMessageContext = (SOAPMessageContext)msgContext ;
+        final SOAPMessage soapMessage = soapMessageContext.getMessage() ;
+
+        // the generic handler can do the job for us -- just pass the correct flag
+
+        return handleInboundMessage(soapMessage, true);
+    }
+
+}




More information about the jboss-svn-commits mailing list