summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-08-12 13:13:13 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-08-12 13:13:13 +0000
commite7ce13186908ef2ec40932b2ea5b9c226174f877 (patch)
tree3fcbcfcf705fcc720aab12bd7e0a000e09e70c13 /sca-java-2.x/trunk/modules
parentd6c656f919cc307885a8de1c4becc945849d9f12 (diff)
More correctly handle the jms uri format of the binding. Still needs more work as there jms uri can be quite complicated and has a whole spec of its own that we should implement
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@984756 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules')
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBinding.java8
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessor.java21
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms/src/main/resources/binding-jms-validation-messages.properties2
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessorTestCase.java2
4 files changed, 24 insertions, 9 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 7480d8fe17..39ffbfb854 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
@@ -150,6 +150,7 @@ public class JMSBinding implements Binding, PolicySubject, OperationsConfigurato
private WireFormat responseWireFormat;
private OperationSelector operationSelector;
private ExtensionType extensionType;
+ private String jmsURI;
public JMSBinding() {
super();
@@ -971,4 +972,11 @@ public class JMSBinding implements Binding, PolicySubject, OperationsConfigurato
public void setExtensionType(ExtensionType intentAttachPointType) {
this.extensionType = intentAttachPointType;
}
+
+ public String getJMSURI() {
+ return jmsURI;
+ }
+ public void setJMSURI(String jmsURI) {
+ this.jmsURI = jmsURI;
+ }
}
diff --git a/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessor.java b/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessor.java
index 5369b81d3f..a90dd67e92 100644
--- a/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessor.java
+++ b/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessor.java
@@ -356,9 +356,9 @@ public class JMSBindingProcessor extends BaseStAXArtifactProcessor implements St
}
protected void parseURI(String uri, JMSBinding jmsBinding, Monitor monitor) {
- if (!uri.startsWith("jms:")) {
- error(monitor, "MustStartWithSchema", jmsBinding, uri);
- return;
+ if (!(uri.startsWith("jms:jndi:") || uri.startsWith("jms:queue:") || uri.startsWith("jms:topic:"))) {
+ error(monitor, "MustStartWithSchema", jmsBinding, uri);
+ return;
}
int i = uri.indexOf('?');
if (i >= 0) {
@@ -378,10 +378,15 @@ public class JMSBindingProcessor extends BaseStAXArtifactProcessor implements St
return;
}
}
- jmsBinding.setDestinationName(uri.substring(4, i));
+ int j=uri.indexOf(':', 4);
+ jmsBinding.setDestinationName(uri.substring(j+1, i));
+ jmsBinding.setDestinationType(uri.substring(4, j));
} else {
- jmsBinding.setDestinationName(uri.substring(4));
+ int j=uri.indexOf(':', 4);
+ jmsBinding.setDestinationName(uri.substring(j+1));
+ jmsBinding.setDestinationType(uri.substring(4, j));
}
+ jmsBinding.setJMSURI(uri);
}
public void resolve(JMSBinding model, ModelResolver resolver, ProcessorContext context) throws ContributionResolveException {
@@ -922,8 +927,10 @@ public class JMSBindingProcessor extends BaseStAXArtifactProcessor implements St
writer.writeAttribute("name", jmsBinding.getName());
}
- if (jmsBinding.getURI() != null) {
- writer.writeAttribute("uri", jmsBinding.getURI());
+ if (jmsBinding.getJMSURI() != null) {
+ writer.writeAttribute("uri", jmsBinding.getJMSURI());
+ writeEnd(writer);
+ return;
}
//String dest = jmsBinding.getDestinationName();
diff --git a/sca-java-2.x/trunk/modules/binding-jms/src/main/resources/binding-jms-validation-messages.properties b/sca-java-2.x/trunk/modules/binding-jms/src/main/resources/binding-jms-validation-messages.properties
index 33d6a9df5c..ca924c3c8f 100644
--- a/sca-java-2.x/trunk/modules/binding-jms/src/main/resources/binding-jms-validation-messages.properties
+++ b/sca-java-2.x/trunk/modules/binding-jms/src/main/resources/binding-jms-validation-messages.properties
@@ -33,7 +33,7 @@ InvalidDestinationType = Invalid destination type: {0}
MissingActivationSpecName = Missing ActivationSpec Name
MissingResponseActivationSpec = Missing response ActivationSpec name
UnknownTokenInURI = Unknown token {0} in uri: {1}
-MustStartWithSchema = URI must start with the scheme 'jms:' for uri: {0}
+MustStartWithSchema = URI must start with the scheme 'jms:jndi:' or 'jms:queue:' or 'jms:topic:' for uri: {0}
InvalidCorrelationScheme = Invalid correlationScheme: {0}
UnexpectedElement = Incomplete binding.jms definition found unexpected element: {0}
UnexpectedResponseElement = Incomplete binding.jms/response definition found unexpected element: {0}
diff --git a/sca-java-2.x/trunk/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessorTestCase.java b/sca-java-2.x/trunk/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessorTestCase.java
index 67a14068ae..e945da22e2 100644
--- a/sca-java-2.x/trunk/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessorTestCase.java
+++ b/sca-java-2.x/trunk/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessorTestCase.java
@@ -53,7 +53,7 @@ public class JMSBindingProcessorTestCase extends TestCase {
+ " <component name=\"HelloWorldComponent\">"
+ " <implementation.java class=\"services.HelloWorld\"/>"
+ " <service name=\"HelloWorldService\">"
- + " <binding.jms uri=\"jms:testQueue\" />"
+ + " <binding.jms uri=\"jms:jndi:testQueue\" />"
+ " </service>"
+ " </component>"
+ "</composite>";