You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2007/04/15 21:23:09 UTC
svn commit: r529049 -
/incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/wire/DataBindingInteceptor.java
Author: rfeng
Date: Sun Apr 15 12:23:08 2007
New Revision: 529049
URL: http://svn.apache.org/viewvc?view=rev&rev=529049
Log:
Fix the source/target operation passed for data transformation
Modified:
incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/wire/DataBindingInteceptor.java
Modified: incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/wire/DataBindingInteceptor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/wire/DataBindingInteceptor.java?view=diff&rev=529049&r1=529048&r2=529049
==============================================================================
--- incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/wire/DataBindingInteceptor.java (original)
+++ incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/wire/DataBindingInteceptor.java Sun Apr 15 12:23:08 2007
@@ -84,7 +84,7 @@
* @see org.apache.tuscany.spi.wire.Interceptor#invoke(org.apache.tuscany.spi.wire.Message)
*/
public Message invoke(Message msg) {
- Object input = transform(msg.getBody(), sourceOperation.getInputType(), targetOperation.getInputType());
+ Object input = transform(msg.getBody(), sourceOperation.getInputType(), targetOperation.getInputType(), false);
msg.setBody(input);
Message resultMsg = next.invoke(msg);
Object result = resultMsg.getBody();
@@ -170,7 +170,7 @@
} else {
assert !(result instanceof Throwable) : "Expected messages that are not throwable " + result;
- Object newResult = transform(result, targetType, sourceType);
+ Object newResult = transform(result, targetType, sourceType, true);
if (newResult != result) {
resultMsg.setBody(newResult);
}
@@ -179,14 +179,14 @@
return resultMsg;
}
- private Object transform(Object source, DataType sourceType, DataType targetType) {
+ private Object transform(Object source, DataType sourceType, DataType targetType, boolean isResponse) {
if (sourceType == targetType || (sourceType != null && sourceType.equals(targetType))) {
return source;
}
Map<String, Object> metadata = new HashMap<String, Object>();
metadata.put(Component.class.getName(), composite);
- metadata.put("source.operation", sourceOperation);
- metadata.put("target.operation", targetOperation);
+ metadata.put("source.operation", isResponse? targetOperation: sourceOperation);
+ metadata.put("target.operation", isResponse? sourceOperation: targetOperation);
return mediator.mediate(source, sourceType, targetType, metadata);
}
@@ -222,6 +222,8 @@
}
Map<String, Object> metadata = new HashMap<String, Object>();
metadata.put(Component.class.getName(), composite);
+ metadata.put("source.operation", targetOperation);
+ metadata.put("target.operation", sourceOperation);
DataType<DataType> eSourceDataType =
new DataTypeImpl<DataType>("idl:fault", sourceExType.getPhysical(), sourceType);
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org