You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2003/10/16 15:41:29 UTC

cvs commit: ws-axis/java/src/org/apache/axis/wsdl/toJava Namespaces.java Utils.java

dims        2003/10/16 06:41:29

  Modified:    java/src/org/apache/axis/wsdl/toJava Namespaces.java
                        Utils.java
  Log:
  Fix for Bug 23731 - Impossible to specify code gen. location for holders of arrays of predefined XSD and SOAPENC types
  Fix for Bug 18911 - generated classes in java.lang.*
  
  from Andrei.Iltchenko@nl.compuware.com (Andrei Iltchenko)
  
  Revision  Changes    Path
  1.8       +10 -3     ws-axis/java/src/org/apache/axis/wsdl/toJava/Namespaces.java
  
  Index: Namespaces.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/Namespaces.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Namespaces.java	22 Apr 2003 19:36:27 -0000	1.7
  +++ Namespaces.java	16 Oct 2003 13:41:29 -0000	1.8
  @@ -112,18 +112,26 @@
        * this namespace, create one.
        */
       public String getCreate(String key) {
  +        return getCreate(key, true);
  +    } // getCreate
  +    
  +    /**
  +     * Get the package name for the given namespace.  If there is no entry in the HashMap for
  +     * this namespace, create one if create flag is on, return <tt>null</tt> otherwise.
  +     */
  +    String getCreate(String key, boolean create) {
           if (defaultPackage != null) {
               return defaultPackage;
           }
           String value = (String)super.get(key);
  -        if (value == null) {
  +        if (value == null && create) {
               value = normalizePackageName(
                           (String)Utils.makePackageName(key),
                           javaPkgSeparator);
               put(key, value);
           }
           return (String) value;
  -    } // getCreate
  +    } // getCreate    
   
       /**
        * Get the package name in directory format (dots replaced by slashes).  If the package name
  @@ -208,5 +216,4 @@
       public void setDefaultPackage(String defaultPackage) {
           this.defaultPackage = defaultPackage;
       }
  -
   } // class Namespaces
  
  
  
  1.77      +17 -2     ws-axis/java/src/org/apache/axis/wsdl/toJava/Utils.java
  
  Index: Utils.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/Utils.java,v
  retrieving revision 1.76
  retrieving revision 1.77
  diff -u -r1.76 -r1.77
  --- Utils.java	29 Jun 2003 15:02:50 -0000	1.76
  +++ Utils.java	16 Oct 2003 13:41:29 -0000	1.77
  @@ -57,16 +57,18 @@
   import org.apache.axis.Constants;
   import org.apache.axis.enum.Style;
   import org.apache.axis.utils.JavaUtils;
  +import org.apache.axis.wsdl.symbolTable.BaseType;
   import org.apache.axis.wsdl.symbolTable.BindingEntry;
   import org.apache.axis.wsdl.symbolTable.CollectionTE;
  +import org.apache.axis.wsdl.symbolTable.CollectionType;
   import org.apache.axis.wsdl.symbolTable.Element;
   import org.apache.axis.wsdl.symbolTable.MessageEntry;
  +import org.apache.axis.wsdl.symbolTable.MimeInfo;
   import org.apache.axis.wsdl.symbolTable.Parameter;
   import org.apache.axis.wsdl.symbolTable.Parameters;
   import org.apache.axis.wsdl.symbolTable.SchemaUtils;
   import org.apache.axis.wsdl.symbolTable.SymbolTable;
   import org.apache.axis.wsdl.symbolTable.TypeEntry;
  -import org.apache.axis.wsdl.symbolTable.MimeInfo;
   import org.w3c.dom.Node;
   import org.w3c.dom.NodeList;
   
  @@ -134,11 +136,24 @@
           // Anything else with [] gets its holder from the qname
           else if (typeValue.endsWith("[]")) {
               String name = emitter.getJavaName(type.getQName());
  +            String packagePrefix = "";
  +            // Make sure that holders for arrays of either primitive Java types
  +            // or their wrappers are generated at a predictable location.
  +            if (type instanceof CollectionType
  +                    && type.getRefType() instanceof BaseType) {
  +                String uri = type.getRefType().getQName().getNamespaceURI();
  +                packagePrefix = emitter.getNamespaces().getCreate(uri, false);
  +                if (packagePrefix == null) {
  +                    packagePrefix = "";
  +                } else {
  +                    packagePrefix += '.';
  +                }
  +            }
               // This could be a special QName for a indexed property.
               // If so, change the [] to Array.
               name = JavaUtils.replace(name, "[]", "Array");
               name = addPackageName(name, "holders");
  -            return name + "Holder";
  +            return packagePrefix + name + "Holder";
           }
           // String also has a reserved holder
           else if (typeValue.equals("String")) {