summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/databinding
diff options
context:
space:
mode:
authorscottkurz <scottkurz@13f79535-47bb-0310-9956-ffa450edef68>2011-01-20 14:57:06 +0000
committerscottkurz <scottkurz@13f79535-47bb-0310-9956-ffa450edef68>2011-01-20 14:57:06 +0000
commitde7789044d196dfadab3b8ddfddf2f26f7a1bbd8 (patch)
treea2eef7b87fb6b98af951c68a188ceb9ac5977f47 /sca-java-2.x/trunk/modules/databinding
parent81ab42fb0730a787d799c870e09726ec1fb82116 (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/databinding')
-rw-r--r--sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBinding.java13
-rw-r--r--sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/MediatorImpl.java51
2 files changed, 30 insertions, 34 deletions
diff --git a/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBinding.java b/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBinding.java
index fd5cf4ac1d..46806c77f1 100644
--- a/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBinding.java
+++ b/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBinding.java
@@ -30,18 +30,7 @@ import org.apache.tuscany.sca.interfacedef.Operation;
* @tuscany.spi.extension.asclient
*/
public interface DataBinding {
- /**
- * 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";
+
/**
* The name of a databinding should be case-insensitive and unique
*
diff --git a/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/MediatorImpl.java b/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/MediatorImpl.java
index d6d56e2711..6759edc992 100644
--- a/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/MediatorImpl.java
+++ b/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/MediatorImpl.java
@@ -18,8 +18,8 @@
*/
package org.apache.tuscany.sca.databinding.impl;
-import static org.apache.tuscany.sca.databinding.DataBinding.IDL_FAULT;
-import static org.apache.tuscany.sca.databinding.DataBinding.IDL_OUTPUT;
+import static org.apache.tuscany.sca.interfacedef.Operation.IDL_FAULT;
+import static org.apache.tuscany.sca.interfacedef.Operation.IDL_OUTPUT;
import java.io.Serializable;
import java.lang.reflect.Array;
@@ -51,6 +51,7 @@ import org.apache.tuscany.sca.interfacedef.DataType;
import org.apache.tuscany.sca.interfacedef.FaultExceptionMapper;
import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.ParameterMode;
import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
import org.apache.tuscany.sca.interfacedef.util.FaultException;
import org.apache.tuscany.sca.interfacedef.util.XMLType;
@@ -390,8 +391,8 @@ public class MediatorImpl implements Mediator {
Operation targetOperation,
Map<String, Object> metadata) {
- DataType sourceType = new DataTypeImpl<DataType>(IDL_OUTPUT, Object.class, sourceOperation.getOutputType());
- DataType targetType = new DataTypeImpl<DataType>(IDL_OUTPUT, Object.class, targetOperation.getOutputType());
+ DataType sourceType = sourceOperation.getOutputType();
+ DataType targetType = targetOperation.getOutputType();
if (sourceType == targetType || (sourceType != null && sourceType.equals(targetType))) {
return output;
@@ -558,24 +559,30 @@ public class MediatorImpl implements Mediator {
List<DataType> inputTypesTarget = targetOperation == null ? null : targetOperation.getInputType().getLogical();
Object[] copy = new Object[data.length];
Map<Object, Object> map = new IdentityHashMap<Object, Object>();
- for (int i = 0, size = inputTypes.size(); i < size; i++) {
- Object arg = data[i];
- if (arg == null) {
- copy[i] = null;
- } else {
- Object copiedArg = map.get(arg);
- if (copiedArg != null) {
- copy[i] = copiedArg;
+ for (int i = 0, nextIndex = 0; i < inputTypes.size(); i++) {
+ // Account for OUT-only parameters. Would be more thorough to look at targetOperation
+ // and ensure it has the same parameter mode, but we'll let that go for now.
+ ParameterMode mode = sourceOperation.getParameterModes().get(i);
+ if (!mode.equals(ParameterMode.OUT)) {
+ Object arg = data[nextIndex];
+ if (arg == null) {
+ copy[nextIndex] = null;
} else {
- copiedArg =
- copy(arg,
- inputTypes.get(i),
- inputTypesTarget == null ? null : inputTypesTarget.get(i),
- sourceOperation,
- targetOperation);
- map.put(arg, copiedArg);
- copy[i] = copiedArg;
+ Object copiedArg = map.get(arg);
+ if (copiedArg != null) {
+ copy[nextIndex] = copiedArg;
+ } else {
+ copiedArg =
+ copy(arg,
+ inputTypes.get(i),
+ inputTypesTarget == null ? null : inputTypesTarget.get(i),
+ sourceOperation,
+ targetOperation);
+ map.put(arg, copiedArg);
+ copy[nextIndex] = copiedArg;
+ }
}
+ nextIndex++;
}
}
return copy;
@@ -590,7 +597,7 @@ public class MediatorImpl implements Mediator {
return null;
Object[] output = null;
- if ( !sourceOperation.hasHolders() ) {
+ if ( !sourceOperation.hasArrayWrappedOutput() ) {
output = new Object[] {data};
} else {
output = (Object[])data;
@@ -620,7 +627,7 @@ public class MediatorImpl implements Mediator {
}
}
}
- if ( !targetOperation.hasHolders()) {
+ if ( !targetOperation.hasArrayWrappedOutput()) {
return copy[0];
} else {
return copy;