axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ami...@apache.org
Subject svn commit: r683917 - /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
Date Fri, 08 Aug 2008 09:08:51 GMT
Author: amilas
Date: Fri Aug  8 02:08:50 2008
New Revision: 683917

URL: http://svn.apache.org/viewvc?rev=683917&view=rev
Log:
Adding support to multidimentional array

Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java?rev=683917&r1=683916&r2=683917&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
Fri Aug  8 02:08:50 2008
@@ -468,7 +468,8 @@
             Class sup = javaType.getSuperclass();
             if ((sup != null) && !("java.lang.Object".compareTo(sup.getName()) ==
0) &&
                     !(getQualifiedName(sup.getPackage()).indexOf("org.apache.axis2") >
0)
-                    && !(getQualifiedName(sup.getPackage()).indexOf("java.util")
> 0)) {
+                    && !(getQualifiedName(sup.getPackage()).indexOf("java.util")
> 0))
+            {
                 String superClassName = sup.getName();
                 String superclassname = sup.getSimpleName();
                 String tgtNamespace;
@@ -559,6 +560,8 @@
                 boolean isArryType = property.getType().isArray();
                 String propname = property.getName();
                 propertiesNames.add(propname);
+
+                //Place to look
                 this.generateSchemaforFieldsandProperties(xmlSchema, sequence, property.getType(),
                         propname, isArryType);
 
@@ -623,6 +626,41 @@
         String propertyName;
         if (isArryType) {
             propertyName = type.getComponentType().getName();
+            if (type.getComponentType().isArray()) {
+                // this is a doble array element
+                Class simpleType = type.getComponentType();
+                String simpleTypeName = "";
+                while (simpleType.isArray()) {
+                    simpleTypeName += "ArrayOf";
+                    simpleType = simpleType.getComponentType();
+                }
+                simpleTypeName += simpleType.getSimpleName();
+
+                if (xmlSchema.getTypeByName(simpleTypeName) == null) {
+                    XmlSchemaComplexType xmlSchemaComplexType = new XmlSchemaComplexType(xmlSchema);
+                    XmlSchemaSequence xmlSchemaSequence = new XmlSchemaSequence();
+                    xmlSchemaComplexType.setParticle(xmlSchemaSequence);
+                    generateSchemaforFieldsandProperties(xmlSchema,
+                            xmlSchemaSequence, type.getComponentType(), name, true);
+
+                    xmlSchemaComplexType.setName(simpleTypeName);
+                    xmlSchema.getItems().add(xmlSchemaComplexType);
+                    xmlSchema.getSchemaTypes().add(
+                            new QName(xmlSchema.getTargetNamespace(), simpleTypeName), xmlSchemaComplexType);
+                }
+
+                XmlSchemaElement elt1 = new XmlSchemaElement();
+                elt1.setName(name);
+                elt1.setSchemaTypeName(new QName(xmlSchema.getTargetNamespace(), simpleTypeName));
+                sequence.getItems().add(elt1);
+                elt1.setMaxOccurs(Long.MAX_VALUE);
+                elt1.setMinOccurs(0);
+
+                if (!type.isPrimitive()) {
+                    elt1.setNillable(true);
+                }
+                return;
+            }
         } else {
             propertyName = type.getName();
         }



Mime
View raw message