tuscany-commits mailing list archives

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

URL: http://svn.apache.org/viewvc?rev=1159781&view=rev
Log:
Fix jms text wireformat to work with async services

Modified:
    tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextProviderFactory.java
    tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceInterceptor.java
    tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceProvider.java

Modified: tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextProviderFactory.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/jmstext/runtime/WireFormatJMSTextProviderFactory.java?rev=1159781&r1=1159780&r2=1159781&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextProviderFactory.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextProviderFactory.java
Fri Aug 19 20:46:35 2011
@@ -19,6 +19,9 @@
 
 package org.apache.tuscany.sca.binding.jms.wireformat.jmstext.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.WireFormatJMSText;
 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 WireFormatJMSTextProviderFactory implements WireFormatProviderFactory<WireFormatJMSText>
{
     private ExtensionPointRegistry registry;
+    private JMSResourceFactoryExtensionPoint jmsRFEP;
     
     public WireFormatJMSTextProviderFactory(ExtensionPointRegistry registry) {
         super();
         this.registry = registry;
+        jmsRFEP = (JMSResourceFactoryExtensionPoint) registry.getExtensionPoint(JMSResourceFactoryExtensionPoint.class);
     }
 
     /**
@@ -46,7 +51,8 @@ public class WireFormatJMSTextProviderFa
     /**
       */
     public WireFormatProvider createServiceWireFormatProvider(RuntimeEndpoint endpoint) {
-        return new WireFormatJMSTextServiceProvider(registry, endpoint);
+        JMSResourceFactory jmsResourceFactory = jmsRFEP.createJMSResourceFactory((JMSBinding)
endpoint.getBinding());
+        return new WireFormatJMSTextServiceProvider(registry, endpoint, jmsResourceFactory);
     }
 
     /**

Modified: tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceInterceptor.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/jmstext/runtime/WireFormatJMSTextServiceInterceptor.java?rev=1159781&r1=1159780&r2=1159781&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceInterceptor.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceInterceptor.java
Fri Aug 19 20:46:35 2011
@@ -91,6 +91,12 @@ public class WireFormatJMSTextServiceInt
     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;
@@ -113,6 +119,12 @@ public class WireFormatJMSTextServiceInt
     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);

Modified: tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceProvider.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/jmstext/runtime/WireFormatJMSTextServiceProvider.java?rev=1159781&r1=1159780&r2=1159781&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceProvider.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceProvider.java
Fri Aug 19 20:46:35 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.WireFormatJMSText;
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.interfacedef.InterfaceContract;
@@ -36,13 +37,16 @@ public class WireFormatJMSTextServicePro
     private ExtensionPointRegistry registry;
     private RuntimeEndpoint endpoint;
     private JMSBinding binding;
-    private InterfaceContract interfaceContract; 
+    private InterfaceContract interfaceContract;
+    private JMSResourceFactory jmsResourceFactory; 
 
     public WireFormatJMSTextServiceProvider(ExtensionPointRegistry registry,
-                                            RuntimeEndpoint endpoint) {
+                                            RuntimeEndpoint endpoint, 
+                                            JMSResourceFactory jmsResourceFactory) {
         super();
         this.registry = registry;
         this.endpoint = endpoint;
+        this.jmsResourceFactory = jmsResourceFactory;
         this.binding = (JMSBinding)endpoint.getBinding();
         
         // configure the service based on this wire format
@@ -88,7 +92,7 @@ public class WireFormatJMSTextServicePro
     /**
      */
     public Interceptor createInterceptor() {
-        return new WireFormatJMSTextServiceInterceptor(registry, null, endpoint);
+        return new WireFormatJMSTextServiceInterceptor(registry, jmsResourceFactory, endpoint);
     }
 
     /**



Mime
View raw message