summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-04-24 11:49:38 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-04-24 11:49:38 +0000
commitfea84bc2dd440ae3c7d36990ad24455166455415 (patch)
treee36db25175db43c8915dfc154771d32e24fbb8b3 /branches/sca-java-1.x/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java
parent89880933c273c7bdb71d78370054254ea3a8775b (diff)
TUSCANY-2930 main part of separating wireFormat.jmsdefault out from wireFormat.jmsTextXML. I've spotted a few more things that need fixing but this basic functionality passes all of our current JMS tests and now better matched what the specification says about default format.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@768263 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--branches/sca-java-1.x/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java20
1 files changed, 13 insertions, 7 deletions
diff --git a/branches/sca-java-1.x/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java b/branches/sca-java-1.x/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java
index 4642a51d45..860e4c6982 100644
--- a/branches/sca-java-1.x/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java
+++ b/branches/sca-java-1.x/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java
@@ -44,6 +44,7 @@ import org.apache.tuscany.sca.assembly.xml.ConfiguredOperationProcessor;
import org.apache.tuscany.sca.assembly.xml.Constants;
import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
import org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault.OperationSelectorJMSDefault;
+import org.apache.tuscany.sca.binding.jms.wireformat.jmsdefault.WireFormatJMSDefault;
import org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.WireFormatJMSObject;
import org.apache.tuscany.sca.binding.jms.wireformat.jmstext.WireFormatJMSText;
import org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.WireFormatJMSTextXML;
@@ -240,18 +241,22 @@ public class JMSBindingProcessor extends BaseStAXArtifactProcessor implements St
if ("XMLTextMessage".equalsIgnoreCase(messageProcessorName)) {
// may be overwritten be real wire format later
jmsBinding.setRequestWireFormat(new WireFormatJMSTextXML());
- jmsBinding.setResponseWireFormat(new WireFormatJMSTextXML());
+ jmsBinding.setResponseWireFormat(jmsBinding.getRequestWireFormat());
} else if ("TextMessage".equalsIgnoreCase(messageProcessorName)) {
// may be overwritten be real wire format later
jmsBinding.setRequestWireFormat(new WireFormatJMSText());
- jmsBinding.setResponseWireFormat(new WireFormatJMSText());
+ jmsBinding.setResponseWireFormat(jmsBinding.getRequestWireFormat());
} else if ("ObjectMessage".equalsIgnoreCase(messageProcessorName)) {
// may be overwritten be real wire format later
jmsBinding.setRequestWireFormat(new WireFormatJMSObject());
- jmsBinding.setResponseWireFormat(new WireFormatJMSObject());
+ jmsBinding.setResponseWireFormat(jmsBinding.getRequestWireFormat());
} else {
jmsBinding.setRequestMessageProcessorName(messageProcessorName);
jmsBinding.setResponseMessageProcessorName(messageProcessorName);
+ // exploit the text wire format code to drive the user selected
+ // message processor
+ jmsBinding.setRequestWireFormat(new WireFormatJMSText());
+ jmsBinding.setResponseWireFormat(jmsBinding.getRequestWireFormat());
}
}
@@ -309,8 +314,9 @@ public class JMSBindingProcessor extends BaseStAXArtifactProcessor implements St
case END_ELEMENT:
QName x = reader.getName();
if (Constants.OPERATION.equals(x.getLocalPart())) break;
- if (x.getLocalPart().equals("wireFormat.jmsBytes") || x.getLocalPart().equals("wireFormat.jmsText")
- || x.getLocalPart().equals("wireFormat.jmsObject") || x.getLocalPart().equals("wireFormat.jmsTextXML")) {
+ // This assumption is not captured in schema, which isn't good, but will probably be fine for now.
+ // A better solution might be to require each processor to advance to its own END_ELEMENT.
+ if (x.getLocalPart().startsWith("wireFormat.") || x.getLocalPart().startsWith("operationSelector.")) {
break;
}
if (x.equals(JMSBindingConstants.BINDING_JMS_QNAME)) {
@@ -329,10 +335,10 @@ public class JMSBindingProcessor extends BaseStAXArtifactProcessor implements St
// if no request wire format specified then assume the default
if (jmsBinding.getRequestWireFormat() == null){
- jmsBinding.setRequestWireFormat(new WireFormatJMSTextXML());
+ jmsBinding.setRequestWireFormat(new WireFormatJMSDefault());
}
- // if no response wire format specific then assume the default
+ // if no response wire format specific then assume the same as the request
if (jmsBinding.getResponseWireFormat() == null){
jmsBinding.setResponseWireFormat(jmsBinding.getRequestWireFormat());
}