You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by de...@apache.org on 2008/04/30 08:06:58 UTC

svn commit: r652280 [1/4] - in /webservices/axis2/trunk/java/modules: adb/src/org/apache/axis2/databinding/utils/ distribution/ documentation/ fastinfoset/ integration/ integration/test-resources/ComplexDataTypes/ integration/test-resources/ComplexData...

Author: deepal
Date: Tue Apr 29 23:06:57 2008
New Revision: 652280

URL: http://svn.apache.org/viewvc?rev=652280&view=rev
Log:
removed annogen dependency and use JDK 1.5 instead. 
 - Will send a mail to the list soon saying what I did and the issues with the change 

Seems like a big commit but do not need to worry I check and test them carefully.

Added:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/FieldComparator.java
Modified:
    webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java
    webservices/axis2/trunk/java/modules/distribution/pom.xml
    webservices/axis2/trunk/java/modules/documentation/pom.xml
    webservices/axis2/trunk/java/modules/fastinfoset/pom.xml
    webservices/axis2/trunk/java/modules/integration/pom.xml
    webservices/axis2/trunk/java/modules/integration/test-resources/ComplexDataTypes/ComplexDataTypes.wsdl
    webservices/axis2/trunk/java/modules/integration/test-resources/ComplexDataTypesDocLitBare/ComplexDataTypesDocLitBare.wsdl
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/complex/ComplexDataTypesComplexDataTypesSOAP11Test.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/complex/ComplexDataTypesDocLitBareTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/tempuri/complex/data/Person.java
    webservices/axis2/trunk/java/modules/java2wsdl/pom.xml
    webservices/axis2/trunk/java/modules/jaxbri/src/org/apache/axis2/jaxbri/JaxbSchemaGenerator.java
    webservices/axis2/trunk/java/modules/kernel/pom.xml
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/MessageContext.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DocLitBareSchemaGenerator.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/SchemaGenerator.java
    webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/module1/META-INF/module.xml
    webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/deployment/DeploymentTotalTest.java
    webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/registry/Handler3.java
    webservices/axis2/trunk/java/modules/parent/pom.xml
    webservices/axis2/trunk/java/modules/samples/book/pom.xml
    webservices/axis2/trunk/java/modules/samples/java_first_jaxws/pom.xml
    webservices/axis2/trunk/java/modules/samples/jaxws-samples/pom.xml
    webservices/axis2/trunk/java/modules/samples/pom.xml
    webservices/axis2/trunk/java/modules/tool/axis2-eclipse-codegen-plugin/build.xml
    webservices/axis2/trunk/java/modules/tool/axis2-eclipse-codegen-plugin/eclipse-codegen-plugin-assembly.xml
    webservices/axis2/trunk/java/modules/tool/axis2-eclipse-codegen-plugin/pom.xml
    webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/idea-plugin-aseembly.xml
    webservices/axis2/trunk/java/modules/tool/conf/codegen/plugin.xml

Modified: webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java?rev=652280&r1=652279&r2=652280&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java (original)
+++ webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java Tue Apr 29 23:06:57 2008
@@ -20,11 +20,7 @@
 package org.apache.axis2.databinding.utils;
 
 
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMAttribute;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMText;
+import org.apache.axiom.om.*;
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
 import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory;
 import org.apache.axiom.om.util.Base64;
@@ -35,16 +31,11 @@
 import org.apache.axis2.deployment.util.BeanExcludeInfo;
 import org.apache.axis2.deployment.util.ExcludeInfo;
 import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.java2wsdl.FieldComparator;
 import org.apache.axis2.description.java2wsdl.TypeTable;
 import org.apache.axis2.engine.ObjectSupplier;
 import org.apache.axis2.util.Loader;
 import org.apache.axis2.util.StreamWrapper;
-import org.codehaus.jam.JClass;
-import org.codehaus.jam.JProperty;
-import org.codehaus.jam.JamClassIterator;
-import org.codehaus.jam.JamService;
-import org.codehaus.jam.JamServiceFactory;
-import org.codehaus.jam.JamServiceParams;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamReader;
@@ -53,14 +44,10 @@
 import java.beans.Introspector;
 import java.beans.PropertyDescriptor;
 import java.lang.reflect.Array;
