From de7789044d196dfadab3b8ddfddf2f26f7a1bbd8 Mon Sep 17 00:00:00 2001 From: scottkurz Date: Thu, 20 Jan 2011 14:57:06 +0000 Subject: Fix for TUSCANY-3819 (still need to cleanup bare case, wsdlgen). git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1061329 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/tuscany/sca/interfacedef/Operation.java | 17 ++++- .../impl/InterfaceContractMapperImpl.java | 9 +-- .../sca/interfacedef/impl/InterfaceImpl.java | 6 +- .../sca/interfacedef/impl/OperationImpl.java | 79 +++++++++++----------- .../tuscany/sca/interfacedef/util/WrapperInfo.java | 23 +++---- 5 files changed, 71 insertions(+), 63 deletions(-) (limited to 'sca-java-2.x/trunk/modules/assembly/src') diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/Operation.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/Operation.java index fd47ece34c..c3a7ca972a 100644 --- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/Operation.java +++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/Operation.java @@ -210,7 +210,20 @@ public interface Operation extends Cloneable, PolicySubject { * Returns true * @return */ - public boolean hasHolders(); + public boolean hasArrayWrappedOutput(); - public void setHasHolders(boolean value); + public void setHasArrayWrappedOutput(boolean value); + + /** + * A special databinding for input message of an operation + */ + String IDL_INPUT = "idl:input"; + /** + * A special databinding for output message of an operation + */ + String IDL_OUTPUT = "idl:output"; + /** + * A special databinding for fault message of an operation + */ + String IDL_FAULT = "idl:fault"; } diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java index c28694c930..486081dfec 100644 --- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java +++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java @@ -260,16 +260,14 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper { List sourceInputType = source.getInputType().getLogical(); if (source.isWrapperStyle() && source.getWrapper() != null) { sourceInputType = source.getWrapper().getUnwrappedInputType().getLogical(); - sourceOutputType = new ArrayList(); - sourceOutputType.add(source.getWrapper().getUnwrappedOutputType()); + sourceOutputType = source.getWrapper().getUnwrappedOutputType().getLogical(); checkSourceWrapper = false; } boolean checkTargetWrapper = true; List targetInputType = target.getInputType().getLogical(); if (target.isWrapperStyle() && target.getWrapper() != null) { targetInputType = target.getWrapper().getUnwrappedInputType().getLogical(); - targetOutputType = new ArrayList(); - targetOutputType.add(target.getWrapper().getUnwrappedOutputType()); + targetOutputType = target.getWrapper().getUnwrappedOutputType().getLogical(); checkTargetWrapper = false; } @@ -278,8 +276,7 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper { return true; } */ - - + if ( sourceOutputType.size() != targetOutputType.size()) { if (audit != null){ audit.append("different number of output types"); diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java index eeab73e14e..1daa6baf9c 100644 --- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java +++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java @@ -222,9 +222,11 @@ public class InterfaceImpl implements Interface { setDataBinding(d, dataBinding); } } - DataType unwrappedOutputType = wrapper.getUnwrappedOutputType(); + DataType> unwrappedOutputType = wrapper.getUnwrappedOutputType(); if (unwrappedOutputType != null) { - setDataBinding(unwrappedOutputType, dataBinding); + for (DataType d : unwrappedOutputType.getLogical()) { + setDataBinding(d, dataBinding); + } } } } diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java index 350135d974..c1fa4d4e4c 100644 --- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java +++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java @@ -63,14 +63,15 @@ public class OperationImpl implements Operation { private List policySets = new ArrayList(); private List requiredIntents = new ArrayList(); private ExtensionType type; - private DataType> outputType; - private boolean hasHolders; + private DataType> outputType; + private boolean hasMultipleOutputs; /** * @param name */ public OperationImpl() { - inputType = new DataTypeImpl>("idl:input", Object[].class, new ArrayList()); + inputType = new DataTypeImpl>(IDL_INPUT, Object[].class, new ArrayList()); + outputType = new DataTypeImpl>(IDL_OUTPUT, Object[].class, new ArrayList()); faultTypes = new ArrayList(); faultBeans = new HashMap>>(); } @@ -123,15 +124,15 @@ public class OperationImpl implements Operation { * @return the outputType */ public DataType> getOutputType() { - return this.outputType; + return this.outputType; } - + /** * @param outputType the outputType to set */ public void setOutputType(DataType> outputType) { - this.outputType = outputType; + this.outputType = outputType; } /** @@ -237,24 +238,24 @@ public class OperationImpl implements Operation { copy.inputType = clonedInputType; if ( outputType != null ) { - List clonedLogicalOutputTypes = new ArrayList(); - for ( DataType t : outputType.getLogical()) { - if ( t == null ) { - clonedLogicalOutputTypes.add(null); - } else { - DataType type = (DataType) t.clone(); - clonedLogicalOutputTypes.add(type); - } - } - DataType> clonedOutputType = - new DataTypeImpl>(outputType.getPhysical(), clonedLogicalOutputTypes); - clonedOutputType.setDataBinding(outputType.getDataBinding()); - copy.outputType = clonedOutputType; + List clonedLogicalOutputTypes = new ArrayList(); + for ( DataType t : outputType.getLogical()) { + if ( t == null ) { + clonedLogicalOutputTypes.add(null); + } else { + DataType type = (DataType) t.clone(); + clonedLogicalOutputTypes.add(type); + } + } + DataType> clonedOutputType = + new DataTypeImpl>(outputType.getPhysical(), clonedLogicalOutputTypes); + clonedOutputType.setDataBinding(outputType.getDataBinding()); + copy.outputType = clonedOutputType; } copy.attributes = new ConcurrentHashMap(); copy.attributes.putAll(attributes); - + // [rfeng] We need to clone the wrapper as it holds the databinding information if (wrapper != null) { copy.wrapper = (WrapperInfo)wrapper.clone(); @@ -287,24 +288,24 @@ public class OperationImpl implements Operation { return attributes; } - /** - * Indicates if this operation is an async server style of operation - * @return true if the operation is async server style - */ - public boolean isAsyncServer() { - return false; - } - - public List getParameterModes() { - return this.parameterModes; - } - - public boolean hasHolders() { - return this.hasHolders; - } - - public void setHasHolders(boolean value) { - this.hasHolders = value; - } + /** + * Indicates if this operation is an async server style of operation + * @return true if the operation is async server style + */ + public boolean isAsyncServer() { + return false; + } + + public List getParameterModes() { + return this.parameterModes; + } + + public boolean hasArrayWrappedOutput() { + return this.hasMultipleOutputs; + } + + public void setHasArrayWrappedOutput(boolean value) { + this.hasMultipleOutputs = value; + } } diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/WrapperInfo.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/WrapperInfo.java index 2252434c39..9f083a4083 100644 --- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/WrapperInfo.java +++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/WrapperInfo.java @@ -60,8 +60,8 @@ public class WrapperInfo implements Cloneable { // The data type of the unwrapped input child elements private DataType> unwrappedInputType; - // The data type of the unwrapped output child element (we only supports one child) - private DataType unwrappedOutputType; + // The data type of the unwrapped output child elements + private DataType> unwrappedOutputType; // The data for the input/output wrappers private String dataBinding; @@ -141,21 +141,16 @@ public class WrapperInfo implements Cloneable { /** * @return the unwrappedOutputType */ - public DataType getUnwrappedOutputType() { + public DataType> getUnwrappedOutputType() { if (unwrappedOutputType == null) { - List elements = getOutputChildElements(); - if (elements != null && elements.size() > 0) { - if (elements.size() > 1) { - // We don't support output with multiple parts - // throw new IllegalArgumentException("Multi-part output is not supported"); - } - ElementInfo element = elements.get(0); - - unwrappedOutputType = getDataType(element); + List childTypes = new ArrayList(); + for (ElementInfo element : getOutputChildElements()) { + DataType type = getDataType(element); + childTypes.add(type); } + unwrappedOutputType = new DataTypeImpl>("idl:unwrapped.input", Object[].class, childTypes); } - return unwrappedOutputType; - } + return unwrappedOutputType; } public Class getInputWrapperClass() { return inputWrapperType == null ? null : inputWrapperType.getPhysical(); -- cgit v1.2.3