summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/binding-jms-runtime
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2008-09-11 07:21:42 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2008-09-11 07:21:42 +0000
commite7261c32e4aefdd3892a591aa49288c9eb8cd393 (patch)
tree3081add755b1d2ec585ea30c7cff96324251a2a3 /java/sca/modules/binding-jms-runtime
parenta3ce58076d0ce2d2f09c2331ea499554e9b5a9f9 (diff)
Partial fix/workaround for TUSCANY-2583 - only first method's parameter is send in JMS Message
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@694155 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/binding-jms-runtime')
-rw-r--r--java/sca/modules/binding-jms-runtime/pom.xml22
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.java2
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.java6
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java55
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java69
5 files changed, 111 insertions, 43 deletions
diff --git a/java/sca/modules/binding-jms-runtime/pom.xml b/java/sca/modules/binding-jms-runtime/pom.xml
index 9d9d07ad39..62eb3de60d 100644
--- a/java/sca/modules/binding-jms-runtime/pom.xml
+++ b/java/sca/modules/binding-jms-runtime/pom.xml
@@ -60,11 +60,23 @@
<version>1.4-SNAPSHOT</version>
</dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding-axiom</artifactId>
- <version>1.4-SNAPSHOT</version>
- </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-wsdlgen</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.java
index 4701c7b805..1990e553e0 100644
--- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.java
+++ b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.java
@@ -102,7 +102,7 @@ public class JMSBindingListener implements MessageListener {
MessageImpl tuscanyMsg = new MessageImpl();
tuscanyMsg.setOperation(operation);
if ("onMessage".equals(operation.getName())) {
- tuscanyMsg.setBody(requestJMSMsg);
+ tuscanyMsg.setBody(new Object[]{requestJMSMsg});
} else {
Object requestPayload = requestMessageProcessor.extractPayloadFromJMSMessage(requestJMSMsg);
tuscanyMsg.setBody(requestPayload);
diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.java
index 00424d32c2..e0cd756849 100644
--- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.java
+++ b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.java
@@ -38,18 +38,20 @@ import org.apache.tuscany.sca.work.WorkScheduler;
public class JMSBindingProviderFactory implements BindingProviderFactory<JMSBinding> {
private WorkScheduler workScheduler;
+ private ExtensionPointRegistry extensionPoints;
public JMSBindingProviderFactory(ExtensionPointRegistry extensionPoints) {
+ this.extensionPoints = extensionPoints;
UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
workScheduler = utilities.getUtility(WorkScheduler.class);
}
public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component, RuntimeComponentReference reference, JMSBinding binding) {
- return new JMSBindingReferenceBindingProvider(component, reference, binding);
+ return new JMSBindingReferenceBindingProvider(component, reference, binding, extensionPoints);
}
public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component, RuntimeComponentService service, JMSBinding binding) {
- return new JMSBindingServiceBindingProvider(component, service, binding, binding, workScheduler);
+ return new JMSBindingServiceBindingProvider(component, service, binding, binding, workScheduler, extensionPoints);
}
public Class<JMSBinding> getModelType() {
diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java
index 020829def6..4266a6c7c8 100644
--- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java
+++ b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java
@@ -24,10 +24,14 @@ import java.util.List;
import javax.jms.JMSException;
+import org.apache.axiom.om.OMElement;
import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
+import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
+import org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.Invoker;
@@ -46,10 +50,14 @@ public class JMSBindingReferenceBindingProvider implements ReferenceBindingProvi
private JMSBinding jmsBinding;
private List<JMSBindingInvoker> jmsBindingInvokers = new ArrayList<JMSBindingInvoker>();
private JMSResourceFactory jmsResourceFactory;
+ private RuntimeComponent component;
+ private InterfaceContract wsdlInterfaceContract;
+ private ExtensionPointRegistry extensions;
- public JMSBindingReferenceBindingProvider(RuntimeComponent component, RuntimeComponentReference reference, JMSBinding binding) {
+ public JMSBindingReferenceBindingProvider(RuntimeComponent component, RuntimeComponentReference reference, JMSBinding binding, ExtensionPointRegistry extensions) {
this.reference = reference;
this.jmsBinding = binding;
+ this.extensions = extensions;
jmsResourceFactory = new JMSResourceFactory(binding.getConnectionFactoryName(), binding.getInitialContextFactoryName(), binding.getJndiURL());
if (XMLTextMessageProcessor.class.isAssignableFrom(JMSMessageProcessorUtil.getRequestMessageProcessor(jmsBinding).getClass())) {
@@ -57,19 +65,28 @@ public class JMSBindingReferenceBindingProvider implements ReferenceBindingProvi
}
}
-
+
protected void setXMLDataBinding(RuntimeComponentReference reference) {
- try {
- InterfaceContract ic = (InterfaceContract)reference.getInterfaceContract().clone();
-
- Interface ii = (Interface)ic.getInterface().clone();
- ii.resetDataBinding("org.apache.axiom.om.OMElement");
- ic.setInterface(ii);
- reference.setInterfaceContract(ic);
-
- } catch (CloneNotSupportedException e) {
- throw new RuntimeException(e);
- }
+
+ WebServiceBindingFactory wsFactory = extensions.getExtensionPoint(WebServiceBindingFactory.class);
+ WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
+ BindingWSDLGenerator.generateWSDL(component, reference, wsBinding, extensions, null);
+ wsdlInterfaceContract = wsBinding.getBindingInterfaceContract();
+ wsdlInterfaceContract.getInterface().resetDataBinding(OMElement.class.getName());
+
+ // TODO: TUSCANY-xxx, section 5.2 "Default Data Binding" in the JMS binding spec
+
+// try {
+// InterfaceContract ic = (InterfaceContract)reference.getInterfaceContract().clone();
+//
+// Interface ii = (Interface)ic.getInterface().clone();
+// ii.resetDataBinding("org.apache.axiom.om.OMElement");
+// ic.setInterface(ii);
+// reference.setInterfaceContract(ic);
+//
+// } catch (CloneNotSupportedException e) {
+// throw new RuntimeException(e);
+// }
}
public Invoker createInvoker(Operation operation) {
@@ -90,10 +107,14 @@ public class JMSBindingReferenceBindingProvider implements ReferenceBindingProvi
}
public InterfaceContract getBindingInterfaceContract() {
- if (reference.getInterfaceContract() == null) {
- return reference.getReference().getInterfaceContract();
+ if (wsdlInterfaceContract != null) {
+ return wsdlInterfaceContract;
} else {
- return reference.getInterfaceContract();
+ if (reference.getInterfaceContract() == null) {
+ return reference.getReference().getInterfaceContract();
+ } else {
+ return reference.getInterfaceContract();
+ }
}
}
diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java
index 9f5bf68d13..7db640b7d1 100644
--- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java
+++ b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java
@@ -31,11 +31,15 @@ import javax.jms.Session;
import javax.jms.Topic;
import javax.naming.NamingException;
+import org.apache.axiom.om.OMElement;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
+import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
+import org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.provider.ServiceBindingProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
@@ -60,11 +64,18 @@ public class JMSBindingServiceBindingProvider implements ServiceBindingProvider
private Destination destination;
- public JMSBindingServiceBindingProvider(RuntimeComponent component, RuntimeComponentService service, Binding targetBinding, JMSBinding binding, WorkScheduler workScheduler) {
+ private ExtensionPointRegistry extensionPoints;
+
+ private RuntimeComponent component;
+ private InterfaceContract wsdlInterfaceContract;
+
+ public JMSBindingServiceBindingProvider(RuntimeComponent component, RuntimeComponentService service, Binding targetBinding, JMSBinding binding, WorkScheduler workScheduler, ExtensionPointRegistry extensionPoints) {
+ this.component = component;
this.service = service;
this.jmsBinding = binding;
this.workScheduler = workScheduler;
this.targetBinding = targetBinding;
+ this.extensionPoints = extensionPoints;
jmsResourceFactory = new JMSResourceFactory(binding.getConnectionFactoryName(), binding.getInitialContextFactoryName(), binding.getJndiURL());
@@ -76,32 +87,54 @@ public class JMSBindingServiceBindingProvider implements ServiceBindingProvider
}
if (XMLTextMessageProcessor.class.isAssignableFrom(JMSMessageProcessorUtil.getRequestMessageProcessor(jmsBinding).getClass())) {
- setXMLDataBinding(service);
+ if (!isOnMessage()) {
+ setXMLDataBinding(service);
+ }
}
}
+
+ protected boolean isOnMessage() {
+ InterfaceContract ic = getBindingInterfaceContract();
+ if (ic.getInterface().getOperations().size() != 1) {
+ return false;
+ }
+ return "onMessage".equals(ic.getInterface().getOperations().get(0).getName());
+ }
protected void setXMLDataBinding(RuntimeComponentService service) {
if (service.getInterfaceContract() != null) {
- try {
- InterfaceContract ic = (InterfaceContract)service.getInterfaceContract().clone();
- Interface ii = ic.getInterface();
- if (ii.getOperations().size() == 1 && "onMessage".equals(ii.getOperations().get(0).getName())) {
- return;
- }
- ii = (Interface)ii.clone();
- ii.resetDataBinding("org.apache.axiom.om.OMElement");
- ic.setInterface(ii);
- service.setInterfaceContract(ic);
-
- } catch (CloneNotSupportedException e) {
- throw new RuntimeException(e);
- }
+ WebServiceBindingFactory wsFactory = extensionPoints.getExtensionPoint(WebServiceBindingFactory.class);
+ WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
+ BindingWSDLGenerator.generateWSDL(component, service, wsBinding, extensionPoints, null);
+ wsdlInterfaceContract = wsBinding.getBindingInterfaceContract();
+ wsdlInterfaceContract.getInterface().resetDataBinding(OMElement.class.getName());
+
+ // TODO: TUSCANY-xxx, section 5.2 "Default Data Binding" in the JMS binding spec
+
+// try {
+// InterfaceContract ic = (InterfaceContract)service.getInterfaceContract().clone();
+// Interface ii = ic.getInterface();
+// if (ii.getOperations().size() == 1 && "onMessage".equals(ii.getOperations().get(0).getName())) {
+// return;
+// }
+// ii = (Interface)ii.clone();
+// ii.resetDataBinding("org.apache.axiom.om.OMElement");
+// ic.setInterface(ii);
+// service.setInterfaceContract(ic);
+//
+// } catch (CloneNotSupportedException e) {
+// throw new RuntimeException(e);
+// }
}
}
public InterfaceContract getBindingInterfaceContract() {
- return service.getInterfaceContract();
+ if (wsdlInterfaceContract != null) {
+ return wsdlInterfaceContract;
+ } else {
+ return service.getInterfaceContract();
+ }
}
public boolean supportsOneWayInvocation() {