+import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Locale;
+import java.util.*;
 
 
 public class BeanUtil {
@@ -79,22 +66,6 @@
                                                 boolean qualified,
                                                 boolean processingDocLitBare) {
         try {
-            JamServiceFactory factory = JamServiceFactory.getInstance();
-            JamServiceParams jam_service_parms = factory.createServiceParams();
-            ClassLoader cl = beanObject.getClass().getClassLoader();
-            if (cl == null)
-                cl = ClassLoader.getSystemClassLoader();
-            jam_service_parms.addClassLoader(cl);
-
-            jam_service_parms.includeClass(beanObject.getClass().getName());
-            JamService service = factory.createService(jam_service_parms);
-            JamClassIterator jClassIter = service.getClasses();
-            JClass jClass;
-            if (jClassIter.hasNext()) {
-                jClass = (JClass)jClassIter.next();
-            } else {
-                throw new AxisFault("No service class found , exception from JAM");
-            }
             QName elemntNameSpace = null;
             if (typeTable != null && qualified) {
                 QName qNamefortheType =
@@ -109,50 +80,51 @@
                 }
 
                 elemntNameSpace = new QName(qNamefortheType.getNamespaceURI(),
-                                            "elementName");
+                        "elementName");
             }
             AxisService axisService = null;
             if (MessageContext.getCurrentMessageContext() != null) {
                 axisService = MessageContext.getCurrentMessageContext().getAxisService();
             }
             BeanExcludeInfo beanExcludeInfo = null;
+            Class beanClass = beanObject.getClass();
             if (axisService != null && axisService.getExcludeInfo() != null) {
                 beanExcludeInfo = axisService.getExcludeInfo().getBeanExcludeInfoForClass(
-                        jClass.getQualifiedName());
+                        beanClass.getName());
             }
             // properties from JAM
             ArrayList propertyList = new ArrayList();
-            JProperty properties [] = jClass.getDeclaredProperties();
+            Field properties [] = beanClass.getDeclaredFields();
             for (int i = 0; i < properties.length; i++) {
-                JProperty property = properties[i];
-                String propertyName = getCorrectName(property.getSimpleName());
+                Field property = properties[i];
+                String propertyName = property.getName();
                 if ((beanExcludeInfo == null) || !beanExcludeInfo.isExcludedProperty(propertyName)){
                     propertyList.add(property);
                 }
 
             }
