cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1081901 - in /cxf/trunk: rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/ rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/ rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/ systests/databin...
Date Tue, 15 Mar 2011 18:48:13 GMT
Author: dkulp
Date: Tue Mar 15 18:48:13 2011
New Revision: 1081901

URL: http://svn.apache.org/viewvc?rev=1081901&view=rev
Log:
[CXF-3402] Don't use the WebParam info for the type names.  That's
against jaxws spec.   Thus, collections and arrays get mapped the same.

Modified:
    cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeMapping.java
    cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/AnnotationReader.java
    cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/Java5TypeCreator.java
    cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbXmlParamTypeTest.java
    cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireXmlParamTypeTest.java
    cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XmlParamTypeTest.java
    cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisJaxWs.java
    cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/mtom/fortest/MtomTestService.java

Modified: cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeMapping.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeMapping.java?rev=1081901&r1=1081900&r2=1081901&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeMapping.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeMapping.java
Tue Mar 15 18:48:13 2011
@@ -99,7 +99,7 @@ public class DefaultTypeMapping implemen
     }
 
     public DefaultTypeMapping(String identifierURI) {
-        this.identifierURI = identifierURI;
+        this.identifierURI = identifierURI == null ? DEFAULT_MAPPING_URI : identifierURI;
         class2Type = Collections.synchronizedMap(new HashMap<Type, AegisType>());
         class2xml = Collections.synchronizedMap(new HashMap<Type, QName>());
         xml2Type = Collections.synchronizedMap(new HashMap<QName, AegisType>());

Modified: cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/AnnotationReader.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/AnnotationReader.java?rev=1081901&r1=1081900&r2=1081901&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/AnnotationReader.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/AnnotationReader.java
Tue Mar 15 18:48:13 2011
@@ -140,22 +140,20 @@ public class AnnotationReader {
     }
 
     @SuppressWarnings("unchecked")
-    public String getParamName(Method method, int index) {
+    public String getParamTypeName(Method method, int index) {
         return (String) getAnnotationValue("name",
                 method,
                 index,
                 AegisType.class,
-                XmlParamType.class,
-                WEB_PARAM);
+                XmlParamType.class);
     }
 
     @SuppressWarnings("unchecked")
-    public String getReturnName(AnnotatedElement element) {
+    public String getReturnTypeName(AnnotatedElement element) {
         return (String) getAnnotationValue("name",
                 element,
                 "",
-                XmlReturnType.class,
-                WEB_RESULT);
+                XmlReturnType.class);
     }
 
     @SuppressWarnings("unchecked")

Modified: cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/Java5TypeCreator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/Java5TypeCreator.java?rev=1081901&r1=1081900&r2=1081901&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/Java5TypeCreator.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/Java5TypeCreator.java
Tue Mar 15 18:48:13 2011
@@ -24,6 +24,7 @@ import java.lang.reflect.ParameterizedTy
 import java.lang.reflect.Type;
 import java.lang.reflect.WildcardType;
 import java.util.Collection;
+import java.util.List;
 import java.util.Map;
 
 import javax.xml.namespace.QName;
@@ -74,14 +75,13 @@ public class Java5TypeCreator extends Ab
 
             Class paramTypeClass = annotationReader.getParamType(m, index);
             info.setAegisTypeClass(castToAegisTypeClass(paramTypeClass));
-
-            String paramName = annotationReader.getParamName(m, index);
+            String paramName = annotationReader.getParamTypeName(m, index);
             if (paramName != null) {
                 info.setTypeName(createQName(m.getParameterTypes()[index],
-                        paramName,
-                        annotationReader.getParamNamespace(m, index)));
+                                             genericType,
+                                             paramName,
+                                             annotationReader.getParamNamespace(m, index)));
             }
-
             return info;
         } else {
             Type genericReturnType = m.getGenericReturnType();
@@ -99,14 +99,14 @@ public class Java5TypeCreator extends Ab
             }
 
             info.setAegisTypeClass(castToAegisTypeClass(annotationReader.getReturnType(m)));
-
-            String returnName = annotationReader.getReturnName(m);
+            String returnName = annotationReader.getReturnTypeName(m);
             if (returnName != null) {
                 info.setTypeName(createQName(m.getReturnType(),
-                        returnName,
-                        annotationReader.getReturnNamespace(m)));
+                                             genericReturnType,
+                                             returnName,
+                                             annotationReader.getReturnNamespace(m)));
+                
             }
-
             return info;
         }
     }
@@ -243,14 +243,24 @@ public class Java5TypeCreator extends Ab
     public QName createQName(Class typeClass) {
         String name = annotationReader.getName(typeClass);
         String ns = annotationReader.getNamespace(typeClass);
-        return createQName(typeClass, name, ns);
+        return createQName(typeClass, null, name, ns);
     }
 
