summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire
diff options
context:
space:
mode:
authorbdaniel <bdaniel@13f79535-47bb-0310-9956-ffa450edef68>2010-11-14 22:32:24 +0000
committerbdaniel <bdaniel@13f79535-47bb-0310-9956-ffa450edef68>2010-11-14 22:32:24 +0000
commitebc9f8e8938b56b0564ca447fef38ba42db689dd (patch)
tree91f7ad5ea13a1a5e1b4776e31d1f9c845addbab0 /sca-java-2.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire
parent5670f96c39fb938bfc6951dcb87d623a2d03bf8d (diff)
TUSCANY-3664 Add support for multiple operation output types
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1035090 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire')
-rw-r--r--sca-java-2.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataBindingRuntimeWireProcessor.java17
-rw-r--r--sca-java-2.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataTransformationInterceptor.java23
2 files changed, 18 insertions, 22 deletions
diff --git a/sca-java-2.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataBindingRuntimeWireProcessor.java b/sca-java-2.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataBindingRuntimeWireProcessor.java
index 0e615519f1..bdb4d6fa08 100644
--- a/sca-java-2.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataBindingRuntimeWireProcessor.java
+++ b/sca-java-2.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataBindingRuntimeWireProcessor.java
@@ -84,14 +84,19 @@ public class DataBindingRuntimeWireProcessor implements RuntimeWireProcessor {
}
// Check output type
- DataType sourceOutputType = source.getOutputType();
- DataType targetOutputType = target.getOutputType();
+ List<DataType> sourceOutputType = source.getOutputType().getLogical();
+ List<DataType> targetOutputType = target.getOutputType().getLogical();
- // Note the target output type is now the source for checking
- // compatibility
- if (isTransformationRequired(targetOutputType, sourceOutputType)) {
- return true;
+ int outputSize = sourceOutputType.size();
+ if ( outputSize != targetOutputType.size() ) {
+ return true;
}
+
+ for (int i = 0; i < outputSize; i++) {
+ if (isTransformationRequired(sourceOutputType.get(i), targetOutputType.get(i))) {
+ return true;
+ }
+ }
List<DataType> sourceInputType = source.getInputType().getLogical();
List<DataType> targetInputType = target.getInputType().getLogical();
diff --git a/sca-java-2.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataTransformationInterceptor.java b/sca-java-2.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataTransformationInterceptor.java
index 7bf9833d04..3b4891af9d 100644
--- a/sca-java-2.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataTransformationInterceptor.java
+++ b/sca-java-2.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataTransformationInterceptor.java
@@ -21,6 +21,7 @@ package org.apache.tuscany.sca.core.databinding.wire;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -59,17 +60,7 @@ public class DataTransformationInterceptor implements Interceptor {
JavaOperation javaOp = (JavaOperation) sourceOperation;
Method sourceMethod = javaOp.getJavaMethod();
}
- // Holder pattern. In order to perform data mediation on Holder return types, it is
- // necessary to set up a data transformation on the Holder<T> class T. on return.
- DataType<DataType> returnTargetType = getFirstHolderType( sourceOperation.getInputType() );
- if ( returnTargetType != null ) {
- this.sourceOperation.setOutputType(returnTargetType);
- }
- returnTargetType = getFirstHolderType( targetOperation.getInputType() );
- if ( returnTargetType != null ) {
- this.targetOperation.setOutputType(returnTargetType);
- }
-
+
this.mediator = mediator;
this.invocable = invocable;
}
@@ -121,21 +112,21 @@ public class DataTransformationInterceptor implements Interceptor {
* Returns return type for first Holder in input list.
* Returns null if the inputs do not contain a Holder.
*/
- protected static DataType<DataType> getFirstHolderType( DataType<List<DataType>> inputTypes ) {
+ protected List<DataType<DataType>> getHolderTypes( DataType<List<DataType>> inputTypes ) {
+ ArrayList<DataType<DataType>> returnTypes = new ArrayList<DataType<DataType>>();
if (inputTypes != null) {
+
List<DataType> logicalType = inputTypes.getLogical();
if (logicalType != null) {
for (int i = 0; i < logicalType.size(); i++) {
DataType dataType = logicalType.get(i);
if (isHolder(dataType.getGenericType())) {
- // Fix up output from void to returned data type.
- // System.out.println("DataTransformationInterceptor.<> source input[" + i + "] is Holder, logicalType=" + dataType);
- return dataType;
+ returnTypes.add(dataType);
}
}
}
}
- return null;
+ return returnTypes;
}
protected static boolean isHolder( Type type ) {