summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornash <nash@13f79535-47bb-0310-9956-ffa450edef68>2010-12-02 13:03:23 +0000
committernash <nash@13f79535-47bb-0310-9956-ffa450edef68>2010-12-02 13:03:23 +0000
commit110d33c76236d8f2c81f00945dd877870e898758 (patch)
tree45e06e2137edabfd77fa997b235c6ce8a91e9df9
parent3aee1ff0d471d8a197add711b9a46f91060d81c4 (diff)
TUSCANY-3804: Handle input and output wrappers separately
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1041359 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sca-java-1.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/WrapperJavaInterfaceProcessor.java49
-rw-r--r--sca-java-1.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java8
2 files changed, 50 insertions, 7 deletions
diff --git a/sca-java-1.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/WrapperJavaInterfaceProcessor.java b/sca-java-1.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/WrapperJavaInterfaceProcessor.java
index 702da720a0..9d5c3d65b1 100644
--- a/sca-java-1.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/WrapperJavaInterfaceProcessor.java
+++ b/sca-java-1.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/WrapperJavaInterfaceProcessor.java
@@ -24,6 +24,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Set;
+import org.apache.tuscany.sca.databinding.DataBinding;
import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
import org.apache.tuscany.sca.databinding.WrapperHandler;
import org.apache.tuscany.sca.databinding.javabeans.JavaBeansDataBinding;
@@ -59,22 +60,41 @@ public class WrapperJavaInterfaceProcessor implements JavaInterfaceVisitor {
if (inputWrapperInfo == null || outputWrapperInfo == null) {
continue;
}
- // JIRA: TUSCANY-842
+ // JIRA: TUSCANY-824
String db = inputWrapperInfo.getDataBinding();
if (db == null || JAXB_DATABINDING.equals(db)) {
db = assignOperationDataBinding(operation);
}
// Introspect the wrapper data type
- org.apache.tuscany.sca.databinding.DataBinding dbObj = dataBindingRegistry.getDataBinding(db);
+ DataBinding dbObj = dataBindingRegistry.getDataBinding(db);
WrapperHandler handler = dbObj == null ? null : dbObj.getWrapperHandler();
if (handler != null) {
inputWrapperInfo.setWrapperType(handler.getWrapperType(operation, true));
- outputWrapperInfo.setWrapperType(handler.getWrapperType(operation, false));
+ // TUSCANY-3804: handle output wrapper separately
+ //outputWrapperInfo.setWrapperType(handler.getWrapperType(operation, false));
}
if (dbObj != null && handler == null) {
// To avoid JAXB wrapper bean generation
inputWrapperInfo.setWrapperType(null);
+ // TUSCANY-3804: handle output wrapper separately
+ //outputWrapperInfo.setWrapperType(null);
+ }
+
+ // TUSCANY-3804: handle output wrapper separately
+ db = outputWrapperInfo.getDataBinding();
+ if (db == null || JAXB_DATABINDING.equals(db)) {
+ db = assignOutputDataBinding(operation);
+ }
+
+ // Introspect the wrapper data type
+ dbObj = dataBindingRegistry.getDataBinding(db);
+ handler = dbObj == null ? null : dbObj.getWrapperHandler();
+ if (handler != null) {
+ outputWrapperInfo.setWrapperType(handler.getWrapperType(operation, false));
+ }
+ if (dbObj != null && handler == null) {
+ // To avoid JAXB wrapper bean generation
outputWrapperInfo.setWrapperType(null);
}
}
@@ -95,7 +115,8 @@ public class WrapperJavaInterfaceProcessor implements JavaInterfaceVisitor {
List<DataType> opDataTypes = new LinkedList<DataType>();
opDataTypes.addAll(operation.getInputType().getLogical());
- opDataTypes.add(operation.getOutputType());
+ // TUSCANY-3804: handle output wrapper separately
+ //opDataTypes.add(operation.getOutputType());
/*
for (DataType<DataType> ft : operation.getFaultTypes()) {
opDataTypes.add(ft.getLogical());
@@ -125,4 +146,24 @@ public class WrapperJavaInterfaceProcessor implements JavaInterfaceVisitor {
return operation.getInputWrapper().getDataBinding();
}
}
+
+ // TUSCANY-3804: handle output wrapper separately
+ private String assignOutputDataBinding(Operation operation) {
+ String db = null;
+ DataType dt = operation.getOutputType();
+ if (dt != null) {
+ db = dt.getDataBinding();
+ if ("java:array".equals(db)) {
+ db = ((DataType)dt.getLogical()).getDataBinding();
+ }
+ }
+ if (db != null &&
+ !JavaBeansDataBinding.NAME.equals(db) &&
+ !SimpleJavaDataBinding.NAME.equals(db)) {
+ operation.getOutputWrapper().setDataBinding(db);
+ return db;
+ } else {
+ return operation.getOutputWrapper().getDataBinding();
+ }
+ }
}
diff --git a/sca-java-1.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java b/sca-java-1.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java
index 27cd163d13..27324be42e 100644
--- a/sca-java-1.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java
+++ b/sca-java-1.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java
@@ -331,11 +331,13 @@ public class JAXWSJavaInterfaceProcessor implements JavaInterfaceVisitor {
outputElements.add(new ElementInfo(element, new TypeInfo(type, false, null)));
}
- String db = inputWrapperDT != null ? inputWrapperDT.getDataBinding() : JAXB_DATABINDING;
+ // TUSCANY-3804: handle output wrapper separately
+ String dbIn = inputWrapperDT != null ? inputWrapperDT.getDataBinding() : JAXB_DATABINDING;
+ String dbOut = outputWrapperDT != null ? outputWrapperDT.getDataBinding() : JAXB_DATABINDING;
- WrapperInfo inputWrapperInfo = new WrapperInfo(db, new ElementInfo(inputWrapper, null), inputElements);
+ WrapperInfo inputWrapperInfo = new WrapperInfo(dbIn, new ElementInfo(inputWrapper, null), inputElements);
WrapperInfo outputWrapperInfo =
- new WrapperInfo(db, new ElementInfo(outputWrapper, null), outputElements);
+ new WrapperInfo(dbOut, new ElementInfo(outputWrapper, null), outputElements);
inputWrapperInfo.setWrapperType(inputWrapperDT);
outputWrapperInfo.setWrapperType(outputWrapperDT);