diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2011-08-19 20:46:35 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2011-08-19 20:46:35 +0000 |
commit | 458cc11ebcfe51a561a4bcfba3d132e134787af0 (patch) | |
tree | 1563027620ec24ff7b1e51b280888e94bd33edb4 /sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime | |
parent | ba247040051481936d49c2f3a41b019b0b9037fe (diff) |
Fix jms text wireformat to work with async services
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1159781 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime')
3 files changed, 26 insertions, 4 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextProviderFactory.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextProviderFactory.java index e3522616c0..de76dbbdb8 100644 --- a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextProviderFactory.java +++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextProviderFactory.java @@ -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.RuntimeEndpointReference; */ 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 WireFormatJMSTextProviderFactory implements WireFormatProviderFacto /** */ public WireFormatProvider createServiceWireFormatProvider(RuntimeEndpoint endpoint) { - return new WireFormatJMSTextServiceProvider(registry, endpoint); + JMSResourceFactory jmsResourceFactory = jmsRFEP.createJMSResourceFactory((JMSBinding) endpoint.getBinding()); + return new WireFormatJMSTextServiceProvider(registry, endpoint, jmsResourceFactory); } /** diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceInterceptor.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceInterceptor.java index 1ba0744593..1d3d4e7a42 100644 --- a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceInterceptor.java +++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceInterceptor.java @@ -91,6 +91,12 @@ public class WireFormatJMSTextServiceInterceptor extends InterceptorAsyncImpl { 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 WireFormatJMSTextServiceInterceptor extends InterceptorAsyncImpl { 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); diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceProvider.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceProvider.java index f4ee1226c5..adc5845a49 100644 --- a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceProvider.java +++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceProvider.java @@ -21,6 +21,7 @@ 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.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 WireFormatJMSTextServiceProvider implements WireFormatProvider { 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 WireFormatJMSTextServiceProvider implements WireFormatProvider { /** */ public Interceptor createInterceptor() { - return new WireFormatJMSTextServiceInterceptor(registry, null, endpoint); + return new WireFormatJMSTextServiceInterceptor(registry, jmsResourceFactory, endpoint); } /** |