From fa76bf91f5918d44c9d72c3d7ad8461210516e3d Mon Sep 17 00:00:00 2001 From: scottkurz Date: Tue, 15 Feb 2011 14:51:35 +0000 Subject: Fix for TUSCANY-3832. Also tries to simplify wrapped vs. bare terminology by introducing "notSubjectToWrapping" as a term in place of "bare". git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1070926 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/interfacedef/InterfaceContractMapper.java | 15 +++++++++++- .../apache/tuscany/sca/interfacedef/Operation.java | 27 ++++++++++++++++++++-- .../impl/InterfaceContractMapperImpl.java | 9 ++++++++ .../sca/interfacedef/impl/OperationImpl.java | 9 ++++++++ 4 files changed, 57 insertions(+), 3 deletions(-) (limited to 'sca-java-2.x/trunk/modules/assembly/src/main') diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java index 94bce6d6b4..ed7b10091b 100644 --- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java +++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java @@ -114,7 +114,20 @@ public interface InterfaceContractMapper { boolean isCompatibleByReference(Operation source, Operation target, Compatibility compatibilityType); boolean isCompatibleByValue(Operation source, Operation target, Compatibility compatibilityType); - + + /** + * Similar to isCompatibleByValue with the one difference that isCompatibleByValue will "unwrap" a wrapperStyle + * operation to compare it to a non-wrapperStyle operation. One the other hand, isCompatibleWithoutUnwrapByValue + * will return false, i.e. not-compatible, if the source and target operation do not have the same wrapperStyle. + * + * + * @param source The source operation + * @param target The target operation + * @param compatibilityType The type of compatibility + * @return true if the source operation is compatible with the target + * operation + */ + boolean isCompatibleWithoutUnwrapByValue(Operation source, Operation target, Compatibility compatibilityType); /** * An interface A is a Compatible Subset of a second interface B if and only if all of points 1 through 6 * in the following list apply: 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 c3a7ca972a..59a79c72d6 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 @@ -207,12 +207,35 @@ public interface Operation extends Cloneable, PolicySubject { List getParameterModes(); /** - * Returns true + * Returns whether the operation's outputs will flow wrapped in an array + * or not. (Needed to distinguish whether an array represents a single output + * or if it wrappers multiple outputs). + * * @return */ public boolean hasArrayWrappedOutput(); - + + /** + * Sets whether the operation's outputs will flow wrapped in an array + * or not. (Needed to distinguish whether an array represents a single output + * or if it wrappers multiple outputs). + * @param value + */ public void setHasArrayWrappedOutput(boolean value); + + /** + * Sets whether operation data is not subject to wrapping along with + * a data transformation. + * @param notSubjectToWrapping + */ + public void setNotSubjectToWrapping(boolean notSubjectToWrapping); + + /** + * Returns whether operation data is not subject to wrapping along with + * a data transformation. + * @return + */ + public boolean isNotSubjectToWrapping(); /** * A special databinding for input message of an operation 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 486081dfec..5e0f6d4e65 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 @@ -347,6 +347,15 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper { return isCompatible(source, target, compatibilityType, true); } + @Override + public boolean isCompatibleWithoutUnwrapByValue(Operation source, Operation target, Compatibility compatibilityType) { + if (!source.isWrapperStyle() == target.isWrapperStyle()) { + return false; + } else { + return isCompatible(source, target, compatibilityType, true); + } + } + // FIXME: How to improve the performance for the lookup private Operation getOperation(List operations, String name) { for (Operation op : operations) { 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 95256101d0..b820f95fcf 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 @@ -54,6 +54,7 @@ public class OperationImpl implements Operation { private boolean wrapperStyle; private WrapperInfo wrapper; private boolean dynamic; + private boolean notSubjectToWrapping; private Map attributes = new ConcurrentHashMap(); @@ -308,4 +309,12 @@ public class OperationImpl implements Operation { this.hasArrayWrappedOutput = value; } + public void setNotSubjectToWrapping(boolean notSubjectToWrapping) { + this.notSubjectToWrapping = notSubjectToWrapping; + } + + public boolean isNotSubjectToWrapping() { + return notSubjectToWrapping; + } + } -- cgit v1.2.3