axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/wsdl/toJava CollectionType.java DefinedElement.java DefinedType.java Emitter.java SymbolTable.java TypeEntry.java
Date Thu, 13 Dec 2001 18:25:48 GMT
scheu       01/12/13 10:25:48

  Modified:    java/src/org/apache/axis/wsdl/toJava CollectionType.java
                        DefinedElement.java DefinedType.java Emitter.java
                        SymbolTable.java TypeEntry.java
  Log:
  Removed the hated shouldEmit flag from the TypeEntry.
  
  Revision  Changes    Path
  1.3       +0 -3      xml-axis/java/src/org/apache/axis/wsdl/toJava/CollectionType.java
  
  Index: CollectionType.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/CollectionType.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CollectionType.java	2001/12/13 17:33:17	1.2
  +++ CollectionType.java	2001/12/13 18:25:48	1.3
  @@ -69,9 +69,6 @@
   public class CollectionType extends DefinedType {
       public CollectionType(QName pqName, TypeEntry refType, Node pNode, String dims) {
           super(pqName, refType, pNode, dims);
  -
  -        // Initially these CollectionTypes are not emitted.  This may change.
  -        setShouldEmit(false); 
       }
   };
   
  
  
  
  1.2       +0 -2      xml-axis/java/src/org/apache/axis/wsdl/toJava/DefinedElement.java
  
  Index: DefinedElement.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/DefinedElement.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefinedElement.java	2001/12/13 17:33:17	1.1
  +++ DefinedElement.java	2001/12/13 18:25:48	1.2
  @@ -71,13 +71,11 @@
        */
       public DefinedElement(QName pqName, TypeEntry refType, Node pNode, String dims) {
           super(pqName, refType, pNode, dims);
  -        setShouldEmit(false);  // No need to emit since code will use ref info
       };
       /**
        * Create an element type defined directly.               
        */
       public DefinedElement(QName pqName, String pjName, Node pNode) {
           super(pqName, pjName, pNode);
  -        setShouldEmit(false);  // Only emit if refd
       }
   };
  
  
  
  1.3       +0 -2      xml-axis/java/src/org/apache/axis/wsdl/toJava/DefinedType.java
  
  Index: DefinedType.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/DefinedType.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefinedType.java	2001/12/13 17:33:17	1.2
  +++ DefinedType.java	2001/12/13 18:25:48	1.3
  @@ -65,11 +65,9 @@
   public class DefinedType extends Type {
       public DefinedType(QName pqName, String pjName, Node pNode) {
           super(pqName, pjName, pNode);
  -        setShouldEmit(true);
       }
       public DefinedType(QName pqName, TypeEntry refType, Node pNode, String dims) {
           super(pqName, refType, pNode, dims);
  -        setShouldEmit(true);
       }
   };
   
  
  
  
  1.3       +10 -1     xml-axis/java/src/org/apache/axis/wsdl/toJava/Emitter.java
  
  Index: Emitter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/Emitter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Emitter.java	2001/12/13 17:33:17	1.2
  +++ Emitter.java	2001/12/13 18:25:48	1.3
  @@ -389,7 +389,16 @@
           Vector types = symbolTable.getTypes();
           for (int i = 0; i < types.size(); ++i) {
               TypeEntry type = (TypeEntry) types.elementAt(i);
  -            if (type.getNode() != null && type.getShouldEmit() && type.getBaseType()
== null) {
  +
  +            // Write out the type if and only if:
  +            //  - we found its definition (getNode())
  +            //  - it is referenced 
  +            //  - it is not a base java type
  +            // (Note that types that are arrays are passed to getWriter
  +            //  because they may require a Holder)
  +            if (type.getNode() != null &&   
  +                type.isReferenced() && 
  +                type.getBaseType() == null) {
                   Writer writer = writerFactory.getWriter(type, symbolTable);
                   writer.write();
               }
  
  
  
  1.5       +16 -27    xml-axis/java/src/org/apache/axis/wsdl/toJava/SymbolTable.java
  
  Index: SymbolTable.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/SymbolTable.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SymbolTable.java	2001/12/13 17:33:17	1.4
  +++ SymbolTable.java	2001/12/13 18:25:48	1.5
  @@ -532,11 +532,9 @@
               if (debug) {
                   System.out.println("Create Type From Def:" + qName);
               }
  -
  -            map(qName.getNamespaceURI());
  -
  +            
               // If the node has a type or ref attribute, get the 
  -            // ref'd type
  +            // qname representing the type
               QName refQName = Utils.getNodeTypeRefQName(node);
               if (refQName != null) {
                   // Discover whether type is from a type= or ref=/element=
  @@ -547,22 +545,21 @@
                   // Now get the TypeEntry
                   TypeEntry refType = getTypeEntry(refQName, !typeAttr);
   
  -                // Create a type from the referenced type
  +                // Create a type from the referenced TypeEntry
                   if (!belowSchemaLevel) {
                       symbolTablePut(new DefinedElement(qName, refType, node, ""));
                   }
  -
               }   
               else {
  -
  +                // Flow to here indicates no type= or ref= attribute.
  +                
                   // See if this is an array definition.
                   QName arrayEQName = SchemaUtils.getArrayElementQName(node);
                   if (arrayEQName != null) {
  -                    TypeEntry arrayType = null;
  -                    // Get the TypeEntry for the element name
  +                    // Get the TypeEntry for the array element type
                       TypeEntry arrayEType = getTypeEntry(arrayEQName, false);
                       if (arrayEType == null) {
  -                        // Array Element Type not defined, add one
  +                        // Array Element Type not defined yet, add one
                           if (debug) {
                               System.out.println("Create Type From Ref:" + arrayEQName);
                           }
  @@ -575,6 +572,7 @@
                       }
   
                       // Create a defined type or element array of arrayEType.
  +                    TypeEntry arrayType = null;
                       if (isElement) {
                           arrayType = new DefinedElement(qName, arrayEType, node, "[]");
                       } else {
  @@ -583,16 +581,13 @@
                       symbolTablePut(arrayType);
                   }
                   else {
  -                    // Create a TypeEntry representing a base type or non-base type
  +                    // Create a TypeEntry representing this non-array type/element
                       String baseJavaName = Utils.getBaseJavaName(qName);
                       if (baseJavaName != null) {
                           symbolTablePut(new BaseJavaType(qName));
                       }
                       else if (isElement) {
  -                        DefinedElement element = new DefinedElement(
  -                                  qName, getJavaName(qName), node);
  -                        symbolTablePut(element);
  -                        element.setShouldEmit(true);
  +                        symbolTablePut(new DefinedElement(qName, getJavaName(qName), node));
                       }
                       else {
                           symbolTablePut(new DefinedType(qName, getJavaName(qName), node));
  @@ -619,17 +614,18 @@
               
               // A symbol table entry is created if the TypeEntry is not found    
               if (type == null) {
  -                // See if this is a special qname for collections
  +                // See if this is a special QName for collections
                   if (qName.getLocalPart().indexOf("[") > 0) {
                       // Get the TypeEntry for the collection element
                       TypeEntry collEl = getTypeEntry(typeAttr, false);
                       if (collEl == null) {
  +                        // Collection Element Type not defined yet, add one.
                           if (debug) {
                               System.out.println("Create Type From Ref:" + typeAttr);
                           }
                           String baseJavaName = Utils.getBaseJavaName(typeAttr);
                           if (baseJavaName != null) {
  -                            collEl =new BaseJavaType(typeAttr);
  +                            collEl = new BaseJavaType(typeAttr);
                           } else {
                               collEl = new UndefinedType(typeAttr);
                           }
  @@ -641,8 +637,6 @@
                       symbolTablePut(new CollectionType(qName, collEl, node, "[]"));
                   } else {
                       // Add a BaseJavaType or Undefined Type/Element
  -                    
  -                    // Type not defined, add a base java type or a refdType
                       if (debug) {
                           System.out.println("Create Type From Ref:" + qName);
                       }
  @@ -654,15 +648,7 @@
                       else
                           symbolTablePut(new UndefinedElement(qName));
                   }
  -            } else {
  -                // Type exists, update shouldEmit flag if necessary
  -                if (type instanceof DefinedElement &&
  -                    type.getNode() != null &&
  -                    type.getJavaName().indexOf("[") < 0) {
  -                    type.setShouldEmit(true);
  -                }
               }
  -                
           }
       } // createTypeFromRef
   
  @@ -670,6 +656,9 @@
        * Convert the specified QName into a full Java Name.
        */
       public String getJavaName(QName qName) {
  +
  +        // Get/Create a package for this namespace 
  +        map(qName.getNamespaceURI());
   
           // If this is one of our special 'collection' qnames.
           // get the element type and append []
  
  
  
  1.2       +0 -20     xml-axis/java/src/org/apache/axis/wsdl/toJava/TypeEntry.java
  
  Index: TypeEntry.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/TypeEntry.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TypeEntry.java	2001/12/13 17:33:17	1.1
  +++ TypeEntry.java	2001/12/13 18:25:48	1.2
  @@ -123,8 +123,6 @@
                                    // then the undefined flag is set.
                                    //  The java name cannot be determined
                                    // until the Undefined type is found.
  -    protected boolean shouldEmit;// Indicates if this TypeEntry should 
  -                                 // have code emitted for it.
       protected boolean isBaseType;// Indicates if represented by a 
                                    // java primitive or util class
   
  @@ -152,7 +150,6 @@
               setName(refType.getName() + dims);             
               isBaseType = (refType.getBaseType() != null && dims.equals(""));
           }
  -        shouldEmit = false;
           
           //System.out.println(toString());
   
  @@ -167,7 +164,6 @@
           refType = null;
           undefined = false;
           dims = "";
  -        shouldEmit  = (node != null);
           isBaseType = false;
           //System.out.println(toString());
       }
  @@ -180,7 +176,6 @@
           node = null;
           undefined = false;
           dims = "";
  -        shouldEmit = false;
           isBaseType = true;
           //System.out.println(toString());
       }
  @@ -232,20 +227,6 @@
       }
   
       /**
  -     * Query whether a Node should be emitted.
  -     */
  -    public boolean getShouldEmit() {
  -        return shouldEmit;
  -    }
  -
  -    /**
  -     * Indicate whether a Node should be emitted.
  -     */
  -    public void setShouldEmit(boolean pShouldEmit) {
  -        shouldEmit = pShouldEmit;
  -    }
  -
  -    /**
        * Returns the Java Base Type Name.
        * For example if the Type represents a schema integer, "int" is returned.
        * If this is a user defined type, null is returned.
  @@ -275,7 +256,6 @@
               refString = indent + "RefType:\n" + refType.toString(indent + "  ") + "\n";
           return super.toString(indent) + 
               indent + "Class:         " + this.getClass().getName() + "\n" + 
  -            indent + "Emit?:         " + shouldEmit + "\n" + 
               indent + "Base?:         " + isBaseType + "\n" + 
               indent + "Undefined?:    " + undefined + "\n" + 
               indent + "Node:          " + getNode() + "\n" +
  
  
  

Mime
View raw message