-            JClass supClass = jClass.getSuperclass();
-            while (!supClass.getQualifiedName().startsWith("java.")) {
-                properties = supClass.getDeclaredProperties();
+            Class supClass = beanClass.getSuperclass();
+            while (!getQualifiedName(supClass.getPackage()).startsWith("java.")) {
+                properties = supClass.getDeclaredFields();
                 ExcludeInfo excludeInfo = axisService.getExcludeInfo();
                 if (excludeInfo != null) {
-                    beanExcludeInfo = excludeInfo.getBeanExcludeInfoForClass(supClass.getQualifiedName());
+                    beanExcludeInfo = excludeInfo.getBeanExcludeInfoForClass(supClass.getName());
                 }
                 for (int i = 0; i < properties.length; i++) {
-                    JProperty property = properties[i];
-                    String propertyName = getCorrectName(property.getSimpleName());
+                    Field property = properties[i];
+                    String propertyName = property.getName();
                     if ((beanExcludeInfo == null) || !beanExcludeInfo.isExcludedProperty(propertyName)) {
                         propertyList.add(property);
                     }
                 }
                 supClass = supClass.getSuperclass();
             }
-            properties = new JProperty[propertyList.size()];
+            properties = new Field[propertyList.size()];
             for (int i = 0; i < propertyList.size(); i++) {
-                JProperty jProperty = (JProperty)propertyList.get(i);
+                Field jProperty = (Field)propertyList.get(i);
                 properties[i] = jProperty;
             }
-            Arrays.sort(properties);
+            Arrays.sort(properties , new FieldComparator());
             BeanInfo beanInfo = Introspector.getBeanInfo(beanObject.getClass());
             PropertyDescriptor [] propDescs = beanInfo.getPropertyDescriptors();
             HashMap propertMap = new HashMap();
@@ -165,14 +137,9 @@
             }
             ArrayList object = new ArrayList();
             for (int i = 0; i < properties.length; i++) {
-                JProperty property = properties[i];
-                PropertyDescriptor propDesc = (PropertyDescriptor)propertMap.get(
-                        getCorrectName(property.getSimpleName()));
+                Field property = properties[i];
+                PropertyDescriptor propDesc = (PropertyDescriptor)propertMap.get(property.getName());
                 if (propDesc == null) {
-                    propDesc = (PropertyDescriptor)propertMap.get(
-                        (property.getSimpleName()));
-                }
-                 if (propDesc == null) {
                     continue;
                 }
                 Class ptype = propDesc.getPropertyType();
@@ -183,9 +150,7 @@
                     Method readMethod = propDesc.getReadMethod();
                     Object value;
                     if(readMethod!=null){
-                        if (property.getGetter() !=null && property.getGetter().isPublic()){
-                            readMethod.setAccessible(true);
-                        }
+                        readMethod.setAccessible(true);
                         value = readMethod.invoke(beanObject, null);
                     } else {
                         throw new AxisFault("can not find read method for : "  + propDesc.getName());
@@ -198,9 +163,7 @@
                         Method readMethod = propDesc.getReadMethod();
                         Object value;
                         if(readMethod!=null){
-                            if (property.getGetter() !=null && property.getGetter().isPublic()){
-                                readMethod.setAccessible(true);
-                            }
+                            readMethod.setAccessible(true);
                             value = readMethod.invoke(beanObject,null);
                         } else {
                             throw new AxisFault("can not find read method for : "  + propDesc.getName());
@@ -225,9 +188,7 @@
                         Method readMethod = propDesc.getReadMethod();
                         Object value [] = null;
                         if(readMethod!=null){
-                            if (property.getGetter() !=null && property.getGetter().isPublic()){
-                                readMethod.setAccessible(true);
-                            }
+                            readMethod.setAccessible(true);
                             value = (Object[])propDesc.getReadMethod().invoke(beanObject,
                                     null);
                         }
@@ -245,11 +206,9 @@
                     }
                 } else if (SimpleTypeMapper.isCollection(ptype)) {
                     Method readMethod = propDesc.getReadMethod();
-                    if (property.getGetter() !=null && property.getGetter().isPublic()){
-                        readMethod.setAccessible(true);
-                    }
+                    readMethod.setAccessible(true);
                     Object value = readMethod.invoke(beanObject,
-                                                                   null);
+                            null);
                     Collection objList = (Collection)value;
                     if (objList != null && objList.size() > 0) {
                         //this was given error , when the array.size = 0
@@ -273,9 +232,7 @@
                 } else {
                     addTypeQname(elemntNameSpace, object, propDesc, beanName,processingDocLitBare);
                     Method readMethod = propDesc.getReadMethod();
-                    if (property.getGetter() !=null && property.getGetter().isPublic()){
-                        readMethod.setAccessible(true);
-                    }
+                    readMethod.setAccessible(true);
                     Object value = readMethod.invoke(beanObject,
                             null);
                     if ("java.lang.Object".equals(ptype.getName())){
@@ -291,7 +248,7 @@
                     object.add(value);
                 }
             }
-             // Added objectAttributes as a fix for issues AXIS2-2055 and AXIS2-1899 to 
+            // Added objectAttributes as a fix for issues AXIS2-2055 and AXIS2-1899 to
             // support polymorphism in POJO approach.
             // For some reason, using QName(Constants.XSI_NAMESPACE, "type", "xsi") does not generate
             // an xsi:type attribtue properly for inner objects. So just using a simple QName("type").
@@ -299,7 +256,7 @@
             objectAttributes.add(new QName("type"));
             objectAttributes.add(beanObject.getClass().getName());
             return new ADBXMLStreamReaderImpl(beanName, object.toArray(), objectAttributes.toArray(),
-                                              typeTable, qualified);
+                    typeTable, qualified);
 
         } catch (java.io.IOException e) {
             throw new RuntimeException(e);
@@ -319,7 +276,7 @@
                                      boolean processingDocLitBare) {
         if (elemntNameSpace != null) {
             object.add(new QName(elemntNameSpace.getNamespaceURI(),
-                   getCorrectName(propDesc.getName()) , elemntNameSpace.getPrefix()));
+                    getCorrectName(propDesc.getName()) , elemntNameSpace.getPrefix()));
         } else {
             if(processingDocLitBare){
                 object.add(new QName(getCorrectName(propDesc.getName())));
@@ -341,7 +298,7 @@
         String className = beanObject.getClass().getName();
         if (className.indexOf(".") > 0) {
             className = className.substring(className.lastIndexOf('.') + 1,
-                                            className.length());
+                    className.length());
         }
         return getPullParser(beanObject, new QName(className), null, false, false);
     }
