axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/wsdl Wsdl2java.java Emitter.java
Date Wed, 05 Sep 2001 19:37:50 GMT
tomj        01/09/05 12:37:50

  Modified:    java/src/org/apache/axis/wsdl Wsdl2java.java Emitter.java
  Log:
  Add a -verbose switch for command line wsdl2java.
  Accept partial switches (e.g. -skel, -v) on the command line.
  
  Revision  Changes    Path
  1.4       +16 -5     xml-axis/java/src/org/apache/axis/wsdl/Wsdl2java.java
  
  Index: Wsdl2java.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/Wsdl2java.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Wsdl2java.java	2001/09/04 11:45:40	1.3
  +++ Wsdl2java.java	2001/09/05 19:37:49	1.4
  @@ -65,8 +65,9 @@
        * print usage message
        */
       private static void usage() {
  -        System.out.println ("Usage: java org.apache.axis.wsdl.Wsdl2java [-skeleton] [-messageContext]
WSDL-URI");
  +        System.out.println ("Usage: java org.apache.axis.wsdl.Wsdl2java [-verbose] [-skeleton
[-messageContext]] WSDL-URI");
           System.out.println ("Switches:");
  +        System.out.println ("   -verbose - Turn on verbose output");
           System.out.println ("   -skeleton - emit skeleton class for web service");
           System.out.println ("   -messageContext - emit a MessageContext parameter in skeleton");
           System.exit(-1);
  @@ -75,16 +76,21 @@
   
       public static void main(String[] args) {
           try {
  -            boolean bSkeleton = false;
  -            boolean bMessageContext = false;
  +            boolean bSkeleton, bVerbose, bMessageContext;
  +            bSkeleton = bVerbose = bMessageContext = false;
  +
               int argcount = args.length;
               int arg = 0;
               while ( arg < (args.length-1)) {
  -               if( args[arg].equals("-skeleton") )      {
  +                if ( args[arg].startsWith("-v")) {
  +                    bVerbose = true;
  +                    --argcount;
  +                }
  +               if( args[arg].startsWith("-skel") )      {
                       bSkeleton = true;
                      --argcount;
                   }
  -               if( args[arg].equals("-messageContext") )        {
  +               if( args[arg].startsWith("-messageContext") )        {
                       bMessageContext = true;
                      --argcount;
                   }
  @@ -96,8 +102,13 @@
               String uri = args[arg];
               if (uri.startsWith("-"))
                   usage();
  +            if (bMessageContext && !bSkeleton) {
  +                System.out.println("Error: -messageContext switch only valid with -skeleton");
  +                usage();
  +            }
   
               Emitter emitter = new Emitter ();
  +            emitter.verbose(bVerbose);
               emitter.generateSkeleton(bSkeleton);
               emitter.generateMessageContext(bMessageContext);
               emitter.emit (uri);
  
  
  
  1.10      +31 -9     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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Emitter.java	2001/09/05 17:35:22	1.9
  +++ Emitter.java	2001/09/05 19:37:49	1.10
  @@ -105,13 +105,16 @@
       private Definition def = null;
       private boolean bEmitSkeleton = false;
       private boolean bMessageContext = false;
  +    private boolean bVerbose = false;
   
       /**
        * Call this method if you have a uri for the WSDL document
        */
       public void emit(String uri) throws IOException {
  -        System.out.println ("Parsing XML File: " + uri);
   
  +        if (bVerbose)
  +            System.out.println ("Parsing XML File: " + uri);
  +
           try {
               doc = XMLUtils.newDocument(uri);
               emit (doc);
  @@ -160,7 +163,16 @@
       public void generateMessageContext(boolean value) {
           this.bMessageContext = value;
       }
  +
       /**
  +     * Turn on/off verbose messages
  +     * @param boolean value
  +     */
  +    public void verbose(boolean value) {
  +        this.bVerbose = value;
  +    }
  +
  +    /**
        * This method returns a set of all the complex types in a given PortType.  The elements
of the returned HashSet are Strings.
        */
       private HashSet complexTypesInClass(PortType portType) {
  @@ -274,8 +286,10 @@
           String nameValue = portType.getQName ().getLocalPart ();
           PrintWriter interfacePW = new PrintWriter (
                   new FileWriter (nameValue + ".java"));
  -        System.out.println("Generating PortType interface: " + nameValue + ".java");
   
  +        if (bVerbose)
  +            System.out.println("Generating PortType interface: " + nameValue + ".java");
  +
           interfacePW.println ("public interface " + nameValue + " extends java.rmi.Remote");
           interfacePW.println ("{");
   
  @@ -302,7 +316,8 @@
           String nameValue = portType.getQName ().getLocalPart () + "Axis";
           PrintWriter interfacePW = new PrintWriter (
                   new FileWriter (nameValue + ".java"));
  -        System.out.println("Generating server-side PortType interface: " + nameValue +
".java");
  +        if (bVerbose)
  +            System.out.println("Generating server-side PortType interface: " + nameValue
+ ".java");
           if(bMessageContext)
             interfacePW.println ("import org.apache.axis.MessageContext;");
           interfacePW.println ("public interface " + nameValue + " extends java.rmi.Remote");
  @@ -702,7 +717,9 @@
   
           String stubName = name + "Stub";
           PrintWriter stubPW = new PrintWriter (new FileWriter (stubName + ".java"));
  -        System.out.println("Generating client-side stub: " + stubName + ".java");
  +
  +        if (bVerbose)
  +            System.out.println("Generating client-side stub: " + stubName + ".java");
   
           stubPW.println ("public class " + stubName + " extends org.apache.axis.wsdl.Stub
implements " + portTypeName);
           stubPW.println ("{");
  @@ -776,7 +793,8 @@
           {
               String skelName = name + "Skeleton";
               skelPW = new PrintWriter (new FileWriter (skelName + ".java"));
  -            System.out.println("Generating server-side skeleton: " + skelName + ".java");
  +            if (bVerbose)
  +                System.out.println("Generating server-side skeleton: " + skelName + ".java");
               if(bMessageContext)
                   skelPW.println ("import org.apache.axis.MessageContext;");
               skelPW.println ("public class " + skelName);
  @@ -1163,10 +1181,12 @@
       private void writeDeploymentXML(){
           try{
               PrintWriter deployPW = new PrintWriter (new FileWriter ("deploy.xml"));
  -            System.out.println("Generating deployment document: deploy.xml");
  +            if (bVerbose)
  +                System.out.println("Generating deployment document: deploy.xml");
               initializeDeploymentDoc(deployPW, "deploy");
               PrintWriter undeployPW = new PrintWriter (new FileWriter ("undeploy.xml"));
  -            System.out.println("Generating deployment document: undeploy.xml");
  +            if (bVerbose)
  +                System.out.println("Generating deployment document: undeploy.xml");
               initializeDeploymentDoc(undeployPW, "undeploy");
               writeDeployServices(deployPW, undeployPW);
               writeDeployTypes(deployPW);
  @@ -1341,7 +1361,8 @@
           NamedNodeMap attributes = node.getAttributes ();
           String nameValue = capitalize (attributes.getNamedItem ("name").getNodeValue ());
           PrintWriter typePW = new PrintWriter (new FileWriter (nameValue + ".java"));
  -                System.out.println("Generating Type Implementation: " + nameValue + ".java");
  +        if (bVerbose)
  +            System.out.println("Generating Type Implementation: " + nameValue + ".java");
   
           typePW.println ("public class " + nameValue + " implements java.io.Serializable");
           typePW.println ("{");
  @@ -1400,7 +1421,8 @@
           PrintWriter pw =
               new PrintWriter (new FileWriter (typeName + "Holder.java"));
   
  -                System.out.println("Generating Type Implementation Holder: " + typeName
+ "Holder.java");
  +        if (bVerbose)
  +            System.out.println("Generating Type Implementation Holder: " + typeName + "Holder.java");
   
           pw.println ("public final class " + typeName + "Holder implements java.io.Serializable");
           pw.println ("{");
  
  
  

Mime
View raw message