summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/binding-jms/src/main
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2012-02-09 17:46:50 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2012-02-09 17:46:50 +0000
commit59412d176cd4e7950cb48e48580a6de6fb8fec70 (patch)
tree2b41f3020605fe14c7ec709aa9b241dfcd8c7d0d /sca-java-2.x/trunk/modules/binding-jms/src/main
parenta9891d03be69d7daab14d273f3209c178fcb086e (diff)
TUSCANY-4011 - stop the SCDL callback binding configuration from being overwritten. The JMS binding strangely relied on this so required some surgery. I've also simplified CallbackServiceReference and added a CALLBACK message header and CallbackHandler object to make is simpler to pass the callback address down the message chain. The existing approach of creating a CallbackEndpoint model is still supported at the moment.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1242412 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/binding-jms/src/main')
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBinding.java56
1 files changed, 56 insertions, 0 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBinding.java b/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBinding.java
index d8e7b24a36..7d91df8e09 100644
--- a/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBinding.java
+++ b/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBinding.java
@@ -24,6 +24,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.StringTokenizer;
import java.util.TreeSet;
import javax.xml.namespace.QName;
@@ -35,6 +36,9 @@ import org.apache.tuscany.sca.assembly.Extension;
import org.apache.tuscany.sca.assembly.OperationSelector;
import org.apache.tuscany.sca.assembly.OperationsConfigurator;
import org.apache.tuscany.sca.assembly.WireFormat;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
import org.apache.tuscany.sca.policy.ExtensionType;
import org.apache.tuscany.sca.policy.Intent;
import org.apache.tuscany.sca.policy.PolicySet;
@@ -180,6 +184,11 @@ public class JMSBinding implements Binding, PolicySubject, OperationsConfigurato
public void setURI(String uri) {
this.uri = uri;
+ if (uri != null){
+ parseURI(uri);
+ } else {
+ setDestinationName(null);
+ }
}
public String getName() {
@@ -1108,5 +1117,52 @@ public class JMSBinding implements Binding, PolicySubject, OperationsConfigurato
public List<Extension> getAttributeExtensions() {
return attributeExtensions;
}
+
+ public void parseURI(String uri) {
+ JMSBinding jmsBinding = this;
+ if (uri == null ||
+ !(uri.startsWith("jms:jndi:") || uri.startsWith("jms:queue:") || uri.startsWith("jms:topic:"))) {
+ return;
+ }
+
+ int i = uri.indexOf('?');
+ if (i >= 0) {
+ StringTokenizer st = new StringTokenizer(uri.substring(i+1),"&");
+ while (st.hasMoreTokens()) {
+ String s = st.nextToken();
+ if (s.startsWith("jndiConnectionFactoryName=")) {
+ jmsBinding.setConnectionFactoryName(s.substring(26));
+ } else if (s.startsWith("deliveryMode=")) {
+ jmsBinding.setURIJMSDeliveryMode("persistent".equals(s.substring(13)));
+ } else if (s.startsWith("priority=")) {
+ jmsBinding.setURIJMSPriority(Integer.parseInt(s.substring(9)));
+ } else if (s.startsWith("timeToLive=")) {
+ jmsBinding.setURIJMSTimeToLive(Long.parseLong(s.substring(11)));
+ } else if (s.startsWith("selector='")) {
+ String selector = s.substring(10);
+ if (selector.startsWith("\"") || selector.startsWith("'")) {
+ selector = selector.substring(1, selector.length());
+ }
+ if (selector.endsWith("\"") || selector.endsWith("'")) {
+ selector = selector.substring(0, selector.length() - 1);
+ }
+ jmsBinding.setURIJMSSelector(selector);
+ } else if (s.startsWith("type")) {
+ String type = s.substring(5);
+ jmsBinding.setJMSURIType(type);
+ } else {
+ return;
+ }
+ }
+ int j=uri.indexOf(':', 4);
+ jmsBinding.setDestinationName(uri.substring(j+1, i));
+ jmsBinding.setDestinationType(uri.substring(4, j));
+ } else {
+ int j=uri.indexOf(':', 4);
+ jmsBinding.setDestinationName(uri.substring(j+1));
+ jmsBinding.setDestinationType(uri.substring(4, j));
+ }
+ jmsBinding.setJMSURI(uri);
+ }
}