axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r438083 - in /webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema: SchemaCompiler.java SchemaConstants.java writer/JavaBeanWriter.java
Date Tue, 29 Aug 2006 14:48:48 GMT
Author: dims
Date: Tue Aug 29 07:48:47 2006
New Revision: 438083

URL: http://svn.apache.org/viewvc?rev=438083&view=rev
Log:
allow elements with anonymous simple types - see Example wsdl in AXIS-2098

Modified:
    webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
    webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaConstants.java
    webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java

Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java?rev=438083&r1=438082&r2=438083&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
(original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
Tue Aug 29 07:48:47 2006
@@ -1447,6 +1447,9 @@
                     referencedQName = elt.getRefName();
                     boolean arrayStatus = ((Boolean) processedElementArrayStatusMap.get(elt)).booleanValue();
                     clazzName = findRefClassName(referencedQName,arrayStatus);
+                    if(clazzName == null) {
+                        clazzName = findClassName(referencedQName,arrayStatus);
+                    }
                     XmlSchemaElement refElement = getReferencedElement(parentSchema, referencedQName);
 
                     // register the mapping if we found the referenced element
@@ -1624,8 +1627,16 @@
             return;
         }
 
-        // Must do this up front to support recursive types
-        String fullyQualifiedClassName = writer.makeFullyQualifiedClassName(simpleType.getQName());
+        String fullyQualifiedClassName = null;
+        if(simpleType.getQName() != null) {
+            // Must do this up front to support recursive types
+            fullyQualifiedClassName = writer.makeFullyQualifiedClassName(simpleType.getQName());
+        } else {
+            fullyQualifiedClassName = writer.makeFullyQualifiedClassName(xsElt.getQName());
+            simpleType.addMetaInfo(SchemaConstants.SchemaCompilerInfoHolder.FAKE_QNAME,
+                    new QName(xsElt.getQName().getNamespaceURI(), xsElt.getQName().getLocalPart()));
+        }
+        
         processedTypemap.put(simpleType.getQName(), fullyQualifiedClassName);
 
         //register that in the schema metainfo bag
@@ -1633,9 +1644,16 @@
                 fullyQualifiedClassName);
 
         BeanWriterMetaInfoHolder metaInfHolder = processSimpleType(simpleType, parentSchema);
+        
+        if(simpleType.getQName() == null) {
+            this.processedAnonymousComplexTypesMap.put(xsElt, metaInfHolder);
+            simpleTypesMap.put(new QName(xsElt.getQName().getNamespaceURI(), xsElt.getQName().getLocalPart()),
fullyQualifiedClassName);
+        }
         //add this information to the metainfo holder
         metaInfHolder.setOwnQname(simpleType.getQName());
-        metaInfHolder.setOwnClassName(fullyQualifiedClassName);
+        if(fullyQualifiedClassName != null) {
+            metaInfHolder.setOwnClassName(fullyQualifiedClassName);
+        }
         //write the class. This type mapping would have been populated right now
         //Note - We always write classes for named complex types
         writeSimpleType(simpleType, metaInfHolder);
@@ -1654,7 +1672,11 @@
                 //check whether the base type is one of the base schema types
                 if (baseSchemaTypeMap.containsKey(baseTypeName)) {
                     //process restriction base type
-                    processSimpleRestrictionBaseType(simpleType.getQName(), restriction.getBaseTypeName(),metaInfHolder);
+                    QName qName = simpleType.getQName();
+                    if(qName == null) {
+                        qName = (QName) simpleType.getMetaInfoMap().get(SchemaConstants.SchemaCompilerInfoHolder.FAKE_QNAME);
+                    }
+                    processSimpleRestrictionBaseType(qName, restriction.getBaseTypeName(),metaInfHolder);
         	
                     //process facets
                     XmlSchemaObjectCollection facets = restriction.getFacets();

Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaConstants.java?rev=438083&r1=438082&r2=438083&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaConstants.java
(original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaConstants.java
Tue Aug 29 07:48:47 2006
@@ -112,5 +112,6 @@
     public static class SchemaCompilerInfoHolder{
         public static final String CLASSNAME_KEY = "CLASS_NAME";
         public static final String CLASSNAME_PRIMITVE_KEY = "CLASS_NAME_PRIMITIVE";
+        public static final String FAKE_QNAME = "Q_NAME";
     }
 }

Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java?rev=438083&r1=438082&r2=438083&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java
(original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java
Tue Aug 29 07:48:47 2006
@@ -21,6 +21,7 @@
 import org.apache.axis2.schema.CompilerOptions;
 import org.apache.axis2.schema.SchemaCompilationException;
 import org.apache.axis2.schema.SchemaCompiler;
+import org.apache.axis2.schema.SchemaConstants;
 import org.apache.axis2.schema.i18n.SchemaCompilerMessages;
 import org.apache.axis2.schema.typemap.JavaTypeMap;
 import org.apache.axis2.schema.util.PrimitiveTypeFinder;
@@ -257,7 +258,9 @@
                         BeanWriterMetaInfoHolder metainf) throws SchemaCompilationException
{
         try {
             QName qName = simpleType.getQName();
-
+            if(qName == null) {
+                qName = (QName) simpleType.getMetaInfoMap().get(SchemaConstants.SchemaCompilerInfoHolder.FAKE_QNAME);
+            }
             return process(qName, metainf, typeMap, true);
         } catch (Exception e) {
             throw new SchemaCompilationException(e);
@@ -365,7 +368,7 @@
                     fullyQualifiedClassName.lastIndexOf('.'));
         }
 
-        String originalName = qName.getLocalPart();
+        String originalName = qName == null ? "" : qName.getLocalPart();
         ArrayList propertyNames = new ArrayList();
 
         if (!templateLoaded) {



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


Mime
View raw message