summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
-rw-r--r--java/sca/modules/databinding-jaxb/META-INF/MANIFEST.MF1
-rw-r--r--java/sca/modules/databinding-jaxb/pom.xml2
-rw-r--r--java/sca/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java24
5 files changed, 57 insertions, 3 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 {
diff --git a/java/sca/modules/databinding-jaxb/META-INF/MANIFEST.MF b/java/sca/modules/databinding-jaxb/META-INF/MANIFEST.MF
index c4ca84e5fd..de480e1e3f 100644
--- a/java/sca/modules/databinding-jaxb/META-INF/MANIFEST.MF
+++ b/java/sca/modules/databinding-jaxb/META-INF/MANIFEST.MF
@@ -43,6 +43,7 @@ Import-Package: javax.activation,
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",
diff --git a/java/sca/modules/databinding-jaxb/pom.xml b/java/sca/modules/databinding-jaxb/pom.xml
index 5240ec7d8b..23ba8ac8d9 100644
--- a/java/sca/modules/databinding-jaxb/pom.xml
+++ b/java/sca/modules/databinding-jaxb/pom.xml
@@ -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>
diff --git a/java/sca/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java b/java/sca/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java
index 830e8c5e23..0e0bb2a931 100644
--- a/java/sca/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java
+++ b/java/sca/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java
@@ -49,6 +49,8 @@ import org.apache.tuscany.sca.databinding.util.LRUCache;
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 @@ public final class JAXBContextHelper {
}
- 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 @@ public final class JAXBContextHelper {
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;
}