cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r800533 - in /cxf/branches/2.1.x-fixes: ./ integration/jca/src/main/java/org/apache/cxf/jca/inbound/ rt/transports/jms/ rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/
Date Mon, 03 Aug 2009 20:27:15 GMT
Author: dkulp
Date: Mon Aug  3 20:27:15 2009
New Revision: 800533

URL: http://svn.apache.org/viewvc?rev=800533&view=rev
Log:
Merged revisions 799740 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.2.x-fixes

................
  r799740 | dkulp | 2009-07-31 16:25:43 -0400 (Fri, 31 Jul 2009) | 11 lines
  
  Merged revisions 799724 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r799724 | dkulp | 2009-07-31 15:54:36 -0400 (Fri, 31 Jul 2009) | 3 lines
    
    [CXF-2372] JCA + XA transaction work
    Patch from Seumas Soltysik applied (with a lot of mods due to conflicts
    on trunk)
  ........
................

Added:
    cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JCATransactionalMessageListenerContainer.java
      - copied unchanged from r799740, cxf/branches/2.2.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JCATransactionalMessageListenerContainer.java
    cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/XASingleConnectionFactory.java
      - copied unchanged from r799740, cxf/branches/2.2.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/XASingleConnectionFactory.java
Modified:
    cxf/branches/2.1.x-fixes/   (props changed)
    cxf/branches/2.1.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/inbound/DispatchMDBInvoker.java
    cxf/branches/2.1.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBActivationWork.java
    cxf/branches/2.1.x-fixes/rt/transports/jms/pom.xml
    cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
    cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
    cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Aug  3 20:27:15 2009
@@ -1,2 +1,2 @@
-/cxf/branches/2.2.x-fixes:743446,753380,753397,753421,754585,755365,757499,757859,757899,757935,757951,758195,758303,758308,758378,758690,758910,759890,759961,759963-759964,759966,760029,760073,760150,760171,760178,760198,760212,760456,760468,760582,760938,761094,761113,761120,761317,761759,761789,762393,762518,762567,763200,763272,763495,763854,763931,763942,763953,764033-764034,764581,764599-764606,764887,765357,766013,766058,766100-766101,766763,766770,766860,766962-766963,767159,767191,767927,771416,772143,772402,772658,772714,773009-773010,773027,773049,773146,773581,773691,773693,774446-774496,774558,774760,774851,774979,775423,776024-776025,776218,776429,776459,777189,777224,777243,777481,777505,777572,777580,780033,780184,780213,780421,780664,780800,780902,780911,781497,781841,782733,782735-782736,783099,783407,784064,784197,785293,785296,785298-785299,785301,785656,786158,786587,786589,786591-786592,786640,787272,787276,787282-787283,787285,787295,787307,787324,7873
 67,788824-788825,788827-788828,788830,789423,789429,789707,789709-789710,789712,789721,789905,789908,789910,789912,790295,790646-790647,790651,790654-790655,790659,791948,791950,791952,791955,792276,792288,792291,792992,792995,792998,794402,794404,794735,794797,794799,794803,795161-795162,796300-796301,796598,797449,797452-797453,797460,797463-797464,797521-797522,797584-797585,797645,797652,797701,797884,797886,798348-798350,798568,798574-798575,798577-798578,798586,798608,798655,798752,798942,799444,799449,799738
