diff options
Diffstat (limited to '')
3 files changed, 28 insertions, 5 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesProviderFactory.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesProviderFactory.java index 7675698cc7..e6ef82e55d 100644 --- a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesProviderFactory.java +++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesProviderFactory.java @@ -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.RuntimeEndpointReference; */ 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 WireFormatJMSBytesProviderFactory implements WireFormatProviderFact /** */ public WireFormatProvider createServiceWireFormatProvider(RuntimeEndpoint endpoint) { - return new WireFormatJMSBytesServiceProvider(registry, endpoint); + JMSResourceFactory jmsRF = jmsRFEP.createJMSResourceFactory((JMSBinding)endpoint.getBinding()); + return new WireFormatJMSBytesServiceProvider(registry, endpoint, jmsRF); } /** diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceInterceptor.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceInterceptor.java index 835734f45e..f8d88f6809 100644 --- a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceInterceptor.java +++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceInterceptor.java @@ -91,6 +91,12 @@ public class WireFormatJMSBytesServiceInterceptor 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; @@ -114,7 +120,13 @@ public class WireFormatJMSBytesServiceInterceptor extends InterceptorAsyncImpl { 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 diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceProvider.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceProvider.java index ef3530640f..fee2ac7748 100644 --- a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceProvider.java +++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceProvider.java @@ -21,6 +21,7 @@ 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.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 WireFormatJMSBytesServiceProvider implements WireFormatProvider { 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 WireFormatJMSBytesServiceProvider implements WireFormatProvider { /** */ public Interceptor createInterceptor() { - return new WireFormatJMSBytesServiceInterceptor(registry, null, endpoint); + return new WireFormatJMSBytesServiceInterceptor(registry, jmsResourceFactory, endpoint); } /** |