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 to...@apache.org on 2004/10/09 05:39:32 UTC

cvs commit: ws-axis/java/src/org/apache/axis/wsdl/fromJava Emitter.java

tomj        2004/10/08 20:39:32

  Modified:    java/src/org/apache/axis/wsdl/fromJava Emitter.java
  Log:
  Add setVersionMessage() to allow the API to control the Version emitted in
  the WSDL.  Null will use the default message, an empty string will turn the
  message off.
  
  Also check the description in the Emitter class and if set, emit that as
  a documentation element for the service.  This will override the documentation
  in the service description.
  
  Revision  Changes    Path
  1.128     +38 -8     ws-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java
  
  Index: Emitter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java,v
  retrieving revision 1.127
  retrieving revision 1.128
  diff -u -r1.127 -r1.128
  --- Emitter.java	3 Jul 2004 00:12:23 -0000	1.127
  +++ Emitter.java	9 Oct 2004 03:39:32 -0000	1.128
  @@ -209,6 +209,9 @@
       /** Should we emit all mapped types in every WSDL? */
       private boolean emitAllTypes = false;
   
  +    /** Version string to put at top of WSDL */
  +    private String versionMessage = null;
  +
       // Style Modes
   
       /** DEPRECATED - Indicates style=rpc use=encoded */
  @@ -358,13 +361,17 @@
           }
   
           // Add Axis version info as comment to beginnning of generated WSDL
  -        Comment wsdlVersion = doc.createComment(
  -                Messages.getMessage(
  -                        "wsdlCreated00",
  -                        XMLUtils.xmlEncodeString(Version.getVersion())));
  -
  -        doc.getDocumentElement().insertBefore(
  -                wsdlVersion, doc.getDocumentElement().getFirstChild());
  +        if (versionMessage == null) {
  +            String versionMessage = Messages.getMessage(
  +                    "wsdlCreated00",
  +                    XMLUtils.xmlEncodeString(Version.getVersion()));
  +        }
  +        // If version is empty string, don't emit one
  +        if (versionMessage.length() > 0) {
  +            Comment wsdlVersion = doc.createComment(versionMessage);
  +            doc.getDocumentElement().insertBefore(
  +                    wsdlVersion, doc.getDocumentElement().getFirstChild());
  +        }
   
           // Return the document
           return doc;
  @@ -941,7 +948,10 @@
               def.addService(service);
           }
   
  -        if (serviceDesc.getDocumentation() != null) {
  +        if (description != null) {
  +            service.setDocumentationElement(
  +                    createDocumentationElement(description));
  +        } else if (serviceDesc.getDocumentation() != null) {
               service.setDocumentationElement(
                       createDocumentationElement(
                               serviceDesc.getDocumentation()));
  @@ -2727,5 +2737,25 @@
   
       public void setEmitAllTypes(boolean emitAllTypes) {
           this.emitAllTypes = emitAllTypes;
  +    }
  +
  +    /**
  +     * Return the version message
  +     * @return message or null if emitter will use the default
  +     */
  +    public String getVersionMessage()
  +    {
  +        return versionMessage;
  +    }
  +
  +    /**
  +     * Set the version message that appears at the top of the WSDL
  +     * If not set, we use the default version message.
  +     * If set to an empty string, no version message will be emitted
  +     * @param versionMessage the message to emit
  +     */
  +    public void setVersionMessage(String versionMessage)
  +    {
  +        this.versionMessage = versionMessage;
       }
   }