diff options
author | bdaniel <bdaniel@13f79535-47bb-0310-9956-ffa450edef68> | 2010-11-14 22:34:32 +0000 |
---|---|---|
committer | bdaniel <bdaniel@13f79535-47bb-0310-9956-ffa450edef68> | 2010-11-14 22:34:32 +0000 |
commit | da521c2a4e5904efcec4c702d4c90e18e0e8745d (patch) | |
tree | 236e29656cc292ac8757347232bc99dd447c68aa /sca-java-2.x/trunk/modules/assembly/src/main | |
parent | ebc9f8e8938b56b0564ca447fef38ba42db689dd (diff) |
TUSCANY-3664 Add support for multiple operation output types
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1035091 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/assembly/src/main')
4 files changed, 73 insertions, 26 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 71c641fa38..fd47ece34c 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 @@ -79,13 +79,12 @@ public interface Operation extends Cloneable, PolicySubject { * Get the data type for the output * * @return the outputType - */ - DataType getOutputType(); - + */ + DataType<List<DataType>> getOutputType(); /** * @param outputType */ - void setOutputType(DataType outputType); + void setOutputType(DataType<List<DataType>> outputType); /** * Get a list of data types to represent the faults/exceptions @@ -206,4 +205,12 @@ public interface Operation extends Cloneable, PolicySubject { * @return */ List<ParameterMode> getParameterModes(); + + /** + * Returns true + * @return + */ + public boolean hasHolders(); + + public void setHasHolders(boolean value); } 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 3dedb5e62c..c28694c930 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 @@ -19,6 +19,7 @@ package org.apache.tuscany.sca.interfacedef.impl; +import java.util.ArrayList; import java.util.List; import javax.xml.namespace.QName; @@ -252,21 +253,23 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper { // FIXME: We need to deal with wrapped<-->unwrapped conversion // Check output type - DataType<?> sourceOutputType = source.getOutputType(); - DataType<?> targetOutputType = target.getOutputType(); + List<DataType> sourceOutputType = source.getOutputType().getLogical(); + List<DataType> targetOutputType = target.getOutputType().getLogical(); boolean checkSourceWrapper = true; List<DataType> sourceInputType = source.getInputType().getLogical(); if (source.isWrapperStyle() && source.getWrapper() != null) { sourceInputType = source.getWrapper().getUnwrappedInputType().getLogical(); - sourceOutputType = source.getWrapper().getUnwrappedOutputType(); + sourceOutputType = new ArrayList<DataType>(); + sourceOutputType.add(source.getWrapper().getUnwrappedOutputType()); checkSourceWrapper = false; } boolean checkTargetWrapper = true; List<DataType> targetInputType = target.getInputType().getLogical(); if (target.isWrapperStyle() && target.getWrapper() != null) { targetInputType = target.getWrapper().getUnwrappedInputType().getLogical(); - targetOutputType = target.getWrapper().getUnwrappedOutputType(); + targetOutputType = new ArrayList<DataType>(); + targetOutputType.add(target.getWrapper().getUnwrappedOutputType()); checkTargetWrapper = false; } @@ -276,13 +279,25 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper { } */ - if (!isCompatible(targetOutputType, sourceOutputType, passByValue, audit)) { - if (audit != null){ - audit.append(" output types"); - audit.appendSeperator(); - } - return false; + + if ( sourceOutputType.size() != targetOutputType.size()) { + if (audit != null){ + audit.append("different number of output types"); + audit.appendSeperator(); + } + return false; + } + + for ( int i=0; i < sourceOutputType.size(); i++) { + if (!isCompatible(targetOutputType.get(i), sourceOutputType.get(i), passByValue, audit)) { + if (audit != null){ + audit.append(" output types"); + audit.appendSeperator(); + } + return false; + } } + if (sourceInputType.size() != targetInputType.size()) { if (audit != null){ 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 c56b5545ce..eeab73e14e 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 @@ -199,10 +199,13 @@ public class InterfaceImpl implements Interface { setDataBinding(d, dataBinding); } } - DataType outputType = op.getOutputType(); - if (outputType != null) { - setDataBinding(outputType, dataBinding); + List<DataType> outputTypes = op.getOutputType().getLogical(); + for ( DataType outputType : outputTypes ) { + if (outputType != null) { + setDataBinding(outputType, dataBinding); + } } + List<DataType> faultTypes = op.getFaultTypes(); if (faultTypes != null) { for (DataType d : faultTypes) { 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 21debb6ea3..350135d974 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 @@ -45,8 +45,7 @@ import org.apache.tuscany.sca.policy.PolicySet; public class OperationImpl implements Operation { private String name; - private boolean unresolved; - private DataType outputType; + private boolean unresolved; private DataType<List<DataType>> inputType; private List<DataType> faultTypes; private Interface interfaze; @@ -64,6 +63,8 @@ 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; /** * @param name @@ -121,15 +122,16 @@ public class OperationImpl implements Operation { /** * @return the outputType */ - public DataType getOutputType() { - return outputType; - } + public DataType<List<DataType>> getOutputType() { + return this.outputType; + } + /** * @param outputType the outputType to set */ - public void setOutputType(DataType outputType) { - this.outputType = outputType; + public void setOutputType(DataType<List<DataType>> outputType) { + this.outputType = outputType; } /** @@ -234,8 +236,20 @@ public class OperationImpl implements Operation { clonedInputType.setDataBinding(inputType.getDataBinding()); copy.inputType = clonedInputType; - if (this.outputType != null) { - copy.outputType = (DataType) this.outputType.clone(); + 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; } copy.attributes = new ConcurrentHashMap<Object, Object>(); @@ -284,5 +298,13 @@ public class OperationImpl implements Operation { public List<ParameterMode> getParameterModes() { return this.parameterModes; } + + public boolean hasHolders() { + return this.hasHolders; + } + + public void setHasHolders(boolean value) { + this.hasHolders = value; + } } |