cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r786597 - in /cxf/branches/2.1.x-fixes: ./ tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/ tools/javato/ws/src/test/java/o...
Date Fri, 19 Jun 2009 17:38:43 GMT
Author: dkulp
Date: Fri Jun 19 17:38:43 2009
New Revision: 786597

URL: http://svn.apache.org/viewvc?rev=786597&view=rev
Log:
Merged revisions 786589 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.2.x-fixes

................
  r786589 | dkulp | 2009-06-19 13:20:07 -0400 (Fri, 19 Jun 2009) | 9 lines
  
  Merged revisions 786395 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r786395 | asoldano | 2009-06-19 03:07:05 -0400 (Fri, 19 Jun 2009) | 2 lines
    
    [CXF-2300] Adding generic support to response wrapper
  ........
................

Added:
    cxf/branches/2.1.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/EchoGenericNoWrapperBean.java
      - copied unchanged from r786589, cxf/branches/2.2.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/EchoGenericNoWrapperBean.java
Modified:
    cxf/branches/2.1.x-fixes/   (props changed)
    cxf/branches/2.1.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapper.java
    cxf/branches/2.1.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapper.java
    cxf/branches/2.1.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/Wrapper.java
    cxf/branches/2.1.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WrapperBeanGeneratorTest.java

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jun 19 17:38:43 2009
@@ -1,2 +1,2 @@
-/cxf/branches/2.2.x-fixes:743446,753380,753397,753421,754585,755365,757499,757859,757899,757935,757951,758195,758303,758308,758378,758690,758910,759890,759961,759963-759964,759966,760029,760073,760150,760171,760178,760198,760212,760456,760468,760582,760938,761094,761113,761120,761317,761759,761789,762393,762518,762567,763200,763272,763495,763854,763931,763942,763953,764033-764034,764581,764599-764606,764887,765357,766013,766058,766100-766101,766763,766770,766860,766962-766963,767159,767191,767927,771416,772143,772402,772658,772714,773009-773010,773027,773049,773146,773581,773691,773693,774446-774496,774558,774760,774851,774979,775423,776024-776025,776218,776429,776459,777189,777224,777243,777481,777505,777572,777580,780033,780184,780213,780421,780664,780800,780902,780911,781497,781841,782733,782735-782736,783099,783407,784064,784197,785293,785296,785298-785299,785301,785656,786158,786587
-/cxf/trunk:782181,782728-782730,783097,783396,784059,784181,784895,785279-785282,785468,786142,786271
+/cxf/branches/2.2.x-fixes:743446,753380,753397,753421,754585,755365,757499,757859,757899,757935,757951,758195,758303,758308,758378,758690,758910,759890,759961,759963-759964,759966,760029,760073,760150,760171,760178,760198,760212,760456,760468,760582,760938,761094,761113,761120,761317,761759,761789,762393,762518,762567,763200,763272,763495,763854,763931,763942,763953,764033-764034,764581,764599-764606,764887,765357,766013,766058,766100-766101,766763,766770,766860,766962-766963,767159,767191,767927,771416,772143,772402,772658,772714,773009-773010,773027,773049,773146,773581,773691,773693,774446-774496,774558,774760,774851,774979,775423,776024-776025,776218,776429,776459,777189,777224,777243,777481,777505,777572,777580,780033,780184,780213,780421,780664,780800,780902,780911,781497,781841,782733,782735-782736,783099,783407,784064,784197,785293,785296,785298-785299,785301,785656,786158,786587,786589
+/cxf/trunk:782181,782728-782730,783097,783396,784059,784181,784895,785279-785282,785468,786142,786271,786395

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.1.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapper.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapper.java?rev=786597&r1=786596&r2=786597&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapper.java
(original)
+++ cxf/branches/2.1.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapper.java
Fri Jun 19 17:38:43 2009
@@ -20,14 +20,12 @@
 package org.apache.cxf.tools.java2wsdl.processor.internal.jaxws;
 
 import java.lang.annotation.Annotation;
