Author: alessio.soldano(a)jboss.com
Date: 2009-01-21 08:05:23 -0500 (Wed, 21 Jan 2009)
New Revision: 9077
Modified:
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/core/jaxws/DynamicWrapperGenerator.java
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/metadata/umdm/WrappedParameter.java
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/SunRIConsumerImpl.java
Log:
[JBWS-2451] Support @XmlList on SEI when producing wrapper beans and wsdl
Modified:
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/core/jaxws/DynamicWrapperGenerator.java
===================================================================
---
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/core/jaxws/DynamicWrapperGenerator.java 2009-01-21
12:17:26 UTC (rev 9076)
+++
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/core/jaxws/DynamicWrapperGenerator.java 2009-01-21
13:05:23 UTC (rev 9077)
@@ -41,6 +41,7 @@
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttachmentRef;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlList;
import javax.xml.bind.annotation.XmlMimeType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
@@ -122,7 +123,8 @@
parameter.getName(), parameter.getVariable(),
parameter.getTypeArguments(),
new boolean[] {parameter.isSwaRef(), parameter.isXop()},
- false
+ false,
+ parameter.isXmlList()
);
}
clazz.stopPruning(!prune);
@@ -159,7 +161,7 @@
addProperty(
clazz, prop.getReturnType().getName(),
new QName(prop.getName()), prop.getName(), null,
- new boolean[] {false, false}, prop.isTransientAnnotated()
+ new boolean[] {false, false}, prop.isTransientAnnotated(), false
);
clazz.stopPruning(!prune);
@@ -216,7 +218,7 @@
private void addProperty(CtClass clazz, String typeName,
QName name, String variable, String[] typeArguments,
- boolean[] attachments, boolean xmlTransient)
+ boolean[] attachments, boolean xmlTransient, boolean
xmlList)
throws CannotCompileException, NotFoundException
{
ConstPool constPool = clazz.getClassFile().getConstPool();
@@ -261,6 +263,12 @@
annotation = JavassistUtils.createAnnotation(XmlTransient.class, constPool);
annotation.markField(field);
}
+ //@XmlList
+ if(xmlList)
+ {
+ annotation = JavassistUtils.createAnnotation(XmlList.class, constPool);
+ annotation.markField(field);
+ }
clazz.addField(field);
// Add accessor methods
Modified:
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java
===================================================================
---
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java 2009-01-21
12:17:26 UTC (rev 9076)
+++
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java 2009-01-21
13:05:23 UTC (rev 9077)
@@ -43,6 +43,7 @@
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPMessageHandlers;
import javax.jws.soap.SOAPBinding.ParameterStyle;
+import javax.xml.bind.annotation.XmlList;
import javax.xml.bind.annotation.XmlType;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
@@ -455,7 +456,16 @@
return null;
}
+
+ private XmlList getXmlListAnnotation(Method method, int pos)
+ {
+ for (Annotation annotation : method.getParameterAnnotations()[pos])
+ if (annotation instanceof XmlList)
+ return (XmlList)annotation;
+ return null;
+ }
+
private QName getWebParamName(OperationMetaData opMetaData, int index, WebParam
webParam)
{
String namespace = null;
@@ -656,6 +666,7 @@
WrappedParameter wrappedParameter = new WrappedParameter(wrappedElementName,
javaTypeName, variable, i);
wrappedParameter.setTypeArguments(convertTypeArguments(javaType,
genericType));
+ wrappedParameter.setXmlList(getXmlListAnnotation(method, i) != null);
if (mode != ParameterMode.OUT)
wrappedParameters.add(wrappedParameter);
@@ -723,6 +734,7 @@
{
WrappedParameter wrapped = new WrappedParameter(xmlName, returnTypeName,
convertToVariable(xmlName.getLocalPart()), -1);
wrapped.setTypeArguments(convertTypeArguments(returnType,
genericReturnType));
+ wrapped.setXmlList(method.getAnnotation(XmlList.class) != null);
// insert at the beginning just for prettiness
wrappedOutputParameters.add(0, wrapped);
Modified:
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/metadata/umdm/WrappedParameter.java
===================================================================
---
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/metadata/umdm/WrappedParameter.java 2009-01-21
12:17:26 UTC (rev 9076)
+++
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/metadata/umdm/WrappedParameter.java 2009-01-21
13:05:23 UTC (rev 9077)
@@ -43,6 +43,7 @@
private Accessor accessor;
private boolean swaRef;
private boolean xop;
+ private boolean xmlList;
public WrappedParameter(WrappedParameter wrapped)
{
@@ -153,6 +154,16 @@
this.xop = xop;
}
+ public boolean isXmlList()
+ {
+ return xmlList;
+ }
+
+ public void setXmlList(boolean xmlList)
+ {
+ this.xmlList = xmlList;
+ }
+
public String toString()
{
return "[name = " + getName() + ", type = " + getType() +
", typeArgs = " + JavaUtils.printArray(getTypeArguments()) + ", variable =
" + getVariable()
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-21
12:17:26 UTC (rev 9076)
+++
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/tools/jaxws/impl/SourceWrapperGenerator.java 2009-01-21
13:05:23 UTC (rev 9077)
@@ -31,6 +31,7 @@
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlList;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
@@ -110,7 +111,7 @@
addClassAnnotations(clazz, parameterMD.getXmlName(), parameterMD.getXmlType(),
null);
for (WrappedParameter wrapped : wrappedParameters)
{
- addProperty(clazz, wrapped.getType(), wrapped.getName(),
wrapped.getVariable(), wrapped.getTypeArguments(), false, loader);
+ addProperty(clazz, wrapped.getType(), wrapped.getName(),
wrapped.getVariable(), wrapped.getTypeArguments(), false, wrapped.isXmlList(), loader);
}
}
catch (Exception e)
@@ -135,7 +136,7 @@
for (String property : propertyOrder)
{
ExceptionProperty p = properties.get(property);
- addProperty(clazz, p.getReturnType().getName(), new QName(property),
property, null, p.isTransientAnnotated(), loader);
+ addProperty(clazz, p.getReturnType().getName(), new QName(property),
property, null, p.isTransientAnnotated(), false, loader);
}
}
catch (Exception e)
@@ -149,7 +150,7 @@
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)
+ private void addProperty(JDefinedClass clazz, String typeName, QName name, String
variable, String[] typeArguments, boolean xmlTransient, boolean xmlList, ClassLoader
loader)
throws Exception
{
// define variable
@@ -160,11 +161,11 @@
}
else
{
- addProperty(clazz, javaType, name, variable, typeArguments, xmlTransient,
codeModel);
+ addProperty(clazz, javaType, name, variable, typeArguments, xmlTransient,
xmlList, codeModel);
}
}
- private static void addProperty(JDefinedClass clazz, Class<?> javaType, QName
name, String variable, String[] typeArguments, boolean xmlTransient, JCodeModel
codeModel)
+ private static void addProperty(JDefinedClass clazz, Class<?> javaType, QName
name, String variable, String[] typeArguments, boolean xmlTransient, boolean xmlList,
JCodeModel codeModel)
throws Exception
{
// be careful about reserved keywords when generating variable names
@@ -198,6 +199,11 @@
//XmlTransient
field.annotate(XmlTransient.class);
}
+
+ if (xmlList)
+ {
+ field.annotate(XmlList.class);
+ }
// generate acessor get method for variable
JMethod method = clazz.method(JMod.PUBLIC, type, getterPrefix(javaType) +
JavaUtils.capitalize(variable));
Modified:
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/tools/jaxws/impl/SunRIConsumerImpl.java
===================================================================
---
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/tools/jaxws/impl/SunRIConsumerImpl.java 2009-01-21
12:17:26 UTC (rev 9076)
+++
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/tools/jaxws/impl/SunRIConsumerImpl.java 2009-01-21
13:05:23 UTC (rev 9077)
@@ -51,7 +51,7 @@
private PrintStream messageStream;
private String wsdlLocation;
private List<String> additionalCompilerClassPath = new
ArrayList<String>();
- private String target = "2.0";
+ private String target = "2.1";
@Override
public void setBindingFiles(List<File> bindingFiles)
@@ -198,8 +198,8 @@
args.add(outputDir.getAbsolutePath());
// Always set the target
- if(!target.equals("2.0"))
- throw new IllegalArgumentException("WSConsume (native) only supports JAX-WS
2.0");
+ if(!target.equals("2.0") && !target.equals("2.1"))
+ throw new IllegalArgumentException("WSConsume (native) only supports JAX-WS
2.0 and 2.1");
args.add("-target");
args.add(target);