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/src/org/apache/axis/wsdl/toJava JavaDeployWriter.java JavaTypeWriter.java SymbolTable.java TypeEntry.java
Date Wed, 23 Jan 2002 17:53:05 GMT
butek       02/01/23 09:53:05

  Modified:    java/src/org/apache/axis/wsdl/toJava JavaDeployWriter.java
                        JavaTypeWriter.java SymbolTable.java TypeEntry.java
  Log:
  In SymbolTable.java, Tom asked:
           // turn off generation of the element type
           // XXX is there a better way to do this?
  Hopefully this is the better way.  Instead of removing the type from the symbol table
  to turn off generation, I've added a new flag to TypeEntry - isOnlyLiteralReferenced -
  so the generators can query the status of this flag to decide whether or not to
  generate the type.  In other words, if it is referenced, but it is ONLY referenced as a
  literal type, then don't generate it.
  
  Revision  Changes    Path
  1.11      +1 -0      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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- JavaDeployWriter.java	18 Jan 2002 20:11:36 -0000	1.10
  +++ JavaDeployWriter.java	23 Jan 2002 17:53:05 -0000	1.11
  @@ -148,6 +148,7 @@
           for (int i = 0; i < types.size(); ++i) {
               TypeEntry type = (TypeEntry) types.elementAt(i);
               if (type.getBaseType() == null && type.isReferenced()
  +                    && !type.isOnlyLiteralReferenced()
                       && !type.getName().endsWith("[]")) {
                   pw.println("  <beanMapping");
                   pw.println("    xmlns:ns=\"" + type.getQName().getNamespaceURI() + "\"");
  
  
  
  1.4       +1 -1      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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JavaTypeWriter.java	13 Dec 2001 17:33:17 -0000	1.3
  +++ JavaTypeWriter.java	23 Jan 2002 17:53:05 -0000	1.4
  @@ -82,7 +82,7 @@
               Emitter emitter,
               TypeEntry type,
               SymbolTable symbolTable) {
  -        if (type.isReferenced()) {
  +        if (type.isReferenced() && !type.isOnlyLiteralReferenced()) {
   
               // Determine what sort of type this is and instantiate the appropriate Writer.
               Node node = type.getNode();
  
  
  
  1.15      +42 -20    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.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- SymbolTable.java	18 Jan 2002 21:05:46 -0000	1.14
  +++ SymbolTable.java	23 Jan 2002 17:53:05 -0000	1.15
  @@ -975,10 +975,6 @@
                       if (vTypes != null) {
                           // add the elements in this list
                           v.addAll(vTypes);
  -                        // turn off generation of the element type
  -                        // XXX is there a better way to do this?
  -                        symbolTable.remove(elementName);
  -                        types.remove(e);
                       } else {
                           // XXX - This should be a SOAPElement/SOAPBodyElement
                           v.add(getElement(elementName));
  @@ -1130,7 +1126,7 @@
                       if (stuff.isEmpty()) {
                           for (int i = 0; i < types.size(); ++i) {
                               TypeEntry type = (TypeEntry) types.get(i);
  -                            setTypeReferences(type, doc);
  +                            setTypeReferences(type, doc, false);
                           }
                       }
                       else {
  @@ -1139,7 +1135,7 @@
                               Message message = (Message) i.next();
                               MessageEntry mEntry =
                                       getMessageEntry(message.getQName());
  -                            setMessageReferences(mEntry, def, doc);
  +                            setMessageReferences(mEntry, def, doc, false);
                           }
                       }
                   }
  @@ -1149,7 +1145,7 @@
                           PortType portType = (PortType) i.next();
                           PortTypeEntry ptEntry =
                                   getPortTypeEntry(portType.getQName());
  -                        setPortTypeReferences(ptEntry, def, doc);
  +                        setPortTypeReferences(ptEntry, null, def, doc);
                       }
                   }
               }
  @@ -1172,7 +1168,21 @@
           }
       } // setReferences
   
  -    private void setTypeReferences(TypeEntry entry, Document doc) {
  +    private void setTypeReferences(TypeEntry entry, Document doc,
  +            boolean literal) {
  +
  +        // If this type is ONLY referenced from a literal usage in a binding,
  +        // then isOnlyLiteralReferenced should return true.
  +        if (!entry.isReferenced() && literal) {
  +            entry.setOnlyLiteralReference(true);
  +        }
  +        // If this type was previously only referenced as a literal type,
  +        // but now it is referenced in a non-literal manner, turn off the
  +        // onlyLiteralReference flag.
  +        else if (entry.isOnlyLiteralReferenced() && !literal) {
  +            entry.setOnlyLiteralReference(false);
  +        }
  +
           // If we don't want to emit stuff from imported files, only set the
           // isReferenced flag if this entry exists in the immediate WSDL file.
           Node node = entry.getNode();
  @@ -1184,7 +1194,7 @@
                   if (referentName != null) {
                       TypeEntry referent = getTypeEntry(referentName, forElement.value);
                       if (referent != null) {
  -                        setTypeReferences(referent, doc);
  +                        setTypeReferences(referent, doc, false);
                       }
                   }
               }
  @@ -1195,7 +1205,7 @@
           while (it.hasNext()) {
               TypeEntry nestedType = (TypeEntry) it.next();
               if (!nestedType.isReferenced()) {
  -                setTypeReferences(nestedType, doc);
  +                setTypeReferences(nestedType, doc, false);
               }
           }
       } // setTypeReferences
  @@ -1204,7 +1214,7 @@
        * Set the isReferenced flag to true on all SymTabEntries that the given Meesage refers
