tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rf...@apache.org
Subject svn commit: r810608 - in /tuscany/java/sca/modules: binding-ws-wsdlgen/META-INF/ binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/ databinding-jaxb/ databinding-jaxb/META-INF/ databinding-jaxb/src/main/java/org/apache/tuscany/...
Date Wed, 02 Sep 2009 16:59:27 GMT
Author: rfeng
Date: Wed Sep  2 16:59:26 2009
New Revision: 810608

URL: http://svn.apache.org/viewvc?rev=810608&view=rev
Log:
Support @XmlSeeAlso at java interface to reference extra JAXB classes

Modified:
    tuscany/java/sca/modules/binding-ws-wsdlgen/META-INF/MANIFEST.MF
    tuscany/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
    tuscany/java/sca/modules/databinding-jaxb/META-INF/MANIFEST.MF
    tuscany/java/sca/modules/databinding-jaxb/pom.xml
    tuscany/java/sca/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java

Modified: tuscany/java/sca/modules/binding-ws-wsdlgen/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-ws-wsdlgen/META-INF/MANIFEST.MF?rev=810608&r1=810607&r2=810608&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-ws-wsdlgen/META-INF/MANIFEST.MF (original)
+++ tuscany/java/sca/modules/binding-ws-wsdlgen/META-INF/MANIFEST.MF Wed Sep  2 16:59:26 2009
@@ -42,6 +42,7 @@
  org.apache.tuscany.sca.databinding;version="2.0.0",
  org.apache.tuscany.sca.databinding.jaxb;version="2.0.0",
  org.apache.tuscany.sca.interfacedef;version="2.0.0",
+ org.apache.tuscany.sca.interfacedef.impl;version="2.0.0",
  org.apache.tuscany.sca.interfacedef.java;version="2.0.0",
  org.apache.tuscany.sca.interfacedef.java.jaxws;version="2.0.0";resolution:=optional,
  org.apache.tuscany.sca.interfacedef.util;version="2.0.0",

Modified: tuscany/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java?rev=810608&r1=810607&r2=810608&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
(original)
+++ tuscany/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
Wed Sep  2 16:59:26 2009
@@ -43,6 +43,7 @@
 import javax.wsdl.WSDLException;
 import javax.wsdl.extensions.schema.Schema;
 import javax.wsdl.factory.WSDLFactory;
+import javax.xml.bind.annotation.XmlSeeAlso;
 import javax.xml.namespace.QName;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
@@ -55,6 +56,7 @@
 import org.apache.tuscany.sca.interfacedef.DataType;
 import org.apache.tuscany.sca.interfacedef.Interface;
 import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
 import org.apache.tuscany.sca.interfacedef.java.JavaOperation;
 import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
@@ -247,8 +249,38 @@
                 addDataType(dataTypes, dt4, helpers);
             }
         }
+        // Adding classes referenced by @XmlSeeAlso in the java interface
+        if (intf instanceof JavaInterface) {
+            JavaInterface javaInterface = (JavaInterface)intf;
+            Class<?>[] seeAlso = getSeeAlso(javaInterface.getJavaClass());
+            if (seeAlso != null) {
+                for (Class<?> cls : seeAlso) {
+                    DataType dt = new DataTypeImpl<XMLType>(JAXBDataBinding.NAME, cls,
XMLType.UNKNOWN);
+                    addDataType(dataTypes, dt, helpers);
+                }
+            }
+            seeAlso = getSeeAlso(javaInterface.getCallbackClass());
+            if (seeAlso != null) {
+                for (Class<?> cls : seeAlso) {
+                    DataType dt = new DataTypeImpl<XMLType>(JAXBDataBinding.NAME, cls,
XMLType.UNKNOWN);
+                    addDataType(dataTypes, dt, helpers);
+                }
+            }
+        }
         return dataTypes;
     }
+    
+    private static Class<?>[] getSeeAlso(Class<?> interfaze) {
+        if (interfaze == null) {
+            return null;
+        }
+        XmlSeeAlso seeAlso = interfaze.getAnnotation(XmlSeeAlso.class);
+        if (seeAlso == null) {
+            return null;
+        } else {
+            return seeAlso.value();
+        }
+    }
 
 
     public Definition generate(Interface interfaze, WSDLDefinition wsdlDefinition) throws
