axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bu...@apache.org
Subject cvs commit: xml-axis/java/test/wsdl/types ComprehensiveTypes.wsdl
Date Thu, 13 Dec 2001 17:11:57 GMT
butek       01/12/13 09:11:57

  Modified:    java/src/org/apache/axis/wsdl/toJava JavaDeployWriter.java
                        JavaHolderWriter.java JavaSkelWriter.java
                        JavaStubWriter.java JavaTestCaseWriter.java
                        JavaTypeWriter.java JavaWriterFactory.java
                        SymTabEntry.java SymbolTable.java Utils.java
               java/test/wsdl/types ComprehensiveTypes.wsdl
  Log:
  Added an array test to ComprehensiveTypes.wsdl.  Had to make a fair number of
  changes to get array holders to work.
  
  Revision  Changes    Path
  1.2       +2 -1      xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaDeployWriter.java
  
  Index: JavaDeployWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaDeployWriter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JavaDeployWriter.java	2001/12/11 15:08:47	1.1
  +++ JavaDeployWriter.java	2001/12/13 17:11:56	1.2
  @@ -138,7 +138,8 @@
           pw.println();
           for (int i = 0; i < types.size(); ++i) {
               Type type = (Type) types.elementAt(i);
  -            if (type.getBaseType() == null && type.isReferenced() && type.getShouldEmit())
{
  +            if (type.getBaseType() == null && type.isReferenced()
  +                    && !type.getJavaName().endsWith("[]")) {
                   pw.println("  <beanMapping");
                   pw.println("    xmlns:ns=\"" + type.getQName().getNamespaceURI() + "\"");
                   pw.println("    qname=\"ns:" + type.getQName().getLocalPart() + '"');
  
  
  
  1.2       +9 -1      xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaHolderWriter.java
  
  Index: JavaHolderWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaHolderWriter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JavaHolderWriter.java	2001/12/11 15:08:47	1.1
  +++ JavaHolderWriter.java	2001/12/13 17:11:56	1.2
  @@ -56,6 +56,8 @@
   
   import java.io.IOException;
   
  +import javax.wsdl.QName;
  +
   import org.apache.axis.utils.JavaUtils;
   
   /**
  @@ -68,7 +70,13 @@
        * Constructor.
        */
       protected JavaHolderWriter(Emitter emitter, Type type) {
  -        super(emitter, type, "Holder", "java",
  +        super(
  +                emitter,
  +                new QName(
  +                        type.getQName().getNamespaceURI(),
  +                        Utils.xmlNameToJavaClass(type.getQName().getLocalPart())),
  +                "Holder",
  +                "java",
                   JavaUtils.getMessage("genHolder00"));
           this.type = type;
       } // ctor
  
  
  
  1.2       +1 -1      xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaSkelWriter.java
  
  Index: JavaSkelWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaSkelWriter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JavaSkelWriter.java	2001/12/11 15:08:47	1.1
  +++ JavaSkelWriter.java	2001/12/13 17:11:56	1.2
  @@ -173,7 +173,7 @@
           for (int i = 0; i < parms.list.size(); ++i) {
               Parameter p = (Parameter) parms.list.get(i);
   
  -            String holder = Utils.holder(p.type);
  +            String holder = Utils.holder(p.type, symbolTable);
               if (p.mode == Parameter.INOUT) {
                   pw.println("        " + holder + " " + p.name + "Holder = new " + holder
+ "(" + Utils.xmlNameToJava(p.name) + ");");
               }
  
  
  
  1.2       +27 -5     xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java
  
  Index: JavaStubWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JavaStubWriter.java	2001/12/11 15:08:47	1.1
  +++ JavaStubWriter.java	2001/12/13 17:11:56	1.2
  @@ -337,7 +337,7 @@
       private boolean firstSer = true ;
   
       private void writeSerializationInit(Type type) throws IOException {
  -        if (type.getBaseType() != null || !type.getShouldEmit()) {
  +        if (type.getBaseType() != null || type.getName().endsWith("[]")) {
               return;
           }
           if ( firstSer ) {
  @@ -445,7 +445,19 @@
                       while (p.mode != Parameter.INOUT) {
                           p = (Parameter) parms.list.get(++i);
                       }
  -                    pw.println ("            " + Utils.xmlNameToJava(p.name) + "._value
= " + getResponseString(p.type, "resp"));
  +                    String javifiedName = Utils.xmlNameToJava(p.name);
  +                    // duplicate scheu's quick fix from a couple dozen lines up...
  +                    if (p.type.getName().endsWith("[]")) {
  +                        pw.println("             // REVISIT THIS!");
  +                        pw.println ("            " + javifiedName
  +                                    + "._value = (" + p.type.getName()
  +                                    + ") org.apache.axis.utils.JavaUtils.convert(resp,
"
  +                                    + p.type.getName() + ".class);");
  +                    }
  +                    else {
  +                        pw.println ("            " + javifiedName + "._value = "
  +                                + getResponseString(p.type, "resp"));
  +                    }
                   }
                   else {
                       // (parms.outputs == 1)
  @@ -478,9 +490,19 @@
                       if (p.mode != Parameter.IN) {
                           if (firstInoutIsResp) {
                               firstInoutIsResp = false;
  -                            pw.println ("            " + javifiedName
  -                                    + "._value = "
  -                                    + getResponseString(p.type,  "resp"));
  +                            // duplicate scheu's quick fix from a couple dozen lines up...
  +                            if (p.type.getName().endsWith("[]")) {
  +                                pw.println("             // REVISIT THIS!");
  +                                pw.println ("            " + javifiedName
  +                                        + "._value = (" + p.type.getName()
  +                                        + ") org.apache.axis.utils.JavaUtils.convert(resp,
"
  +                                        + p.type.getName() + ".class);");
  +                            }
  +                            else {
  +                                pw.println ("            " + javifiedName +
  +                                            "._value = " +
  +                                            getResponseString(p.type,  "resp"));
  +                            }
                           }
                           else {
                               pw.println ("            " + javifiedName
  
  
  
  1.3       +6 -1      xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaTestCaseWriter.java
  
  Index: JavaTestCaseWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaTestCaseWriter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JavaTestCaseWriter.java	2001/12/11 16:43:28	1.2
  +++ JavaTestCaseWriter.java	2001/12/13 17:11:56	1.3
  @@ -217,7 +217,8 @@
                   String suffix = "";
   
                   if (param.mode != Parameter.IN) {
  -                    pw.print("new " + Utils.holder(param.type) + "(");
  +                    pw.print("new " + Utils.holder(param.type, symbolTable)
  +                            + "(");
                       suffix = ")";
                   }
   
  @@ -238,6 +239,10 @@
                           pw.print("new java.math.BigInteger(\"0\")");
                       } else if (paramType.equals("byte[]")) {
                           pw.print("new byte[0]");
  +                    } else if (paramType.endsWith("[]")) {
  +                        pw.print("new "
  +                                + paramType.substring(0, paramType.length() - 1)
  +                                + "0]");
                       } else {
   
                           // We have some constructed type.
  
  
  
  1.2       +19 -13    xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaTypeWriter.java
  
  Index: JavaTypeWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaTypeWriter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JavaTypeWriter.java	2001/12/11 15:08:47	1.1
  +++ JavaTypeWriter.java	2001/12/13 17:11:56	1.2
  @@ -87,23 +87,29 @@
               // Determine what sort of type this is and instantiate the appropriate Writer.
               Node node = type.getNode();
   
  -            // Generate the proper class for either "complex" or "enumeration" types
  -            Vector v = SchemaUtils.getComplexElementTypesAndNames(
  -                    node, symbolTable);
  -            if (v != null) {
  -                typeWriter = new JavaComplexTypeWriter(emitter, type, v,
  -                    SchemaUtils.getComplexElementExtensionBase(node,symbolTable));
  -            }
  -            else {
  -                v = SchemaUtils.getEnumerationBaseAndValues(node, symbolTable);
  +            // If it's an array, don't emit a class
  +            if (!type.getName().endsWith("[]")) {
  +
  +                // Generate the proper class for either "complex" or "enumeration" types
  +                Vector v = SchemaUtils.getComplexElementTypesAndNames(
  +                        node, symbolTable);
                   if (v != null) {
  -                    typeWriter = new JavaEnumTypeWriter(emitter, type, v);
  +                    typeWriter = new JavaComplexTypeWriter(emitter, type, v,
  +                            SchemaUtils.getComplexElementExtensionBase(
  +                            node, symbolTable));
  +                }
  +                else {
  +                    v = SchemaUtils.getEnumerationBaseAndValues(
  +                            node, symbolTable);
  +                    if (v != null) {
  +                        typeWriter = new JavaEnumTypeWriter(emitter, type, v);
  +                    }
                   }
               }
   
  -            // If a type class is written, and the holder is needed (ie., something uses
this
  -            // type as an out or inout parameter), instantiate the holder writer.
  -            if (v != null && holderIsNeeded(type)) {
  +            // If the holder is needed (ie., something uses this type as an out or inout
  +            // parameter), instantiate the holder writer.
  +            if (holderIsNeeded(type)) {
                   holderWriter = new JavaHolderWriter(emitter, type);
               }
           }
  
  
  
  1.2       +7 -5      xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaWriterFactory.java
  
  Index: JavaWriterFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaWriterFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JavaWriterFactory.java	2001/12/11 15:08:47	1.1
  +++ JavaWriterFactory.java	2001/12/13 17:11:56	1.2
  @@ -73,7 +73,8 @@
   */
   
   public class JavaWriterFactory implements WriterFactory {
  -    private Emitter emitter;
  +    private Emitter     emitter;
  +    private SymbolTable symbolTable;
   
       /**
        * Default constructor.  Note that this class is unusable until setEmitter
  @@ -88,6 +89,7 @@
        * - construct signatures
        */
       public void writerPass(Definition def, SymbolTable symbolTable) {
  +        this.symbolTable = symbolTable;
           javifyNames(symbolTable);
           resolveNameClashes(symbolTable);
           ignoreNonSOAPBindingPortTypes(symbolTable);
  @@ -400,14 +402,14 @@
                   skelSig = skelSig + p.type.getName() + " " + javifiedName;
               }
               else if (p.mode == Parameter.INOUT) {
  -                signature = signature + Utils.holder(p.type) + " " +
  -                        javifiedName;
  +                signature = signature + Utils.holder(p.type, symbolTable) + " "
  +                        + javifiedName;
                   skelSig = skelSig + p.type.getName() + " " + javifiedName;
               }
               else// (p.mode == Parameter.OUT)
               {
  -                signature = signature + Utils.holder(p.type) + " " +
  -                        javifiedName;
  +                signature = signature + Utils.holder(p.type, symbolTable) + " "
  +                        + javifiedName;
               }
           }
           signature = signature + ") throws java.rmi.RemoteException";
  
  
  
  1.2       +13 -3     xml-axis/java/src/org/apache/axis/wsdl/toJava/SymTabEntry.java
  
  Index: SymTabEntry.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/SymTabEntry.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SymTabEntry.java	2001/12/11 15:08:47	1.1
  +++ SymTabEntry.java	2001/12/13 17:11:56	1.2
  @@ -56,6 +56,7 @@
   package org.apache.axis.wsdl.toJava;
   
   import java.util.HashMap;
  +import java.util.Iterator;
   
   import javax.wsdl.QName;
   
  @@ -143,8 +144,17 @@
        * Collate the info in this object in string form.
        */
       public String toString() {
  -        return "QName:         " + qname + '\n' + 
  -               "name:          " + name + '\n' + 
  -               "isReferenced?  " + isReferenced + '\n';
  +        String string =
  +                "QName:         " + qname + '\n' + 
  +                "name:          " + name + '\n' + 
  +                "isReferenced?  " + isReferenced + '\n';
  +        String prefix = "dynamicVars:   ";
  +        Iterator keys = dynamicVars.keySet().iterator();
  +        while (keys.hasNext()) {
  +            Object key = keys.next();
  +            string += prefix + key + " = " + dynamicVars.get(key) + '\n';
  +            prefix = "               ";
  +        }
  +        return string;
       } // toString
   } // abstract class SymTabEntry
  
  
  
  1.3       +0 -1      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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SymbolTable.java	2001/12/12 20:53:38	1.2
  +++ SymbolTable.java	2001/12/13 17:11:56	1.3
  @@ -413,7 +413,6 @@
                           arrayType = new DefinedType(qName, javaName, node);
                       }
                       symbolTablePut(arrayType);
  -                    arrayType.setShouldEmit(false);
                   }
                   else {
                       // Create a Type representing a base type or non-base type
  
  
  
  1.2       +4 -1      xml-axis/java/src/org/apache/axis/wsdl/toJava/Utils.java
  
  Index: Utils.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/Utils.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Utils.java	2001/12/11 15:08:47	1.1
  +++ Utils.java	2001/12/13 17:11:57	1.2
  @@ -517,7 +517,7 @@
       /**
        * Given a type, return the Java mapping of that type's holder.
        */
  -    public static String holder(Type type) {
  +    public static String holder(Type type, SymbolTable symbolTable) {
           String typeValue = type.getName();
           if (typeValue.equals("java.lang.String")) {
               return "javax.xml.rpc.holders.StringHolder";
  @@ -536,6 +536,9 @@
           }
           else if (typeValue.equals("byte[]")) {
               return "javax.xml.rpc.holders.ByteArrayHolder";
  +        }
  +        else if (typeValue.endsWith("[]")) {
  +            return symbolTable.getJavaName(type.getQName()) + "Holder";
           }
           else if (typeValue.equals("int")
                   || typeValue.equals("long")
  
  
  
  1.4       +0 -4      xml-axis/java/test/wsdl/types/ComprehensiveTypes.wsdl
  
  Index: ComprehensiveTypes.wsdl
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/types/ComprehensiveTypes.wsdl,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ComprehensiveTypes.wsdl	2001/12/12 20:53:38	1.3
  +++ ComprehensiveTypes.wsdl	2001/12/13 17:11:57	1.4
  @@ -157,7 +157,6 @@
         <input message="tns:empty"/>
         <output message="tns:enum"/>
       </operation>
  -<!--
       <operation name="arrayIn">
         <input message="tns:array"/>
         <output message="tns:empty"/>
  @@ -170,7 +169,6 @@
         <input message="tns:empty"/>
         <output message="tns:array"/>
       </operation>
  --->
       <operation name="complexAllIn">
         <input message="tns:complexAll"/>
         <output message="tns:empty"/>
  @@ -316,7 +314,6 @@
               encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
         </output>
       </operation>
  -<!--
       <operation name="arrayIn">
         <soap:operation soapAction=""/>
         <input>
  @@ -362,7 +359,6 @@
               encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
         </output>
       </operation>
  --->
       <operation name="complexAllIn">
         <soap:operation soapAction=""/>
         <input>
  
  
  

Mime
View raw message