tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r1041359 - in /tuscany/sca-java-1.x/trunk/modules: core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/ interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/
Date Thu, 02 Dec 2010 13:03:24 GMT
Author: nash
Date: Thu Dec  2 13:03:23 2010
New Revision: 1041359

URL: http://svn.apache.org/viewvc?rev=1041359&view=rev
Log:
TUSCANY-3804: Handle input and output wrappers separately

Modified:
    tuscany/sca-java-1.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/WrapperJavaInterfaceProcessor.java
    tuscany/sca-java-1.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java

Modified: tuscany/sca-java-1.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/WrapperJavaInterfaceProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-1.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/WrapperJavaInterfaceProcessor.java?rev=1041359&r1=1041358&r2=1041359&view=diff
==============================================================================
--- tuscany/sca-java-1.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/WrapperJavaInterfaceProcessor.java
(original)
+++ tuscany/sca-java-1.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/WrapperJavaInterfaceProcessor.java
Thu Dec  2 13:03:23 2010
@@ -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 WrapperJavaInterfaceProcess
             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 WrapperJavaInterfaceProcess
         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 WrapperJavaInterfaceProcess
             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();
+        }
+    }
 }

Modified: tuscany/sca-java-1.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-1.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java?rev=1041359&r1=1041358&r2=1041359&view=diff
==============================================================================
--- tuscany/sca-java-1.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java
(original)
+++ tuscany/sca-java-1.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java
Thu Dec  2 13:03:23 2010
@@ -331,11 +331,13 @@ public class JAXWSJavaInterfaceProcessor
                     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);



Mime
View raw message