WSDLException {

Modified: tuscany/java/sca/modules/databinding-jaxb/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/databinding-jaxb/META-INF/MANIFEST.MF?rev=810608&r1=810607&r2=810608&view=diff
==============================================================================
--- tuscany/java/sca/modules/databinding-jaxb/META-INF/MANIFEST.MF (original)
+++ tuscany/java/sca/modules/databinding-jaxb/META-INF/MANIFEST.MF Wed Sep  2 16:59:26 2009
@@ -43,6 +43,7 @@
  org.apache.tuscany.sca.extensibility;version="2.0.0",
  org.apache.tuscany.sca.interfacedef;version="2.0.0",
  org.apache.tuscany.sca.interfacedef.impl;version="2.0.0",
+ org.apache.tuscany.sca.interfacedef.java;version="2.0.0",
  org.apache.tuscany.sca.interfacedef.util;version="2.0.0",
  org.apache.tuscany.sca.policy;version="2.0.0",
  org.apache.tuscany.sca.xsd;version="2.0.0",

Modified: tuscany/java/sca/modules/databinding-jaxb/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/databinding-jaxb/pom.xml?rev=810608&r1=810607&r2=810608&view=diff
==============================================================================
--- tuscany/java/sca/modules/databinding-jaxb/pom.xml (original)
+++ tuscany/java/sca/modules/databinding-jaxb/pom.xml Wed Sep  2 16:59:26 2009
@@ -39,13 +39,11 @@
             <artifactId>tuscany-databinding</artifactId>
             <version>2.0-SNAPSHOT</version>
         </dependency>
-        <!--
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>
             <artifactId>tuscany-interface-java</artifactId>
             <version>2.0-SNAPSHOT</version>
         </dependency>
-         -->
         <dependency>
             <groupId>javax.xml.bind</groupId>
             <artifactId>jaxb-api</artifactId>

Modified: tuscany/java/sca/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java?rev=810608&r1=810607&r2=810608&view=diff
==============================================================================
--- tuscany/java/sca/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java
(original)
+++ tuscany/java/sca/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java
Wed Sep  2 16:59:26 2009
@@ -49,6 +49,8 @@
 import org.apache.tuscany.sca.interfacedef.DataType;
 import org.apache.tuscany.sca.interfacedef.Interface;
 import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
 import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
 import org.apache.tuscany.sca.interfacedef.util.XMLType;
 
@@ -102,7 +104,10 @@
 
     }
     
-    private Class<?>[] getSeeAlso(Class<?> interfaze) {
+    private static Class<?>[] getSeeAlso(Class<?> interfaze) {
+        if (interfaze == null) {
+            return null;
+        }
         XmlSeeAlso seeAlso = interfaze.getAnnotation(XmlSeeAlso.class);
         if (seeAlso == null) {
             return null;
@@ -311,6 +316,23 @@
     private static List<DataType> getDataTypes(Operation op, boolean useWrapper) {
         List<DataType> dataTypes = new ArrayList<DataType>();
         getDataTypes(dataTypes, op, useWrapper);
+        // Adding classes referenced by @XmlSeeAlso in the java interface
+        Interface interface1 = op.getInterface();
+        if (interface1 instanceof JavaInterface) {
+            JavaInterface javaInterface = (JavaInterface)interface1;
+            Class<?>[] seeAlso = getSeeAlso(javaInterface.getJavaClass());
+            if (seeAlso != null) {
+                for (Class<?> cls : seeAlso) {
+                    dataTypes.add(new DataTypeImpl<XMLType>(JAXBDataBinding.NAME, cls,
XMLType.UNKNOWN));
+                }
+            }
+            seeAlso = getSeeAlso(javaInterface.getCallbackClass());
+            if (seeAlso != null) {
+                for (Class<?> cls : seeAlso) {
+                    dataTypes.add(new DataTypeImpl<XMLType>(JAXBDataBinding.NAME, cls,
XMLType.UNKNOWN));
+                }
+            }
+        }
         return dataTypes;
     }
 



Mime
View raw message