-    private QName createQName(Class typeClass, String name, String ns) {
+    private QName createQName(Class typeClass, Type type, String name, String ns) {
+        if (typeClass.isArray()) {
+            typeClass = typeClass.getComponentType();
+        }
+        if (List.class.isAssignableFrom(typeClass)
+            && type instanceof ParameterizedType) {
+            type = ((ParameterizedType)type).getActualTypeArguments()[0];
+            if (type instanceof Class) {
+                typeClass = (Class)type;
+            }
+        }
+        
         if (name == null || name.length() == 0) {
             name = ServiceUtils.makeServiceNameFromClassName(typeClass);
         }
-        
         //check from aegis type annotation
         if (ns == null || ns.length() == 0) {
             ns = annotationReader.getNamespace(typeClass);

Modified: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbXmlParamTypeTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbXmlParamTypeTest.java?rev=1081901&r1=1081900&r2=1081901&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbXmlParamTypeTest.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbXmlParamTypeTest.java
Tue Mar 15 18:48:13 2011
@@ -18,14 +18,11 @@
  */
 package org.apache.cxf.aegis.type.java5;
 
-import java.lang.reflect.Method;
 
 import javax.jws.WebParam;
 import javax.jws.WebResult;
-import javax.xml.namespace.QName;
 
 import org.apache.cxf.aegis.AbstractAegisTest;
-import org.apache.cxf.aegis.type.AegisType;
 import org.apache.cxf.aegis.type.DefaultTypeCreator;
 import org.apache.cxf.aegis.type.DefaultTypeMapping;
 import org.apache.cxf.aegis.type.TypeCreationOptions;
@@ -41,27 +38,14 @@ public class JaxbXmlParamTypeTest extend
     public void setUp() throws Exception {
         super.setUp();
 
-        tm = new DefaultTypeMapping();
+        tm = new DefaultTypeMapping(null, 
+                                    DefaultTypeMapping.createDefaultTypeMapping(false, false));
         creator = new Java5TypeCreator();
         creator.setNextCreator(new DefaultTypeCreator());
         creator.setConfiguration(new TypeCreationOptions());
         tm.setTypeCreator(creator);
     }
 
-    @Test
-    public void testType() throws Exception {
-        Method m = CustomTypeService.class.getMethod("doFoo", new Class[] {String.class});
-
-        AegisType type = creator.createType(m, 0);
-        tm.register(type);
-        assertTrue(type instanceof org.apache.cxf.aegis.type.basic.BeanType);
-        assertEquals(new QName("urn:xfire:foo", "custom"), type.getSchemaType());
-
-        type = creator.createType(m, -1);
-        tm.register(type);
-        assertTrue(type instanceof org.apache.cxf.aegis.type.basic.BeanType);
-        assertEquals(new QName("urn:xfire:foo", "custom"), type.getSchemaType());
-    }
 
     @Test
     public void testMapServiceWSDL() throws Exception {

Modified: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireXmlParamTypeTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireXmlParamTypeTest.java?rev=1081901&r1=1081900&r2=1081901&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireXmlParamTypeTest.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireXmlParamTypeTest.java
Tue Mar 15 18:48:13 2011
@@ -41,7 +41,7 @@ public class XFireXmlParamTypeTest exten
     public void setUp() throws Exception {
         super.setUp();
 
-        tm = new DefaultTypeMapping();
+        tm = new DefaultTypeMapping(null, DefaultTypeMapping.createDefaultTypeMapping(false,
false));
         creator = new Java5TypeCreator();
         creator.setNextCreator(new DefaultTypeCreator());
         creator.setConfiguration(new org.apache.cxf.aegis.type.Configuration());

Modified: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XmlParamTypeTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XmlParamTypeTest.java?rev=1081901&r1=1081900&r2=1081901&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XmlParamTypeTest.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XmlParamTypeTest.java
Tue Mar 15 18:48:13 2011
@@ -41,7 +41,7 @@ public class XmlParamTypeTest extends Ab
     public void setUp() throws Exception {
         super.setUp();
 
-        tm = new DefaultTypeMapping();
+        tm = new DefaultTypeMapping(null, DefaultTypeMapping.createDefaultTypeMapping(false,
false));
         creator = new Java5TypeCreator();
         creator.setNextCreator(new DefaultTypeCreator());
         creator.setConfiguration(new TypeCreationOptions());
@@ -55,7 +55,7 @@ public class XmlParamTypeTest extends Ab
         AegisType type = creator.createType(m, 0);
         tm.register(type);
         assertTrue(type instanceof CustomStringType);
-        assertEquals(new QName("urn:xfire:foo", "custom"), type.getSchemaType());
+        //assertEquals(new QName("urn:xfire:foo", "custom"), type.getSchemaType());
 
         type = creator.createType(m, -1);
         tm.register(type);

Modified: cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisJaxWs.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisJaxWs.java?rev=1081901&r1=1081900&r2=1081901&view=diff
==============================================================================
--- cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisJaxWs.java
(original)
+++ cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisJaxWs.java
Tue Mar 15 18:48:13 2011
@@ -56,7 +56,7 @@ public interface AegisJaxWs {
     java.util.List<String> getStringList();
     
     @WebMethod
-    java.util.List<String> echoBigList(java.util.List<String> l);
+    java.util.List<String> echoBigList(@WebParam(name = "foo") java.util.List<String>
l);
     
     @WebMethod
     byte[] export(java.util.List<java.lang.Integer> integers);

Modified: cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/mtom/fortest/MtomTestService.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/mtom/fortest/MtomTestService.java?rev=1081901&r1=1081900&r2=1081901&view=diff
==============================================================================
--- cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/mtom/fortest/MtomTestService.java
(original)
+++ cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/mtom/fortest/MtomTestService.java
Tue Mar 15 18:48:13 2011
@@ -23,12 +23,16 @@ import javax.jws.WebParam;
 import javax.jws.WebService;
 import javax.xml.ws.soap.MTOM;
 
+import org.apache.cxf.aegis.type.java5.XmlParamType;
+
 /**
  *
  */
 @WebService(name = "MtomTestService", serviceName = "MtomTestService")
 @MTOM
 public interface MtomTestService {
-    void acceptDataHandler(@WebParam(name = "inputDhBean") DataHandlerBean dhBean);
+    void acceptDataHandler(@WebParam(name = "inputDhBean")
+                           @XmlParamType(name = "inputDhBean")
+                           DataHandlerBean dhBean);
     DataHandlerBean produceDataHandlerBean();
 }



Mime
View raw message