diff options
author | scottkurz <scottkurz@13f79535-47bb-0310-9956-ffa450edef68> | 2011-01-20 14:57:06 +0000 |
---|---|---|
committer | scottkurz <scottkurz@13f79535-47bb-0310-9956-ffa450edef68> | 2011-01-20 14:57:06 +0000 |
commit | de7789044d196dfadab3b8ddfddf2f26f7a1bbd8 (patch) | |
tree | a2eef7b87fb6b98af951c68a188ceb9ac5977f47 /sca-java-2.x/trunk/modules/assembly | |
parent | 81ab42fb0730a787d799c870e09726ec1fb82116 (diff) |
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
Diffstat (limited to 'sca-java-2.x/trunk/modules/assembly')
5 files changed, 71 insertions, 63 deletions
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<DataType> sourceInputType = source.getInputType().getLogical(); if (source.isWrapperStyle() && source.getWrapper() != null) { sourceInputType = source.getWrapper().getUnwrappedInputType().getLogical(); - sourceOutputType = new ArrayList<DataType>(); - sourceOutputType.add(source.getWrapper().getUnwrappedOutputType()); + sourceOutputType = source.getWrapper().getUnwrappedOutputType().getLogical(); checkSourceWrapper = false; } boolean checkTargetWrapper = true; List<DataType> targetInputType = target.getInputType().getLogical(); if (target.isWrapperStyle() && target.getWrapper() != null) { targetInputType = target.getWrapper().getUnwrappedInputType().getLogical(); - targetOutputType = new ArrayList<DataType>(); - 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<List<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<PolicySet> policySets = new ArrayList<PolicySet>(); private List<Intent> requiredIntents = new ArrayList<Intent>(); private ExtensionType type; - private DataType<List<DataType>> outputType; - private boolean hasHolders; + private DataType<List<DataType>> outputType; + private boolean hasMultipleOutputs; /** * @param name */ public OperationImpl() { - inputType = new DataTypeImpl<List<DataType>>("idl:input", Object[].class, new ArrayList<DataType>()); + inputType = new DataTypeImpl<List<DataType>>(IDL_INPUT, Object[].class, new ArrayList<DataType>()); + outputType = new DataTypeImpl<List<DataType>>(IDL_OUTPUT, Object[].class, new ArrayList<DataType>()); faultTypes = new ArrayList<DataType>(); faultBeans = new HashMap<QName, List<DataType<XMLType>>>(); } @@ -123,15 +124,15 @@ public class OperationImpl implements Operation { * @return the outputType */ public DataType<List<DataType>> getOutputType() { - return this.outputType; + return this.outputType; } - + /** * @param outputType the outputType to set */ public void setOutputType(DataType<List<DataType>> outputType) { - this.outputType = outputType; + this.outputType = outputType; } /** @@ -237,24 +238,24 @@ public class OperationImpl implements Operation { copy.inputType = clonedInputType; if ( outputType != null ) { - List<DataType> clonedLogicalOutputTypes = new ArrayList<DataType>(); - for ( DataType t : outputType.getLogical()) { - if ( t == null ) { - clonedLogicalOutputTypes.add(null); - } else { - DataType type = (DataType) t.clone(); - clonedLogicalOutputTypes.add(type); - } - } - DataType<List<DataType>> clonedOutputType = - new DataTypeImpl<List<DataType>>(outputType.getPhysical(), clonedLogicalOutputTypes); - clonedOutputType.setDataBinding(outputType.getDataBinding()); - copy.outputType = clonedOutputType; + List<DataType> clonedLogicalOutputTypes = new ArrayList<DataType>(); + for ( DataType t : outputType.getLogical()) { + if ( t == null ) { + clonedLogicalOutputTypes.add(null); + } else { + DataType type = (DataType) t.clone(); + clonedLogicalOutputTypes.add(type); + } + } + DataType<List<DataType>> clonedOutputType = + new DataTypeImpl<List<DataType>>(outputType.getPhysical(), clonedLogicalOutputTypes); + clonedOutputType.setDataBinding(outputType.getDataBinding()); + copy.outputType = clonedOutputType; } copy.attributes = new ConcurrentHashMap<Object, Object>(); 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<ParameterMode> 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<ParameterMode> 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<List<DataType>> unwrappedInputType; - // The data type of the unwrapped output child element (we only supports one child) - private DataType<XMLType> unwrappedOutputType; + // The data type of the unwrapped output child elements + private DataType<List<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<List<DataType>> getUnwrappedOutputType() { if (unwrappedOutputType == null) { - List<ElementInfo> 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<DataType> childTypes = new ArrayList<DataType>(); + for (ElementInfo element : getOutputChildElements()) { + DataType type = getDataType(element); + childTypes.add(type); } + unwrappedOutputType = new DataTypeImpl<List<DataType>>("idl:unwrapped.input", Object[].class, childTypes); } - return unwrappedOutputType; - } + return unwrappedOutputType; } public Class<?> getInputWrapperClass() { return inputWrapperType == null ? null : inputWrapperType.getPhysical(); |