axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Jordahl <t...@macromedia.com>
Subject RE: cvs commit: xml-axis/java/src/org/apache/axis/wsdl Wsdl2java. java Emitter.java
Date Fri, 28 Sep 2001 14:55:50 GMT

Russell,

I would suggest doing the command line validation in the Wsdl2java class.
You should verify the scope option before passing it to the emitter.

Then in the emitter, you should throw an exception if it is passed an
invalid value.

Actually an even better way to do this would be to have setScope() take
an enumeration so it doesn't have to throw any errors at all.

This way, the emitter isn't printing to stdout (which is important if
another program is using the emitter).  And the option validation logic
is kept out of the emitter code.

--
Tom Jordahl
Macromedia


-----Original Message-----
From: butek@apache.org [mailto:butek@apache.org]
Sent: Friday, September 28, 2001 10:37 AM
To: xml-axis-cvs@apache.org
Subject: cvs commit: xml-axis/java/src/org/apache/axis/wsdl
Wsdl2java.java Emitter.java


butek       01/09/28 07:36:49

  Modified:    java/src/org/apache/axis/wsdl Wsdl2java.java Emitter.java
  Log:
  Added the --deployScope option.
  
  Revision  Changes    Path
  1.11      +12 -1     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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Wsdl2java.java	2001/09/27 20:11:57	1.10
  +++ Wsdl2java.java	2001/09/28 14:36:49	1.11
  @@ -74,6 +74,7 @@
       protected static final int SKELETON_OPT = 's';
       protected static final int PACKAGE_OPT = 'p';
       protected static final int OUTPUT_OPT = 'o';
  +    protected static final int SCOPE_OPT = 'd';
   
       /**
        *  Define the understood options. Each CLOptionDescriptor contains:
  @@ -108,7 +109,11 @@
           new CLOptionDescriptor("output",
                   CLOptionDescriptor.ARGUMENT_REQUIRED,
                   OUTPUT_OPT,
  -                "output dir for emitted files")
  +                "output dir for emitted files"),
  +        new CLOptionDescriptor("deployScope",
  +                CLOptionDescriptor.ARGUMENT_REQUIRED,
  +                SCOPE_OPT,
  +                "add scope to deploy.xml: \"Application\", \"Request\",
\"Session\"")
       };
   
       /**
  @@ -122,6 +127,7 @@
           String packageName = null;
           String wsdlURI = null;
           String outputDir = null;
  +        String scope = null;
   
           // Parse the arguments
           CLArgsParser parser = new CLArgsParser(args, options);
  @@ -172,6 +178,10 @@
                   case OUTPUT_OPT:
                       outputDir = option.getArgument();
                       break;
  +
  +                case SCOPE_OPT:
  +                    scope = option.getArgument();
  +                    break;
               }
           }
   
  @@ -195,6 +205,7 @@
               if (packageName != null)
                   emitter.setPackageName(packageName);
               emitter.setOutputDir(outputDir);
  +            emitter.setScope(scope);
               // Start writing code!
               emitter.emit(wsdlURI);
           }
  
  
  
  1.31      +16 -0     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.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- Emitter.java	2001/09/26 19:56:55	1.30
  +++ Emitter.java	2001/09/28 14:36:49	1.31
  @@ -121,6 +121,7 @@
       String packageName = null;
       String packageDirName = "";
       String outputDir = null;
  +    String scope = null;
   
       /**
        * Call this method if you have a uri for the WSDL document
  @@ -251,6 +252,17 @@
           this.outputDir = outputDir;
       }
   
  +    /**
  +     * Set the scope for the deploy.xml file.
  +     */
  +    public void setScope(String scope) {
  +        if ("Application".equals(scope) || "Request".equals(scope) ||
"Session".equals(scope))
  +            this.scope = scope;
  +        else if (scope != null) {
  +            System.err.println("Unrecognized scope:  " + scope + ".
Ignoring it.");
  +        }
  +    } // setScope
  +
       ///////////////////////////////////////////////////
       //
       // Implementation
  @@ -1484,6 +1496,10 @@
           }
   
           deployPW.println("      <option name=\"methodName\" value=\"" +
methodList + "\"/>");
  +
  +        if (scope != null) {
  +            deployPW.println("      <option name=\"scope\" value=\"" +
scope + "\"/>");
  +        }
       } //writeDeployBinding
   
       //////////////////////////////
  
  
  

Mime
View raw message