diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-03-26 13:23:57 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-03-26 13:23:57 +0000 |
commit | aef1e52d6377f18516371655c32125c68bac0cce (patch) | |
tree | 598aeb93747d119998df3f87b22eacb0125efaa3 /branches/sca-java-1.x/modules/databinding/src | |
parent | de53364092d375a98144b29e85e09abc8842268e (diff) |
TUSCANY-2931 - allow separate request and response wire formats in binding.jms. The tuscany binding.jms XSD has been extended to allow a response wireFormat element to be specified. The knock on effect of all this is that the Operation interface has been changed to allow input and output wrapper info to be held separately. Also Interface has some new operations. There are changes across the code base to take account of this interface change.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@758625 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules/databinding/src')
2 files changed, 25 insertions, 17 deletions
diff --git a/branches/sca-java-1.x/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/util/DataTypeHelper.java b/branches/sca-java-1.x/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/util/DataTypeHelper.java index 1e39150f4a..ce3237a574 100644 --- a/branches/sca-java-1.x/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/util/DataTypeHelper.java +++ b/branches/sca-java-1.x/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/util/DataTypeHelper.java @@ -132,13 +132,16 @@ public class DataTypeHelper { } private static void getDataTypes(List<DataType> dataTypes, Operation op, boolean useWrapper) { - WrapperInfo wrapper = op.getWrapper(); - if (useWrapper && wrapper != null) { - DataType dt1 = wrapper.getInputWrapperType(); + + WrapperInfo inputWrapperInfo = op.getInputWrapper(); + WrapperInfo outputWrapperInfo = op.getOutputWrapper(); + + if (useWrapper && (inputWrapperInfo != null) && (outputWrapperInfo != null)) { + DataType dt1 = inputWrapperInfo.getWrapperType(); if (dt1 != null) { dataTypes.add(dt1); } - DataType dt2 = wrapper.getOutputWrapperType(); + DataType dt2 = outputWrapperInfo.getWrapperType(); if (dt2 != null) { dataTypes.add(dt2); } diff --git a/branches/sca-java-1.x/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMWrapperHandler.java b/branches/sca-java-1.x/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMWrapperHandler.java index 9e1ebb3522..19a8fe32d3 100644 --- a/branches/sca-java-1.x/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMWrapperHandler.java +++ b/branches/sca-java-1.x/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMWrapperHandler.java @@ -48,9 +48,10 @@ public class DOMWrapperHandler implements WrapperHandler<Node> { public Node create(Operation operation, boolean input) { try { - WrapperInfo wrapperInfo = operation.getWrapper(); - ElementInfo element = input ? wrapperInfo.getInputWrapperElement() : wrapperInfo.getOutputWrapperElement(); - // Class<?> wrapperClass = input ? wrapperInfo.getInputWrapperClass() : wrapperInfo.getOutputWrapperClass(); + WrapperInfo inputWrapperInfo = operation.getInputWrapper(); + WrapperInfo outputWrapperInfo = operation.getOutputWrapper(); + ElementInfo element = input ? inputWrapperInfo.getWrapperElement() : outputWrapperInfo.getWrapperElement(); + Document document = DOMHelper.newDocument(); QName name = element.getQName(); return DOMHelper.createElement(document, name); @@ -62,8 +63,8 @@ public class DOMWrapperHandler implements WrapperHandler<Node> { public void setChildren(Node wrapper, Object[] childObjects, Operation operation, boolean input) { - List<ElementInfo> childElements = input? operation.getWrapper().getInputChildElements(): - operation.getWrapper().getOutputChildElements(); + List<ElementInfo> childElements = input? operation.getInputWrapper().getChildElements(): + operation.getOutputWrapper().getChildElements(); for (int i = 0; i < childElements.size(); i++) { setChild(wrapper, i, childElements.get(i), childObjects[i]); } @@ -79,8 +80,8 @@ public class DOMWrapperHandler implements WrapperHandler<Node> { public List getChildren(Node wrapper, Operation operation, boolean input) { assert wrapper != null; - List<ElementInfo> childElements = input? operation.getWrapper().getInputChildElements(): - operation.getWrapper().getOutputChildElements(); + List<ElementInfo> childElements = input? operation.getInputWrapper().getChildElements(): + operation.getOutputWrapper().getChildElements(); if (wrapper.getNodeType() == Node.DOCUMENT_NODE) { wrapper = ((Document)wrapper).getDocumentElement(); } @@ -99,8 +100,9 @@ public class DOMWrapperHandler implements WrapperHandler<Node> { * @see org.apache.tuscany.sca.databinding.WrapperHandler#getWrapperType(Operation, boolean) */ public DataType getWrapperType(Operation operation, boolean input) { - WrapperInfo wrapper = operation.getWrapper(); - ElementInfo element = input? wrapper.getInputWrapperElement(): wrapper.getOutputWrapperElement(); + WrapperInfo inputWrapperInfo = operation.getInputWrapper(); + WrapperInfo outputWrapperInfo = operation.getOutputWrapper(); + ElementInfo element = input ? inputWrapperInfo.getWrapperElement() : outputWrapperInfo.getWrapperElement(); DataType<XMLType> wrapperType = new DataTypeImpl<XMLType>(DOMDataBinding.NAME, Node.class, new XMLType(element)); return wrapperType; @@ -109,10 +111,13 @@ public class DOMWrapperHandler implements WrapperHandler<Node> { public boolean isInstance(Object wrapperObj, Operation operation, boolean input) { - WrapperInfo wrapperInfo = operation.getWrapper(); - ElementInfo element = input ? wrapperInfo.getInputWrapperElement() : wrapperInfo.getOutputWrapperElement(); - List<ElementInfo> childElements = - input ? wrapperInfo.getInputChildElements() : wrapperInfo.getOutputChildElements(); + WrapperInfo inputWrapperInfo = operation.getInputWrapper(); + WrapperInfo outputWrapperInfo = operation.getOutputWrapper(); + ElementInfo element = input ? inputWrapperInfo.getWrapperElement() : outputWrapperInfo.getWrapperElement(); + + List<ElementInfo> childElements = input? inputWrapperInfo.getChildElements(): + outputWrapperInfo.getChildElements(); + Node wrapper = (Node)wrapperObj; if (wrapper.getNodeType() == Node.DOCUMENT_NODE) { wrapper = ((Document)wrapper).getDocumentElement(); |