You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2008/08/21 18:40:07 UTC
svn commit: r687800 - in /cxf/branches/2.1.x-fixes: ./
common/common/src/main/java/org/apache/cxf/common/classloader/
rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/
rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/
rt/frontend/jaxws/...
Author: dkulp
Date: Thu Aug 21 09:40:06 2008
New Revision: 687800
URL: http://svn.apache.org/viewvc?rev=687800&view=rev
Log:
Merged revisions 687798 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r687798 | dkulp | 2008-08-21 12:36:22 -0400 (Thu, 21 Aug 2008) | 2 lines
[CXF-1735] Allow wrapper parts to be individually qualified in code first cases
........
Modified:
cxf/branches/2.1.x-fixes/ (props changed)
cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/common/classloader/ClassLoaderUtils.java
cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/WrapperClassGenerator.java
cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/ArrayService.java
cxf/branches/2.1.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java
cxf/branches/2.1.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/DefaultServiceConfiguration.java
cxf/branches/2.1.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Aug 21 09:40:06 2008
@@ -1 +1 @@
-/cxf/trunk:686333-686363,686764,686820,687096,687363,687387,687463,687543,687722
+/cxf/trunk:686333-686363,686764,686820,687096,687363,687387,687463,687543,687722,687798
Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Aug 21 09:40:06 2008
@@ -1 +1 @@
-/cxf/trunk:1-686342,686344-686363,686764,686820,687096,687363,687387,687463,687543,687722
+/cxf/trunk:1-686342,686344-686363,686764,686820,687096,687363,687387,687463,687543,687722,687798
Modified: cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/common/classloader/ClassLoaderUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/common/classloader/ClassLoaderUtils.java?rev=687800&r1=687799&r2=687800&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/common/classloader/ClassLoaderUtils.java (original)
+++ cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/common/classloader/ClassLoaderUtils.java Thu Aug 21 09:40:06 2008
@@ -120,12 +120,11 @@
if (cl != null) {
return cl.loadClass(className);
- }
-
- return loadClass2(className, callingClass);
+ }
} catch (ClassNotFoundException e) {
- return loadClass2(className, callingClass);
+ //ignore
}
+ return loadClass2(className, callingClass);
}
private static Class<?> loadClass2(String className, Class<?> callingClass)
@@ -134,10 +133,15 @@
return Class.forName(className);
} catch (ClassNotFoundException ex) {
try {
- return ClassLoaderUtils.class.getClassLoader().loadClass(className);
+ if (ClassLoaderUtils.class.getClassLoader() != null) {
+ return ClassLoaderUtils.class.getClassLoader().loadClass(className);
+ }
} catch (ClassNotFoundException exc) {
- return callingClass.getClassLoader().loadClass(className);
+ if (callingClass != null && callingClass.getClassLoader() != null) {
+ return callingClass.getClassLoader().loadClass(className);
+ }
}
+ throw ex;
}
}
}
Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/WrapperClassGenerator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/WrapperClassGenerator.java?rev=687800&r1=687799&r2=687800&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/WrapperClassGenerator.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/WrapperClassGenerator.java Thu Aug 21 09:40:06 2008
@@ -31,6 +31,8 @@
import java.util.Set;
import java.util.logging.Logger;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
import javax.xml.bind.annotation.XmlAttachmentRef;
import javax.xml.bind.annotation.XmlList;
import javax.xml.bind.annotation.XmlMimeType;
@@ -293,6 +295,22 @@
AnnotationVisitor av0 = fv.visitAnnotation("Ljavax/xml/bind/annotation/XmlElement;", true);
av0.visit("name", name);
+
+
+ Annotation[] a = (Annotation[])mpi.getProperty(ReflectionServiceFactoryBean.PARAM_ANNOTATION);
+ if (a != null) {
+ for (Annotation an : a) {
+ String tns = null;
+ if (an instanceof WebParam) {
+ tns = ((WebParam)an).targetNamespace();
+ } else if (an instanceof WebResult) {
+ tns = ((WebResult)an).targetNamespace();
+ }
+ if (tns != null && !StringUtils.isEmpty(tns)) {
+ av0.visit("namespace", tns);
+ }
+ }
+ }
av0.visitEnd();
List<Annotation> jaxbAnnos = getJaxbAnnos(mpi);
Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java?rev=687800&r1=687799&r2=687800&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java Thu Aug 21 09:40:06 2008
@@ -52,6 +52,7 @@
import org.apache.cxf.service.factory.ServiceConstructionException;
import org.apache.cxf.service.model.InterfaceInfo;
import org.apache.cxf.service.model.MessageInfo;
+import org.apache.cxf.service.model.MessagePartInfo;
import org.apache.cxf.service.model.OperationInfo;
public class JaxWsServiceConfiguration extends AbstractServiceConfiguration {
@@ -750,6 +751,24 @@
}
return cls;
- }
+ }
+
+ public Boolean isWrapperPartQualified(MessagePartInfo mpi) {
+ Annotation[] annotations = (Annotation[])mpi.getProperty("parameter.annotations");
+ if (annotations != null) {
+ for (Annotation an : annotations) {
+ String tns = null;
+ if (an instanceof WebParam) {
+ tns = ((WebParam)an).targetNamespace();
+ } else if (an instanceof WebResult) {
+ tns = ((WebResult)an).targetNamespace();
+ }
+ if (tns != null && !StringUtils.isEmpty(tns)) {
+ return Boolean.TRUE;
+ }
+ }
+ }
+ return null;
+ }
}
Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/ArrayService.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/ArrayService.java?rev=687800&r1=687799&r2=687800&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/ArrayService.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/ArrayService.java Thu Aug 21 09:40:06 2008
@@ -48,6 +48,7 @@
@WebMethod
List<String> listOutput();
@WebMethod
- String listInput(@WebParam(name = "input")List<String> inputs);
+ String listInput(@WebParam(name = "input",
+ targetNamespace = "http://service.jaxws.cxf.apache.org/") List<String> inputs);
}
Modified: cxf/branches/2.1.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java?rev=687800&r1=687799&r2=687800&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java Thu Aug 21 09:40:06 2008
@@ -192,6 +192,9 @@
public Boolean isWrapperPartNillable(MessagePartInfo mpi) {
return null;
}
+ public Boolean isWrapperPartQualified(MessagePartInfo mpi) {
+ return null;
+ }
public Long getWrapperPartMaxOccurs(MessagePartInfo mpi) {
//return Long.MAX_VALUE for unbounded
return null;
Modified: cxf/branches/2.1.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/DefaultServiceConfiguration.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/DefaultServiceConfiguration.java?rev=687800&r1=687799&r2=687800&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/DefaultServiceConfiguration.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/DefaultServiceConfiguration.java Thu Aug 21 09:40:06 2008
@@ -285,8 +285,7 @@
}
return rawClass;
}
-
-
+
public Boolean isWrapperPartNillable(MessagePartInfo mpi) {
return (Boolean)mpi.getProperty("nillable");
}
Modified: cxf/branches/2.1.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=687800&r1=687799&r2=687800&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java Thu Aug 21 09:40:06 2008
@@ -56,6 +56,7 @@
import org.apache.cxf.catalog.CatalogXmlSchemaURIResolver;
import org.apache.cxf.common.i18n.Message;
import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.StringUtils;
import org.apache.cxf.common.xmlschema.SchemaCollection;
import org.apache.cxf.common.xmlschema.XmlSchemaTools;
import org.apache.cxf.databinding.DataBinding;
@@ -1129,6 +1130,19 @@
long min = getWrapperPartMinOccurs(mpi);
long max = getWrapperPartMaxOccurs(mpi);
boolean nillable = isWrapperPartNillable(mpi);
+ Boolean qualified = isWrapperPartQualified(mpi);
+ if (qualified == null) {
+ qualified = this.isQualifyWrapperSchema();
+ }
+ if (qualified
+ && StringUtils.isEmpty(mpi.getConcreteName().getNamespaceURI())) {
+ QName newName = new QName(wrapperName.getNamespaceURI(),
+ mpi.getConcreteName().getLocalPart());
+ mpi.setElement(true);
+ mpi.setElementQName(newName);
+ mpi.setConcreteName(newName);
+ XmlSchemaTools.setElementQName(el, newName);
+ }
if (Collection.class.isAssignableFrom(mpi.getTypeClass())
&& mpi.getTypeClass().isInterface()) {
@@ -1967,6 +1981,15 @@
return null;
}
+ public Boolean isWrapperPartQualified(MessagePartInfo mpi) {
+ for (AbstractServiceConfiguration c : serviceConfigurations) {
+ Boolean b = c.isWrapperPartQualified(mpi);
+ if (b != null) {
+ return b;
+ }
+ }
+ return false;
+ }
public boolean isWrapperPartNillable(MessagePartInfo mpi) {
for (AbstractServiceConfiguration c : serviceConfigurations) {
Boolean b = c.isWrapperPartNillable(mpi);