tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r1159761 - /tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/
Date Fri, 19 Aug 2011 19:55:46 GMT
Author: antelder
Date: Fri Aug 19 19:55:46 2011
New Revision: 1159761

URL: http://svn.apache.org/viewvc?rev=1159761&view=rev
Log:
Fix NPE in jmsObject wireformat with async services

Modified:
    tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectProviderFactory.java
    tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java
    tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceProvider.java

Modified: tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectProviderFactory.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectProviderFactory.java?rev=1159761&r1=1159760&r2=1159761&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectProviderFactory.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectProviderFactory.java
Fri Aug 19 19:55:46 2011
@@ -19,6 +19,9 @@
 
 package org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.runtime;
 
+import org.apache.tuscany.sca.binding.jms.JMSBinding;
+import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
+import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactoryExtensionPoint;
 import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSObject;
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.provider.WireFormatProvider;
@@ -31,10 +34,12 @@ import org.apache.tuscany.sca.runtime.Ru
  */
 public class WireFormatJMSObjectProviderFactory implements WireFormatProviderFactory<WireFormatJMSObject>
{
     private ExtensionPointRegistry registry;
+    private JMSResourceFactoryExtensionPoint jmsRFEP;
     
     public WireFormatJMSObjectProviderFactory(ExtensionPointRegistry registry) {
         super();
         this.registry = registry;
+        jmsRFEP = (JMSResourceFactoryExtensionPoint) registry.getExtensionPoint(JMSResourceFactoryExtensionPoint.class);
     }
 
     /**
@@ -46,7 +51,8 @@ public class WireFormatJMSObjectProvider
     /**
       */
     public WireFormatProvider createServiceWireFormatProvider(RuntimeEndpoint endpoint) {
-        return new WireFormatJMSObjectServiceProvider(registry, endpoint);
+        JMSResourceFactory jmsResourceFactory = jmsRFEP.createJMSResourceFactory((JMSBinding)
endpoint.getBinding());
+        return new WireFormatJMSObjectServiceProvider(registry, endpoint, jmsResourceFactory);
     }
 
     /**

Modified: tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java?rev=1159761&r1=1159760&r2=1159761&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java
Fri Aug 19 19:55:46 2011
@@ -116,6 +116,13 @@ public class WireFormatJMSObjectServiceI
     public Message invokeResponse(Message msg) {
         // get the jms context
         JMSBindingContext context = msg.getBindingContext();
+        
+        // The Binding Context may be null on an asynchronous response - in which case, create
a new one
+        if(context == null) {
+            context = createBindingContext();
+            msg.setBindingContext(context);
+        }
+
         Session session = context.getJmsResponseSession();
 
         javax.jms.Message responseJMSMsg = null;
@@ -138,7 +145,13 @@ public class WireFormatJMSObjectServiceI
         this.next = next;
     }
     
-	public Message processRequest(Message msg) {
+    private JMSBindingContext createBindingContext() {
+        JMSBindingContext context = new JMSBindingContext();
+        context.setJmsResourceFactory(jmsResourceFactory);
+        return context;
+    }
+
+    public Message processRequest(Message msg) {
 		return invokeRequest(msg);
 	} // end method processRequest
 

Modified: tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceProvider.java?rev=1159761&r1=1159760&r2=1159761&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceProvider.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceProvider.java
Fri Aug 19 19:55:46 2011
@@ -26,6 +26,7 @@ import java.util.List;
 import org.apache.tuscany.sca.assembly.ComponentService;
 import org.apache.tuscany.sca.binding.jms.JMSBinding;
 import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
+import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
 import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSObject;
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.interfacedef.InterfaceContract;
@@ -45,11 +46,13 @@ public class WireFormatJMSObjectServiceP
     private InterfaceContract interfaceContract; 
     private HashMap<String,Class<?>> singleArgMap;
     private boolean wrapSingle = true;
+    private JMSResourceFactory jmsResourceFactory ;
 
-    public WireFormatJMSObjectServiceProvider(ExtensionPointRegistry registry, RuntimeEndpoint
endpoint) {
+    public WireFormatJMSObjectServiceProvider(ExtensionPointRegistry registry, RuntimeEndpoint
endpoint, JMSResourceFactory jmsResourceFactory) {
         super();
         this.registry = registry;
         this.endpoint = endpoint;
+        this.jmsResourceFactory = jmsResourceFactory;
         this.binding = (JMSBinding)endpoint.getBinding();
         this.singleArgMap = new HashMap<String,Class<?>>();
         
@@ -104,7 +107,7 @@ public class WireFormatJMSObjectServiceP
      */
     public Interceptor createInterceptor() {
 
-        return new WireFormatJMSObjectServiceInterceptor(registry, null, endpoint, this.singleArgMap,
wrapSingle);
+        return new WireFormatJMSObjectServiceInterceptor(registry, jmsResourceFactory, endpoint,
this.singleArgMap, wrapSingle);
     }
 
     /**



Mime
View raw message