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 bu...@apache.org on 2001/10/31 18:28:56 UTC

cvs commit: xml-axis/java/src/org/apache/axis/wsdl JavaUndeployWriter.java JavaDeployWriter.java JavaDefinitionWriter.java WriterFactory.java JavaWriterFactory.java JavaWriter.java Emitter.java

butek       01/10/31 09:28:56

  Modified:    java/src/org/apache/axis/wsdl WriterFactory.java
                        JavaWriterFactory.java JavaWriter.java Emitter.java
  Added:       java/src/org/apache/axis/wsdl JavaUndeployWriter.java
                        JavaDeployWriter.java JavaDefinitionWriter.java
  Log:
  Another incremental drop of Writer framework code.  Rearranged stuff for
  JavaDefinitionWriter (ie deploy/undeploy).  Emitter.java is under 1000 lines and
  getting smaller!
  
  Revision  Changes    Path
  1.4       +7 -0      xml-axis/java/src/org/apache/axis/wsdl/WriterFactory.java
  
  Index: WriterFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/WriterFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- WriterFactory.java	2001/10/30 22:24:56	1.3
  +++ WriterFactory.java	2001/10/31 17:28:55	1.4
  @@ -57,6 +57,7 @@
   import java.util.HashMap;
   
   import javax.wsdl.Binding;
  +import javax.wsdl.Definition;
   import javax.wsdl.PortType;
   import javax.wsdl.Service;
   
  @@ -97,6 +98,12 @@
        * Type.
        */
       public Writer getWriter(Type type);
  +
  +    /**
  +     * Get a Writer implementation that will generate anything that doesn't
  +     * fit into the scope of any of the other writers.
  +     */
  +    public Writer getWriter(Definition definition);
   
       /**
        * Provide the Emitter to the factory.
  
  
  
  1.5       +8 -0      xml-axis/java/src/org/apache/axis/wsdl/JavaWriterFactory.java
  
  Index: JavaWriterFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/JavaWriterFactory.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JavaWriterFactory.java	2001/10/31 15:18:22	1.4
  +++ JavaWriterFactory.java	2001/10/31 17:28:55	1.5
  @@ -57,6 +57,7 @@
   import java.util.HashMap;
   
   import javax.wsdl.Binding;
  +import javax.wsdl.Definition;
   import javax.wsdl.PortType;
   import javax.wsdl.Service;
   
  @@ -107,5 +108,12 @@
        */
       public Writer getWriter(Type type) {
           return new JavaTypeWriter(emitter, type);
  +    } // getWriter
  +
  +    /**
  +     * Return Wsdl2java's JavaDefinitionWriter object.
  +     */
  +    public Writer getWriter(Definition definition) {
  +        return new JavaDefinitionWriter(emitter, definition);
       } // getWriter
   } // class JavaWriterFactory
  
  
  
  1.3       +27 -0     xml-axis/java/src/org/apache/axis/wsdl/JavaWriter.java
  
  Index: JavaWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/JavaWriter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JavaWriter.java	2001/10/30 19:36:09	1.2
  +++ JavaWriter.java	2001/10/31 17:28:55	1.3
  @@ -219,6 +219,33 @@
       }
   
       /**
  +     * Initialize the deployment document, spit out preamble comments
  +     * and opening tag.
  +     */
  +    protected void initializeDeploymentDoc(String deploymentOpName) throws IOException {
  +        pw.println("<!--                                         " +
  +                "                    -->");
  +        pw.println("<!--Use this file to " + deploymentOpName +
  +                " some handlers/chains and services  -->");
  +        pw.println("<!--Two ways to do this:                     " +
  +                "                    -->");
  +        pw.println("<!--  java org.apache.axis.utils.Admin " +
  +                deploymentOpName + ".xml              -->");
  +        pw.println("<!--     from the same dir that the Axis " +
  +                "engine runs             -->");
  +        pw.println("<!--or                                     " +
  +                "                      -->");
  +        pw.println("<!--  java org.apache.axis.client.AdminClient " +
  +                deploymentOpName + ".xml       -->");
  +        pw.println("<!--     after the axis server is running    " +
  +                "                    -->");
  +        pw.println("<!--This file will be replaced by WSDD once " +
  +                "it's ready           -->");
  +        pw.println();
  +        pw.println("<m:" + deploymentOpName + " xmlns:m=\"AdminService\">");
  +    } // initializeDeploymentDoc
  +
  +    /**
        * Write the body of the file.  This is what extenders of this class must
        * implement
        */
  
  
  
  1.94      +9 -174    xml-axis/java/src/org/apache/axis/wsdl/Emitter.java
  
  Index: Emitter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/Emitter.java,v
  retrieving revision 1.93
  retrieving revision 1.94
  diff -u -r1.93 -r1.94
  --- Emitter.java	2001/10/31 15:18:22	1.93
  +++ Emitter.java	2001/10/31 17:28:55	1.94
  @@ -59,11 +59,8 @@
   import org.apache.axis.utils.XMLUtils;
   
   import org.w3c.dom.Document;
  -import org.w3c.dom.Element;
  -import org.w3c.dom.Node;
   
   import javax.wsdl.Binding;
  -import javax.wsdl.BindingOperation;
   import javax.wsdl.Definition;
   import javax.wsdl.Fault;
   import javax.wsdl.Import;
  @@ -72,7 +69,6 @@
   import javax.wsdl.Operation;
   import javax.wsdl.Output;
   import javax.wsdl.Part;
  -import javax.wsdl.Port;
   import javax.wsdl.PortType;
   import javax.wsdl.QName;
   import javax.wsdl.Service;
  @@ -98,7 +94,6 @@
    * @author Steve Graham (sggraham@us.ibm.com)
    */
   public class Emitter {
  -
       // Scope constants
       public static final byte NO_EXPLICIT_SCOPE = 0x00;
       public static final byte APPLICATION_SCOPE = 0x01;
  @@ -184,7 +179,8 @@
   
               // Output deploy.xml and undeploy.xml outside of the recursive emit method.
               if (bEmitSkeleton) {
  -                writeDeploymentXML(def.getTargetNamespace());
  +                Writer writer = writerFactory.getWriter(def);
  +                writer.write();
               }
           }
           catch (Throwable t) {
  @@ -349,6 +345,13 @@
           this.scope = scope;
       } // setScope
   
  +    /**
  +     * Get the scope for the deploy.xml file.
  +     */
  +    public byte getScope() {
  +        return scope;
  +    } // getScope
  +
       ///////////////////////////////////////////////////
       //
       // Implementation
  @@ -854,174 +857,6 @@
               writer.write();
          }
       }
  -
  -    /**
  -     * Generate the deployment descriptor and undeployment descriptor
  -     * for the current WSDL file
  -     */
  -    private void writeDeploymentXML(String namespace) {
  -        try {
  -            QName dummyQName = new QName(namespace, "deploy");
  -            PrintWriter deployPW = printWriter(dummyQName, null, "xml", "Generating deployment document:  ");
  -            initializeDeploymentDoc(deployPW, "deploy");
  -
  -            dummyQName = new QName(namespace, "undeploy");
  -            PrintWriter undeployPW = printWriter(dummyQName, null, "xml", "Generating deployment document:  ");
  -            initializeDeploymentDoc(undeployPW, "undeploy");
  -            writeDeployServices(deployPW, undeployPW);
  -            writeDeployTypes(deployPW);
  -            deployPW.println("</m:deploy>");
  -            deployPW.close();
  -            undeployPW.println("</m:undeploy>");
  -            undeployPW.close();
  -        }
  -        catch (IOException e) {
  -            System.err.println("Failed to write deployment documents");
  -            e.printStackTrace();
  -        }
  -
  -    } // writeDeploymentXML
  -
  -    /**
  -     * Initialize the deployment document, spit out preamble comments
  -     * and opening tag
  -     */
  -    private void initializeDeploymentDoc(PrintWriter pw, String deploymentOpName) throws IOException {
  -        pw.println("<!--                                         " +
  -                "                    -->");
  -        pw.println("<!--Use this file to " + deploymentOpName +
  -                " some handlers/chains and services  -->");
  -        pw.println("<!--Two ways to do this:                     " +
  -                "                    -->");
  -        pw.println("<!--  java org.apache.axis.utils.Admin " +
  -                deploymentOpName + ".xml              -->");
  -        pw.println("<!--     from the same dir that the Axis " +
  -                "engine runs             -->");
  -        pw.println("<!--or                                     " +
  -                "                      -->");
  -        pw.println("<!--  java org.apache.axis.client.AdminClient " +
  -                deploymentOpName + ".xml       -->");
  -        pw.println("<!--     after the axis server is running    " +
  -                "                    -->");
  -        pw.println("<!--This file will be replaced by WSDD once " +
  -                "it's ready           -->");
  -        pw.println();
  -        pw.println("<m:" + deploymentOpName + " xmlns:m=\"AdminService\">");
  -    } // initializeDeploymentDoc
  -
  -    /**
  -     * Write out bean mappings for each type
  -     */
  -    private void writeDeployTypes(PrintWriter pw) throws IOException {
  -        HashMap types = emitFactory.getTypes();
  -
  -        if (types.isEmpty()) return;
  -
  -        pw.println();
  -
  -        pw.print("   <beanMappings ");
  -        HashMap nsMap = new HashMap();
  -        int i = 1;
  -        String nsPrefix = null;
  -        Iterator it = types.values().iterator();
  -        while (it.hasNext()) {
  -            Type type = (Type) it.next();
  -            if (type.getBaseType() == null) {
  -                if (!nsMap.containsKey(type.getQName().getNamespaceURI())) {
  -                  pw.println("");
  -                  nsPrefix = "ns" + i++;
  -                  nsMap.put(type.getQName().getNamespaceURI(), nsPrefix);
  -                  pw.print("     xmlns:" + nsPrefix  + "=\"" + type.getQName().getNamespaceURI() + "\"");
  -                }
  -            }
  -        }
  -        pw.println(">");
  -        it = types.values().iterator();
  -        while (it.hasNext()) {
  -            Type type = (Type) it.next();
  -            if (type.getBaseType() == null) {
  -                nsPrefix = (String)nsMap.get(type.getQName().getNamespaceURI());
  -                pw.println("     <" + nsPrefix + ":" + type.getQName().getLocalPart()
  -                       + " classname=\"" + type.getJavaName() +"\"/>");
  -            }
  -        }
  -        pw.println("   </beanMappings>");
  -
  -    } //writeDeployTypes
  -
  -    /**
  -     * Write out deployment and undeployment instructions for each WSDL service
  -     */
  -    private void writeDeployServices(PrintWriter deployPW, PrintWriter undeployPW) throws IOException {
  -        //deploy the ports on each service
  -        Map serviceMap = def.getServices();
  -        for (Iterator mapIterator = serviceMap.values().iterator(); mapIterator.hasNext();) {
  -            Service myService = (Service) mapIterator.next();
  -
  -            deployPW.println();
  -            deployPW.println("   <!-- Services from " + myService.getQName().getLocalPart() + " WSDL service -->");
  -            deployPW.println();
  -
  -            undeployPW.println();
  -            undeployPW.println("   <!-- Services from " + myService.getQName().getLocalPart() + " WSDL service -->");
  -            undeployPW.println();
  -
  -            for (Iterator portIterator = myService.getPorts().values().iterator(); portIterator.hasNext();) {
  -                Port myPort = (Port) portIterator.next();
  -                writeDeployPort(deployPW, undeployPW, myPort);
  -            }
  -        }
  -    } //writeDeployServices
  -
  -    /**
  -     * Write out deployment and undeployment instructions for given WSDL port
  -     */
  -    private void writeDeployPort(PrintWriter deployPW, PrintWriter undeployPW, Port port) throws IOException {
  -        Binding binding = port.getBinding();
  -        String serviceName = port.getName();
  -
  -        boolean isRPC = (wsdlAttr.getBindingStyle(binding) == WsdlAttributes.STYLE_RPC);
  -
  -        deployPW.println("   <service name=\"" + serviceName
  -                + "\" pivot=\"" + (isRPC ? "RPCDispatcher" : "MsgDispatcher") + "\">");
  -        undeployPW.println("   <service name=\"" + serviceName
  -                + "\" pivot=\"" + (isRPC ? "RPCDispatcher" : "MsgDispatcher") + "\">");
  -
  -        writeDeployBinding(deployPW, binding);
  -
  -        deployPW.println("   </service>");
  -        undeployPW.println("   </service>");
  -    } //writeDeployPort
  -
  -    /**
  -     * Write out deployment instructions for given WSDL binding
  -     */
  -    private void writeDeployBinding(PrintWriter deployPW, Binding binding) throws IOException {
  -        QName bindingQName = binding.getQName();
  -        String packageName = namespaces.getCreate(bindingQName.getNamespaceURI());
  -        deployPW.println("      <option name=\"className\" value=\""
  -                         + packageName + "."
  -                         + bindingQName.getLocalPart() + "Skeleton" + "\"/>");
  -
  -        String methodList = "";
  -        Iterator operationsIterator = binding.getBindingOperations().iterator();
  -        for (; operationsIterator.hasNext();) {
  -            BindingOperation op = (BindingOperation) operationsIterator.next();
  -            methodList = methodList + " " + op.getName();
  -        }
  -
  -        deployPW.println("      <option name=\"methodName\" value=\"" + methodList + "\"/>");
  -
  -        if (scope == APPLICATION_SCOPE) {
  -            deployPW.println("      <option name=\"scope\" value=\"Application\"/>");
  -        }
  -        else if (scope == REQUEST_SCOPE) {
  -            deployPW.println("      <option name=\"scope\" value=\"Request\"/>");
  -        }
  -        else if (scope == SESSION_SCOPE) {
  -            deployPW.println("      <option name=\"scope\" value=\"Session\"/>");
  -        }
  -    } //writeDeployBinding
   
       //////////////////////////////
       //
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/JavaUndeployWriter.java
  
  Index: JavaUndeployWriter.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.axis.wsdl;
  
  import java.io.IOException;
  
  import java.util.Iterator;
  import java.util.Map;
  
  import javax.wsdl.Binding;
  import javax.wsdl.Definition;
  import javax.wsdl.Port;
  import javax.wsdl.QName;
  import javax.wsdl.Service;
  
  /**
  * This is Wsdl2java's deploy Writer.  It writes the deploy.java file.
  */
  public class JavaUndeployWriter extends JavaWriter {
      private Definition definition;
  
      /**
       * Constructor.
       */
      protected JavaUndeployWriter(Emitter emitter, Definition definition) {
          super(emitter,
                  new QName(definition.getTargetNamespace(), "undeploy"),
                  "",
                  "xml",
                  "Generating deployment document:  ");
          this.definition = definition;
      } // ctor
  
      /**
       * Replace the default file header with the deployment doc file header.
       */
      protected void writeFileHeader() throws IOException {
          initializeDeploymentDoc("undeploy");
      } // writeFileHeader
  
      /**
       * Write the body of the deploy.xml file.
       */
      protected void writeFileBody() throws IOException {
          try {
              writeDeployServices();
              pw.println("</m:undeploy>");
              pw.close();
          }
          catch (IOException e) {
              System.err.println("Failed to write deployment documents");
              e.printStackTrace();
          }
      } // writeFileBody
  
      /**
       * Write out deployment and undeployment instructions for each WSDL service
       */
      private void writeDeployServices() throws IOException {
          //deploy the ports on each service
          Map serviceMap = definition.getServices();
          for (Iterator mapIterator = serviceMap.values().iterator(); mapIterator.hasNext();) {
              Service myService = (Service) mapIterator.next();
  
              pw.println();
              pw.println("   <!-- Services from " + myService.getQName().getLocalPart() + " WSDL service -->");
              pw.println();
  
              for (Iterator portIterator = myService.getPorts().values().iterator(); portIterator.hasNext();) {
                  Port myPort = (Port) portIterator.next();
                  writeDeployPort(myPort);
              }
          }
      } //writeDeployServices
  
      /**
       * Write out deployment and undeployment instructions for given WSDL port
       */
      private void writeDeployPort(Port port) throws IOException {
          Binding binding = port.getBinding();
          String serviceName = port.getName();
  
          boolean isRPC = (emitter.wsdlAttr.getBindingStyle(binding) == WsdlAttributes.STYLE_RPC);
  
          pw.println("   <service name=\"" + serviceName
                  + "\" pivot=\"" + (isRPC ? "RPCDispatcher" : "MsgDispatcher") + "\">");
          pw.println("   </service>");
      } //writeDeployPort
  
  } // class JavaUndeployWriter
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/JavaDeployWriter.java
  
  Index: JavaDeployWriter.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.axis.wsdl;
  
  import java.io.IOException;
  
  import java.util.HashMap;
  import java.util.Iterator;
  import java.util.Map;
  
  import javax.wsdl.Binding;
  import javax.wsdl.BindingOperation;
  import javax.wsdl.Definition;
  import javax.wsdl.Port;
  import javax.wsdl.QName;
  import javax.wsdl.Service;
  
  /**
  * This is Wsdl2java's deploy Writer.  It writes the deploy.java file.
  */
  public class JavaDeployWriter extends JavaWriter {
      private Definition definition;
  
      /**
       * Constructor.
       */
      protected JavaDeployWriter(Emitter emitter, Definition definition) {
          super(emitter,
                  new QName(definition.getTargetNamespace(), "deploy"),
                  "",
                  "xml",
                  "Generating deployment document:  ");
          this.definition = definition;
      } // ctor
  
      /**
       * Replace the default file header with the deployment doc file header.
       */
      protected void writeFileHeader() throws IOException {
          initializeDeploymentDoc("deploy");
      } // writeFileHeader
  
      /**
       * Write the body of the deploy.xml file.
       */
      protected void writeFileBody() throws IOException {
          try {
              writeDeployServices();
              writeDeployTypes();
              pw.println("</m:deploy>");
              pw.close();
          }
          catch (IOException e) {
              System.err.println("Failed to write deployment documents");
              e.printStackTrace();
          }
      } // writeFileBody
  
      /**
       * Write out deployment and undeployment instructions for each WSDL service
       */
      private void writeDeployServices() throws IOException {
          //deploy the ports on each service
          Map serviceMap = definition.getServices();
          for (Iterator mapIterator = serviceMap.values().iterator(); mapIterator.hasNext();) {
              Service myService = (Service) mapIterator.next();
  
              pw.println();
              pw.println("   <!-- Services from " + myService.getQName().getLocalPart() + " WSDL service -->");
              pw.println();
  
              for (Iterator portIterator = myService.getPorts().values().iterator(); portIterator.hasNext();) {
                  Port myPort = (Port) portIterator.next();
                  writeDeployPort(myPort);
              }
          }
      } //writeDeployServices
  
      /**
       * Write out bean mappings for each type
       */
      private void writeDeployTypes() throws IOException {
          HashMap types = emitter.getTypeFactory().getTypes();
  
          if (types.isEmpty()) return;
  
          pw.println();
  
          pw.print("   <beanMappings ");
          HashMap nsMap = new HashMap();
          int i = 1;
          String nsPrefix = null;
          Iterator it = types.values().iterator();
          while (it.hasNext()) {
              Type type = (Type) it.next();
              if (type.getBaseType() == null) {
                  if (!nsMap.containsKey(type.getQName().getNamespaceURI())) {
                    pw.println("");
                    nsPrefix = "ns" + i++;
                    nsMap.put(type.getQName().getNamespaceURI(), nsPrefix);
                    pw.print("     xmlns:" + nsPrefix  + "=\"" + type.getQName().getNamespaceURI() + "\"");
                  }
              }
          }
          pw.println(">");
          it = types.values().iterator();
          while (it.hasNext()) {
              Type type = (Type) it.next();
              if (type.getBaseType() == null) {
                  nsPrefix = (String)nsMap.get(type.getQName().getNamespaceURI());
                  pw.println("     <" + nsPrefix + ":" + type.getQName().getLocalPart()
                         + " classname=\"" + type.getJavaName() +"\"/>");
              }
          }
          pw.println("   </beanMappings>");
      } //writeDeployTypes
  
      /**
       * Write out deployment and undeployment instructions for given WSDL port
       */
      private void writeDeployPort(Port port) throws IOException {
          Binding binding = port.getBinding();
          String serviceName = port.getName();
  
          boolean isRPC = (emitter.wsdlAttr.getBindingStyle(binding) == WsdlAttributes.STYLE_RPC);
  
          pw.println("   <service name=\"" + serviceName
                  + "\" pivot=\"" + (isRPC ? "RPCDispatcher" : "MsgDispatcher") + "\">");
  
          writeDeployBinding(binding);
  
          pw.println("   </service>");
      } //writeDeployPort
  
      /**
       * Write out deployment instructions for given WSDL binding
       */
      private void writeDeployBinding(Binding binding) throws IOException {
          QName bindingQName = binding.getQName();
          String packageName = namespaces.getCreate(bindingQName.getNamespaceURI());
          pw.println("      <option name=\"className\" value=\""
                           + packageName + "."
                           + bindingQName.getLocalPart() + "Skeleton" + "\"/>");
  
          String methodList = "";
          Iterator operationsIterator = binding.getBindingOperations().iterator();
          for (; operationsIterator.hasNext();) {
              BindingOperation op = (BindingOperation) operationsIterator.next();
              methodList = methodList + " " + op.getName();
          }
  
          pw.println("      <option name=\"methodName\" value=\"" + methodList + "\"/>");
  
          if (emitter.getScope() == Emitter.APPLICATION_SCOPE) {
              pw.println("      <option name=\"scope\" value=\"Application\"/>");
          }
          else if (emitter.getScope() == Emitter.REQUEST_SCOPE) {
              pw.println("      <option name=\"scope\" value=\"Request\"/>");
          }
          else if (emitter.getScope() == Emitter.SESSION_SCOPE) {
              pw.println("      <option name=\"scope\" value=\"Session\"/>");
          }
      } //writeDeployBinding
  
  } // class JavaDeployWriter
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/JavaDefinitionWriter.java
  
  Index: JavaDefinitionWriter.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.axis.wsdl;
  
  import java.io.IOException;
  
  import javax.wsdl.Definition;
  
  /**
  * This is Wsdl2java's Definition Writer.  It writes the following files:
  * deploy.xml, undeploy.xml.
  */
  public class JavaDefinitionWriter implements Writer {
      Writer deployWriter = null;
      Writer undeployWriter = null;
  
      /**
       * Constructor.
       */
      protected JavaDefinitionWriter(Emitter emitter, Definition definition) {
          deployWriter = new JavaDeployWriter(emitter, definition);
          undeployWriter = new JavaUndeployWriter(emitter, definition);
      } // ctor
  
      /**
       * Write all the service bindnigs:  service and testcase.
       */
      public void write() throws IOException {
          deployWriter.write();
          undeployWriter.write();
      } // write
  
  } // class JavaDefinitionWriter