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 sa...@apache.org on 2004/09/08 06:27:03 UTC

cvs commit: ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws BuildScriptWriter.java CLArgParser.java WSDL2Ws.java

samisa      2004/09/07 21:27:03

  Modified:    c/src/wsdl/org/apache/axis/wsdl/wsdl2ws
                        BuildScriptWriter.java CLArgParser.java
                        WSDL2Ws.java
  Log:
  Made the GNU make file generation optional with -m option
  Also improved the command line option hadling mechanism
  Added -h
  
  Revision  Changes    Path
  1.2       +8 -0      ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/BuildScriptWriter.java
  
  Index: BuildScriptWriter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/BuildScriptWriter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BuildScriptWriter.java	14 Jun 2004 05:44:49 -0000	1.1
  +++ BuildScriptWriter.java	8 Sep 2004 04:27:03 -0000	1.2
  @@ -23,9 +23,11 @@
   import java.util.Iterator;
   
   import org.apache.axis.wsdl.wsdl2ws.info.WebServiceContext;
  +import org.apache.axis.wsdl.wsdl2ws.WSDL2Ws;
   
   /**
    * @author Susantha Kumara susantha@opensource.lk
  + * @author Samisa Abeysinghe sabeysinghe@virtusa.com
    *
    */
   public class BuildScriptWriter implements SourceWriter {
  @@ -39,6 +41,12 @@
   	 * @see org.apache.axis.wsdl.wsdl2ws.SourceWriter#writeSource()
   	 */
   	public void writeSource() throws WrapperFault {
  +            // Samisa - we write the gnu make system files only at the moment
  +            // hence check if user wanted gnu make files
  +   
  +            if ( (WSDL2Ws.makeSystem == null) || (!WSDL2Ws.makeSystem.equals("gnu")) )
  +                return;
  +
   		try {
   			servicename = wscontext.getSerInfo().getServicename();
   			Iterator filelist = wscontext.getGeneratedFileList().iterator();
  
  
  
  1.3       +6 -1      ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/CLArgParser.java
  
  Index: CLArgParser.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/CLArgParser.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CLArgParser.java	9 Apr 2004 08:49:31 -0000	1.2
  +++ CLArgParser.java	8 Sep 2004 04:27:03 -0000	1.3
  @@ -17,6 +17,7 @@
    
   /**
    * @author Srinath Perera(hemapani@openource.lk)
  + * @author Samisa Abeysinghe (sabeysinghe@virtusa.com)
    */
   
   package org.apache.axis.wsdl.wsdl2ws;
  @@ -35,7 +36,7 @@
               if (!args[i].startsWith("-"))
                   this.args.add(args[i]);
               else {
  -                System.out.println("args = " + args[i].substring(1,1));
  +                System.out.println("args " + args[i].substring(1,2) + " = " + args[i].substring(2));
                   bag.put(args[i].substring(1, 2), args[i].substring(2));
               }
   
  @@ -61,6 +62,10 @@
   
       public String getOptionBykey(String key) {
           return (String) bag.get(key);
  +    }
  +
  +    public boolean isSet(String key) {
  +        return bag.containsKey(key);
       }
   
   }
  
  
  
  1.38      +34 -10    ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java
  
  Index: WSDL2Ws.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- WSDL2Ws.java	27 Aug 2004 01:24:59 -0000	1.37
  +++ WSDL2Ws.java	8 Sep 2004 04:27:03 -0000	1.38
  @@ -66,8 +66,11 @@
    *  5) create WebServiceContext using above three classes and start execution 
    * 
    * @author hemapani@opensource.lk
  + * @author Samisa Abeysinghe (sabeysinghe@virtusa.com)
    */
   public class WSDL2Ws {
  +    public static boolean verbose = false;
  +    public static String makeSystem = null;
   
       private String language;
   	private boolean wsdlWrappingStyle;
  @@ -79,7 +82,7 @@
   
       private String serviceStyle = null;
   
  -    private boolean verbose = true;
  +    //private boolean verbose = true;
       private String targetEndpointURI = null;
       private String transportURI = null;
       private String targetNameSpaceOfWSDL = null;
  @@ -90,6 +93,7 @@
       private PortTypeEntry portTypeEntry;
   	private ArrayList methods;	
   
  +    
       public WSDL2Ws(CLArgParser cmdLineArgs) throws WrapperFault {
           try {
               Parser wsdlParser = new Parser();
  @@ -479,7 +483,7 @@
                       typeMap));
           if (wsg == null)
               throw new WrapperFault("does not support the option combination");
  -        if(verbose){
  +        if (WSDL2Ws.verbose){
           	Iterator it = typeMap.getTypes().iterator();
           	while(it.hasNext()){
           		System.out.println(it.next());
  @@ -735,6 +739,19 @@
   		throw new WrapperFault("binding and the port type do not match");
   	}
   
  +    public static void usage() {
  +        System.out.println(
  +                "java WSDL2Ws -<options> <wsdlfile>\n"
  +                    + "-help, -h              print this message\n"
  +                    + "-o<folder>             target output folder - default is current folder\n"
  +                    + "-l<c++|c>              target language (c++|c) - default is c++\n"
  +                    + "-s<server|client>      target side (serve|client) - default is server\n"
  +                    + "-c<none|ssl>           channel security (ssl|none) - default is none\n"
  +                    + "-w<wrapped|nonwrapped> wrapping style of the WSDL (wrapped|nonwrapped) - default is wrapped\n"
  +                    + "-verbose, -v           be verbose\n"
  +                    + "-m<none|gnu>           generate make files (none|gnu) - default is none\n");
  +
  +    }
       /**
        * Usage
        * =====
  @@ -757,15 +774,22 @@
       public static void main(String[] args) throws Exception {
           CLArgParser data = new CLArgParser(args);
           System.out.println(data.getArgumentCount());
  -        if (data.getArgumentCount() != 1)
  -            System.out.println(
  -                "java WSDL2Ws <wsdlfile> -<optionChar><value>\n"
  -                    + "-o target output folder - default is current folder\n"
  -                    + "-l target language(c|c++) - default is c++\n"
  -                    + "-s target side(client|server) - default is server\n"
  -                    + "-c channel security(ssl|none) - default is none\n"
  -                    + "-w wrapping style of the WSDL (wrapped|nonwrapped) - default is wrapped\n");
  +        if (data.getArgumentCount() != 1) {
  +            usage();
  +        }
           else {
  +
  +            if (data.isSet("v"))
  +                WSDL2Ws.verbose = true;
  +
  +            if (data.isSet("h")) {
  +                usage();
  +                return; 
  +            }
  +
  +            WSDL2Ws.makeSystem = data.getOptionBykey("m");
  +
  +	System.out.println( WSDL2Ws.makeSystem );
               WSDL2Ws gen = new WSDL2Ws(data);
               gen.genarateWrappers(
                   null,