diff options
Diffstat (limited to '')
8 files changed, 68 insertions, 14 deletions
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<ParameterMode> 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<Operation> 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<Object, Object> attributes = new ConcurrentHashMap<Object, Object>(); @@ -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; + } + } diff --git a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAReferenceBindingProvider.java b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAReferenceBindingProvider.java index 36ae886b46..e91cf1569c 100644 --- a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAReferenceBindingProvider.java +++ b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAReferenceBindingProvider.java @@ -153,7 +153,7 @@ public class RuntimeSCAReferenceBindingProvider implements EndpointReferenceAsyn targetOp, Compatibility.SUBSET)) { passByValue = false; - } else if (interfaceContractMapper.isCompatibleByValue(operation, targetOp, Compatibility.SUBSET)) { + } else if (interfaceContractMapper.isCompatibleWithoutUnwrapByValue(operation, targetOp, Compatibility.SUBSET)) { passByValue = true; } } diff --git a/sca-java-2.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java b/sca-java-2.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java index 0ac448ce34..1386aa38e9 100644 --- a/sca-java-2.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java +++ b/sca-java-2.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java @@ -126,7 +126,7 @@ public class Input2InputTransformer extends BaseTransformer<Object[], Object[]> DataType<List<DataType>> sourceType = context.getSourceDataType(); Operation sourceOp = context.getSourceOperation(); boolean sourceWrapped = sourceOp != null && sourceOp.isWrapperStyle() && sourceOp.getWrapper() != null; - boolean sourceBare = sourceOp != null && !sourceOp.isWrapperStyle() && sourceOp.getWrapper() == null; + boolean sourceNotSubjectToWrapping = sourceOp != null && sourceOp.isNotSubjectToWrapping(); // Find the wrapper handler for source data WrapperHandler sourceWrapperHandler = null; @@ -137,14 +137,14 @@ public class Input2InputTransformer extends BaseTransformer<Object[], Object[]> DataType<List<DataType>> targetType = context.getTargetDataType(); Operation targetOp = (Operation)context.getTargetOperation(); boolean targetWrapped = targetOp != null && targetOp.isWrapperStyle() && targetOp.getWrapper() != null; - boolean targetBare = targetOp != null && !targetOp.isWrapperStyle() && targetOp.getWrapper() == null; + boolean targetNotSubjectToWrapping = targetOp != null && targetOp.isNotSubjectToWrapping(); // Find the wrapper handler for target data WrapperHandler targetWrapperHandler = null; String targetDataBinding = getDataBinding(targetOp); targetWrapperHandler = getWrapperHandler(targetDataBinding, targetWrapped); - if ((!sourceWrapped && !sourceBare) && targetWrapped) { + if ((!sourceWrapped && !sourceNotSubjectToWrapping) && targetWrapped) { // Unwrapped --> Wrapped WrapperInfo wrapper = targetOp.getWrapper(); // ElementInfo wrapperElement = wrapper.getInputWrapperElement(); @@ -201,7 +201,7 @@ public class Input2InputTransformer extends BaseTransformer<Object[], Object[]> true); return new Object[] {targetWrapper}; - } else if (sourceWrapped && (!targetWrapped && !targetBare)) { + } else if (sourceWrapped && (!targetWrapped && !targetNotSubjectToWrapping)) { // Wrapped to Unwrapped Object sourceWrapper = source[0]; Object[] target = null; diff --git a/sca-java-2.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java b/sca-java-2.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java index ad37eaccb8..706e01aac7 100644 --- a/sca-java-2.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java +++ b/sca-java-2.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java @@ -152,7 +152,7 @@ public class Output2OutputTransformer extends BaseTransformer<Object, Object> im DataType<List<DataType>> sourceType = context.getSourceDataType(); Operation sourceOp = context.getSourceOperation(); boolean sourceWrapped = sourceOp != null && sourceOp.isWrapperStyle() && sourceOp.getWrapper() != null; - boolean sourceBare = sourceOp != null && !sourceOp.isWrapperStyle() && sourceOp.getWrapper() == null; + boolean sourceNotSubjectToWrapping = sourceOp != null && sourceOp.isNotSubjectToWrapping(); WrapperHandler sourceWrapperHandler = null; String sourceDataBinding = getDataBinding(sourceOp); @@ -161,13 +161,13 @@ public class Output2OutputTransformer extends BaseTransformer<Object, Object> im DataType<List<DataType>> targetType = context.getTargetDataType(); Operation targetOp = (Operation)context.getTargetOperation(); boolean targetWrapped = targetOp != null && targetOp.isWrapperStyle() && targetOp.getWrapper() != null; - boolean targetBare = targetOp != null && !targetOp.isWrapperStyle() && targetOp.getWrapper() == null; + boolean targetNotSubjectToWrapping = targetOp != null && targetOp.isNotSubjectToWrapping(); WrapperHandler targetWrapperHandler = null; String targetDataBinding = getDataBinding(targetOp); targetWrapperHandler = getWrapperHandler(targetDataBinding, targetWrapped); - if ((!sourceWrapped &&!sourceBare) && targetWrapped) { + if ((!sourceWrapped &&!sourceNotSubjectToWrapping) && targetWrapped) { // Unwrapped --> Wrapped WrapperInfo wrapper = targetOp.getWrapper(); ElementInfo wrapperElement = wrapper.getOutputWrapperElement(); @@ -228,7 +228,7 @@ public class Output2OutputTransformer extends BaseTransformer<Object, Object> im false); return targetWrapper; - } else if (sourceWrapped && (!targetWrapped && !targetBare)) { + } else if (sourceWrapped && (!targetWrapped && !targetNotSubjectToWrapping)) { // Wrapped to Unwrapped Object sourceWrapper = response; List<ElementInfo> childElements = sourceOp.getWrapper().getOutputChildElements(); diff --git a/sca-java-2.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java b/sca-java-2.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java index 57f2b9c3a1..1c6f326e55 100644 --- a/sca-java-2.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java +++ b/sca-java-2.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java @@ -201,8 +201,8 @@ public class JAXWSJavaInterfaceProcessor implements JavaInterfaceVisitor { } } } - // FIXME: [rfeng] For the BARE mapping, do we need to create a Wrapper? - // it's null at this point + // Rather than relying on null wrapper, we use a flag with a clearer meaning. + operation.setNotSubjectToWrapping(true); } else { RequestWrapper requestWrapper = method.getAnnotation(RequestWrapper.class); |