summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/databinding-axiom/src
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-12-13 14:12:38 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-12-13 14:12:38 +0000
commit699653d2ae2df1cec6af2915c90a6a7137a1c077 (patch)
tree86e5639772629c69a4e9637e682ede48b518b70b /sca-java-2.x/trunk/modules/databinding-axiom/src
parent438fd75ec9cb93740700d9a37c6ea133e1c997ed (diff)
TUSCANY-3890 - separate the request wrapper model from the response wrapper model as per the change in 1.x under TUSCANY-2931.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1213702 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/databinding-axiom/src')
-rw-r--r--sca-java-2.x/trunk/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElementWrapperHandler.java33
-rw-r--r--sca-java-2.x/trunk/modules/databinding-axiom/src/test/java/org/apache/tuscany/sca/databinding/axiom/OMElementWrapperHandlerTestCase.java4
2 files changed, 26 insertions, 11 deletions
diff --git a/sca-java-2.x/trunk/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElementWrapperHandler.java b/sca-java-2.x/trunk/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElementWrapperHandler.java
index 09fc0a311b..c2c2d8a313 100644
--- a/sca-java-2.x/trunk/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElementWrapperHandler.java
+++ b/sca-java-2.x/trunk/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElementWrapperHandler.java
@@ -57,16 +57,22 @@ public class OMElementWrapperHandler implements WrapperHandler<OMElement> {
}
public OMElement create(Operation operation, boolean input) {
- WrapperInfo wrapperInfo = operation.getWrapper();
- ElementInfo element = input ? wrapperInfo.getInputWrapperElement() : wrapperInfo.getOutputWrapperElement();
+ WrapperInfo inputWrapperInfo = operation.getInputWrapper();
+ WrapperInfo outputWrapperInfo = operation.getOutputWrapper();
+
+ ElementInfo element = input ? inputWrapperInfo.getWrapperElement() : outputWrapperInfo.getWrapperElement();
// Class<?> wrapperClass = input ? wrapperInfo.getInputWrapperClass() : wrapperInfo.getOutputWrapperClass();
OMElement wrapper = AxiomHelper.createOMElement(factory, element.getQName());
return wrapper;
}
public void setChildren(OMElement wrapper, Object[] childObjects, Operation operation, boolean input) {
+ WrapperInfo inputWrapperInfo = operation.getInputWrapper();
+ WrapperInfo outputWrapperInfo = operation.getOutputWrapper();
+
List<ElementInfo> childElements =
- input ? operation.getWrapper().getInputChildElements() : operation.getWrapper().getOutputChildElements();
+ input ? inputWrapperInfo.getChildElements() : outputWrapperInfo.getChildElements();
+
for (int i = 0; i < childElements.size(); i++) {
setChild(wrapper, i, childElements.get(i), childObjects[i]);
}
@@ -108,8 +114,11 @@ public class OMElementWrapperHandler implements WrapperHandler<OMElement> {
}
public List getChildren(OMElement wrapper, Operation operation, boolean input) {
- List<ElementInfo> childElements = input? operation.getWrapper().getInputChildElements():
- operation.getWrapper().getOutputChildElements();
+ WrapperInfo inputWrapperInfo = operation.getInputWrapper();
+ WrapperInfo outputWrapperInfo = operation.getOutputWrapper();
+
+ List<ElementInfo> childElements = input? inputWrapperInfo.getChildElements():
+ outputWrapperInfo.getChildElements();
// Used in both the schema-valid and schema-invalid paths
List<List<OMElement>> groupedElements = getElements(wrapper);
@@ -264,16 +273,22 @@ public class OMElementWrapperHandler implements WrapperHandler<OMElement> {
* @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>(AxiomDataBinding.NAME, OMElement.class, new XMLType(element));
return wrapperType;
}
public boolean isInstance(Object wrapperObj, Operation operation, boolean input) {
- WrapperInfo wrapperInfo = operation.getWrapper();
- ElementInfo element = input ? wrapperInfo.getInputWrapperElement() : wrapperInfo.getOutputWrapperElement();
+ WrapperInfo inputWrapperInfo = operation.getInputWrapper();
+ WrapperInfo outputWrapperInfo = operation.getOutputWrapper();
+
+ ElementInfo element = input ? inputWrapperInfo.getWrapperElement() : outputWrapperInfo.getWrapperElement();
+
// List<ElementInfo> childElements =
// input ? wrapperInfo.getInputChildElements() : wrapperInfo.getOutputChildElements();
OMElement wrapper = (OMElement)wrapperObj;
diff --git a/sca-java-2.x/trunk/modules/databinding-axiom/src/test/java/org/apache/tuscany/sca/databinding/axiom/OMElementWrapperHandlerTestCase.java b/sca-java-2.x/trunk/modules/databinding-axiom/src/test/java/org/apache/tuscany/sca/databinding/axiom/OMElementWrapperHandlerTestCase.java
index 2270947c29..fe42603108 100644
--- a/sca-java-2.x/trunk/modules/databinding-axiom/src/test/java/org/apache/tuscany/sca/databinding/axiom/OMElementWrapperHandlerTestCase.java
+++ b/sca-java-2.x/trunk/modules/databinding-axiom/src/test/java/org/apache/tuscany/sca/databinding/axiom/OMElementWrapperHandlerTestCase.java
@@ -93,9 +93,9 @@ public class OMElementWrapperHandlerTestCase {
elements.get(1).setOmissible(true);
elements.get(1).setNillable(false);
- WrapperInfo wrapperInfo = new WrapperInfo(AxiomDataBinding.NAME, null, null, elements, null);
+ WrapperInfo wrapperInfo = new WrapperInfo(AxiomDataBinding.NAME, null, elements);
this.op = new OperationImpl();
- op.setWrapper(wrapperInfo);
+ op.setInputWrapper(wrapperInfo);
}
@Test