summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/binding-ws-wsdlgen
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-09-02 16:59:26 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-09-02 16:59:26 +0000
commit3c14d04dd18e34baaeb79223b121650fe19575b9 (patch)
tree6e308c81275f4f06e683885237e799739b9dc0a2 /java/sca/modules/binding-ws-wsdlgen
parentd8df6f699d7c5de11382b5f6dc5f148da523b19e (diff)
Support @XmlSeeAlso at java interface to reference extra JAXB classes
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@810608 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/binding-ws-wsdlgen')
-rw-r--r--java/sca/modules/binding-ws-wsdlgen/META-INF/MANIFEST.MF1
-rw-r--r--java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java32
2 files changed, 33 insertions, 0 deletions
diff --git a/java/sca/modules/binding-ws-wsdlgen/META-INF/MANIFEST.MF b/java/sca/modules/binding-ws-wsdlgen/META-INF/MANIFEST.MF
index 1016f2f40a..822e724c50 100644
--- a/java/sca/modules/binding-ws-wsdlgen/META-INF/MANIFEST.MF
+++ b/java/sca/modules/binding-ws-wsdlgen/META-INF/MANIFEST.MF
@@ -42,6 +42,7 @@ Import-Package: javax.jws;resolution:=optional,
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",
diff --git a/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java b/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
index a1e9075009..548a14793f 100644
--- a/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
+++ b/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
@@ -43,6 +43,7 @@ import javax.wsdl.Types;
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.databinding.jaxb.JAXBDataBinding;
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 @@ public class Interface2WSDLGenerator {
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 {