-/cxf/trunk:782181,782728-782730,783097,783396,784059,784181,784895,785279-785282,785468,786142,786271,786395,786582-786583,786638,786647,787269,787277-787279,787290,787305,787323,787366,788060,788187,788703,788774,788820,789371,789420,789527-789529,789704-789705,789896,789898-789900,790294,790637-790644,791354,791538,791753,791947,792261-792263,792684,792975,792985,794297,794396,794728,794778-794780,794892,795160,796022-796023,796593,796780,797194,797231-797233,797442,797505,797517,797581-797582,797640,797651,797699,797882-797883,798344-798346,798479,798533,798551,798557,798561-798562,798570,798573,798584,798654,798749,798929,799439,799448,799637
+/cxf/branches/2.2.x-fixes:743446,753380,753397,753421,754585,755365,757499,757859,757899,757935,757951,758195,758303,758308,758378,758690,758910,759890,759961,759963-759964,759966,760029,760073,760150,760171,760178,760198,760212,760456,760468,760582,760938,761094,761113,761120,761317,761759,761789,762393,762518,762567,763200,763272,763495,763854,763931,763942,763953,764033-764034,764581,764599-764606,764887,765357,766013,766058,766100-766101,766763,766770,766860,766962-766963,767159,767191,767927,771416,772143,772402,772658,772714,773009-773010,773027,773049,773146,773581,773691,773693,774446-774496,774558,774760,774851,774979,775423,776024-776025,776218,776429,776459,777189,777224,777243,777481,777505,777572,777580,780033,780184,780213,780421,780664,780800,780902,780911,781497,781841,782733,782735-782736,783099,783407,784064,784197,785293,785296,785298-785299,785301,785656,786158,786587,786589,786591-786592,786640,787272,787276,787282-787283,787285,787295,787307,787324,7873
 67,788824-788825,788827-788828,788830,789423,789429,789707,789709-789710,789712,789721,789905,789908,789910,789912,790295,790646-790647,790651,790654-790655,790659,791948,791950,791952,791955,792276,792288,792291,792992,792995,792998,794402,794404,794735,794797,794799,794803,795161-795162,796300-796301,796598,797449,797452-797453,797460,797463-797464,797521-797522,797584-797585,797645,797652,797701,797884,797886,798348-798350,798568,798574-798575,798577-798578,798586,798608,798655,798752,798942,799444,799449,799738,799740
+/cxf/trunk:782181,782728-782730,783097,783396,784059,784181,784895,785279-785282,785468,786142,786271,786395,786582-786583,786638,786647,787269,787277-787279,787290,787305,787323,787366,788060,788187,788703,788774,788820,789371,789420,789527-789529,789704-789705,789896,789898-789900,790294,790637-790644,791354,791538,791753,791947,792261-792263,792684,792975,792985,794297,794396,794728,794778-794780,794892,795160,796022-796023,796593,796780,797194,797231-797233,797442,797505,797517,797581-797582,797640,797651,797699,797882-797883,798344-798346,798479,798533,798551,798557,798561-798562,798570,798573,798584,798654,798749,798929,799439,799448,799637,799724

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.1.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/inbound/DispatchMDBInvoker.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/inbound/DispatchMDBInvoker.java?rev=800533&r1=800532&r2=800533&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/inbound/DispatchMDBInvoker.java
(original)
+++ cxf/branches/2.1.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/inbound/DispatchMDBInvoker.java
Mon Aug  3 20:27:15 2009
@@ -53,8 +53,20 @@
     
     @Override
     public Object getServiceObject(Exchange context) {
+        MessageEndpoint ep = null;
+        MessageEndpoint epFromMessage = null;
+        
+        if (context != null) {
+            epFromMessage = context.getInMessage().getContent(MessageEndpoint.class);
+        }
+         
+        if (epFromMessage == null) {
+            ep = getMessageEndpoint();
+        } else {
+            ep = epFromMessage;
+        }
+        
         Object target = null;
-        MessageEndpoint ep = getMessageEndpoint();
 
         if (ep == null) {
             LOG.log(Level.SEVERE, "Failed to obtain MessageEndpoint");
@@ -68,9 +80,11 @@
             LOG.log(Level.SEVERE, "Failed to obtain service object " + targetJndiName, e);
             return null;
         } finally {
-            releaseEndpoint(ep);
+            if (epFromMessage == null) {
+                releaseEndpoint(ep);
+            }
         }
-        
+
         return target;
     }
 

Modified: cxf/branches/2.1.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBActivationWork.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBActivationWork.java?rev=800533&r1=800532&r2=800533&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBActivationWork.java
(original)
+++ cxf/branches/2.1.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBActivationWork.java
Mon Aug  3 20:27:15 2009
@@ -18,6 +18,7 @@
  */
 package org.apache.cxf.jca.inbound;
 
+import java.lang.reflect.Method;
 import java.net.URL;
 import java.util.Arrays;
 import java.util.List;
@@ -39,6 +40,7 @@
 import org.apache.cxf.jaxws.EndpointImpl;
 import org.apache.cxf.jaxws.EndpointUtils;
 import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
