summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.5.1
diff options
context:
space:
mode:
Diffstat (limited to 'branches/sca-java-1.5.1')
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java32
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/pom.xml4
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java32
3 files changed, 65 insertions, 3 deletions
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java b/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
index 3cc2cb68d0..dd47d23f6b 100644
--- a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
+++ b/branches/sca-java-1.5.1/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;
@@ -246,8 +248,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/branches/sca-java-1.5.1/modules/databinding-jaxb/pom.xml b/branches/sca-java-1.5.1/modules/databinding-jaxb/pom.xml
index 6c3fe46582..7d539a531b 100644
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/pom.xml
+++ b/branches/sca-java-1.5.1/modules/databinding-jaxb/pom.xml
@@ -39,13 +39,11 @@
<artifactId>tuscany-databinding</artifactId>
<version>1.5.1-SNAPSHOT</version>
</dependency>
- <!--
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java-xml</artifactId>
+ <artifactId>tuscany-interface-java</artifactId>
<version>1.5.1-SNAPSHOT</version>
</dependency>
- -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java
index 2e8a4fc385..95aa6d1402 100644
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java
+++ b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java
@@ -37,6 +37,7 @@ import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchema;
+import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
import javax.xml.namespace.QName;
@@ -47,6 +48,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;
@@ -98,6 +101,18 @@ public class JAXBContextHelper {
return createJAXBContext(dataType);
}
+
+ 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 static JAXBContext createJAXBContext(DataType dataType) throws JAXBException {
return createJAXBContext(findClasses(dataType));
@@ -298,6 +313,23 @@ public 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;
}