-import java.lang.reflect.GenericArrayType;
 import java.lang.reflect.Method;
-import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.util.ArrayList;
 import java.util.List;
+
 import javax.jws.WebParam;
-import javax.xml.ws.Holder;
 
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.service.model.MessageInfo;
@@ -61,39 +59,7 @@
     @Override
     protected List<JavaField> buildFields() {
         return buildFields(getMethod(), getOperationInfo().getUnwrappedOperation().getInput());
-    }
-
-    private String getTypeString(Type t) {
-        String type = "Object";
-        if (t instanceof Class) {
-            Class clz = (Class) t;
-            if (clz.isArray()) {
-                if (isBuiltInTypes(clz.getComponentType())) {
-                    type = clz.getComponentType().getSimpleName() + "[]";
-                } else {
-                    type = clz.getComponentType().getName() + "[]";
-                }
-            } else {
-                type = clz.getName();
-            }
-        } else if (t instanceof ParameterizedType) {
-            ParameterizedType pt = (ParameterizedType) t;
-            Class c = (Class)pt.getRawType();
-            if (Holder.class.isAssignableFrom(c)
-                && pt.getActualTypeArguments().length == 1
-                && pt.getActualTypeArguments()[0] instanceof Class) {
-                type = getTypeString(pt.getActualTypeArguments()[0]);
-            } else {
-                type = t.toString();
-            }
-        } else if (t instanceof GenericArrayType) {
-            GenericArrayType gat = (GenericArrayType)t;
-            type = gat.toString();
-        }
-        type = type.replace('$', '.');
-        return type;
-    }
-    
+    }    
     
     protected List<JavaField> buildFields(final Method method, final MessageInfo message)
{
         List<JavaField> fields = new ArrayList<JavaField>();

Modified: cxf/branches/2.1.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapper.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapper.java?rev=786597&r1=786596&r2=786597&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapper.java
(original)
+++ cxf/branches/2.1.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapper.java
Fri Jun 19 17:38:43 2009
@@ -21,7 +21,6 @@
 
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Method;
-import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.util.ArrayList;
 import java.util.List;
@@ -79,16 +78,7 @@
 
         if (!returnType.isAssignableFrom(void.class)) {
             hasReturnType = true;
-            String type;
-            if (returnType.isArray()) {
-                if (isBuiltInTypes(returnType.getComponentType())) {
-                    type = returnType.getComponentType().getSimpleName() + "[]";
-                } else {
-                    type = returnType.getComponentType().getName() + "[]";
-                }
-            } else {
-                type = returnType.getName();
-            }
+            String type = getTypeString(method.getGenericReturnType());
             List<Annotation> jaxbAnns = WrapperUtil.getJaxbAnnotations(method);
             field.setType(type);
             field.setJaxbAnnotations(jaxbAnns.toArray(new Annotation[jaxbAnns.size()]));
@@ -102,27 +92,9 @@
             int idx = hasReturnType ? mpi.getIndex() - 1 : mpi.getIndex();
             if (idx >= 0) {
                 String name = mpi.getName().getLocalPart();
-                String type = "Object";
 
                 Type t = paramClasses[idx];
-                if (t instanceof Class) {
-                    Class clz = (Class) t;
-                    if (clz.isArray()) {
-                        if (isBuiltInTypes(clz.getComponentType())) {
-                            type = clz.getComponentType().getSimpleName() + "[]";
-                        } else {
-                            type = clz.getComponentType().getName() + "[]";
-                        }
-                    } else {
-                        type = clz.getName();
-                    }
-                } else if (t instanceof ParameterizedType) {
-                    ParameterizedType pt = (ParameterizedType) t;
-                    if (pt.getActualTypeArguments().length > 0
-                        && pt.getActualTypeArguments()[0] instanceof Class) {
-                        type = ((Class)pt.getActualTypeArguments()[0]).getName();
-                    }
-                }
+                String type = getTypeString(t);
 
                 JavaField jf = new JavaField(name, type, "");
                 List<Annotation> jaxbAnns = WrapperUtil.getJaxbAnnotations(method,
idx - 1);
@@ -134,7 +106,7 @@
 
         return fields;
     }
-
+    
     @Override
     public WrapperBeanClass getWrapperBeanClass(final Method method) {
         javax.xml.ws.ResponseWrapper resWrapper = method.getAnnotation(javax.xml.ws.ResponseWrapper.class);
@@ -157,7 +129,4 @@
         return jClass;
     }
 
-
-
-
 }

Modified: cxf/branches/2.1.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/Wrapper.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/Wrapper.java?rev=786597&r1=786596&r2=786597&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/Wrapper.java
(original)
+++ cxf/branches/2.1.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/Wrapper.java
Fri Jun 19 17:38:43 2009
@@ -19,12 +19,17 @@
 
 package org.apache.cxf.tools.java2wsdl.processor.internal.jaxws;
 
+import java.lang.reflect.GenericArrayType;
 import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
+
 import javax.xml.namespace.QName;
+import javax.xml.ws.Holder;
 
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
@@ -190,4 +195,36 @@
     public OperationInfo getOperationInfo() {
         return this.operationInfo;
     }
+    
+    protected String getTypeString(Type t) {
+        String type = "Object";
+        if (t instanceof Class) {
+            Class clz = (Class) t;
+            if (clz.isArray()) {
+                if (isBuiltInTypes(clz.getComponentType())) {
+                    type = clz.getComponentType().getSimpleName() + "[]";
+                } else {
+                    type = clz.getComponentType().getName() + "[]";
+                }
+            } else {
+                type = clz.getName();
+            }
+        } else if (t instanceof ParameterizedType) {
+            ParameterizedType pt = (ParameterizedType) t;
+            Class c = (Class)pt.getRawType();
+            if (Holder.class.isAssignableFrom(c)
+                && pt.getActualTypeArguments().length == 1
+                && pt.getActualTypeArguments()[0] instanceof Class) {
+                type = getTypeString(pt.getActualTypeArguments()[0]);
+            } else {
+                type = t.toString();
+            }
+        } else if (t instanceof GenericArrayType) {
+            GenericArrayType gat = (GenericArrayType)t;
+            type = gat.toString();
+        }
+        type = type.replace('$', '.');
+        return type;
+    }
+
 }

