KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis2 > wsdl > WSDL2Code


1 package org.apache.axis2.wsdl;
2
3 import org.apache.axis2.wsdl.codegen.CodeGenerationEngine;
4 import org.apache.axis2.wsdl.codegen.CommandLineOptionConstants;
5 import org.apache.axis2.wsdl.codegen.CommandLineOptionParser;
6
7  /**
8  * Copyright 2004,2005 The Apache Software Foundation.
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  */

22 public class WSDL2Code {
23     
24     
25     public static void main(String JavaDoc[] args) throws Exception JavaDoc{
26         CommandLineOptionParser commandLineOptionParser = new CommandLineOptionParser(args);
27         validateCommandLineOptions(commandLineOptionParser);
28         new CodeGenerationEngine(commandLineOptionParser).generate();
29         
30     }
31     
32     private static void printUsage(){
33         System.out.println("Usage WSDL2Code -uri <Location of WSDL> :WSDL file location ");
34         System.out.println("-o <output Location> : output file location ");
35         System.out.println("-a : Generate async style code only. Default if off");
36         System.out.println("-s : Generate sync style code only. Default if off. takes precedence over -a");
37         System.out.println("-p <package name> : set custom package name");
38         System.out.println("-l <language> : valid languages are java and csharp. Default is java");
39         System.out.println("-t : Generate TestCase to test the generated code");
40         System.out.println("-ss : Generate server side code (i.e. skeletons).Default is off");
41         System.out.println("-sd : Generate service descriptor (i.e. axis2.xml).Default is off.Valid with -ss ");
42         System.exit(0);
43     }
44     
45     
46     
47     private static void validateCommandLineOptions(CommandLineOptionParser parser){
48         if(parser.getInvalidOptions().size()>0)
49             printUsage();
50         if(null == parser.getAllOptions().get(CommandLineOptionConstants.WSDL_LOCATION_URI_OPTION))
51             printUsage();
52     }
53     
54     
55
56 }
57
Popular Tags