summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/binding-jms-runtime/src
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-08-19 19:55:46 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-08-19 19:55:46 +0000
commit7bda76851bb05833f9ba0f96141154d015a2088b (patch)
treecf600d6d6f74349f5d54e3b51c35016ec694b893 /sca-java-2.x/trunk/modules/binding-jms-runtime/src
parent26a29763aa23bf394dbb36a35a09937660168dc2 (diff)
Fix NPE in jmsObject wireformat with async services
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1159761 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/binding-jms-runtime/src')
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectProviderFactory.java8
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java15
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceProvider.java7
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/jmsobject/runtime/WireFormatJMSObjectProviderFactory.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectProviderFactory.java
index 1e445f1b11..3b033004c4 100644
--- a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectProviderFactory.java
+++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectProviderFactory.java
@@ -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.RuntimeEndpointReference;
*/
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 WireFormatJMSObjectProviderFactory implements WireFormatProviderFac
/**
*/
public WireFormatProvider createServiceWireFormatProvider(RuntimeEndpoint endpoint) {
- return new WireFormatJMSObjectServiceProvider(registry, endpoint);
+ JMSResourceFactory jmsResourceFactory = jmsRFEP.createJMSResourceFactory((JMSBinding) endpoint.getBinding());
+ return new WireFormatJMSObjectServiceProvider(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/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java
index e04501e8b7..d4bc99aa7b 100644
--- a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java
+++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java
@@ -116,6 +116,13 @@ public class WireFormatJMSObjectServiceInterceptor 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 = null;
@@ -138,7 +145,13 @@ public class WireFormatJMSObjectServiceInterceptor 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/jmsobject/runtime/WireFormatJMSObjectServiceProvider.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceProvider.java
index 2e50f27a47..2b16ba650e 100644
--- a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceProvider.java
+++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceProvider.java
@@ -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 WireFormatJMSObjectServiceProvider implements WireFormatProvider {
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 WireFormatJMSObjectServiceProvider implements WireFormatProvider {
*/
public Interceptor createInterceptor() {
- return new WireFormatJMSObjectServiceInterceptor(registry, null, endpoint, this.singleArgMap, wrapSingle);
+ return new WireFormatJMSObjectServiceInterceptor(registry, jmsResourceFactory, endpoint, this.singleArgMap, wrapSingle);
}
/**