@@ -600,12 +557,12 @@
             currentLocalName = omElement.getLocalName();
             classType = (Class)javaTypes[count];
             omElement = ProcessElement(classType, omElement, helper, parts,
-                                       currentLocalName, retObjs, count, objectSupplier);
+                    currentLocalName, retObjs, count, objectSupplier);
             while (omElement != null) {
                 count ++;
                 omElement = ProcessElement((Class)javaTypes[count], omElement,
-                                           helper, parts, omElement.getLocalName(), retObjs, count,
-                                           objectSupplier);
+                        helper, parts, omElement.getLocalName(), retObjs, count,
+                        objectSupplier);
             }
             count ++;
         }
@@ -639,7 +596,7 @@
                 return null;
             } else {
                 valueList.add(processObject(omElement, arrayClassType, helper, true,
-                                            objectSupplier));
+                        objectSupplier));
             }
             while (parts.hasNext()) {
                 objValue = parts.next();
@@ -653,7 +610,7 @@
                     break;
                 }
                 Object o = processObject(omElement, arrayClassType,
-                                         helper, true, objectSupplier);
+                        helper, true, objectSupplier);
                 valueList.add(o);
             }
             if(valueList.get(0)==null){
@@ -874,4 +831,12 @@
         }
     }
 
+    private static String getQualifiedName(Package packagez) {
+        if (packagez != null) {
+            return packagez.getName();
+        } else {
+            return "";
+        }
+    }
+
 }

Modified: webservices/axis2/trunk/java/modules/distribution/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/distribution/pom.xml?rev=652280&r1=652279&r2=652280&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/distribution/pom.xml (original)
+++ webservices/axis2/trunk/java/modules/distribution/pom.xml Tue Apr 29 23:06:57 2008
@@ -150,10 +150,6 @@
             <artifactId>jaxen</artifactId>
         </dependency>
         <dependency>
-            <groupId>annogen</groupId>
-            <artifactId>annogen</artifactId>
-        </dependency>
-        <dependency>
             <groupId>commons-httpclient</groupId>
             <artifactId>commons-httpclient</artifactId>
         </dependency>

Modified: webservices/axis2/trunk/java/modules/documentation/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/documentation/pom.xml?rev=652280&r1=652279&r2=652280&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/documentation/pom.xml (original)
+++ webservices/axis2/trunk/java/modules/documentation/pom.xml Tue Apr 29 23:06:57 2008
@@ -147,10 +147,6 @@
             <artifactId>jaxen</artifactId>
         </dependency>
         <dependency>
-            <groupId>annogen</groupId>
-            <artifactId>annogen</artifactId>
-        </dependency>
-        <dependency>
             <groupId>commons-httpclient</groupId>
             <artifactId>commons-httpclient</artifactId>
         </dependency>

Modified: webservices/axis2/trunk/java/modules/fastinfoset/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/fastinfoset/pom.xml?rev=652280&r1=652279&r2=652280&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/fastinfoset/pom.xml (original)
+++ webservices/axis2/trunk/java/modules/fastinfoset/pom.xml Tue Apr 29 23:06:57 2008
@@ -82,10 +82,6 @@
             <version>${version}</version>
         </dependency>
         <dependency>
-            <groupId>annogen</groupId>
-            <artifactId>annogen</artifactId>
-        </dependency>
-        <dependency>
             <groupId>org.apache.httpcomponents</groupId>
             <artifactId>httpcore</artifactId>
         </dependency>

Modified: webservices/axis2/trunk/java/modules/integration/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/pom.xml?rev=652280&r1=652279&r2=652280&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/pom.xml (original)
+++ webservices/axis2/trunk/java/modules/integration/pom.xml Tue Apr 29 23:06:57 2008
@@ -180,6 +180,18 @@
                 </exclusion>
             </exclusions>
         </dependency>
+         <dependency>
+            <groupId>org.apache.axis2</groupId>
+            <artifactId>axis2-jws-api</artifactId>
+            <version>${version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.apache.geronimo.specs</groupId>
+                    <artifactId>geronimo-javamail_1.4_spec</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
         <dependency>
             <groupId>org.apache.axis2</groupId>
             <artifactId>axis2-metadata</artifactId>



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org