tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r1160610 - in /tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat: jmsbytes/runtime/ jmsbytesxml/runtime/ jmstextxml/runtime/
Date Tue, 23 Aug 2011 10:40:57 GMT
Author: antelder
Date: Tue Aug 23 10:40:56 2011
New Revision: 1160610

URL: http://svn.apache.org/viewvc?rev=1160610&view=rev
Log:
Update jms wireformats to fix NPE with async services

Modified:
    tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesProviderFactory.java
    tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceInterceptor.java
    tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceProvider.java
    tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceInterceptor.java
    tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceInterceptor.java

Modified: tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesProviderFactory.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/jmsbytes/runtime/WireFormatJMSBytesProviderFactory.java?rev=1160610&r1=1160609&r2=1160610&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesProviderFactory.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesProviderFactory.java
Tue Aug 23 10:40:56 2011
@@ -19,6 +19,9 @@
 
 package org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.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.WireFormatJMSBytes;
 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 WireFormatJMSBytesProviderFactory implements WireFormatProviderFactory<WireFormatJMSBytes>
{
     private ExtensionPointRegistry registry;
+    private JMSResourceFactoryExtensionPoint jmsRFEP;
     
     public WireFormatJMSBytesProviderFactory(ExtensionPointRegistry registry) {
         super();
         this.registry = registry;
+        jmsRFEP = (JMSResourceFactoryExtensionPoint)registry.getExtensionPoint(JMSResourceFactoryExtensionPoint.class);
     }
 
     /**
@@ -46,7 +51,8 @@ public class WireFormatJMSBytesProviderF
     /**
       */
     public WireFormatProvider createServiceWireFormatProvider(RuntimeEndpoint endpoint) {
-        return new WireFormatJMSBytesServiceProvider(registry, endpoint);
+        JMSResourceFactory jmsRF = jmsRFEP.createJMSResourceFactory((JMSBinding)endpoint.getBinding());
+        return new WireFormatJMSBytesServiceProvider(registry, endpoint, jmsRF);
     }
 
     /**

Modified: tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceInterceptor.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/jmsbytes/runtime/WireFormatJMSBytesServiceInterceptor.java?rev=1160610&r1=1160609&r2=1160610&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceInterceptor.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceInterceptor.java
Tue Aug 23 10:40:56 2011
@@ -91,6 +91,12 @@ public class WireFormatJMSBytesServiceIn
     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;
@@ -114,7 +120,13 @@ public class WireFormatJMSBytesServiceIn
         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/jmsbytes/runtime/WireFormatJMSBytesServiceProvider.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/jmsbytes/runtime/WireFormatJMSBytesServiceProvider.java?rev=1160610&r1=1160609&r2=1160610&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceProvider.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceProvider.java
Tue Aug 23 10:40:56 2011
@@ -21,6 +21,7 @@ package org.apache.tuscany.sca.binding.j
 
 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.WireFormatJMSBytes;
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.interfacedef.InterfaceContract;
@@ -36,13 +37,17 @@ public class WireFormatJMSBytesServicePr
     private ExtensionPointRegistry registry;
     private RuntimeEndpoint endpoint;
     private JMSBinding binding;
-    private InterfaceContract interfaceContract; 
+    private InterfaceContract interfaceContract;
+    private JMSResourceFactory jmsResourceFactory; 
 
     public WireFormatJMSBytesServiceProvider(ExtensionPointRegistry registry,
-                                             RuntimeEndpoint endpoint) {
+                                             RuntimeEndpoint endpoint, 
+                                             JMSResourceFactory jmsResourceFactory) {
         super();
         this.registry = registry;
         this.endpoint = endpoint;
+        this.endpoint = endpoint;
+        this.jmsResourceFactory = jmsResourceFactory;
         this.binding = (JMSBinding) endpoint.getBinding();
         
         // configure the service based on this wire format
@@ -81,7 +86,7 @@ public class WireFormatJMSBytesServicePr
     /**
      */
     public Interceptor createInterceptor() {
-        return new WireFormatJMSBytesServiceInterceptor(registry, null, endpoint);
+        return new WireFormatJMSBytesServiceInterceptor(registry, jmsResourceFactory, endpoint);
     }
 
     /**

Modified: tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceInterceptor.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/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceInterceptor.java?rev=1160610&r1=1160609&r2=1160610&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceInterceptor.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceInterceptor.java
Tue Aug 23 10:40:56 2011
@@ -85,6 +85,12 @@ public class WireFormatJMSBytesXMLServic
     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;
@@ -108,7 +114,13 @@ public class WireFormatJMSBytesXMLServic
         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/jmstextxml/runtime/WireFormatJMSTextXMLServiceInterceptor.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/jmstextxml/runtime/WireFormatJMSTextXMLServiceInterceptor.java?rev=1160610&r1=1160609&r2=1160610&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceInterceptor.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceInterceptor.java
Tue Aug 23 10:40:56 2011
@@ -93,6 +93,12 @@ public class WireFormatJMSTextXMLService
         
         // 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;
@@ -114,6 +120,12 @@ public class WireFormatJMSTextXMLService
     public void setNext(Invoker next) {
         this.next = next;
     }
+
+    private JMSBindingContext createBindingContext() {
+        JMSBindingContext context = new JMSBindingContext();
+        context.setJmsResourceFactory(jmsResourceFactory);
+        return context;
+    }
     
 	public Message processRequest(Message msg) {
 		return invokeRequest(msg);



Mime
View raw message