+import org.apache.cxf.service.model.EndpointInfo;
 
 /**
  *
@@ -51,6 +53,9 @@
 public class MDBActivationWork implements Work {
     
     private static final Logger LOG = LogUtils.getL7dLogger(MDBActivationWork.class);
+    private static final String MESSAGE_LISTENER_METHOD = "lookupTargetObject";
+    private static final String MESSAGE_ENDPOINT_FACTORY = "MessageEndpointFactory";
+    private static final String MDB_TRANSACTED_METHOD = "MDBTransactedMethod";
 
     private MDBActivationSpec spec;
     private MessageEndpointFactory endpointFactory;
@@ -126,6 +131,16 @@
         if (bus == null) {
             bus = BusFactory.getDefaultBus();
         }
+        
+        Method method = null;
+
+        try {
+            Class clazz = org.apache.cxf.jca.inbound.DispatchMDBMessageListener.class;
+            method = clazz.getMethod(MESSAGE_LISTENER_METHOD, new Class[] {String.class});
+        } catch (Exception ex) {
+            LOG.severe("Failed to get method " + MESSAGE_LISTENER_METHOD
+                       + " from class DispatchMDBMessageListener.");
+        }
 
         Server server = createServer(bus, serviceClass, invoker);
         
@@ -134,6 +149,10 @@
             return;
         }
         
+        EndpointInfo  ei = server.getEndpoint().getEndpointInfo();
+        ei.setProperty(MESSAGE_ENDPOINT_FACTORY, endpointFactory);
+        ei.setProperty(MDB_TRANSACTED_METHOD, method);
+
         server.start();
         
         // save the server for clean up later

Modified: cxf/branches/2.1.x-fixes/rt/transports/jms/pom.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/jms/pom.xml?rev=800533&r1=800532&r2=800533&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/transports/jms/pom.xml (original)
+++ cxf/branches/2.1.x-fixes/rt/transports/jms/pom.xml Mon Aug  3 20:27:15 2009
@@ -91,6 +91,11 @@
         	<version>${spring.version}</version>
         </dependency>
 
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-j2ee-connector_1.5_spec</artifactId>
+            <scope>provided</scope>
+        </dependency>        
     </dependencies>
 
     <build>

Modified: cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java?rev=800533&r1=800532&r2=800533&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
Mon Aug  3 20:27:15 2009
@@ -20,6 +20,7 @@
 
 import javax.jms.ConnectionFactory;
 import javax.jms.Message;
+import javax.jms.XAConnectionFactory;
 
 import org.apache.cxf.configuration.ConfigurationException;
 import org.springframework.beans.factory.InitializingBean;
@@ -407,7 +408,11 @@
             if (wrapInSingleConnectionFactory && !(connectionFactory instanceof SingleConnectionFactory))
{
                 SingleConnectionFactory scf;
                 if (useJms11) {
-                    scf = new SingleConnectionFactory(connectionFactory);
+                    if (connectionFactory instanceof XAConnectionFactory) {
+                        scf = new XASingleConnectionFactory(connectionFactory);
+                    } else {
+                        scf = new SingleConnectionFactory(connectionFactory);
+                    }
                 } else {
                     scf = new SingleConnectionFactory102(connectionFactory, pubSubDomain);
                 }

Modified: cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java?rev=800533&r1=800532&r2=800533&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
Mon Aug  3 20:27:15 2009
@@ -41,6 +41,7 @@
 import javax.jms.MessageListener;
 import javax.jms.Session;
 import javax.jms.TextMessage;
+import javax.resource.spi.endpoint.MessageEndpoint;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
@@ -76,6 +77,7 @@
 
     private JMSConfiguration jmsConfig;
     private Bus bus;
+    private EndpointInfo ei;
     private DefaultMessageListenerContainer jmsListener;
     private Collection<JMSContinuation> continuations = 
         new ConcurrentLinkedQueue<JMSContinuation>();
@@ -83,6 +85,7 @@
     public JMSDestination(Bus b, EndpointInfo info, JMSConfiguration jmsConfig) {
         super(b, getTargetReference(info, b), info);
         this.bus = b;
+        this.ei = info;
         this.jmsConfig = jmsConfig;
         info.setProperty(OneWayProcessorInterceptor.USE_ORIGINAL_THREAD, Boolean.TRUE);
     }
@@ -105,7 +108,7 @@
         org.apache.cxf.common.i18n.Message msg = 
             new org.apache.cxf.common.i18n.Message("INSUFFICIENT_CONFIGURATION_DESTINATION",
LOG, name);
         jmsConfig.ensureProperlyConfigured(msg);
-        jmsListener = JMSFactory.createJmsListener(jmsConfig, this, 
+        jmsListener = JMSFactory.createJmsListener(ei, jmsConfig, this, 
                                                    jmsConfig.getTargetDestination(), null,
false);
     }
 
@@ -193,6 +196,12 @@
             
             BusFactory.setThreadDefaultBus(bus);
 
+            MessageEndpoint ep = JCATransactionalMessageListenerContainer.ENDPOINT_LOCAL.get();
+            if (ep != null) {
+                inMessage.setContent(MessageEndpoint.class, ep);
+                JCATransactionalMessageListenerContainer.ENDPOINT_LOCAL.remove();
+            }
+            
             // handle the incoming message
             incomingObserver.onMessage(inMessage);
         } catch (SuspendedInvocationException ex) {

Modified: cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java?rev=800533&r1=800532&r2=800533&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java
Mon Aug  3 20:27:15 2009
@@ -18,6 +18,7 @@
  */
 package org.apache.cxf.transport.jms;
 
