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 JavaDeployWriter.java JavaStubWriter.java
Date Thu, 31 Jan 2002 15:20:27 GMT
scheu       02/01/31 07:20:27

  Modified:    java/src/org/apache/axis/wsdl/toJava JavaDeployWriter.java
                        JavaStubWriter.java
  Log:
  Arrays and Enums are now registered in the Stubs and deploy.wsdd emitted by WSDL2Java
  
  Revision  Changes    Path
  1.13      +13 -12    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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- JavaDeployWriter.java	30 Jan 2002 03:34:10 -0000	1.12
  +++ JavaDeployWriter.java	31 Jan 2002 15:20:26 -0000	1.13
  @@ -149,22 +149,23 @@
               TypeEntry type = (TypeEntry) types.elementAt(i);
               if (type.getBaseType() == null && type.isReferenced()
                       && !type.isOnlyLiteralReferenced()
  -                    && !type.getName().endsWith("[]")) {
  -                // Generate a typeMapping clause that is compatible with JSR 109
  -                // This replaces the old beanMapping clause
  -                //pw.println("  <beanMapping");
  -                //pw.println("    xmlns:ns=\"" + type.getQName().getNamespaceURI() + "\"");
  -                //pw.println("    qname=\"ns:" + type.getQName().getLocalPart() + '"');
  -                //pw.println("    type=\"" + 
  -                // Constants.NSPREFIX_WSDD_JAVA + ":" + type.getName() + '"');
  -                //pw.println("  />");
  -
  +                    && !(type instanceof CollectionType)) {
                   pw.println("  <typeMapping");
                   pw.println("    xmlns:ns=\"" + type.getQName().getNamespaceURI() + "\"");
                   pw.println("    qname=\"ns:" + type.getQName().getLocalPart() + '"');
                   pw.println("    type=\"java:" + type.getName() + '"');
  -                pw.println("    serializer=\"org.apache.axis.encoding.ser.BeanSerializerFactory\"");
  -                pw.println("    deserializer=\"org.apache.axis.encoding.ser.BeanDeserializerFactory\"");
  +                if (type.getName().endsWith("[]")) {
  +                    pw.println("    serializer=\"org.apache.axis.encoding.ser.ArraySerializerFactory\"");
  +                    pw.println("    deserializer=\"org.apache.axis.encoding.ser.ArrayDeserializerFactory\"");
  +                } else if (type.getNode() != null && 
  +                   SchemaUtils.getEnumerationBaseAndValues(
  +                     type.getNode(), emitter.getSymbolTable()) != null) {
  +                    pw.println("    serializer=\"org.apache.axis.encoding.ser.EnumSerializerFactory\"");
  +                    pw.println("    deserializer=\"org.apache.axis.encoding.ser.EnumDeserializerFactory\"");
  +                } else {
  +                    pw.println("    serializer=\"org.apache.axis.encoding.ser.BeanSerializerFactory\"");
  +                    pw.println("    deserializer=\"org.apache.axis.encoding.ser.BeanDeserializerFactory\"");
  +                }
                   pw.println("    encodingStyle=\""+ Constants.URI_CURRENT_SOAP_ENC+"\"");
                   pw.println("  />");
               }
  
  
  
  1.24      +40 -14    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.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- JavaStubWriter.java	28 Jan 2002 20:50:14 -0000	1.23
  +++ JavaStubWriter.java	31 Jan 2002 15:20:26 -0000	1.24
  @@ -129,6 +129,7 @@
               pw.println("    private java.util.Vector cachedSerQNames = new java.util.Vector();");
               pw.println("    private java.util.Vector cachedSerFactories = new java.util.Vector();");
               pw.println("    private java.util.Vector cachedDeserFactories = new java.util.Vector();");
  +            pw.println("    private boolean firstCall = true;");
           }
           pw.println();
   
  @@ -180,15 +181,23 @@
           pw.println("                call.setProperty(key, super.cachedProperties.get(key));");
           pw.println("            }");
           if (types.size() > 0) {
  -            pw.println("            for (int i = 0; i < cachedSerFactories.size(); ++i)
{");
  -            pw.println("                Class cls = (Class) cachedSerClasses.get(i);");
  -            pw.println("                javax.xml.rpc.namespace.QName qname =");
  -            pw.println("                        (javax.xml.rpc.namespace.QName) cachedSerQNames.get(i);");
  -            pw.println("                Class sf = (Class)");
  -            pw.println("                         cachedSerFactories.get(i);");
  -            pw.println("                Class df = (Class)");
  -            pw.println("                         cachedDeserFactories.get(i);");
  -            pw.println("                call.registerTypeMapping(cls, qname, sf, df, false);");
  +            pw.println("            // All the type mapping information is registered");
  +            pw.println("            // when the first call is made.");
  +            pw.println("            // The type mapping information is actually registered
in");
  +            pw.println("            // the TypeMappingRegistry of the service, which");
  +            pw.println("            // is the reason why registration is only needed for
the first call.");
  +            pw.println("            if (firstCall) {");
  +            pw.println("                firstCall = false;");
  +            pw.println("                for (int i = 0; i < cachedSerFactories.size();
++i) {");
  +            pw.println("                    Class cls = (Class) cachedSerClasses.get(i);");
  +            pw.println("                    javax.xml.rpc.namespace.QName qName =");
  +            pw.println("                            (javax.xml.rpc.namespace.QName) cachedSerQNames.get(i);");
  +            pw.println("                    Class sf = (Class)");
  +            pw.println("                             cachedSerFactories.get(i);");
  +            pw.println("                    Class df = (Class)");
  +            pw.println("                             cachedDeserFactories.get(i);");
  +            pw.println("                    call.registerTypeMapping(cls, qName, sf, df,
false);");
  +            pw.println("                }");
               pw.println("            }");
           }
           pw.println("            return call;");
  @@ -365,14 +374,21 @@
       private boolean firstSer = true ;
   
       private void writeSerializationInit(TypeEntry type) throws IOException {
  -        if (type.getBaseType() != null || type.getName().endsWith("[]")) {
  +        // Don't need to register base types or
  +        // our special collection types for indexed properties
  +        if (type.getBaseType() != null ||
  +            type instanceof CollectionType) {
               return;
           }
           if ( firstSer ) {
               pw.println("            Class cls;" );
               pw.println("            javax.xml.rpc.namespace.QName qName;" );
  -            pw.println("            Class sf = org.apache.axis.encoding.ser.BeanSerializerFactory.class;");
  -            pw.println("            Class df = org.apache.axis.encoding.ser.BeanDeserializerFactory.class;");
  +            pw.println("            Class beansf = org.apache.axis.encoding.ser.BeanSerializerFactory.class;");
  +            pw.println("            Class beandf = org.apache.axis.encoding.ser.BeanDeserializerFactory.class;");
  +            pw.println("            Class enumsf = org.apache.axis.encoding.ser.EnumSerializerFactory.class;");
  +            pw.println("            Class enumdf = org.apache.axis.encoding.ser.EnumDeserializerFactory.class;");
  +            pw.println("            Class arraysf = org.apache.axis.encoding.ser.ArraySerializerFactory.class;");
  +            pw.println("            Class arraydf = org.apache.axis.encoding.ser.ArrayDeserializerFactory.class;");
           }
           firstSer = false ;
   
  @@ -383,8 +399,18 @@
           pw.println("            cachedSerQNames.add(qName);");
           pw.println("            cls = " + type.getName() + ".class;");
           pw.println("            cachedSerClasses.add(cls);");
  -        pw.println("            cachedSerFactories.add(sf);");
  -        pw.println("            cachedDeserFactories.add(df);");
  +        if (type.getName().endsWith("[]")) {
  +            pw.println("            cachedSerFactories.add(arraysf);");
  +            pw.println("            cachedDeserFactories.add(arraydf);");
  +        } else if (type.getNode() != null && 
  +                   SchemaUtils.getEnumerationBaseAndValues(
  +                     type.getNode(), emitter.getSymbolTable()) != null) {
  +            pw.println("            cachedSerFactories.add(enumsf);");
  +            pw.println("            cachedDeserFactories.add(enumdf);");
  +        } else {
  +            pw.println("            cachedSerFactories.add(beansf);");
  +            pw.println("            cachedDeserFactories.add(beandf);");
  +        }
           pw.println();
       } // writeSerializationInit
   
  
  
  

Mime
View raw message