axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: ws-axis/java/src/org/apache/axis/wsdl/toJava Emitter.java JavaBeanHelperWriter.java JavaBeanWriter.java JavaGeneratorFactory.java JavaTypeWriter.java
Date Sun, 22 Aug 2004 03:07:01 GMT
dims        2004/08/21 20:07:01

  Modified:    java/src/org/apache/axis/wsdl/symbolTable ElementDecl.java
                        SchemaUtils.java SymbolTable.java Type.java
                        TypeEntry.java Utils.java
               java/src/org/apache/axis/wsdl/toJava Emitter.java
                        JavaBeanHelperWriter.java JavaBeanWriter.java
                        JavaGeneratorFactory.java JavaTypeWriter.java
  Added:       java/src/org/apache/axis/wsdl/symbolTable
                        ContainedAttribute.java ContainedEntry.java
  Log:
  Fix for (AXIS-1501) [EWS, AXIS2] A proposal for xml-to-java name mapping in Axis and EWS
(WSDL --> Java)
  from Jongjin Choi (mailto:gunsnroz@hotmail.com)
  
  Revision  Changes    Path
  1.9       +3 -50     ws-axis/java/src/org/apache/axis/wsdl/symbolTable/ElementDecl.java
  
  Index: ElementDecl.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/symbolTable/ElementDecl.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ElementDecl.java	25 Feb 2004 14:02:50 -0000	1.8
  +++ ElementDecl.java	22 Aug 2004 03:06:59 -0000	1.9
  @@ -25,13 +25,8 @@
    * @author Glen Daniels (gdaniels@apache.org)
    * @author Tom Jordahl (tomj@apache.org)
    */
  -public class ElementDecl {
  +public class ElementDecl extends ContainedEntry {
   
  -    /** Field name */
  -    private QName name;
  -
  -    /** Field type */
  -    private TypeEntry type;
       
       /** Field documentation */
       private String documentation;
  @@ -54,11 +49,6 @@
       /** Field anyElement */
       private boolean anyElement = false;
   
  -    /**
  -     * Constructor ElementDecl
  -     */
  -    public ElementDecl() {
  -    }
   
       /**
        * Constructor ElementDecl
  @@ -67,45 +57,8 @@
        * @param name 
        */
       public ElementDecl(TypeEntry type, QName name) {
  -        this.type = type;
  -        this.name = name;
  -    }
  -
  -    /**
  -     * Method getType
  -     * 
  -     * @return 
  -     */
  -    public TypeEntry getType() {
  -        return type;
  -    }
  -
  -    /**
  -     * Method setType
  -     * 
  -     * @param type 
  -     */
  -    public void setType(TypeEntry type) {
  -        this.type = type;
  -    }
  -
  -    /**
  -     * Method getName
  -     * 
  -     * @return 
  -     */
  -    public QName getName() {
  -        return name;
  -    }
  -
  -    /**
  -     * Method setName
  -     * 
  -     * @param name 
  -     */
  -    public void setName(QName name) {
  -        this.name = name;
  -    }
  +        super(type, name);
  +    }    
   
       /**
        * Method getMinOccursIs0
  
  
  
  1.47      +10 -24    ws-axis/java/src/org/apache/axis/wsdl/symbolTable/SchemaUtils.java
  
  Index: SchemaUtils.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/symbolTable/SchemaUtils.java,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- SchemaUtils.java	29 Jul 2004 21:36:50 -0000	1.46
  +++ SchemaUtils.java	22 Aug 2004 03:06:59 -0000	1.47
  @@ -273,12 +273,7 @@
                           // Return an element declaration with a fixed name
                           // ("value") and the correct type.
                           Vector v = new Vector();
  -                        ElementDecl elem = new ElementDecl();
  -
  -                        elem.setType(
  -                                symbolTable.getTypeEntry(
  -                                        extendsOrRestrictsType, false));
  -                        elem.setName(VALUE_QNAME);
  +                        ElementDecl elem = new ElementDecl(symbolTable.getTypeEntry(extendsOrRestrictsType,
false), VALUE_QNAME);
                           v.add(elem);
   
                           return v;
  @@ -348,28 +343,21 @@
   
                   for (int i = 0; i < simpleQName.length; i++) {
   
  -                    TypeEntry simpleType = symbolTable.getType(simpleQName[i]);
  +                    Type simpleType = symbolTable.getType(simpleQName[i]);
   
                       if (simpleType != null) {
                           if (v == null) {
                               v = new Vector();
                           }
   
  -                        ElementDecl elem = new ElementDecl();
  -
  -                        elem.setType(simpleType);
  -
  +                        QName qname = null;
                           if (simpleQName.length > 1) {
  -                            elem.setName(
  -                                    new javax.xml.namespace.QName(
  -                                            "",
  -                                            simpleQName[i].getLocalPart() + "Value"));
  +                            qname = new QName("", simpleQName[i].getLocalPart() + "Value");
                           } else {
  -                            elem.setName(
  -                                    new javax.xml.namespace.QName("", "value"));
  +                            qname = new QName("", "value");
                           }
   
  -                        v.add(elem);
  +                        v.add(new ElementDecl(simpleType, qname));
                       }
                   }
   
  @@ -557,7 +545,7 @@
                       // Represent this as an element named any of type any type.
                       // This will cause it to be serialized with the element
                       // serializer.
  -                    TypeEntry type = symbolTable.getType(Constants.XSD_ANY);
  +                    Type type = symbolTable.getType(Constants.XSD_ANY);
                       ElementDecl elem = new ElementDecl(type,
                               Utils.findQName("",
                                       "any"));
  @@ -614,7 +602,7 @@
               // The value of the second argument is 'false' since global model group
               // definitions are always represented by objects whose type is
               // assignment compatible with 'org.apache.axis.wsdl.symbolTable.Type'.
  -            TypeEntry type = symbolTable.getTypeEntry(nodeType, false);
  +            Type type = (Type) symbolTable.getTypeEntry(nodeType, false);
   
               if (type != null) {
                   v.add(new ElementDecl(type, nodeName));
  @@ -1579,8 +1567,7 @@
           // add type and name to vector, skip it if we couldn't parse it
           // XXX - this may need to be revisited.
           if ((type != null) && (attributeName != null)) {
  -            v.add(type);
  -            v.add(attributeName);
  +            v.add(new ContainedAttribute(type, attributeName));
           }
       }
   
  @@ -1600,8 +1587,7 @@
   
           if (typeEnt != null)    // better not be null
           {
  -            v.add(typeEnt);
  -            v.add(name);
  +            v.add(new ContainedAttribute(typeEnt, name));
           }
       }
   
  
  
  
  1.104     +32 -10    ws-axis/java/src/org/apache/axis/wsdl/symbolTable/SymbolTable.java
  
  Index: SymbolTable.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/symbolTable/SymbolTable.java,v
  retrieving revision 1.103
  retrieving revision 1.104
  diff -u -r1.103 -r1.104
  --- SymbolTable.java	29 Jul 2004 21:36:50 -0000	1.103
  +++ SymbolTable.java	22 Aug 2004 03:06:59 -0000	1.104
  @@ -697,6 +697,7 @@
                   lookForImports(context, doc);
               }
           }
  +        processTypes();
   
           if (def != null) {
               checkForUndefined(def, filename);
  @@ -2082,6 +2083,7 @@
               // See if we can map all the XML types to java(?) types
               // if we can, we use these as the types
               Node node = null;
  +            TypeEntry typeEntry = null;
   
               if ((typeName != null)
                       && (bindingEntry == null || bindingEntry.getMIMETypes().size()
== 0)) {
  @@ -2109,7 +2111,8 @@
               // ...
               // <schema targetNamespace="foo">
               // <element name="bar"...>  <--- This one
  -            node = getTypeEntry(elementName, true).getNode();
  +            typeEntry = getTypeEntry(elementName, true);
  +            node = typeEntry.getNode();
   
               // Check if this element is of the form:
               // <element name="foo" type="tns:foo_type"/>
  @@ -2121,7 +2124,8 @@
   
                   // If in fact we have such a type, go get the node that
                   // corresponds to THAT definition.
  -                node = getTypeEntry(type, false).getNode();
  +                typeEntry = getTypeEntry(type, false);
  +                node = typeEntry.getNode();
               }
   
               Vector vTypes = null;
  @@ -2134,11 +2138,7 @@
               } else {
   
                   // check for attributes
  -                Vector vAttrs = SchemaUtils.getContainedAttributeTypes(node,
  -                        this);
  -
  -                if (vAttrs != null) {
  -
  +                if (typeEntry.getContainedAttributes() != null) {
                       // can't do wrapped mode
                       wrapped = false;
                   }
  @@ -2151,8 +2151,7 @@
                   // TODO - If we are unable to represent any of the types in the
                   // element, we need to use SOAPElement/SOAPBodyElement.
                   // I don't believe getContainedElementDecl does the right thing yet.
  -                vTypes = SchemaUtils.getContainedElementDeclarations(node,
  -                        this);
  +                vTypes = typeEntry.getContainedElements();
               }
   
               // IF we got the type entries and we didn't find attributes
  @@ -2164,7 +2163,7 @@
                       ElementDecl elem = (ElementDecl) vTypes.elementAt(j);
                       Parameter p = new Parameter();
   
  -                    p.setQName(elem.getName());
  +                    p.setQName(elem.getQName());
                       p.setType(elem.getType());
                       p.setOmittable(elem.getMinOccursIs0());
                       fillParamInfo(p, bindingEntry, opName, partName);
  @@ -3683,5 +3682,28 @@
           }
   
           return null;
  +    }
  +    
  +    protected void processTypes() {
  +        for (Iterator i = typeTypeEntries.values().iterator(); i.hasNext(); ) {
  +            Type type = (Type) i.next();
  +            Node node = type.getNode();            
  +            
  +            // Process the attributes
  +            Vector attributes = 
  +                    SchemaUtils.getContainedAttributeTypes(node, this);
  +
  +            if (attributes != null) {
  +                type.setContainedAttributes(attributes);
  +            }
  +
  +            // Process the elements
  +            Vector elements =
  +                    SchemaUtils.getContainedElementDeclarations(node, this);
  +
  +            if (elements != null) {
  +                type.setContainedElements(elements);
  +            }
  +        }
       }
   }    // class SymbolTable
  
  
  
  1.6       +9 -1      ws-axis/java/src/org/apache/axis/wsdl/symbolTable/Type.java
  
  Index: Type.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/symbolTable/Type.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Type.java	25 Feb 2004 14:02:51 -0000	1.5
  +++ Type.java	22 Aug 2004 03:06:59 -0000	1.6
  @@ -25,7 +25,8 @@
    * @author Rich Scheuerle  (scheu@us.ibm.com)
    */
   public abstract class Type extends TypeEntry {
  -
  +    private boolean generated;	// true if java class is generated during WSDL->Java
processing
  +    
       /**
        * Create a Type object for an xml construct name that represents a base type
        * 
  @@ -56,5 +57,12 @@
        */
       protected Type(QName pqName, Node pNode) {
           super(pqName, pNode);
  +    }
  +    public void setGenerated(boolean b) {
  +        generated = true;        
  +    }
  +    
  +    public boolean isGenerated() {
  +        return generated;
       }
   }
  
  
  
  1.16      +41 -6     ws-axis/java/src/org/apache/axis/wsdl/symbolTable/TypeEntry.java
  
  Index: TypeEntry.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/symbolTable/TypeEntry.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- TypeEntry.java	25 Feb 2004 14:02:51 -0000	1.15
  +++ TypeEntry.java	22 Aug 2004 03:06:59 -0000	1.16
  @@ -22,6 +22,7 @@
   import java.io.IOException;
   import java.io.Serializable;
   import java.util.HashSet;
  +import java.util.Vector;
   
   /**
    * This class represents a wsdl types entry that is supported by the WSDL2Java emitter.
  @@ -104,6 +105,12 @@
       
       /** Field types */
       protected HashSet types = null;
  +    
  +    /** contained elements in the schema's type definition */
  +    protected Vector containedElements;
  +
  +    /** contained attributes in the schema's type definition */
  +    protected Vector containedAttributes;
   
       // whether this type is only referenced
       // via a binding's literal use.
  @@ -391,12 +398,15 @@
                       + "\n";
           }
   
  -        return super.toString(indent) + indent + "Class:         "
  -                + this.getClass().getName() + "\n" + indent + "Base?:         "
  -                + isBaseType + "\n" + indent + "Undefined?:    " + undefined
  -                + "\n" + indent + "isSimpleType?  " + isSimpleType + "\n"
  -                + indent + "Node:          " + getNode() + "\n" + indent
  -                + "Dims:          " + dims + "\n" + refString;
  +        return super.toString(indent) 
  +                + indent + "Class:         " + this.getClass().getName() + "\n" 
  +                + indent + "Base?:         " + isBaseType + "\n" 
  +                + indent + "Undefined?:    " + undefined + "\n" 
  +                + indent + "isSimpleType?  " + isSimpleType + "\n"
  +                + indent + "Node:          " + getNode() + "\n" 
  +                + indent + "Dims:          " + dims + "\n"              
  +                + indent + "isOnlyLiteralReferenced: " + onlyLiteralReference + "\n"
  +                + refString;
       }
   
       /**
  @@ -417,4 +427,29 @@
           }
           return types;
       }    // getNestedTypes
  +
  +    /**
  +     * @return Returns the containedAttributes.
  +     */
  +    public Vector getContainedAttributes() {
  +        return containedAttributes;
  +    }
  +    /**
  +     * @param containedAttributes The containedAttributes to set.
  +     */
  +    public void setContainedAttributes(Vector containedAttributes) {
  +        this.containedAttributes = containedAttributes;
  +    }
  +    /**
  +     * @return Returns the containedElements.
  +     */
  +    public Vector getContainedElements() {
  +        return containedElements;
  +    }
  +    /**
  +     * @param containedElements The containedElements to set.
  +     */
  +    public void setContainedElements(Vector containedElements) {
  +        this.containedElements = containedElements;
  +    }
   }
  
  
  
  1.41      +7 -6      ws-axis/java/src/org/apache/axis/wsdl/symbolTable/Utils.java
  
  Index: Utils.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/symbolTable/Utils.java,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- Utils.java	18 Aug 2004 11:33:56 -0000	1.40
  +++ Utils.java	22 Aug 2004 03:06:59 -0000	1.41
  @@ -640,12 +640,13 @@
           v = SchemaUtils.getContainedAttributeTypes(node, symbolTable);
   
           if (v != null) {
  -            for (int i = 0; i < v.size(); i += 2) {
  -                if (!types.contains(v.get(i))) {
  -                    types.add(v.get(i));
  -                    getNestedTypes(((TypeEntry) v.get(i)), types, symbolTable,
  -                            derivedFlag);
  -                }
  +            for (int i = 0; i < v.size(); i++) {
  +                ContainedAttribute attr = (ContainedAttribute) v.get(i);
  +                TypeEntry te = attr.getType();
  +                if (!types.contains(te)) {
  +                    types.add(te);
  +                    getNestedTypes(te, types, symbolTable, derivedFlag);
  +                }                
               }
           }
   
  
  
  
  1.1                  ws-axis/java/src/org/apache/axis/wsdl/symbolTable/ContainedAttribute.java
  
  Index: ContainedAttribute.java
  ===================================================================
  /*
   * Copyright 2001-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  package org.apache.axis.wsdl.symbolTable;
  
  import javax.xml.namespace.QName;
  
  public class ContainedAttribute extends ContainedEntry {
  
      /**
       * @param qname
       */
      protected ContainedAttribute(TypeEntry type, QName qname) {
          super(type, qname);
      }
  }
  
  
  
  1.1                  ws-axis/java/src/org/apache/axis/wsdl/symbolTable/ContainedEntry.java
  
  Index: ContainedEntry.java
  ===================================================================
  package org.apache.axis.wsdl.symbolTable;
  
  import javax.xml.namespace.QName;
  
  public class ContainedEntry extends SymTabEntry {    
      protected TypeEntry type;       // TypeEntry for nested type
      
      /**
       * @param qname
       */
      protected ContainedEntry(TypeEntry type, QName qname) {
          super(qname);
          this.type = type;
      }
      
      /**
       * @return Returns the type.
       */
      public TypeEntry getType() {
          return type;
      }
      /**
       * @param type The type to set.
       */
      public void setType(TypeEntry type) {
          this.type = type;
      }
  }
  
  
  
  1.70      +30 -0     ws-axis/java/src/org/apache/axis/wsdl/toJava/Emitter.java
  
  Index: Emitter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/Emitter.java,v
  retrieving revision 1.69
  retrieving revision 1.70
  diff -u -r1.69 -r1.70
  --- Emitter.java	10 May 2004 17:25:43 -0000	1.69
  +++ Emitter.java	22 Aug 2004 03:07:00 -0000	1.70
  @@ -504,6 +504,10 @@
               return fullJavaName;
           }
   
  +        fullJavaName = getJavaNameHook(qName);
  +        if (fullJavaName != null) {
  +            return fullJavaName;
  +        }
           // Use the namespace uri to get the appropriate package
           String pkg = getPackage(qName.getNamespaceURI());
   
  @@ -516,6 +520,32 @@
   
           return fullJavaName;
       }    // getJavaName
  +    
  +    protected String getJavaNameHook(QName qname) { return null; }
  +    
  +    
  +    /**
  +     * @param typeQName QName for containing xml type
  +     * @param xmlName QName for element
  +     * @return
  +     */
  +    protected String getJavaVariableName(QName typeQName, QName xmlName, boolean isElement)
{
  +        String javaName = null;
  +        
  +        
  +        javaName = getJavaVariableNameHook(typeQName, xmlName, isElement);        
  +        if (javaName == null) {
  +            String elemName = Utils.getLastLocalPart(xmlName.getLocalPart());         
  
  +            javaName = Utils.xmlNameToJava(elemName);
  +        }
  +        return javaName;
  +    }
  +        
  +    protected String getJavaVariableNameHook(QName typeQName, QName xmlName, boolean isElement)
{
  +        return null;
  +    }
  +        
  +    
   
       /**
        * Emit appropriate Java files for a WSDL at a given URL.
  
  
  
  1.46      +8 -12     ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaBeanHelperWriter.java
  
  Index: JavaBeanHelperWriter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaBeanHelperWriter.java,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- JavaBeanHelperWriter.java	25 Feb 2004 14:02:52 -0000	1.45
  +++ JavaBeanHelperWriter.java	22 Aug 2004 03:07:00 -0000	1.46
  @@ -16,6 +16,7 @@
   package org.apache.axis.wsdl.toJava;
   
   import org.apache.axis.utils.Messages;
  +import org.apache.axis.wsdl.symbolTable.ContainedAttribute;
   import org.apache.axis.wsdl.symbolTable.DefinedType;
   import org.apache.axis.wsdl.symbolTable.ElementDecl;
   import org.apache.axis.wsdl.symbolTable.SchemaUtils;
  @@ -270,14 +271,12 @@
               if (attributes != null) {
                   boolean wroteAttrDecl = false;
   
  -                for (int i = 0; i < attributes.size(); i += 2) {
  -                    TypeEntry te = (TypeEntry) attributes.get(i);
  -                    QName attrName = (QName) attributes.get(i + 1);
  -                    String attrLocalName = Utils.getLastLocalPart(attrName.getLocalPart());
  -                    String fieldName =
  -                            Utils.xmlNameToJava(attrLocalName);
  +                for (int i = 0; i < attributes.size(); i += 1) {
  +                    ContainedAttribute attr = (ContainedAttribute) attributes.get(i);
  +                    TypeEntry te = attr.getType();
  +                    QName attrName = attr.getQName();
   
  -                    fieldName = getAsFieldName(fieldName);
  +                    String fieldName = getAsFieldName(attr.getName());
   
                       QName attrXmlType = te.getQName();
   
  @@ -316,12 +315,9 @@
                           continue;
                       }
   
  -                    String elemLocalName = Utils.getLastLocalPart(elem.getName().getLocalPart());
  -                    String fieldName = Utils.xmlNameToJava(elemLocalName);
  +                    String fieldName = getAsFieldName(elem.getName());  // jongjin.
   
  -                    fieldName = getAsFieldName(fieldName);
  -
  -                    QName xmlName = elem.getName();
  +                    QName xmlName = elem.getQName();
   
                       // Some special handling for arrays.
                       TypeEntry elemType = elem.getType();
  
  
  
  1.68      +16 -25    ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaBeanWriter.java
  
  Index: JavaBeanWriter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaBeanWriter.java,v
  retrieving revision 1.67
  retrieving revision 1.68
  diff -u -r1.67 -r1.68
  --- JavaBeanWriter.java	29 Jul 2004 21:36:50 -0000	1.67
  +++ JavaBeanWriter.java	22 Aug 2004 03:07:00 -0000	1.68
  @@ -18,6 +18,7 @@
   import org.apache.axis.Constants;
   import org.apache.axis.utils.JavaUtils;
   import org.apache.axis.utils.Messages;
  +import org.apache.axis.wsdl.symbolTable.ContainedAttribute;
   import org.apache.axis.wsdl.symbolTable.ElementDecl;
   import org.apache.axis.wsdl.symbolTable.SchemaUtils;
   import org.apache.axis.wsdl.symbolTable.TypeEntry;
  @@ -266,8 +267,7 @@
                       variableName = Constants.ANYCONTENT;
                       isAny = true;
                   } else {
  -                    String elemName = Utils.getLastLocalPart(elem.getName().getLocalPart());
  -                    variableName = Utils.xmlNameToJava(elemName);
  +                    variableName = elem.getName();
                       
                       if (elem.getMinOccursIs0() || elem.getNillable()) {
                           typeName = Utils.getWrapperType(typeName);
  @@ -303,14 +303,11 @@
   
           // Add attribute names
           if (attributes != null) {
  -            for (int i = 0; i < attributes.size(); i += 2) {
  -                TypeEntry attr = (TypeEntry) attributes.get(i);
  -                String typeName = attr.getName();
  -                QName xmlName = (QName) attributes.get(i + 1);
  -                String attrName = Utils.getLastLocalPart(xmlName.getLocalPart());
  -                String variableName =
  -                        Utils.xmlNameToJava(attrName);
   
  +            for (int i = 0; i < attributes.size(); i += 1) {
  +                ContainedAttribute attr = (ContainedAttribute) attributes.get(i);
  +                String typeName = attr.getType().getName(); 
  +                String variableName = attr.getName();
                   names.add(typeName);
                   names.add(variableName);
   
  @@ -323,7 +320,7 @@
                   // bug 19069: need to generate code that access member variables that
                   // are enum types through the class interface, not the constructor
                   // this util method returns non-null if the type at node is an enum
  -                if (null != Utils.getEnumerationBaseAndValues(attr.getNode(),
  +                if (null != Utils.getEnumerationBaseAndValues(attr.getType().getNode(),
                           emitter.getSymbolTable())) {
                       enumerationTypes.add(typeName);
                   }
  @@ -566,31 +563,25 @@
               }
   
               // Process the attributes
  -            Vector attributes = SchemaUtils.getContainedAttributeTypes(
  -                    te.getNode(), emitter.getSymbolTable());
  -
  +            Vector attributes = te.getContainedAttributes();
               if (attributes != null) {
  -                for (int j = 0; j < attributes.size(); j += 2) {
  -                    paramTypes.add(((TypeEntry) attributes.get(j)).getName());
  -                    String name = Utils.getLastLocalPart(
  -                            ((QName) attributes.get(j + 1)).getLocalPart());
  -                    paramNames.add(mangle + Utils.xmlNameToJava(name));
  +                for (int j = 0; j < attributes.size(); j += 1) {
  +                    ContainedAttribute attr = (ContainedAttribute) attributes.get(j);
  +                    paramTypes.add(attr.getType().getName());
  +                    paramNames.add(attr.getName());
  +                            
                   }
               }
   
               // Process the elements
  -            Vector elements =
  -                    SchemaUtils.getContainedElementDeclarations(te.getNode(),
  -                            emitter.getSymbolTable());
  +            Vector elements = te.getContainedElements();
   
               if (elements != null) {
                   for (int j = 0; j < elements.size(); j++) {
                       ElementDecl elem = (ElementDecl) elements.get(j);
  -                    String name = Utils.getLastLocalPart(elem.getName().getLocalPart());
  +
                       paramTypes.add(elem.getType().getName());
  -                    paramNames.add(
  -                            mangle
  -                            + Utils.xmlNameToJava(name));
  +                    paramNames.add(elem.getName());
                   }
               }
           }
  
  
  
  1.55      +22 -1     ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaGeneratorFactory.java
  
  Index: JavaGeneratorFactory.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaGeneratorFactory.java,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -u -r1.54 -r1.55
  --- JavaGeneratorFactory.java	18 Aug 2004 11:33:57 -0000	1.54
  +++ JavaGeneratorFactory.java	22 Aug 2004 03:07:01 -0000	1.55
  @@ -25,7 +25,9 @@
   import org.apache.axis.wsdl.gen.NoopGenerator;
   import org.apache.axis.wsdl.symbolTable.BaseTypeMapping;
   import org.apache.axis.wsdl.symbolTable.BindingEntry;
  +import org.apache.axis.wsdl.symbolTable.ContainedAttribute;
   import org.apache.axis.wsdl.symbolTable.Element;
  +import org.apache.axis.wsdl.symbolTable.ElementDecl;
   import org.apache.axis.wsdl.symbolTable.FaultInfo;
   import org.apache.axis.wsdl.symbolTable.MessageEntry;
   import org.apache.axis.wsdl.symbolTable.Parameter;
  @@ -524,7 +526,7 @@
   
               if (Utils.getEnumerationBaseAndValues(te.getNode(), symbolTable) == null
                       &&SchemaUtils.getComplexElementExtensionBase(te.getNode(),
symbolTable) == null
  -                    &&SchemaUtils.getContainedAttributeTypes(te.getNode(), symbolTable)
== null) {
  +					&& te.getContainedAttributes() == null) {
                   if(!SchemaUtils.isSimpleTypeWithUnion(te.getNode())) {
                       if (base.isSimpleType()) {
                           // Case 1:
  @@ -632,7 +634,26 @@
                   // Now set the name with the constructed qname
                   tEntry.setName(emitter.getJavaName(typeQName));
               }
  +        
  +            Vector elements = tEntry.getContainedElements();
  +            if (elements != null) {
  +                for (int i = 0; i < elements.size(); i++) {
  +                    ElementDecl elem = (ElementDecl) elements.get(i);
  +                    String varName = emitter.getJavaVariableName(typeQName, elem.getQName(),
true);
  +                    elem.setName(varName);
  +                }
  +            }
  +            
  +            Vector attributes = tEntry.getContainedAttributes();
  +            if (attributes != null) {
  +                for (int i = 0; i < attributes.size(); i++) {
  +                    ContainedAttribute attr = (ContainedAttribute) attributes.get(i);
  +                    String varName = emitter.getJavaVariableName(typeQName, attr.getQName(),
false);
  +                    attr.setName(varName);
  +                }
  +            }
           }
  +
           // Set the entry with the same name as the ref'd entry
           // but add the appropriate amount of dimensions
           entry.setName(tEntry.getName() + dims);
  
  
  
  1.21      +10 -10    ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaTypeWriter.java
  
  Index: JavaTypeWriter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaTypeWriter.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- JavaTypeWriter.java	25 Feb 2004 14:02:52 -0000	1.20
  +++ JavaTypeWriter.java	22 Aug 2004 03:07:01 -0000	1.21
  @@ -19,6 +19,7 @@
   import org.apache.axis.wsdl.symbolTable.SchemaUtils;
   import org.apache.axis.wsdl.symbolTable.SymTabEntry;
   import org.apache.axis.wsdl.symbolTable.SymbolTable;
  +import org.apache.axis.wsdl.symbolTable.Type;
   import org.apache.axis.wsdl.symbolTable.TypeEntry;
   import org.w3c.dom.Node;
   
  @@ -84,12 +85,7 @@
                           }
                       }
   
  -                    typeWriter = getBeanWriter(
  -                            emitter, type,
  -                            SchemaUtils.getContainedElementDeclarations(
  -                                    node, symbolTable), base,
  -                            SchemaUtils.getContainedAttributeTypes(
  -                                    node, symbolTable));
  +                    typeWriter = getBeanWriter(emitter, type, base);
                   }
               }
   
  @@ -98,6 +94,10 @@
               if (holderIsNeeded(type)) {
                   holderWriter = getHolderWriter(emitter, type);
               }
  +            
  +            if (typeWriter != null) {
  +                ((Type)type).setGenerated(true);
  +            }
           }
       }    // ctor
   
  @@ -154,10 +154,10 @@
        * @param attributes 
        * @return 
        */
  -    protected JavaWriter getBeanWriter(Emitter emitter, TypeEntry type,
  -                                       Vector elements, TypeEntry base,
  -                                       Vector attributes) {
  -
  +    protected JavaWriter getBeanWriter(Emitter emitter, TypeEntry type, TypeEntry base)
{   // CONTAINED_ELEM_AND_ATTR
  +        Vector elements = type.getContainedElements();
  +        Vector attributes = type.getContainedAttributes();
  +        
           JavaWriter helperWriter = getBeanHelperWriter(emitter, type, elements,
                   base, attributes);
   
  
  
  

Mime
View raw message