+import java.lang.reflect.Method;
 import java.util.logging.Logger;
 
 import javax.jms.ConnectionFactory;
@@ -26,9 +27,11 @@
 import javax.jms.MessageListener;
 import javax.jms.QueueSession;
 import javax.jms.Session;
+import javax.jms.XAConnectionFactory;
 import javax.naming.NamingException;
 
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.service.model.EndpointInfo;
 import org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter;
 import org.springframework.jms.core.JmsTemplate;
 import org.springframework.jms.core.JmsTemplate102;
@@ -113,6 +116,37 @@
         return jmsTemplate;
     }
 
+    public static DefaultMessageListenerContainer createJmsListener(EndpointInfo ei,
+                                                                    JMSConfiguration jmsConfig,
+                                                                    MessageListener listenerHandler,
+                                                                    String destinationName,

+                                                                    String messageSelectorPrefix,
+                                                                    boolean userCID) {
+        DefaultMessageListenerContainer jmsListener = null;
+        
+        if (jmsConfig.isUseJms11()) {
+            //Check to see if transport is being used in JCA RA with XA
+            Method method = ei.getProperty(JCATransactionalMessageListenerContainer.MDB_TRANSACTED_METHOD,
+                                           java.lang.reflect.Method.class);
+            if (method != null 
+                && 
+                jmsConfig.getConnectionFactory() instanceof XAConnectionFactory) {
+                jmsListener = new JCATransactionalMessageListenerContainer(ei); 
+            } else {
+                jmsListener = new DefaultMessageListenerContainer();
+            }
+        } else {
+            jmsListener = new DefaultMessageListenerContainer102();
+        }
+        
+        return createJmsListener(jmsListener,
+                                 jmsConfig,
+                                 listenerHandler,
+                                 destinationName, 
+                                 messageSelectorPrefix,
+                                 userCID);            
+    }
+    
     /**
      * Create and start listener using configuration information from jmsConfig. Uses
      * resolveOrCreateDestination to determine the destination for the listener.
@@ -130,6 +164,23 @@
                                                                     boolean userCID) {
         DefaultMessageListenerContainer jmsListener = jmsConfig.isUseJms11()
             ? new DefaultMessageListenerContainer() : new DefaultMessageListenerContainer102();
+        
+        return createJmsListener(jmsListener,
+                                 jmsConfig,
+                                 listenerHandler,
+                                 destinationName, 
+                                 messageSelectorPrefix,
+                                 userCID);    
+    }
+    
+    public static DefaultMessageListenerContainer 
+    createJmsListener(DefaultMessageListenerContainer jmsListener,
+                      JMSConfiguration jmsConfig,
+                      MessageListener listenerHandler,
+                      String destinationName, 
+                      String messageSelectorPrefix,
+                      boolean userCID) {
+        
         jmsListener.setConcurrentConsumers(jmsConfig.getConcurrentConsumers());
         jmsListener.setMaxConcurrentConsumers(jmsConfig.getMaxConcurrentConsumers());
         jmsListener.setPubSubDomain(jmsConfig.isPubSubDomain());



Mime
View raw message