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 Wed, 06 Mar 2002 18:50:51 GMT
scheu       02/03/06 10:50:51

  Modified:    java/src/org/apache/axis/wsdl/toJava JavaDeployWriter.java
                        JavaStubWriter.java
  Log:
  Changes to get comprehensive tests to work.
  
    The code in the deploy and stub writers needs to be
    in sync.
    Added appopriate fixes for registering simple types.
    Added quick fix for registering the anonymous type of an element.
  
  Revision  Changes    Path
  1.24      +34 -4     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.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- JavaDeployWriter.java	5 Mar 2002 14:02:13 -0000	1.23
  +++ JavaDeployWriter.java	6 Mar 2002 18:50:51 -0000	1.24
  @@ -72,6 +72,7 @@
   import javax.wsdl.Service;
   import javax.wsdl.Part;
   
  +import org.w3c.dom.Node;
   
   import org.apache.axis.Constants;
   import org.apache.axis.utils.JavaUtils;
  @@ -149,10 +150,36 @@
           pw.println();
           for (int i = 0; i < types.size(); ++i) {
               TypeEntry type = (TypeEntry) types.elementAt(i);
  -            if (type.getBaseType() == null && type.isReferenced()
  -                && !type.isOnlyLiteralReferenced()
  -                && !(type instanceof CollectionType)
  -                && !(type instanceof DefinedElement)) {
  +
  +            // Note this same check is repeated in JavaStubWriter.
  +            boolean process = true;
  +
  +            // 1) Don't register types that are base (primitive) types.
  +            //    If the baseType != null && getRefType() != null this
  +            //    is a simpleType that must be registered.
  +            // 2) Don't register the special types for collections
  +            //    (indexed properties)
  +            // 3) Don't register types that are not referenced
  +            //    or only referenced in a literal context.
  +            if ((type.getBaseType() != null && type.getRefType() == null) ||
  +                type instanceof CollectionType ||
  +                !type.isReferenced() ||
  +                type.isOnlyLiteralReferenced()) {
  +                process = false;
  +            }
  +
  +
  +            // 4) If the type is an element, the typemapping is only generated
  +            // if the element has an anonymous type.  This is a quick fix
  +            // until I add anonymous types as actual symbol table elements. Scheu
  +            if (process && type instanceof Element) {
  +                Node node = symbolTable.getTypeEntry(type.getQName(),
  +                                                     true).getNode();
  +                if (node == null ||
  +                    Utils.getNodeTypeRefQName(node, "type") != null)
  +                    process = false;
  +            }
  +            if (process) {
                   pw.println("      <typeMapping");
                   pw.println("        xmlns:ns=\"" + type.getQName().getNamespaceURI() +
"\"");
                   pw.println("        qname=\"ns:" + type.getQName().getLocalPart() + '"');
  @@ -167,6 +194,9 @@
                       pw.println("        deserializer=\"org.apache.axis.encoding.ser.EnumDeserializerFactory\"");
                   } else if (type.isSimpleType()) {
                       pw.println("        serializer=\"org.apache.axis.encoding.ser.SimpleNonPrimitiveSerializerFactory\"");
  +                    pw.println("        deserializer=\"org.apache.axis.encoding.ser.SimpleDeserializerFactory\"");
  +                } else if (type.getBaseType() != null) {
  +                    // Serializers are already defined for the simple types
                       pw.println("        deserializer=\"org.apache.axis.encoding.ser.SimpleDeserializerFactory\"");
                   } else {
                       pw.println("        serializer=\"org.apache.axis.encoding.ser.BeanSerializerFactory\"");
  
  
  
  1.41      +26 -8     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.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- JavaStubWriter.java	6 Mar 2002 14:49:49 -0000	1.40
  +++ JavaStubWriter.java	6 Mar 2002 18:50:51 -0000	1.41
  @@ -395,17 +395,35 @@
       private boolean firstSer = true ;
   
       private void writeSerializationInit(TypeEntry type) throws IOException {
  -        // Don't need to register base types or
  -        // our special collection types for indexed properties
  -        // Note that we still have to register types derived from base types
  -        // This is necessary to be able to properly identify such derived types
  -        // during deserialization
  +
  +        // Note this same check is repeated in JavaDeployWriter.
  +        boolean process = true;
  +
  +        // 1) Don't register types that are base (primitive) types.
  +        //    If the baseType != null && getRefType() != null this
  +        //    is a simpleType that must be registered.
  +        // 2) Don't register the special types for collections
  +        //    (indexed properties)
  +        // 3) Don't register types that are not referenced
  +        //    or only referenced in a literal context.
           if ((type.getBaseType() != null && type.getRefType() == null) ||
  -            type instanceof CollectionType) {
  -            return;
  +            type instanceof CollectionType ||
  +            !type.isReferenced() ||
  +            type.isOnlyLiteralReferenced()) {
  +            process = false;
           }
           
  -        if (type instanceof Element) {
  +        // 4) If the type is an element, the typemapping is only generated
  +        // if the element has an anonymous type.  This is a quick fix
  +        // until I add anonymous types as actual symbol table elements. Scheu
  +        if (process && type instanceof Element) {
  +            Node node = symbolTable.getTypeEntry(type.getQName(),
  +                                                 true).getNode();
  +            if (node == null ||
  +                Utils.getNodeTypeRefQName(node, "type") != null)
  +                process = false;
  +        }
  +        if (!process) {
               return;
           }
           
  
  
  

Mime
View raw message