cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r687798 - in /cxf/trunk: 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/src/test/java/org/...
Date Thu, 21 Aug 2008 16:36:23 GMT
Author: dkulp
Date: Thu Aug 21 09:36:22 2008
New Revision: 687798

URL: http://svn.apache.org/viewvc?rev=687798&view=rev
Log:
[CXF-1735] Allow wrapper parts to be individually qualified in code first cases

Modified:
    cxf/trunk/common/common/src/main/java/org/apache/cxf/common/classloader/ClassLoaderUtils.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/WrapperClassGenerator.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
    cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/ArrayService.java
    cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java
    cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/DefaultServiceConfiguration.java
    cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/common/classloader/ClassLoaderUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/classloader/ClassLoaderUtils.java?rev=687798&r1=687797&r2=687798&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/common/classloader/ClassLoaderUtils.java
(original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/common/classloader/ClassLoaderUtils.java
Thu Aug 21 09:36:22 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/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/WrapperClassGenerator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/WrapperClassGenerator.java?rev=687798&r1=687797&r2=687798&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/WrapperClassGenerator.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/WrapperClassGenerator.java
Thu Aug 21 09:36:22 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/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java?rev=687798&r1=687797&r2=687798&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
Thu Aug 21 09:36:22 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/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/ArrayService.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/ArrayService.java?rev=687798&r1=687797&r2=687798&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/ArrayService.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/ArrayService.java
Thu Aug 21 09:36:22 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/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java?rev=687798&r1=687797&r2=687798&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java
(original)
+++ cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java
Thu Aug 21 09:36:22 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/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/DefaultServiceConfiguration.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/DefaultServiceConfiguration.java?rev=687798&r1=687797&r2=687798&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/DefaultServiceConfiguration.java
(original)
+++ cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/DefaultServiceConfiguration.java
Thu Aug 21 09:36:22 2008
@@ -285,8 +285,7 @@
         }
         return rawClass;
     }
-    
-    
+
     public Boolean isWrapperPartNillable(MessagePartInfo mpi) {
         return (Boolean)mpi.getProperty("nillable");
     }

Modified: cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=687798&r1=687797&r2=687798&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
(original)
+++ cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
Thu Aug 21 09:36:22 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);



Mime
View raw message