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-jaxb/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-jaxb/src')
3 files changed, 25 insertions, 19 deletions
diff --git a/branches/sca-java-1.x/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java b/branches/sca-java-1.x/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java index ac544862e0..2e8a4fc385 100644 --- a/branches/sca-java-1.x/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java +++ b/branches/sca-java-1.x/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java @@ -302,13 +302,17 @@ public class JAXBContextHelper { } 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)) { + DataType dt1 = inputWrapperInfo.getWrapperType(); if (dt1 != null) { dataTypes.add(dt1); } - DataType dt2 = wrapper.getOutputWrapperType(); + } + if (useWrapper && (outputWrapperInfo != null)) { + DataType dt2 = outputWrapperInfo.getWrapperType(); if (dt2 != null) { dataTypes.add(dt2); } diff --git a/branches/sca-java-1.x/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperHandler.java b/branches/sca-java-1.x/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperHandler.java index a1f4c12c8f..9cb781a3e1 100644 --- a/branches/sca-java-1.x/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperHandler.java +++ b/branches/sca-java-1.x/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperHandler.java @@ -46,9 +46,10 @@ public class JAXBWrapperHandler implements WrapperHandler<Object> { private JAXBWrapperHelper helper = new JAXBWrapperHelper(); public Object create(Operation operation, boolean input) { - WrapperInfo wrapperInfo = operation.getWrapper(); - ElementInfo element = input ? wrapperInfo.getInputWrapperElement() : wrapperInfo.getOutputWrapperElement(); - final Class<?> wrapperClass = input ? wrapperInfo.getInputWrapperClass() : wrapperInfo.getOutputWrapperClass(); + WrapperInfo inputWrapperInfo = operation.getInputWrapper(); + WrapperInfo outputWrapperInfo = operation.getOutputWrapper(); + ElementInfo element = input ? inputWrapperInfo.getWrapperElement() : outputWrapperInfo.getWrapperElement(); + final Class<?> wrapperClass = input ? inputWrapperInfo.getWrapperClass() : outputWrapperInfo.getWrapperClass(); try { if (wrapperClass == null) { return null; @@ -65,7 +66,7 @@ public class JAXBWrapperHandler implements WrapperHandler<Object> { public void setChildren(Object wrapper, Object[] childObjects, Operation operation, boolean input) { List<ElementInfo> childElements = - input ? operation.getWrapper().getInputChildElements() : operation.getWrapper().getOutputChildElements(); + input ? operation.getInputWrapper().getChildElements() : operation.getOutputWrapper().getChildElements(); List<String> childNames = new ArrayList<String>(); Map<String, Object> values = new HashMap<String, Object>(); for (int i = 0; i < childElements.size(); i++) { @@ -121,8 +122,8 @@ public class JAXBWrapperHandler implements WrapperHandler<Object> { * @see org.apache.tuscany.sca.databinding.WrapperHandler#getChildren(java.lang.Object, Operation, boolean) */ public List getChildren(Object wrapper, Operation operation, boolean input) { - List<ElementInfo> childElements = input? operation.getWrapper().getInputChildElements(): - operation.getWrapper().getOutputChildElements(); + List<ElementInfo> childElements = input? operation.getInputWrapper().getChildElements(): + operation.getOutputWrapper().getChildElements(); List<String> childNames = new ArrayList<String>(); for (ElementInfo e : childElements) { @@ -135,8 +136,9 @@ public class JAXBWrapperHandler implements WrapperHandler<Object> { * @see org.apache.tuscany.sca.databinding.WrapperHandler#getWrapperType(Operation, boolean) */ public DataType getWrapperType(Operation operation, boolean input) { - WrapperInfo wrapper = operation.getWrapper(); - DataType dt = input ? wrapper.getInputWrapperType() : wrapper.getOutputWrapperType(); + WrapperInfo inputWrapperInfo = operation.getInputWrapper(); + WrapperInfo outputWrapperInfo = operation.getOutputWrapper(); + DataType dt = input ? inputWrapperInfo.getWrapperType() : outputWrapperInfo.getWrapperType(); return dt; } @@ -145,7 +147,7 @@ public class JAXBWrapperHandler implements WrapperHandler<Object> { */ public boolean isInstance(Object wrapper, Operation operation, boolean input) { Class<?> wrapperClass = - input ? operation.getWrapper().getInputWrapperClass() : operation.getWrapper().getOutputWrapperClass(); + input ? operation.getInputWrapper().getWrapperClass() : operation.getOutputWrapper().getWrapperClass(); return wrapperClass == null ? false : wrapperClass.isInstance(wrapper); } } diff --git a/branches/sca-java-1.x/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperHandlerTestCase.java b/branches/sca-java-1.x/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperHandlerTestCase.java index c10a5227ce..501f5b21b7 100644 --- a/branches/sca-java-1.x/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperHandlerTestCase.java +++ b/branches/sca-java-1.x/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperHandlerTestCase.java @@ -60,10 +60,10 @@ public class JAXBWrapperHandlerTestCase extends TestCase { public void testCreate() { ElementInfo element = new ElementInfo(ELEMENT, null); Operation op = new OperationImpl(); - WrapperInfo wrapperInfo = new WrapperInfo(JAXBDataBinding.NAME, element, null, null, null); - wrapperInfo.setInputWrapperType(new DataTypeImpl<XMLType>(JAXBDataBinding.NAME, StockQuoteOffer.class, - XMLType.UNKNOWN)); - op.setWrapper(wrapperInfo); + WrapperInfo wrapperInfo = new WrapperInfo(JAXBDataBinding.NAME, element, null); + wrapperInfo.setWrapperType(new DataTypeImpl<XMLType>(JAXBDataBinding.NAME, StockQuoteOffer.class, + XMLType.UNKNOWN)); + op.setInputWrapper(wrapperInfo); Object offer = handler.create(op, true); Assert.assertTrue(offer instanceof StockQuoteOffer); } @@ -79,9 +79,9 @@ public class JAXBWrapperHandlerTestCase extends TestCase { wrapper.setInput("IBM"); List<ElementInfo> elements = new ArrayList<ElementInfo>(); elements.add(new ElementInfo(INPUT, null)); - WrapperInfo wrapperInfo = new WrapperInfo(JAXBDataBinding.NAME, null, null, elements, null); + WrapperInfo wrapperInfo = new WrapperInfo(JAXBDataBinding.NAME, null, elements); Operation op = new OperationImpl(); - op.setWrapper(wrapperInfo); + op.setInputWrapper(wrapperInfo); List children = handler.getChildren(wrapper, op, true); assertNotNull(children); assertEquals(1, children.size()); |