to.
        */
       private void setMessageReferences(
  -            MessageEntry entry, Definition def, Document doc) {
  +            MessageEntry entry, Definition def, Document doc, boolean literal) {
           // If we don't want to emit stuff from imported files, only set the
           // isReferenced flag if this entry exists in the immediate WSDL file.
           Message message = entry.getMessage();
  @@ -1227,11 +1237,11 @@
               Part part = (Part) parts.next();
               TypeEntry type = getType(part.getTypeName());
               if (type != null) {
  -                setTypeReferences(type, doc);
  +                setTypeReferences(type, doc, literal);
               }
               type = getElement(part.getElementName());
               if (type != null) {
  -                setTypeReferences(type, doc);
  +                setTypeReferences(type, doc, literal);
               }
           }
       } // setMessageReference
  @@ -1240,7 +1250,8 @@
        * Set the isReferenced flag to true on all SymTabEntries that the given PortType refers
to.
        */
       private void setPortTypeReferences(
  -            PortTypeEntry entry, Definition def, Document doc) {
  +            PortTypeEntry entry, BindingEntry bEntry,
  +            Definition def, Document doc) {
           // If we don't want to emit stuff from imported files, only set the
           // isReferenced flag if this entry exists in the immediate WSDL file.
           PortType portType = entry.getPortType();
  @@ -1264,26 +1275,37 @@
           while (operations.hasNext()) {
               Operation operation = (Operation) operations.next();
   
  -            // Query the input message
               Input input = operation.getInput();
  +            Output output = operation.getOutput();
  +
  +            // Find out if this reference is a literal reference or not.
  +            boolean literalInput = false;
  +            boolean literalOutput = false;
  +            if (bEntry != null) {
  +                literalInput = bEntry.getInputBodyType(operation) ==
  +                        BindingEntry.USE_LITERAL;
  +                literalOutput = bEntry.getOutputBodyType(operation) ==
  +                        BindingEntry.USE_LITERAL;
  +            }
  +
  +            // Query the input message
               if (input != null) {
                   Message message = input.getMessage();
                   if (message != null) {
                       MessageEntry mEntry = getMessageEntry(message.getQName());
                       if (mEntry != null) {
  -                        setMessageReferences(mEntry, def, doc);
  +                        setMessageReferences(mEntry, def, doc, literalInput);
                       }
                   }
               }
   
               // Query the output message
  -            Output output = operation.getOutput();
               if (output != null) {
                   Message message = output.getMessage();
                   if (message != null) {
                       MessageEntry mEntry = getMessageEntry(message.getQName());
                       if (mEntry != null) {
  -                        setMessageReferences(mEntry, def, doc);
  +                        setMessageReferences(mEntry, def, doc, literalOutput);
                       }
                   }
               }
  @@ -1296,7 +1318,7 @@
                   if (message != null) {
                       MessageEntry mEntry = getMessageEntry(message.getQName());
                       if (mEntry != null) {
  -                        setMessageReferences(mEntry, def, doc);
  +                        setMessageReferences(mEntry, def, doc, false);
                       }
                   }
               }
  @@ -1328,7 +1350,7 @@
           PortType portType = binding.getPortType();
           PortTypeEntry ptEntry = getPortTypeEntry(portType.getQName());
           if (ptEntry != null) {
  -            setPortTypeReferences(ptEntry, def, doc);
  +            setPortTypeReferences(ptEntry, entry, def, doc);
           }
       } // setBindingReferences
   
  
  
  
  1.6       +23 -0     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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TypeEntry.java	14 Dec 2001 20:01:16 -0000	1.5
  +++ TypeEntry.java	23 Jan 2002 17:53:05 -0000	1.6
  @@ -125,6 +125,9 @@
                                    // until the Undefined type is found.
       protected boolean isBaseType;// Indicates if represented by a 
                                    // java primitive or util class
  +    protected boolean onlyLiteralReference = false; // Indicates
  +                                 // whether this type is only referenced
  +                                 // via a binding's literal use.
   
       /**
        * Create a TypeEntry object for an xml construct that references another type. 
  @@ -199,6 +202,26 @@
               return null;
           }
       }
  +
  +    /**
  +     * Is this type references ONLY as a literal type?  If a binding's
  +     * message's soapBody says:  use="literal", then a type is referenced
  +     * literally.  Note that that type's contained types (ie., an address
  +     * contains a phone#) are not referenced literally.  Since a type
  +     * that is ONLY referenced as a literal may cause a generator to act
  +     * differently (like WSDL2Java), this extra reference distinction is
  +     * needed.
  +     */
  +    public boolean isOnlyLiteralReferenced() {
  +        return onlyLiteralReference;
  +    } // isOnlyLiteralReferenced
  +
  +    /**
  +     * Set the isOnlyLiteralReference flag.
  +     */
  +    public void setOnlyLiteralReference(boolean set) {
  +        onlyLiteralReference = set;
  +    } // setOnlyLiteralRefeerence
   
       /**
        * getUndefinedTypeRef returns the Undefined TypeEntry that this entry depends on or
NULL.
  
  
  

Mime
View raw message