| 1 |
/* |
| 2 |
* Copyright 2001-2004 The Apache Software Foundation. |
| 3 |
* |
| 4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 |
* you may not use this file except in compliance with the License. |
| 6 |
* You may obtain a copy of the License at |
| 7 |
* |
| 8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
* |
| 10 |
* Unless required by applicable law or agreed to in writing, software |
| 11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 |
* See the License for the specific language governing permissions and |
| 14 |
* limitations under the License. |
| 15 |
*/ |
| 16 |
package samples.integrationGuide.example2; |
| 17 |
|
| 18 |
import org.apache.axis.utils.CLOption; |
| 19 |
import org.apache.axis.utils.CLOptionDescriptor; |
| 20 |
import org.apache.axis.wsdl.WSDL2Java; |
| 21 |
import org.apache.axis.wsdl.gen.Parser; |
| 22 |
|
| 23 |
public class WSDL2Useless extends WSDL2Java { |
| 24 |
|
| 25 |
protected static final int SONG_OPT = 'g'; |
| 26 |
|
| 27 |
protected static final CLOptionDescriptor[] options = new CLOptionDescriptor[]{ |
| 28 |
new CLOptionDescriptor("song", |
| 29 |
CLOptionDescriptor.ARGUMENT_REQUIRED, |
| 30 |
SONG_OPT, |
| 31 |
"Choose a song for deploy.useless: work or rum") |
| 32 |
}; |
| 33 |
|
| 34 |
public WSDL2Useless() { |
| 35 |
addOptions(options); |
| 36 |
} // ctor |
| 37 |
|
| 38 |
protected Parser createParser() { |
| 39 |
return new MyEmitter(); |
| 40 |
} // createParser |
| 41 |
|
| 42 |
protected void parseOption(CLOption option) { |
| 43 |
if (option.getId() == SONG_OPT) { |
| 44 |
String arg = option.getArgument(); |
| 45 |
if (arg.equals("rum")) { |
| 46 |
((MyEmitter) parser).setSong(MyEmitter.RUM); |
| 47 |
} |
| 48 |
else if (arg.equals("work")) { |
| 49 |
((MyEmitter) parser).setSong(MyEmitter.WORK); |
| 50 |
} |
| 51 |
} |
| 52 |
else { |
| 53 |
super.parseOption(option); |
| 54 |
} |
| 55 |
} // parseOption |
| 56 |
|
| 57 |
/** |
| 58 |
* Main |
| 59 |
*/ |
| 60 |
public static void main(String args[]) { |
| 61 |
WSDL2Useless useless = new WSDL2Useless(); |
| 62 |
|
| 63 |
useless.run(args); |
| 64 |
} // main |
| 65 |
} // class WSDL2Useless |