summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java9
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.java14
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.java41
-rw-r--r--java/sca/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingConstants.java1
4 files changed, 55 insertions, 10 deletions
diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java
index c2e971fe1d..706a0e049c 100644
--- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java
+++ b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java
@@ -260,7 +260,7 @@ public class JMSBindingInvoker implements Invoker, DataExchangeSemantics {
requestMsg.setJMSDeliveryMode(jmsBinding.getDeliveryMode());
requestMsg.setJMSPriority(jmsBinding.getPriority());
- setCallbackHeaders(tuscanyMsg, requestMsg);
+ setHeaders(tuscanyMsg, requestMsg);
requestMessageProcessor.setOperationName(operationName, requestMsg);
requestMsg.setJMSReplyTo(replyToDest);
@@ -294,7 +294,7 @@ public class JMSBindingInvoker implements Invoker, DataExchangeSemantics {
return requestDestination;
}
- protected void setCallbackHeaders(org.apache.tuscany.sca.invocation.Message tuscanyMsg, Message jmsMsg) throws JMSException {
+ protected void setHeaders(org.apache.tuscany.sca.invocation.Message tuscanyMsg, Message jmsMsg) throws JMSException {
if (hasCallback()) {
ReferenceParameters parameters = tuscanyMsg.getFrom().getReferenceParameters();
@@ -307,6 +307,11 @@ public class JMSBindingInvoker implements Invoker, DataExchangeSemantics {
if (callbackDestName != null) {
jmsMsg.setStringProperty(JMSBindingConstants.CALLBACK_Q_PROPERTY, callbackDestName);
}
+
+ Object conversationID = parameters.getConversationID();
+ if (conversationID != null) {
+ jmsMsg.setStringProperty(JMSBindingConstants.CONVERSATION_ID_PROPERTY, conversationID.toString());
+ }
}
}
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 f04ef38f26..6f5f571cb5 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
@@ -126,21 +126,18 @@ public class JMSBindingListener implements MessageListener {
tuscanyMsg.setBody(requestPayload);
tuscanyMsg.setOperation(operation);
- setCallbackProperties(requestJMSMsg, tuscanyMsg, operation);
+ setHeaderProperties(requestJMSMsg, tuscanyMsg, operation);
return service.getRuntimeWire(jmsBinding).invoke(operation, tuscanyMsg);
}
- protected void setCallbackProperties(Message requestJMSMsg, MessageImpl tuscanyMsg, Operation operation) throws JMSException {
+ protected void setHeaderProperties(Message requestJMSMsg, MessageImpl tuscanyMsg, Operation operation) throws JMSException {
if (service.getInterfaceContract().getCallbackInterface() != null) {
EndpointReference from = new EndpointReferenceImpl(null);
tuscanyMsg.setFrom(from);
- from.setCallbackEndpoint(new EndpointReferenceImpl("/")); // TODO:
- // whats
- // this
- // for?
+ from.setCallbackEndpoint(new EndpointReferenceImpl("/")); // TODO: whats this for?
ReferenceParameters parameters = from.getReferenceParameters();
@@ -164,6 +161,11 @@ public class JMSBindingListener implements MessageListener {
if (callbackID != null) {
parameters.setCallbackID(callbackID);
}
+
+ String conversationID = requestJMSMsg.getStringProperty(JMSBindingConstants.CONVERSATION_ID_PROPERTY);
+ if (conversationID != null) {
+ parameters.setConversationID(conversationID);
+ }
}
}
diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.java
index e4a403e0b2..97dbc208a9 100644
--- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.java
+++ b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.java
@@ -29,6 +29,7 @@ import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
/**
@@ -144,8 +145,44 @@ public class JMSResourceFactory {
}
}
- public Destination lookupDestination(String jndiName) throws NamingException {
- return (Destination)jndiLookUp(jndiName);
+ public Destination lookupDestination(String destName) throws NamingException {
+ if (JMSBindingConstants.DEFAULT_DESTINATION_NAME.equals(destName)) {
+ return null;
+ }
+
+ Destination dest = (Destination)jndiLookUp(destName);
+ if (dest == null) {
+ dest = lookupPhysical(destName);
+ }
+ return dest;
+ }
+
+ protected Destination lookupPhysical(String jndiName) {
+
+ // TODO: the SCA JMS spec says a destination name may be a non-jndi plain destination name
+
+// Session session = null;
+// try {
+//
+// Destination dest;
+// session = createSession();
+// dest = session.createQueue(jndiName);
+// return dest;
+//
+// } catch (JMSException e) {
+// throw new JMSBindingException(e);
+// } catch (NamingException e) {
+// throw new JMSBindingException(e);
+// } finally {
+// if (session != null) {
+// try {
+// session.close();
+// } catch (JMSException e) {
+// throw new JMSBindingException(e);
+// }
+// }
+// }
+ return null;
}
/**
diff --git a/java/sca/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingConstants.java b/java/sca/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingConstants.java
index 5fdc038864..57fa7a0eb7 100644
--- a/java/sca/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingConstants.java
+++ b/java/sca/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingConstants.java
@@ -67,5 +67,6 @@ public interface JMSBindingConstants {
String CALLBACK_ID_PROPERTY = "CallbackID";
String CALLBACK_Q_PROPERTY = "scaCallbackQueue ";
+ String CONVERSATION_ID_PROPERTY = "scaConversationId";
}