JBossWS SVN: r9072 - stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/tools/jaxws/impl.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2009-01-21 04:40:14 -0500 (Wed, 21 Jan 2009)
New Revision: 9072
Modified:
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/tools/jaxws/impl/SourceWrapperGenerator.java
Log:
[JBWS-2477] Support generics when generating wrapper classes
Modified: stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/tools/jaxws/impl/SourceWrapperGenerator.java
===================================================================
--- stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/tools/jaxws/impl/SourceWrapperGenerator.java 2009-01-20 11:32:58 UTC (rev 9071)
+++ stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/tools/jaxws/impl/SourceWrapperGenerator.java 2009-01-21 09:40:14 UTC (rev 9072)
@@ -21,14 +21,21 @@
*/
package org.jboss.ws.tools.jaxws.impl;
-import com.sun.codemodel.JAnnotationUse;
-import com.sun.codemodel.JAnnotationArrayMember;
-import com.sun.codemodel.JCodeModel;
-import com.sun.codemodel.JDefinedClass;
-import com.sun.codemodel.JExpr;
-import com.sun.codemodel.JFieldVar;
-import com.sun.codemodel.JMethod;
-import com.sun.codemodel.JMod;
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.SortedMap;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.namespace.QName;
+
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
import org.jboss.ws.core.jaxws.AbstractWrapperGenerator;
@@ -37,19 +44,17 @@
import org.jboss.ws.metadata.umdm.ParameterMetaData;
import org.jboss.ws.metadata.umdm.WrappedParameter;
import org.jboss.wsf.common.JavaUtils;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlTransient;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.namespace.QName;
-import java.io.File;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.util.List;
-import java.util.SortedMap;
+import com.sun.codemodel.JAnnotationArrayMember;
+import com.sun.codemodel.JAnnotationUse;
+import com.sun.codemodel.JClass;
+import com.sun.codemodel.JCodeModel;
+import com.sun.codemodel.JDefinedClass;
+import com.sun.codemodel.JExpr;
+import com.sun.codemodel.JFieldVar;
+import com.sun.codemodel.JMethod;
+import com.sun.codemodel.JMod;
+
/**
* Generates source for wrapper beans
*
@@ -105,7 +110,7 @@
addClassAnnotations(clazz, parameterMD.getXmlName(), parameterMD.getXmlType(), null);
for (WrappedParameter wrapped : wrappedParameters)
{
- addProperty(clazz, wrapped.getType(), wrapped.getName(), wrapped.getVariable(), false, loader);
+ addProperty(clazz, wrapped.getType(), wrapped.getName(), wrapped.getVariable(), wrapped.getTypeArguments(), false, loader);
}
}
catch (Exception e)
@@ -130,7 +135,7 @@
for (String property : propertyOrder)
{
ExceptionProperty p = properties.get(property);
- addProperty(clazz, p.getReturnType().getName(), new QName(property), property, p.isTransientAnnotated(), loader);
+ addProperty(clazz, p.getReturnType().getName(), new QName(property), property, null, p.isTransientAnnotated(), loader);
}
}
catch (Exception e)
@@ -143,15 +148,39 @@
{
return (Boolean.TYPE == type || Boolean.class == type) ? "is" : "get";
}
+
+ private void addProperty(JDefinedClass clazz, String typeName, QName name, String variable, String[] typeArguments, boolean xmlTransient, ClassLoader loader)
+ throws Exception
+ {
+ // define variable
+ Class<?> javaType = JavaUtils.loadJavaType(typeName, loader);
+ if (JavaUtils.isPrimitive(javaType))
+ {
+ addPrimitiveProperty(clazz, javaType, name, variable, xmlTransient);
+ }
+ else
+ {
+ addProperty(clazz, javaType, name, variable, typeArguments, xmlTransient, codeModel);
+ }
+ }
- private static void addProperty(JDefinedClass clazz, String typeName, QName name, String variable, boolean xmlTransient, ClassLoader loader)
- throws ClassNotFoundException
+ private static void addProperty(JDefinedClass clazz, Class<?> javaType, QName name, String variable, String[] typeArguments, boolean xmlTransient, JCodeModel codeModel)
+ throws Exception
{
// be careful about reserved keywords when generating variable names
String realVariableName = JavaUtils.isReservedKeyword(variable) ? "_" + variable : variable;
- // define variable
- Class<?> type = JavaUtils.loadJavaType(typeName, loader);
+ //use narrow() for generics: http://forums.java.net/jive/thread.jspa?messageID=209333𳆵
+ JClass type = codeModel.ref(javaType);
+ if (typeArguments != null)
+ {
+ LinkedList<JClass> jclasses = new LinkedList<JClass>();
+ for (String tp : typeArguments)
+ {
+ jclasses.add(codeModel.ref(tp));
+ }
+ type = type.narrow(jclasses);
+ }
JFieldVar field = clazz.field(JMod.PRIVATE, type, realVariableName);
if (xmlTransient == false)
@@ -171,14 +200,46 @@
}
// generate acessor get method for variable
- JMethod method = clazz.method(JMod.PUBLIC, type, getterPrefix(type) + JavaUtils.capitalize(variable));
+ JMethod method = clazz.method(JMod.PUBLIC, type, getterPrefix(javaType) + JavaUtils.capitalize(variable));
method.body()._return(JExpr._this().ref(realVariableName));
// generate acessor set method for variable
method = clazz.method(JMod.PUBLIC, void.class, "set" + JavaUtils.capitalize(variable));
method.body().assign(JExpr._this().ref(realVariableName), method.param(type, realVariableName));
}
+
+ private static void addPrimitiveProperty(JDefinedClass clazz, Class<?> javaType, QName name, String variable, boolean xmlTransient)
+ {
+ // be careful about reserved keywords when generating variable names
+ String realVariableName = JavaUtils.isReservedKeyword(variable) ? "_" + variable : variable;
+
+ JFieldVar field = clazz.field(JMod.PRIVATE, javaType, realVariableName);
+
+ if (xmlTransient == false)
+ {
+ // define XmlElement annotation for variable
+ JAnnotationUse annotation = field.annotate(XmlElement.class);
+ annotation.param("name", name.getLocalPart());
+ if (name.getNamespaceURI() != null)
+ {
+ annotation.param("namespace", name.getNamespaceURI());
+ }
+ }
+ else
+ {
+ //XmlTransient
+ field.annotate(XmlTransient.class);
+ }
+ // generate acessor get method for variable
+ JMethod method = clazz.method(JMod.PUBLIC, javaType, getterPrefix(javaType) + JavaUtils.capitalize(variable));
+ method.body()._return(JExpr._this().ref(realVariableName));
+
+ // generate acessor set method for variable
+ method = clazz.method(JMod.PUBLIC, void.class, "set" + JavaUtils.capitalize(variable));
+ method.body().assign(JExpr._this().ref(realVariableName), method.param(javaType, realVariableName));
+ }
+
private static void addClassAnnotations(JDefinedClass clazz, QName xmlName, QName xmlType, String[] propertyOrder)
{
// define XmlRootElement class annotation
15 years, 11 months
JBossWS SVN: r9071 - in legacy: tags and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2009-01-20 06:32:58 -0500 (Tue, 20 Jan 2009)
New Revision: 9071
Added:
legacy/tags/jbossws-1.2.1.GA_CP04/
Removed:
legacy/branches/jbossws-1.2.1.GA_CP04/
Log:
[JBPAPP-734] Tagging jbossws 1.2.1.GA_CP04
Copied: legacy/tags/jbossws-1.2.1.GA_CP04 (from rev 9070, legacy/branches/jbossws-1.2.1.GA_CP04)
15 years, 11 months
JBossWS SVN: r9070 - legacy/branches/jbossws-1.2.1.GA_CP04/build.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2009-01-20 06:01:08 -0500 (Tue, 20 Jan 2009)
New Revision: 9070
Modified:
legacy/branches/jbossws-1.2.1.GA_CP04/build/version.properties
Log:
[JBPAPP-734] Updating version
Modified: legacy/branches/jbossws-1.2.1.GA_CP04/build/version.properties
===================================================================
--- legacy/branches/jbossws-1.2.1.GA_CP04/build/version.properties 2009-01-20 10:56:16 UTC (rev 9069)
+++ legacy/branches/jbossws-1.2.1.GA_CP04/build/version.properties 2009-01-20 11:01:08 UTC (rev 9070)
@@ -5,8 +5,8 @@
specification.vendor=JBoss (http://www.jboss.org)
specification.version=jbossws-1.2
-version.id=1.2.1.GA_CP01
-repository.id=1.2.1.GA_CP01
+version.id=1.2.1.GA_CP04
+repository.id=1.2.1.GA_CP04
implementation.title=JBoss Web Services (JBossWS)
implementation.url=http://www.jboss.org/products/jbossws
15 years, 11 months
JBossWS SVN: r9069 - in legacy/branches: jbossws-1.2.1.GA_CP04/build/hudson/hudson-home and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2009-01-20 05:56:16 -0500 (Tue, 20 Jan 2009)
New Revision: 9069
Added:
legacy/branches/jbossws-1.2.1.GA_CP/build/hudson/hudson-home/config.xml
legacy/branches/jbossws-1.2.1.GA_CP04/build/hudson/hudson-home/config.xml
Log:
[JBPAPP-1634] Restoring hudson config (modified)
Added: legacy/branches/jbossws-1.2.1.GA_CP/build/hudson/hudson-home/config.xml
===================================================================
--- legacy/branches/jbossws-1.2.1.GA_CP/build/hudson/hudson-home/config.xml (rev 0)
+++ legacy/branches/jbossws-1.2.1.GA_CP/build/hudson/hudson-home/config.xml 2009-01-20 10:56:16 UTC (rev 9069)
@@ -0,0 +1,136 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<hudson>
+ <numExecutors>1</numExecutors>
+ <useSecurity>true</useSecurity>
+ <systemMessage>
+<![CDATA[
+ <h2>JBossWS-(a)version.id@ QA Environment</h2>
+
+ <table>
+ <tr><th align=left>SVN:</th><td>@svn.url@</td></tr>
+ </table>
+ <p/>
+
+ <b>Target Container</b>
+ <p/>
+
+ <table>
+ <tr><th align=left>@hudson.jboss42.build@</th><td>-r(a)hudson.jboss42.rev@ @hudson.jboss42.url@</td></tr>
+ </table>
+]]>
+ </systemMessage>
+ <jdks/>
+ <slaves/>
+ <quietPeriod>5</quietPeriod>
+ <views>
+
+ <!-- JBossAS Testsuite -->
+ <view>
+ <owner reference="../../.."/>
+ <jobNames class="tree-set">
+ <no-comparator/>
+ <string>JBAS-Tests-AS-4.2</string>
+ </jobNames>
+ <name>JBossAS Testsuite</name>
+ <description>
+<![CDATA[
+ Run the JBossAS webservice testsuite.
+ <p/>
+ Make sure you have sucessfuly build the <a href="/hudson/view/Target%20Container">Target Container</a>
+]]>
+ </description>
+ </view>
+
+ <!-- JBossWS Local Testsuite
+ <view>
+ <owner reference="../../.."/>
+ <jobNames class="tree-set">
+ <no-comparator/>
+ <string>JBWS-Local-Sanity-AS-5.0</string>
+ <string>JBWS-Local-Sanity-AS-4.2</string>
+ <string>JBWS-Local-Tests-AS-5.0</string>
+ <string>JBWS-Local-Tests-AS-4.2</string>
+ </jobNames>
+ <name>JBossWS Local Testsuite</name>
+ <description>
+<![CDATA[
+ Run the JBossWS testsuite from: @svn.basedir.local@
+ <p/>
+ Make sure you have sucessfuly build the <a href="/hudson/view/Target%20Container">Target Container</a>
+]]>
+ </description>
+ </view>
+ -->
+
+ <!-- JBossWS Testsuite -->
+ <view>
+ <owner reference="../../.."/>
+ <jobNames class="tree-set">
+ <no-comparator/>
+ <string>JBWS-Tests-AS-4.2</string>
+ </jobNames>
+ <name>JBossWS Testsuite</name>
+ <description>
+<![CDATA[
+ Run the JBossWS testsuite.
+ <p/>
+ Make sure you have sucessfuly build the <a href="/hudson/view/Target%20Container">Target Container</a>
+]]>
+ </description>
+ </view>
+
+ <!-- JBossWS Samples -->
+ <view>
+ <owner reference="../../.."/>
+ <jobNames class="tree-set">
+ <no-comparator/>
+ <string>JBWS-Samples-AS-4.2</string>
+ </jobNames>
+ <name>JBossWS Samples</name>
+ <description>
+<![CDATA[
+ Run the JBossWS samples.
+ <p/>
+ Make sure you have sucessfuly build the <a href="/hudson/view/Target%20Container">Target Container</a>
+]]>
+ </description>
+ </view>
+
+ <!-- Release QA -->
+ <view>
+ <owner reference="../../.."/>
+ <jobNames class="tree-set">
+ <no-comparator/>
+ <string>Release-Matrix-Step1</string>
+ <string>Release-Matrix-Step2</string>
+ </jobNames>
+ <name>Release QA</name>
+ <description>
+<![CDATA[
+A collection of jobs that covers the JBossWS release matrix.
+<p/>
+<table border=1>
+<tr><th> </th><th>JBWS-Tests</th><th>JBAS-Tests</th><th>JBWS-Samples</th></tr>
+<tr align=center><th align=left>AS-4.2</th><td>ok</td><td>ok</td><td>ok</td></tr>
+</table>
+]]>
+ </description>
+ </view>
+
+ <!-- Target Container -->
+ <view>
+ <owner reference="../../.."/>
+ <jobNames class="tree-set">
+ <no-comparator/>
+ <string>AS-4.2</string>
+ </jobNames>
+ <name>Target Container</name>
+ <description>
+<![CDATA[
+ Build the supported target container. A successful build is a prerequisite for any testrun that targets the container.
+]]>
+ </description>
+ </view>
+
+ </views>
+</hudson>
Property changes on: legacy/branches/jbossws-1.2.1.GA_CP/build/hudson/hudson-home/config.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: legacy/branches/jbossws-1.2.1.GA_CP04/build/hudson/hudson-home/config.xml
===================================================================
--- legacy/branches/jbossws-1.2.1.GA_CP04/build/hudson/hudson-home/config.xml (rev 0)
+++ legacy/branches/jbossws-1.2.1.GA_CP04/build/hudson/hudson-home/config.xml 2009-01-20 10:56:16 UTC (rev 9069)
@@ -0,0 +1,136 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<hudson>
+ <numExecutors>1</numExecutors>
+ <useSecurity>true</useSecurity>
+ <systemMessage>
+<![CDATA[
+ <h2>JBossWS-(a)version.id@ QA Environment</h2>
+
+ <table>
+ <tr><th align=left>SVN:</th><td>@svn.url@</td></tr>
+ </table>
+ <p/>
+
+ <b>Target Container</b>
+ <p/>
+
+ <table>
+ <tr><th align=left>@hudson.jboss42.build@</th><td>-r(a)hudson.jboss42.rev@ @hudson.jboss42.url@</td></tr>
+ </table>
+]]>
+ </systemMessage>
+ <jdks/>
+ <slaves/>
+ <quietPeriod>5</quietPeriod>
+ <views>
+
+ <!-- JBossAS Testsuite -->
+ <view>
+ <owner reference="../../.."/>
+ <jobNames class="tree-set">
+ <no-comparator/>
+ <string>JBAS-Tests-AS-4.2</string>
+ </jobNames>
+ <name>JBossAS Testsuite</name>
+ <description>
+<![CDATA[
+ Run the JBossAS webservice testsuite.
+ <p/>
+ Make sure you have sucessfuly build the <a href="/hudson/view/Target%20Container">Target Container</a>
+]]>
+ </description>
+ </view>
+
+ <!-- JBossWS Local Testsuite
+ <view>
+ <owner reference="../../.."/>
+ <jobNames class="tree-set">
+ <no-comparator/>
+ <string>JBWS-Local-Sanity-AS-5.0</string>
+ <string>JBWS-Local-Sanity-AS-4.2</string>
+ <string>JBWS-Local-Tests-AS-5.0</string>
+ <string>JBWS-Local-Tests-AS-4.2</string>
+ </jobNames>
+ <name>JBossWS Local Testsuite</name>
+ <description>
+<![CDATA[
+ Run the JBossWS testsuite from: @svn.basedir.local@
+ <p/>
+ Make sure you have sucessfuly build the <a href="/hudson/view/Target%20Container">Target Container</a>
+]]>
+ </description>
+ </view>
+ -->
+
+ <!-- JBossWS Testsuite -->
+ <view>
+ <owner reference="../../.."/>
+ <jobNames class="tree-set">
+ <no-comparator/>
+ <string>JBWS-Tests-AS-4.2</string>
+ </jobNames>
+ <name>JBossWS Testsuite</name>
+ <description>
+<![CDATA[
+ Run the JBossWS testsuite.
+ <p/>
+ Make sure you have sucessfuly build the <a href="/hudson/view/Target%20Container">Target Container</a>
+]]>
+ </description>
+ </view>
+
+ <!-- JBossWS Samples -->
+ <view>
+ <owner reference="../../.."/>
+ <jobNames class="tree-set">
+ <no-comparator/>
+ <string>JBWS-Samples-AS-4.2</string>
+ </jobNames>
+ <name>JBossWS Samples</name>
+ <description>
+<![CDATA[
+ Run the JBossWS samples.
+ <p/>
+ Make sure you have sucessfuly build the <a href="/hudson/view/Target%20Container">Target Container</a>
+]]>
+ </description>
+ </view>
+
+ <!-- Release QA -->
+ <view>
+ <owner reference="../../.."/>
+ <jobNames class="tree-set">
+ <no-comparator/>
+ <string>Release-Matrix-Step1</string>
+ <string>Release-Matrix-Step2</string>
+ </jobNames>
+ <name>Release QA</name>
+ <description>
+<![CDATA[
+A collection of jobs that covers the JBossWS release matrix.
+<p/>
+<table border=1>
+<tr><th> </th><th>JBWS-Tests</th><th>JBAS-Tests</th><th>JBWS-Samples</th></tr>
+<tr align=center><th align=left>AS-4.2</th><td>ok</td><td>ok</td><td>ok</td></tr>
+</table>
+]]>
+ </description>
+ </view>
+
+ <!-- Target Container -->
+ <view>
+ <owner reference="../../.."/>
+ <jobNames class="tree-set">
+ <no-comparator/>
+ <string>AS-4.2</string>
+ </jobNames>
+ <name>Target Container</name>
+ <description>
+<![CDATA[
+ Build the supported target container. A successful build is a prerequisite for any testrun that targets the container.
+]]>
+ </description>
+ </view>
+
+ </views>
+</hudson>
Property changes on: legacy/branches/jbossws-1.2.1.GA_CP04/build/hudson/hudson-home/config.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
15 years, 11 months