summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-11-09 15:31:53 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-11-09 15:31:53 +0000
commitd888428d9fc7e9a9be609dd2d0b8576004af93ad (patch)
treef46b90b8f951a12a0f1bfb0e17aa540fb066b388 /sca-java-2.x/trunk/modules
parent348fc05ecdb5eaff4035ac8d41b8373ff41d0fa9 (diff)
Update the JMS binding so that the message format may be either AXIOM or DOM. The default is still DOM as that minimizes the required dependencies but you can now configure it to use AXIOM OMElements which are optimized in some runtime environments
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1199797 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-runtime/pom.xml7
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceInterceptor.java31
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultMessageProcessor.java105
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLBytesMessageProcessor.java23
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLTextMessageProcessor.java26
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/xml/AXIOMXMLHelper.java102
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/xml/DOMXMLHelper.java102
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/xml/XMLHelper.java37
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/xml/XMLHelperFactory.java48
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceInterceptor.java10
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceProvider.java3
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceProvider.java3
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceInterceptor.java16
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceProvider.java25
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceInterceptor.java9
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceProvider.java25
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceInterceptor.java10
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceProvider.java3
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceProvider.java3
19 files changed, 406 insertions, 182 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/pom.xml b/sca-java-2.x/trunk/modules/binding-jms-runtime/pom.xml
index bb1adae73c..0a9d2c104f 100644
--- a/sca-java-2.x/trunk/modules/binding-jms-runtime/pom.xml
+++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/pom.xml
@@ -46,6 +46,13 @@
</dependency>
<dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>1.2.10</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jms_1.1_spec</artifactId>
<version>1.1.1</version>
diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceInterceptor.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceInterceptor.java
index 57879952ce..352141682d 100644
--- a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceInterceptor.java
+++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceInterceptor.java
@@ -31,20 +31,18 @@ import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor;
import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil;
import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
+import org.apache.tuscany.sca.binding.jms.provider.xml.XMLHelper;
+import org.apache.tuscany.sca.binding.jms.provider.xml.XMLHelperFactory;
import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSBytesXML;
import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSDefault;
import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSTextXML;
-import org.apache.tuscany.sca.common.xml.dom.DOMHelper;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl;
import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
-import org.w3c.dom.Node;
-import org.xml.sax.SAXException;
/**
* Policy handler to handle PolicySet related to Logging with the QName
@@ -64,7 +62,7 @@ public class OperationSelectorJMSDefaultServiceInterceptor extends InterceptorAs
private JMSMessageProcessor responseMessageProcessor;
private RuntimeComponentService service;
private List<Operation> serviceOperations;
- private DOMHelper domHelper;
+ private XMLHelper xmlHelper;
public OperationSelectorJMSDefaultServiceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory, RuntimeEndpoint endpoint) {
super();
@@ -75,7 +73,7 @@ public class OperationSelectorJMSDefaultServiceInterceptor extends InterceptorAs
this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(registry, jmsBinding);
this.service = (RuntimeComponentService)endpoint.getService();
this.serviceOperations = service.getInterfaceContract().getInterface().getOperations();
- this.domHelper = DOMHelper.getInstance(registry);
+ this.xmlHelper = XMLHelperFactory.createXMLHelper(registry);
}
public Message invoke(Message msg) {
@@ -118,10 +116,9 @@ public class OperationSelectorJMSDefaultServiceInterceptor extends InterceptorAs
}
}
} else if (jmsBinding.getRequestWireFormat() instanceof WireFormatJMSDefault
- || jmsBinding.getRequestWireFormat() instanceof WireFormatJMSTextXML
- || jmsBinding.getRequestWireFormat() instanceof WireFormatJMSBytesXML) {
+ || jmsBinding.getRequestWireFormat() instanceof WireFormatJMSTextXML
+ || jmsBinding.getRequestWireFormat() instanceof WireFormatJMSBytesXML) {
- Node rootElement;
String operationFromPayload;
try {
@@ -129,10 +126,9 @@ public class OperationSelectorJMSDefaultServiceInterceptor extends InterceptorAs
String xmlPayload = ((TextMessage) jmsMsg).getText();
if (xmlPayload != null) {
- rootElement = domHelper.load(xmlPayload);
- Node firstChild = rootElement.getFirstChild();
- if (firstChild != null) {
- operationFromPayload = firstChild.getLocalName();
+ Object rootElement = xmlHelper.load(xmlPayload);
+ operationFromPayload = xmlHelper.getOperationName(rootElement);
+ if (operationFromPayload != null) {
for (Operation op : serviceOperations) {
if (op.getName().equals(operationFromPayload)) {
operation = op;
@@ -148,10 +144,9 @@ public class OperationSelectorJMSDefaultServiceInterceptor extends InterceptorAs
((BytesMessage) jmsMsg).reset();
if (bytes != null) {
- rootElement = domHelper.load(new String(bytes));
- Node firstChild = rootElement.getFirstChild();
- if (firstChild != null) {
- operationFromPayload = firstChild.getLocalName();
+ Object rootElement = xmlHelper.load(new String(bytes));
+ operationFromPayload = xmlHelper.getOperationName(rootElement);
+ if (operationFromPayload != null) {
for (Operation op : serviceOperations) {
if (op.getName().equals(operationFromPayload)) {
operation = op;
@@ -164,8 +159,6 @@ public class OperationSelectorJMSDefaultServiceInterceptor extends InterceptorAs
} catch (IOException e) {
//let's ignore this in case the client doesn't want to use a wrapped xml message
- } catch (SAXException e) {
- //let's ignore this in case the client doesn't want to use a wrapped xml message
} catch (JMSException e) {
throw new JMSBindingException(e);
}
diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultMessageProcessor.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultMessageProcessor.java
index c538dd01da..0288ecb5ba 100644
--- a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultMessageProcessor.java
+++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultMessageProcessor.java
@@ -26,18 +26,14 @@ import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Session;
import javax.jms.TextMessage;
-import javax.xml.namespace.QName;
import org.apache.tuscany.sca.binding.jms.JMSBinding;
import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-import org.apache.tuscany.sca.common.xml.dom.DOMHelper;
+import org.apache.tuscany.sca.binding.jms.provider.xml.XMLHelper;
+import org.apache.tuscany.sca.binding.jms.provider.xml.XMLHelperFactory;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.interfacedef.util.FaultException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.xml.sax.SAXException;
/**
* MessageProcessor for sending/receiving XML over javax.jms.TextMessage or javax.jms.BytesMessage
@@ -50,11 +46,11 @@ import org.xml.sax.SAXException;
public class DefaultMessageProcessor extends AbstractMessageProcessor {
private static final Logger logger = Logger.getLogger(DefaultMessageProcessor.class.getName());
- private DOMHelper domHelper;
+ private XMLHelper xmlHelper;
public DefaultMessageProcessor(JMSBinding jmsBinding, ExtensionPointRegistry registry) {
super(jmsBinding);
- this.domHelper = DOMHelper.getInstance(registry);
+ this.xmlHelper = XMLHelperFactory.createXMLHelper(registry);
}
// inherited methods that don't do anything useful
@@ -79,31 +75,20 @@ public class DefaultMessageProcessor extends AbstractMessageProcessor {
// handle text messages
- public Object extractPayloadFromJMSTextMessage(Message msg, Node wrapper) {
+ public Object extractPayloadFromJMSTextMessage(Message msg, Object wrapper) {
if (msg instanceof TextMessage) {
try {
String xml = ((TextMessage) msg).getText();
Object os;
if (xml != null && xml.length() > 0) {
- os = domHelper.load(xml);
+ os = xmlHelper.load(xml);
} else {
os = null;
}
if (wrapper != null){
- //don't modify the original wrapper since it will be reused
- //clone the wrapper
- Node node = ((Node)os);
- if (node == null) {
- node = domHelper.newDocument();
- }
- Element newWrapper = DOMHelper.createElement((Document)node, new QName(wrapper.getNamespaceURI(), wrapper.getLocalName()));
- if (os != null){
- Node child = node.getFirstChild();
- newWrapper.appendChild(child);
- }
- return newWrapper;
+ return xmlHelper.wrap(wrapper, os);
}
return os;
@@ -112,8 +97,6 @@ public class DefaultMessageProcessor extends AbstractMessageProcessor {
throw new JMSBindingException(e);
} catch (IOException e) {
throw new JMSBindingException(e);
- } catch (SAXException e) {
- throw new JMSBindingException(e);
}
} else {
// handle the non-text fault case
@@ -127,31 +110,28 @@ public class DefaultMessageProcessor extends AbstractMessageProcessor {
TextMessage message = session.createTextMessage();
- if (o instanceof Node) {
-
+ if ((o instanceof Object[])) {
if (unwrap){
- Node firstElement = ((Node)o).getFirstChild();
+ Object firstElement = xmlHelper.getFirstChild(((Object[])o)[0]);
if (firstElement == null ) {
- message.setText("");
+ message.setText(null);
} else {
- message.setText(domHelper.saveAsString(firstElement));
+ message.setText(xmlHelper.saveAsString(firstElement));
}
}else {
- message.setText(domHelper.saveAsString((Node)o));
+ message.setText(xmlHelper.saveAsString(((Object[])o)[0]));
}
- } else if ((o instanceof Object[]) && ((Object[]) o)[0] instanceof Node) {
+ } else if (o != null) {
if (unwrap){
- Node firstElement = ((Node)((Object[]) o)[0]).getFirstChild();
+ Object firstElement = xmlHelper.getFirstChild(o);
if (firstElement == null ) {
- message.setText(null);
+ message.setText("");
} else {
- message.setText(domHelper.saveAsString(firstElement));
+ message.setText(xmlHelper.saveAsString(firstElement));
}
}else {
- message.setText(domHelper.saveAsString((Node)((Object[])o)[0]));
+ message.setText(xmlHelper.saveAsString(o));
}
- } else if (o != null) {
- throw new IllegalStateException("expecting Node payload: " + o);
}
return message;
@@ -171,7 +151,7 @@ public class DefaultMessageProcessor extends AbstractMessageProcessor {
try {
TextMessage message = session.createTextMessage();
- message.setText(domHelper.saveAsString((Node)((FaultException)o).getFaultInfo()));
+ message.setText(xmlHelper.saveAsString(((FaultException)o).getFaultInfo()));
message.setBooleanProperty(JMSBindingConstants.FAULT_PROPERTY, true);
return message;
@@ -186,7 +166,7 @@ public class DefaultMessageProcessor extends AbstractMessageProcessor {
// handle bytes messages
- public Object extractPayloadFromJMSBytesMessage(Message msg, Node wrapper) {
+ public Object extractPayloadFromJMSBytesMessage(Message msg, Object wrapper) {
if (msg instanceof BytesMessage) {
try {
@@ -198,24 +178,13 @@ public class DefaultMessageProcessor extends AbstractMessageProcessor {
((BytesMessage)msg).reset();
if ((bytes != null) && (bytes.length > 0)) {
- os = domHelper.load(new String(bytes));
+ os = xmlHelper.load(new String(bytes));
} else {
os = null;
}
if (wrapper != null){
- //don't modify the original wrapper since it will be reused
- //clone the wrapper
- Node node = ((Node)os);
- if (node == null) {
- node = domHelper.newDocument();
- }
- Element newWrapper = DOMHelper.createElement((Document)node, new QName(wrapper.getNamespaceURI(), wrapper.getLocalName()));
- if (os != null){
- Node child = node.getFirstChild();
- newWrapper.appendChild(child);
- }
- return newWrapper;
+ return xmlHelper.wrap(wrapper, os);
}
return os;
@@ -224,8 +193,6 @@ public class DefaultMessageProcessor extends AbstractMessageProcessor {
throw new JMSBindingException(e);
} catch (IOException e) {
throw new JMSBindingException(e);
- } catch (SAXException e) {
- throw new JMSBindingException(e);
}
} else {
// trap the non-bytes fault case
@@ -238,35 +205,31 @@ public class DefaultMessageProcessor extends AbstractMessageProcessor {
try {
BytesMessage message = session.createBytesMessage();
-
- if (o instanceof Node) {
- if (unwrap) {
- Node firstElement = ((Node)o).getFirstChild();
+ if ((o instanceof Object[])) {
+ if (unwrap){
+ Object firstElement = xmlHelper.getFirstChild(((Object[])o)[0]);
if (firstElement == null ) {
//do nothing, the message will just be set with a byte[0]
} else {
- message.writeBytes(domHelper.saveAsString(firstElement).getBytes());
+ message.writeBytes(xmlHelper.saveAsString(firstElement).getBytes());
}
- } else {
- message.writeBytes(domHelper.saveAsString((Node)o).getBytes());
+ }else {
+ message.writeBytes(xmlHelper.saveAsString(((Object[]) o)[0]).getBytes());
}
-
- } else if ((o instanceof Object[]) && ((Object[]) o)[0] instanceof Node) {
- if (unwrap){
- Node firstElement = ((Node)((Object[]) o)[0]).getFirstChild();
+ } else if (o != null) {
+ if (unwrap) {
+ Object firstElement = xmlHelper.getFirstChild(o);
if (firstElement == null ) {
//do nothing, the message will just be set with a byte[0]
} else {
- message.writeBytes(domHelper.saveAsString(firstElement).getBytes());
+ message.writeBytes(xmlHelper.saveAsString(firstElement).getBytes());
}
- }else {
- message.writeBytes(domHelper.saveAsString((Node)((Object[]) o)[0]).getBytes());
+ } else {
+ message.writeBytes(xmlHelper.saveAsString(o).getBytes());
}
- } else if (o != null) {
- throw new IllegalStateException("expecting Node payload: " + o);
}
return message;
@@ -287,7 +250,7 @@ public class DefaultMessageProcessor extends AbstractMessageProcessor {
try {
BytesMessage message = session.createBytesMessage();
- String s = domHelper.saveAsString((Node)((FaultException)o).getFaultInfo());
+ String s = xmlHelper.saveAsString(((FaultException)o).getFaultInfo());
message.writeBytes(s.getBytes());
message.setBooleanProperty(JMSBindingConstants.FAULT_PROPERTY, true);
return message;
diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLBytesMessageProcessor.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLBytesMessageProcessor.java
index 69a69064d0..5ca47da2c5 100644
--- a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLBytesMessageProcessor.java
+++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLBytesMessageProcessor.java
@@ -29,11 +29,10 @@ import javax.jms.Session;
import org.apache.tuscany.sca.binding.jms.JMSBinding;
import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-import org.apache.tuscany.sca.common.xml.dom.DOMHelper;
+import org.apache.tuscany.sca.binding.jms.provider.xml.XMLHelper;
+import org.apache.tuscany.sca.binding.jms.provider.xml.XMLHelperFactory;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.interfacedef.util.FaultException;
-import org.w3c.dom.Node;
-import org.xml.sax.SAXException;
/**
* MessageProcessor for sending/receiving XML javax.jms.BytesMessage with the JMSBinding.
@@ -41,11 +40,11 @@ import org.xml.sax.SAXException;
public class XMLBytesMessageProcessor extends AbstractMessageProcessor {
private static final Logger logger = Logger.getLogger(XMLBytesMessageProcessor.class.getName());
- private DOMHelper domHelper;
+ private XMLHelper xmlHelper;
public XMLBytesMessageProcessor(JMSBinding jmsBinding, ExtensionPointRegistry registry) {
super(jmsBinding);
- this.domHelper = DOMHelper.getInstance(registry);
+ this.xmlHelper = XMLHelperFactory.createXMLHelper(registry);
}
@Override
@@ -63,7 +62,7 @@ public class XMLBytesMessageProcessor extends AbstractMessageProcessor {
Object os;
if (noOfBytes > 0) {
- os = domHelper.load(new String(bytes));
+ os = xmlHelper.load(new String(bytes));
} else {
os = null;
}
@@ -72,8 +71,6 @@ public class XMLBytesMessageProcessor extends AbstractMessageProcessor {
throw new JMSBindingException(e);
} catch (IOException e) {
throw new JMSBindingException(e);
- } catch (SAXException e) {
- throw new JMSBindingException(e);
}
}
@@ -95,12 +92,10 @@ public class XMLBytesMessageProcessor extends AbstractMessageProcessor {
try {
BytesMessage message = session.createBytesMessage();
- if (o instanceof Node) {
- message.writeBytes(domHelper.saveAsString((Node)o).getBytes());
- } else if ((o instanceof Object[]) && ((Object[])o)[0] instanceof Node) {
- message.writeBytes(domHelper.saveAsString((Node)((Object[])o)[0]).getBytes());
+ if ((o instanceof Object[])) {
+ message.writeBytes(xmlHelper.saveAsString(((Object[])o)[0]).getBytes());
} else if (o != null) {
- throw new IllegalStateException("expecting Node payload: " + o);
+ message.writeBytes(xmlHelper.saveAsString(o).getBytes());
}
return message;
@@ -121,7 +116,7 @@ public class XMLBytesMessageProcessor extends AbstractMessageProcessor {
try {
BytesMessage message = session.createBytesMessage();
- message.writeBytes(domHelper.saveAsString((Node)((FaultException)o).getFaultInfo()).getBytes());
+ message.writeBytes(xmlHelper.saveAsString(((FaultException)o).getFaultInfo()).getBytes());
message.setBooleanProperty(JMSBindingConstants.FAULT_PROPERTY, true);
return message;
diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLTextMessageProcessor.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLTextMessageProcessor.java
index 5031f55c6b..44588dfb7d 100644
--- a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLTextMessageProcessor.java
+++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLTextMessageProcessor.java
@@ -29,12 +29,10 @@ import javax.jms.TextMessage;
import org.apache.tuscany.sca.binding.jms.JMSBinding;
import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-import org.apache.tuscany.sca.common.xml.dom.DOMHelper;
+import org.apache.tuscany.sca.binding.jms.provider.xml.XMLHelper;
+import org.apache.tuscany.sca.binding.jms.provider.xml.XMLHelperFactory;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.interfacedef.util.FaultException;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.xml.sax.SAXException;
/**
* MessageProcessor for sending/receiving XML javax.jms.TextMessage with the JMSBinding.
@@ -44,11 +42,11 @@ import org.xml.sax.SAXException;
public class XMLTextMessageProcessor extends AbstractMessageProcessor {
private static final Logger logger = Logger.getLogger(XMLTextMessageProcessor.class.getName());
- private DOMHelper domHelper;
+ private XMLHelper xmlHelper;
public XMLTextMessageProcessor(JMSBinding jmsBinding, ExtensionPointRegistry registry) {
super(jmsBinding);
- this.domHelper = DOMHelper.getInstance(registry);
+ this.xmlHelper = XMLHelperFactory.createXMLHelper(registry);
}
@Override
@@ -58,7 +56,7 @@ public class XMLTextMessageProcessor extends AbstractMessageProcessor {
String xml = ((TextMessage)msg).getText();
Object os;
if (xml != null) {
- os = domHelper.load(xml);
+ os = xmlHelper.load(xml);
} else {
os = null;
}
@@ -68,8 +66,6 @@ public class XMLTextMessageProcessor extends AbstractMessageProcessor {
throw new JMSBindingException(e);
} catch (JMSException e) {
throw new JMSBindingException(e);
- } catch (SAXException e) {
- throw new JMSBindingException(e);
}
}
@@ -92,12 +88,10 @@ public class XMLTextMessageProcessor extends AbstractMessageProcessor {
TextMessage message = session.createTextMessage();
- if (o instanceof Element) {
- message.setText(domHelper.saveAsString((Node)o));
- } else if ((o instanceof Object[]) && ((Object[])o)[0] instanceof Node) {
- message.setText(domHelper.saveAsString((Node)((Object[])o)[0]));
- } else if (o != null) {
- throw new IllegalStateException("expecting Node payload: " + o);
+ if (o instanceof Object[]) {
+ message.setText(xmlHelper.saveAsString(((Object[])o)[0]));
+ } else {
+ message.setText(xmlHelper.saveAsString(o));
}
return message;
@@ -117,7 +111,7 @@ public class XMLTextMessageProcessor extends AbstractMessageProcessor {
try {
TextMessage message = session.createTextMessage();
- message.setText(domHelper.saveAsString((Node)((FaultException)o).getFaultInfo()));
+ message.setText(xmlHelper.saveAsString(((FaultException)o).getFaultInfo()));
message.setBooleanProperty(JMSBindingConstants.FAULT_PROPERTY, true);
return message;
diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/xml/AXIOMXMLHelper.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/xml/AXIOMXMLHelper.java
new file mode 100644
index 0000000000..bdf2deb5a5
--- /dev/null
+++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/xml/AXIOMXMLHelper.java
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.jms.provider.xml;
+
+import java.io.IOException;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.tuscany.sca.common.xml.stax.StAXHelper;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.interfacedef.util.FaultException;
+
+public class AXIOMXMLHelper implements XMLHelper<OMElement> {
+
+ private OMFactory factory;
+ private StAXHelper staxhelper;
+
+ public AXIOMXMLHelper(ExtensionPointRegistry epr) {
+ this.staxhelper = StAXHelper.getInstance(epr);
+ this.factory = OMAbstractFactory.getOMFactory();
+ }
+
+ @Override
+ public OMElement load(String xml) throws IOException {
+ StAXOMBuilder builder;
+ try {
+ builder = new StAXOMBuilder(staxhelper.createXMLStreamReader(xml));
+ } catch (XMLStreamException e) {
+ throw new IOException(e);
+ }
+ return builder.getDocumentElement();
+ }
+
+ @Override
+ public String saveAsString(OMElement t) {
+ // TODO: The JMS compliance tests require the XML prefix but AXIOM doesn't include that
+ return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + t.toString();
+ }
+
+ @Override
+ public String getOperationName(OMElement t) {
+ return t.getLocalName();
+ }
+
+ @Override
+ public Object wrap(OMElement template, OMElement os) {
+ OMElement newWrapper = template.cloneOMElement();
+ if (os != null) {
+ os.declareDefaultNamespace(newWrapper.getNamespace().getNamespaceURI());
+ newWrapper.addChild(os);
+ }
+ return newWrapper;
+ }
+
+ @Override
+ public OMElement createWrapper(QName qname) {
+ // The OMElement2JAXB transformer wants the opName to be capitalized
+ String opName = Character.toUpperCase(qname.getLocalPart().charAt(0)) + qname.getLocalPart().substring(1);
+ OMElement om = factory.createOMElement(qname);
+ OMNamespace defaultNS = om.declareDefaultNamespace(qname.getNamespaceURI());
+ return factory.createOMElement(opName, defaultNS);
+ }
+
+ @Override
+ public String getDataBindingName() {
+ return OMElement.class.getName();
+ }
+
+ @Override
+ public OMElement getFirstChild(OMElement o) {
+ return o.getFirstElement();
+ }
+
+ @Override
+ public void setFaultName(FaultException e, Object o) {
+ OMElement om = (OMElement)o;
+ e.setFaultName(new QName(om.getNamespace().getNamespaceURI(), om.getLocalName()));
+ }
+}
diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/xml/DOMXMLHelper.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/xml/DOMXMLHelper.java
new file mode 100644
index 0000000000..f0bed9833c
--- /dev/null
+++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/xml/DOMXMLHelper.java
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.jms.provider.xml;
+
+import java.io.IOException;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.common.xml.dom.DOMHelper;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.interfacedef.util.FaultException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
+
+public class DOMXMLHelper implements XMLHelper<Node> {
+
+ private DOMHelper domHelper;
+
+ public DOMXMLHelper(ExtensionPointRegistry epr) {
+ this.domHelper = DOMHelper.getInstance(epr);
+ }
+
+ @Override
+ public Document load(String xml) throws IOException {
+ try {
+ return domHelper.load(xml);
+ } catch (SAXException e) {
+ throw new IOException(e);
+ }
+ }
+
+ @Override
+ public String saveAsString(Node t) {
+ return domHelper.saveAsString(t);
+ }
+
+ @Override
+ public String getOperationName(Node t) {
+ Node firstChild = t.getFirstChild();
+ if (firstChild != null) {
+ return firstChild.getLocalName();
+ }
+ return null;
+ }
+
+ @Override
+ public Object wrap(Node wrapper, Node os) {
+ //don't modify the original wrapper since it will be reused
+ //clone the wrapper
+ Node node = ((Node)os);
+ if (node == null) {
+ node = domHelper.newDocument();
+ }
+ Element newWrapper = DOMHelper.createElement((Document)node, new QName(wrapper.getNamespaceURI(), wrapper.getLocalName()));
+ if (os != null){
+ Node child = node.getFirstChild();
+ newWrapper.appendChild(child);
+ }
+ return newWrapper;
+ }
+
+ @Override
+ public Node createWrapper(QName qname) {
+ Document document = domHelper.newDocument();
+ Element wrapper = DOMHelper.createElement(document, qname);
+ return wrapper;
+ }
+
+ @Override
+ public String getDataBindingName() {
+ return Node.class.getName();
+ }
+
+ @Override
+ public Node getFirstChild(Node o) {
+ return o.getFirstChild();
+ }
+ @Override
+ public void setFaultName(FaultException e, Object response) {
+ Node n = ((Node)response).getFirstChild();
+ e.setFaultName(new QName(n.getNamespaceURI(), n.getLocalName()));
+ }
+}
diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/xml/XMLHelper.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/xml/XMLHelper.java
new file mode 100644
index 0000000000..3fbe561c60
--- /dev/null
+++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/xml/XMLHelper.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.jms.provider.xml;
+
+import java.io.IOException;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.interfacedef.util.FaultException;
+
+public interface XMLHelper<T> {
+ T load(String xml) throws IOException;
+ String saveAsString(T t);
+ String getOperationName(T t);
+ Object wrap(T template, T t);
+ T createWrapper(QName qname);
+ String getDataBindingName();
+ T getFirstChild(T object);
+ void setFaultName(FaultException e, Object response);
+}
diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/xml/XMLHelperFactory.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/xml/XMLHelperFactory.java
new file mode 100644
index 0000000000..3533e9182a
--- /dev/null
+++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/xml/XMLHelperFactory.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.jms.provider.xml;
+
+import java.util.Properties;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.runtime.RuntimeProperties;
+
+public class XMLHelperFactory {
+
+ public static XMLHelper<?> createXMLHelper(ExtensionPointRegistry epr) {
+
+ XMLHelper<?> xmlHelper = epr.getExtensionPoint(UtilityExtensionPoint.class).getUtility(XMLHelper.class);
+ if (xmlHelper != null) {
+ return xmlHelper;
+ }
+ if (useAXIOM(epr)) {
+ return new AXIOMXMLHelper(epr);
+ } else {
+ return new DOMXMLHelper(epr);
+ }
+ }
+
+ private static boolean useAXIOM(ExtensionPointRegistry epr) {
+ Properties runtimeProps = epr.getExtensionPoint(UtilityExtensionPoint.class).getUtility(RuntimeProperties.class).getProperties();
+ return Boolean.parseBoolean(runtimeProps.getProperty(RuntimeProperties.USE_AXIOM));
+ }
+
+}
diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceInterceptor.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceInterceptor.java
index 6a32344f94..53b5ac11df 100644
--- a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceInterceptor.java
+++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceInterceptor.java
@@ -20,7 +20,6 @@ package org.apache.tuscany.sca.binding.jms.wireformat.jmsbytesxml.runtime;
import javax.jms.JMSException;
import javax.jms.Session;
-import javax.xml.namespace.QName;
import org.apache.tuscany.sca.binding.jms.JMSBinding;
import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
@@ -29,15 +28,15 @@ import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor;
import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil;
import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
+import org.apache.tuscany.sca.binding.jms.provider.xml.XMLHelper;
+import org.apache.tuscany.sca.binding.jms.provider.xml.XMLHelperFactory;
import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSBytesXML;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl;
import org.apache.tuscany.sca.interfacedef.util.FaultException;
-import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
-import org.w3c.dom.Node;
public class WireFormatJMSBytesXMLReferenceInterceptor extends InterceptorAsyncImpl {
@@ -48,6 +47,7 @@ public class WireFormatJMSBytesXMLReferenceInterceptor extends InterceptorAsyncI
private JMSBinding jmsBinding;
private JMSMessageProcessor requestMessageProcessor;
private JMSMessageProcessor responseMessageProcessor;
+ private XMLHelper<?> xmlhelper;
public WireFormatJMSBytesXMLReferenceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory, RuntimeEndpointReference endpointReference) {
super();
@@ -56,6 +56,7 @@ public class WireFormatJMSBytesXMLReferenceInterceptor extends InterceptorAsyncI
this.jmsResourceFactory = jmsResourceFactory;
this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(registry, jmsBinding);
this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(registry, jmsBinding);
+ this.xmlhelper = XMLHelperFactory.createXMLHelper(registry);
}
public Message invoke(Message msg) {
@@ -99,8 +100,7 @@ public class WireFormatJMSBytesXMLReferenceInterceptor extends InterceptorAsyncI
try {
if (jmsMsg.getBooleanProperty(JMSBindingConstants.FAULT_PROPERTY)) {
FaultException e = new FaultException("remote exception", response);
- Node om = ((Node)response).getFirstChild();
- e.setFaultName(new QName(om.getNamespaceURI(), om.getLocalName()));
+ xmlhelper.setFaultName(e, response);
msg.setFaultBody(e);
}
} catch (JMSException e) {
diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceProvider.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceProvider.java
index e0f928de12..abaa21f572 100644
--- a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceProvider.java
+++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceProvider.java
@@ -21,6 +21,7 @@ package org.apache.tuscany.sca.binding.jms.wireformat.jmsbytesxml.runtime;
import org.apache.tuscany.sca.binding.jms.JMSBinding;
import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
+import org.apache.tuscany.sca.binding.jms.provider.xml.XMLHelperFactory;
import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSBytesXML;
import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
@@ -67,7 +68,7 @@ public class WireFormatJMSBytesXMLReferenceProvider implements WireFormatProvide
WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
BindingWSDLGenerator.generateWSDL(endpointReference.getComponent(), endpointReference.getContract(), wsBinding, registry, null);
interfaceContract = wsBinding.getBindingInterfaceContract();
- interfaceContract.getInterface().resetDataBinding(DOMDataBinding.NAME);
+ interfaceContract.getInterface().resetDataBinding(XMLHelperFactory.createXMLHelper(registry).getDataBindingName());
}
public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract){
diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceProvider.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceProvider.java
index d2ff153227..b2b424378f 100644
--- a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceProvider.java
+++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceProvider.java
@@ -22,6 +22,7 @@ package org.apache.tuscany.sca.binding.jms.wireformat.jmsbytesxml.runtime;
import org.apache.tuscany.sca.binding.jms.JMSBinding;
import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
+import org.apache.tuscany.sca.binding.jms.provider.xml.XMLHelperFactory;
import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSBytesXML;
import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
@@ -71,7 +72,7 @@ public class WireFormatJMSBytesXMLServiceProvider implements WireFormatProvider
WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
BindingWSDLGenerator.generateWSDL(endpoint.getComponent(), endpoint.getService(), wsBinding, registry, null);
interfaceContract = wsBinding.getBindingInterfaceContract();
- interfaceContract.getInterface().resetDataBinding(DOMDataBinding.NAME);
+ interfaceContract.getInterface().resetDataBinding(XMLHelperFactory.createXMLHelper(registry).getDataBindingName());
}
public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract){
diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceInterceptor.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceInterceptor.java
index 33e73a69ef..ba1002fab2 100644
--- a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceInterceptor.java
+++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceInterceptor.java
@@ -23,7 +23,6 @@ import java.util.HashMap;
import javax.jms.BytesMessage;
import javax.jms.JMSException;
import javax.jms.Session;
-import javax.xml.namespace.QName;
import org.apache.tuscany.sca.binding.jms.JMSBinding;
import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
@@ -31,17 +30,17 @@ import org.apache.tuscany.sca.binding.jms.JMSBindingException;
import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
import org.apache.tuscany.sca.binding.jms.provider.DefaultMessageProcessor;
import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
+import org.apache.tuscany.sca.binding.jms.provider.xml.XMLHelper;
+import org.apache.tuscany.sca.binding.jms.provider.xml.XMLHelperFactory;
import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSDefault;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl;
import org.apache.tuscany.sca.interfacedef.DataType;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.interfacedef.util.FaultException;
-import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
-import org.w3c.dom.Node;
/**
*
@@ -56,10 +55,11 @@ public class WireFormatJMSDefaultReferenceInterceptor extends InterceptorAsyncIm
private DefaultMessageProcessor requestMessageProcessor;
private DefaultMessageProcessor responseMessageProcessor;
private HashMap<String, Boolean> inputWrapperMap;
- private HashMap<String, Node> outputWrapperMap;
+ private HashMap<String, Object> outputWrapperMap;
+ private XMLHelper xmlhelper;
public WireFormatJMSDefaultReferenceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory, RuntimeEndpointReference endpointReference, HashMap<String, Boolean> inputWrapperMap,
- HashMap<String, Node> outputWrapperMap) {
+ HashMap<String, Object> outputWrapperMap) {
super();
this.jmsBinding = (JMSBinding) endpointReference.getBinding();
this.endpointReference = endpointReference;
@@ -70,6 +70,7 @@ public class WireFormatJMSDefaultReferenceInterceptor extends InterceptorAsyncIm
this.responseMessageProcessor = new DefaultMessageProcessor(jmsBinding, registry);
this.inputWrapperMap = inputWrapperMap;
this.outputWrapperMap = outputWrapperMap;
+ this.xmlhelper = XMLHelperFactory.createXMLHelper(registry);
}
public Message invoke(Message msg) {
@@ -127,7 +128,7 @@ public class WireFormatJMSDefaultReferenceInterceptor extends InterceptorAsyncIm
msg.setBody(jmsMsg);
} else {
- Node wrapper = null;
+ Object wrapper = null;
// if we have a fault no need to wrap the response
try {
if (!jmsMsg.getBooleanProperty(JMSBindingConstants.FAULT_PROPERTY)) {
@@ -150,8 +151,7 @@ public class WireFormatJMSDefaultReferenceInterceptor extends InterceptorAsyncIm
try {
if (jmsMsg.getBooleanProperty(JMSBindingConstants.FAULT_PROPERTY)) {
FaultException e = new FaultException("remote exception", response);
- Node om = ((Node)response).getFirstChild();
- e.setFaultName(new QName(om.getNamespaceURI(), om.getLocalName()));
+ xmlhelper.setFaultName(e, response);
msg.setFaultBody(e);
}
} catch (JMSException e) {
diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceProvider.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceProvider.java
index 127680c283..67ee7309e2 100644
--- a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceProvider.java
+++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceProvider.java
@@ -22,18 +22,16 @@ package org.apache.tuscany.sca.binding.jms.wireformat.jmsdefault.runtime;
import java.util.HashMap;
import java.util.List;
-import javax.xml.namespace.QName;
-
import org.apache.tuscany.sca.assembly.ComponentReference;
import org.apache.tuscany.sca.binding.jms.JMSBinding;
import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
+import org.apache.tuscany.sca.binding.jms.provider.xml.XMLHelper;
+import org.apache.tuscany.sca.binding.jms.provider.xml.XMLHelperFactory;
import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSDefault;
import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
import org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator;
-import org.apache.tuscany.sca.common.xml.dom.DOMHelper;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.databinding.xml.DOMDataBinding;
import org.apache.tuscany.sca.interfacedef.DataType;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.interfacedef.Operation;
@@ -42,9 +40,6 @@ import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Phase;
import org.apache.tuscany.sca.provider.WireFormatProvider;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
/**
* @version $Rev$ $Date$
@@ -55,9 +50,9 @@ public class WireFormatJMSDefaultReferenceProvider implements WireFormatProvider
private ComponentReference reference;
private JMSBinding binding;
private InterfaceContract interfaceContract;
- private DOMHelper domHelper;
+ private XMLHelper xmlHelper;
private HashMap<String, Boolean> inputWrapperMap;
- private HashMap<String, Node> outputWrapperMap;
+ private HashMap<String, Object> outputWrapperMap;
public WireFormatJMSDefaultReferenceProvider(ExtensionPointRegistry registry, RuntimeEndpointReference endpointReference) {
super();
@@ -65,9 +60,9 @@ public class WireFormatJMSDefaultReferenceProvider implements WireFormatProvider
this.endpointReference = endpointReference;
this.binding = (JMSBinding) endpointReference.getBinding();
- this.domHelper = DOMHelper.getInstance(registry);
+ this.xmlHelper = XMLHelperFactory.createXMLHelper(registry);
this.inputWrapperMap = new HashMap<String, Boolean>();
- this.outputWrapperMap = new HashMap<String, Node>();
+ this.outputWrapperMap = new HashMap<String, Object>();
// configure the reference based on this wire format
@@ -101,7 +96,7 @@ public class WireFormatJMSDefaultReferenceProvider implements WireFormatProvider
WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
BindingWSDLGenerator.generateWSDL(endpointReference.getComponent(), reference, wsBinding, registry, null);
interfaceContract = wsBinding.getBindingInterfaceContract();
- interfaceContract.getInterface().resetDataBinding(DOMDataBinding.NAME);
+ interfaceContract.getInterface().resetDataBinding(XMLHelperFactory.createXMLHelper(registry).getDataBindingName());
List<Operation> wsdlOpList = interfaceContract.getInterface().getOperations();
@@ -140,11 +135,7 @@ public class WireFormatJMSDefaultReferenceProvider implements WireFormatProvider
// we only need to know what the wrapper is on the deserialization
// might need to change this when there input/output wrapper style is different
ElementInfo ei = op.getWrapper().getOutputWrapperElement();
- String namespace = ei.getQName().getNamespaceURI();
- String opName = ei.getQName().getLocalPart();
- Document document = domHelper.newDocument();
- Element wrapper = DOMHelper.createElement(document, new QName(namespace, opName));
- this.outputWrapperMap.put(name, wrapper);
+ this.outputWrapperMap.put(name, xmlHelper.createWrapper(ei.getQName()));
}
}
} else {
diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceInterceptor.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceInterceptor.java
index b66dd0154f..3427155bf0 100644
--- a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceInterceptor.java
+++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceInterceptor.java
@@ -36,11 +36,8 @@ import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl;
import org.apache.tuscany.sca.interfacedef.DataType;
import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
-import org.w3c.dom.Node;
/**
* Policy handler to handle PolicySet related to Logging with the QName {http://tuscany.apache.org/xmlns/sca/1.1/impl/java}LoggingPolicy
@@ -53,10 +50,10 @@ public class WireFormatJMSDefaultServiceInterceptor extends InterceptorAsyncImpl
private JMSBinding jmsBinding;
private DefaultMessageProcessor requestMessageProcessor;
private DefaultMessageProcessor responseMessageProcessor;
- private HashMap<String, Node> inputWrapperMap;
+ private HashMap<String, Object> inputWrapperMap;
private HashMap<String, Boolean> outputWrapperMap;
- public WireFormatJMSDefaultServiceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory, RuntimeEndpoint endpoint, HashMap<String, Node> inputWrapperMap,
+ public WireFormatJMSDefaultServiceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory, RuntimeEndpoint endpoint, HashMap<String, Object> inputWrapperMap,
HashMap<String, Boolean> outputWrapperMap) {
super();
this.jmsBinding = (JMSBinding) endpoint.getBinding();
@@ -115,7 +112,7 @@ public class WireFormatJMSDefaultServiceInterceptor extends InterceptorAsyncImpl
} else {
// If there is only one arg we must add a wrapper if the operation is wrapper style
- Node wrapper = this.inputWrapperMap.get(msg.getOperation().getName());
+ Object wrapper = this.inputWrapperMap.get(msg.getOperation().getName());
Object requestPayload;
if (jmsMsg instanceof BytesMessage) {
diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceProvider.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceProvider.java
index 3541666007..e24be41ebf 100644
--- a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceProvider.java
+++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceProvider.java
@@ -22,19 +22,17 @@ package org.apache.tuscany.sca.binding.jms.wireformat.jmsdefault.runtime;
import java.util.HashMap;
import java.util.List;
-import javax.xml.namespace.QName;
-
import org.apache.tuscany.sca.assembly.ComponentService;
import org.apache.tuscany.sca.binding.jms.JMSBinding;
import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
+import org.apache.tuscany.sca.binding.jms.provider.xml.XMLHelper;
+import org.apache.tuscany.sca.binding.jms.provider.xml.XMLHelperFactory;
import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSDefault;
import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
import org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator;
-import org.apache.tuscany.sca.common.xml.dom.DOMHelper;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.databinding.xml.DOMDataBinding;
import org.apache.tuscany.sca.interfacedef.DataType;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.interfacedef.Operation;
@@ -43,9 +41,6 @@ import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Phase;
import org.apache.tuscany.sca.provider.WireFormatProvider;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
/**
* @version $Rev$ $Date$
@@ -57,8 +52,8 @@ public class WireFormatJMSDefaultServiceProvider implements WireFormatProvider {
private JMSBinding binding;
private JMSResourceFactory jmsResourceFactory;
private InterfaceContract interfaceContract;
- private DOMHelper domHelper;
- private HashMap<String, Node> inputWrapperMap;
+ private XMLHelper<?> xmlHelper;
+ private HashMap<String, Object> inputWrapperMap;
private HashMap<String, Boolean> outputWrapperMap;
public WireFormatJMSDefaultServiceProvider(ExtensionPointRegistry registry, RuntimeEndpoint endpoint, JMSResourceFactory jmsResourceFactory) {
@@ -69,8 +64,8 @@ public class WireFormatJMSDefaultServiceProvider implements WireFormatProvider {
this.service = endpoint.getService();
this.jmsResourceFactory = jmsResourceFactory;
- this.domHelper = DOMHelper.getInstance(registry);
- this.inputWrapperMap = new HashMap<String, Node>();
+ this.xmlHelper = XMLHelperFactory.createXMLHelper(registry);
+ this.inputWrapperMap = new HashMap<String, Object>();
this.outputWrapperMap = new HashMap<String, Boolean>();
// configure the service based on this wire format
@@ -98,7 +93,7 @@ public class WireFormatJMSDefaultServiceProvider implements WireFormatProvider {
WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
BindingWSDLGenerator.generateWSDL(endpoint.getComponent(), service, wsBinding, registry, null);
interfaceContract = wsBinding.getBindingInterfaceContract();
- interfaceContract.getInterface().resetDataBinding(DOMDataBinding.NAME);
+ interfaceContract.getInterface().resetDataBinding(XMLHelperFactory.createXMLHelper(registry).getDataBindingName());
List<Operation> wsdlOpList = interfaceContract.getInterface().getOperations();
@@ -125,11 +120,7 @@ public class WireFormatJMSDefaultServiceProvider implements WireFormatProvider {
// we only need to know what the wrapper is on the deserialization
// might need to change this when the input/output wrapper style is different
ElementInfo ei = op.getWrapper().getInputWrapperElement();
- String namespace = ei.getQName().getNamespaceURI();
- String opName = ei.getQName().getLocalPart();
- Document document = domHelper.newDocument();
- Element wrapper = DOMHelper.createElement(document, new QName(namespace, opName));
- this.inputWrapperMap.put(name, wrapper);
+ this.inputWrapperMap.put(name, xmlHelper.createWrapper(ei.getQName()));
}
}
diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceInterceptor.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceInterceptor.java
index 25e476f837..8201e94133 100644
--- a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceInterceptor.java
+++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceInterceptor.java
@@ -23,7 +23,6 @@ package org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.runtime;
import javax.jms.JMSException;
import javax.jms.Session;
-import javax.xml.namespace.QName;
import org.apache.tuscany.sca.binding.jms.JMSBinding;
import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
@@ -32,15 +31,15 @@ import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor;
import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil;
import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
+import org.apache.tuscany.sca.binding.jms.provider.xml.XMLHelper;
+import org.apache.tuscany.sca.binding.jms.provider.xml.XMLHelperFactory;
import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSTextXML;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl;
import org.apache.tuscany.sca.interfacedef.util.FaultException;
-import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
-import org.w3c.dom.Node;
/**
*
@@ -54,6 +53,7 @@ public class WireFormatJMSTextXMLReferenceInterceptor extends InterceptorAsyncIm
private JMSBinding jmsBinding;
private JMSMessageProcessor requestMessageProcessor;
private JMSMessageProcessor responseMessageProcessor;
+ private XMLHelper<?> xmlhelper;
public WireFormatJMSTextXMLReferenceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory, RuntimeEndpointReference endpointReference) {
@@ -63,6 +63,7 @@ public class WireFormatJMSTextXMLReferenceInterceptor extends InterceptorAsyncIm
this.jmsResourceFactory = jmsResourceFactory;
this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(registry, jmsBinding);
this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(registry, jmsBinding);
+ this.xmlhelper = XMLHelperFactory.createXMLHelper(registry);
}
public Message invoke(Message msg) {
@@ -105,8 +106,7 @@ public class WireFormatJMSTextXMLReferenceInterceptor extends InterceptorAsyncIm
try {
if (jmsMsg.getBooleanProperty(JMSBindingConstants.FAULT_PROPERTY)) {
FaultException e = new FaultException("remote exception", response);
- Node node = ((Node)response).getFirstChild();
- e.setFaultName(new QName(node.getNamespaceURI(), node.getLocalName()));
+ xmlhelper.setFaultName(e, response);
msg.setFaultBody(e);
}
} catch (JMSException e) {
diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceProvider.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceProvider.java
index 957994a146..a2830d1fc3 100644
--- a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceProvider.java
+++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceProvider.java
@@ -21,6 +21,7 @@ package org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.runtime;
import org.apache.tuscany.sca.binding.jms.JMSBinding;
import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
+import org.apache.tuscany.sca.binding.jms.provider.xml.XMLHelperFactory;
import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSTextXML;
import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
@@ -71,7 +72,7 @@ public class WireFormatJMSTextXMLReferenceProvider implements WireFormatProvider
WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
BindingWSDLGenerator.generateWSDL(endpointReference.getComponent(), endpointReference.getReference(), wsBinding, registry, null);
interfaceContract = wsBinding.getBindingInterfaceContract();
- interfaceContract.getInterface().resetDataBinding(DOMDataBinding.NAME);
+ interfaceContract.getInterface().resetDataBinding(XMLHelperFactory.createXMLHelper(registry).getDataBindingName());
}
protected boolean isOnMessage() {
diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceProvider.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceProvider.java
index c56a9e0e50..fef9e78937 100644
--- a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceProvider.java
+++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceProvider.java
@@ -22,6 +22,7 @@ package org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.runtime;
import org.apache.tuscany.sca.binding.jms.JMSBinding;
import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
+import org.apache.tuscany.sca.binding.jms.provider.xml.XMLHelperFactory;
import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSTextXML;
import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
@@ -74,7 +75,7 @@ public class WireFormatJMSTextXMLServiceProvider implements WireFormatProvider {
WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
BindingWSDLGenerator.generateWSDL(endpoint.getComponent(), endpoint.getService(), wsBinding, registry, null);
interfaceContract = wsBinding.getBindingInterfaceContract();
- interfaceContract.getInterface().resetDataBinding(DOMDataBinding.NAME);
+ interfaceContract.getInterface().resetDataBinding(XMLHelperFactory.createXMLHelper(registry).getDataBindingName());
}
public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract){