summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/binding-jms-runtime
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2008-09-02 08:20:57 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2008-09-02 08:20:57 +0000
commit36eecb1a08a817605dcc81d949921123d3e23487 (patch)
treeeba0bf3bc42484bdecc8e198d7aeb1239c9997ad /java/sca/modules/binding-jms-runtime
parentb2cbbd0bb90295c9f73ac2ada44b7f0772a19212 (diff)
Change so the target binding is passed in to the JMS service listener. (used by the jms based sca binding so it can get the tagert uri)
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@691145 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/binding-jms-runtime')
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.java7
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.java2
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java7
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/ObjectMessageProcessor.java7
-rw-r--r--java/sca/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/OperationSelectionTestCaseFIXME.java2
-rw-r--r--java/sca/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceQueueCreateModeTestCaseFIXME.java2
6 files changed, 19 insertions, 8 deletions
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 6a2ba35aa3..4701c7b805 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
@@ -33,6 +33,7 @@ import javax.jms.Session;
import javax.jms.Topic;
import javax.naming.NamingException;
+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;
@@ -54,6 +55,7 @@ public class JMSBindingListener implements MessageListener {
private static final String ON_MESSAGE_METHOD_NAME = "onMessage";
private JMSBinding jmsBinding;
+ private Binding targetBinding;
private JMSResourceFactory jmsResourceFactory;
private RuntimeComponentService service;
private JMSMessageProcessor requestMessageProcessor;
@@ -61,10 +63,11 @@ public class JMSBindingListener implements MessageListener {
private String correlationScheme;
private List<Operation> serviceOperations;
- public JMSBindingListener(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeComponentService service) throws NamingException {
+ public JMSBindingListener(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeComponentService service, Binding targetBinding) throws NamingException {
this.jmsBinding = jmsBinding;
this.jmsResourceFactory = jmsResourceFactory;
this.service = service;
+ this.targetBinding = targetBinding;
requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(jmsBinding);
responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(jmsBinding);
correlationScheme = jmsBinding.getCorrelationScheme();
@@ -107,7 +110,7 @@ public class JMSBindingListener implements MessageListener {
setHeaderProperties(requestJMSMsg, tuscanyMsg, operation);
- return service.getRuntimeWire(jmsBinding).invoke(operation, tuscanyMsg);
+ return service.getRuntimeWire(targetBinding).invoke(operation, tuscanyMsg);
}
protected Operation getTargetOperation(String operationName) {
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 5afe0abf34..00424d32c2 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
@@ -49,7 +49,7 @@ public class JMSBindingProviderFactory implements BindingProviderFactory<JMSBind
}
public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component, RuntimeComponentService service, JMSBinding binding) {
- return new JMSBindingServiceBindingProvider(component, service, binding, workScheduler);
+ return new JMSBindingServiceBindingProvider(component, service, binding, binding, workScheduler);
}
public Class<JMSBinding> getModelType() {
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 2e19db86ca..a84283be65 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,6 +31,7 @@ import javax.jms.Session;
import javax.jms.Topic;
import javax.naming.NamingException;
+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;
@@ -50,6 +51,7 @@ public class JMSBindingServiceBindingProvider implements ServiceBindingProvider
private static final Logger logger = Logger.getLogger(JMSBindingServiceBindingProvider.class.getName());
private RuntimeComponentService service;
+ private Binding targetBinding;
private JMSBinding jmsBinding;
private JMSResourceFactory jmsResourceFactory;
private MessageConsumer consumer;
@@ -58,10 +60,11 @@ public class JMSBindingServiceBindingProvider implements ServiceBindingProvider
private Destination destination;
- public JMSBindingServiceBindingProvider(RuntimeComponent component, RuntimeComponentService service, JMSBinding binding, WorkScheduler workScheduler) {
+ public JMSBindingServiceBindingProvider(RuntimeComponent component, RuntimeComponentService service, Binding targetBinding, JMSBinding binding, WorkScheduler workScheduler) {
this.service = service;
this.jmsBinding = binding;
this.workScheduler = workScheduler;
+ this.targetBinding = targetBinding;
jmsResourceFactory = new JMSResourceFactory(binding.getConnectionFactoryName(), binding.getInitialContextFactoryName(), binding.getJndiURL());
@@ -139,7 +142,7 @@ public class JMSBindingServiceBindingProvider implements ServiceBindingProvider
consumer = session.createConsumer(destination);
}
- final JMSBindingListener listener = new JMSBindingListener(jmsBinding, jmsResourceFactory, service);
+ final JMSBindingListener listener = new JMSBindingListener(jmsBinding, jmsResourceFactory, service, targetBinding);
try {
consumer.setMessageListener(listener);
diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/ObjectMessageProcessor.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/ObjectMessageProcessor.java
index e83fad89a4..e9ae3cecaa 100644
--- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/ObjectMessageProcessor.java
+++ b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/ObjectMessageProcessor.java
@@ -43,7 +43,12 @@ public class ObjectMessageProcessor extends AbstractMessageProcessor {
protected Object[] extractPayload(Message msg) {
try {
- return new Object[] {((ObjectMessage)msg).getObject()};
+ Object o = ((ObjectMessage)msg).getObject();
+ if (o != null && o.getClass().isArray()) {
+ return (Object[])o;
+ } else {
+ return new Object[] { o};
+ }
} catch (JMSException e) {
throw new JMSBindingException(e);
diff --git a/java/sca/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/OperationSelectionTestCaseFIXME.java b/java/sca/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/OperationSelectionTestCaseFIXME.java
index b27795ab09..03cc0bf1c4 100644
--- a/java/sca/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/OperationSelectionTestCaseFIXME.java
+++ b/java/sca/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/OperationSelectionTestCaseFIXME.java
@@ -204,7 +204,7 @@ public class OperationSelectionTestCaseFIXME {
.andReturn(operationReturnValue);
// Create the JMS Binding Listener
- final JMSBindingListener bindingListener = new JMSBindingListener(jmsBinding, jmsResourceFactory, service);
+ final JMSBindingListener bindingListener = new JMSBindingListener(jmsBinding, jmsResourceFactory, service, null);
// Simulate a message
final TextMessage requestJMSMsg = EasyMock.createStrictMock(TextMessage.class);
diff --git a/java/sca/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceQueueCreateModeTestCaseFIXME.java b/java/sca/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceQueueCreateModeTestCaseFIXME.java
index c3c18fbfbe..b002c35cc8 100644
--- a/java/sca/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceQueueCreateModeTestCaseFIXME.java
+++ b/java/sca/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceQueueCreateModeTestCaseFIXME.java
@@ -141,7 +141,7 @@ public class JMSBindingServiceQueueCreateModeTestCaseFIXME {
// Try and create the JMS Binding Service for the JMS Binding
try {
JMSBindingServiceBindingProvider jmsService =
- new JMSBindingServiceBindingProvider(null, service, jmsBinding, null);
+ new JMSBindingServiceBindingProvider(null, service, null, jmsBinding, null);
jmsService.start();
// Check whether we were expecting an exception