Modified: cxf/branches/2.1.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WrapperBeanGeneratorTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WrapperBeanGeneratorTest.java?rev=786597&r1=786596&r2=786597&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WrapperBeanGeneratorTest.java
(original)
+++ cxf/branches/2.1.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WrapperBeanGeneratorTest.java
Fri Jun 19 17:38:43 2009
@@ -135,4 +135,26 @@
         assertNotNull(field.getAnnotation(XmlList.class));
     }
     
+    @Test
+    public void testGenGeneric() throws Exception {
+        String testingClass = "org.apache.cxf.tools.fortest.withannotation.doc.EchoGenericNoWrapperBean";
+        env.put(ToolConstants.CFG_CLASSNAME, testingClass);
+        
+        WrapperBeanGenerator generator = new WrapperBeanGenerator();
+        generator.setServiceModel(getServiceInfo());
+        
+        generator.generate(output);
+
+        String pkgBase = "org/apache/cxf";
+        File requestWrapperClass = new File(output, pkgBase + "/EchoGeneric.java");
+        assertTrue(requestWrapperClass.exists());
+        String contents = IOUtils.toString(new FileInputStream(requestWrapperClass));
+        assertTrue(contents.indexOf("public java.util.List<java.lang.String> get")
!= -1);
+        
+        File responseWrapperClass = new File(output, pkgBase + "/EchoGenericResponse.java");
+        assertTrue(responseWrapperClass.exists());
+        contents = IOUtils.toString(new FileInputStream(responseWrapperClass));
+        assertTrue(contents.indexOf("public java.util.List<java.lang.String> getReturn()")
!= -1);
+    }
+    
 }



Mime
View raw message