1 /*
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
159 }
160
161 private static final Target LOADED_API_VERSION;
162
163 static {
164 // check if we are indeed loading JAX-WS 2.2 API
165 if (Invoker.checkIfLoading22API()) {
166 LOADED_API_VERSION = Target.V2_2;
167 } // check if we are indeed loading JAX-WS 2.1 API
168 else if (Invoker.checkIfLoading21API()) {
169 LOADED_API_VERSION = Target.V2_1;
170 } else {
171 LOADED_API_VERSION = Target.V2_0;
172 }
173 }
174 }
175
176 public Target target = Target.V2_2;
177
178 /**
179 * strictly follow the compatibility rules specified in JAXWS spec
180 */
181 public static final int STRICT = 1;
182
183 /**
184 * loosely follow the compatibility rules and allow the use of vendor
185 * binding extensions
186 */
187 public static final int EXTENSION = 2;
188
189 /**
190 * this switch determines how carefully the compiler will follow
191 * the compatibility rules in the spec. Either <code>STRICT</code>
192 * or <code>EXTENSION</code>.
193 */
194 public int compatibilityMode = STRICT;
195
196 public boolean isExtensionMode() {
197 return compatibilityMode == EXTENSION;
198 }
199
200 public boolean debug = false;
201
202 /**
203 * -Xdebug - gives complete stack trace
204 */
205 public boolean debugMode = false;
206
207
208 private final List<File> generatedFiles = new ArrayList<File>();
209 private ClassLoader classLoader;
210
211
212 /**
276 i += (j-1);
277 } else {
278 addFile(args[i]);
279 }
280 }
281 if(destDir == null)
282 destDir = new File(".");
283 if(sourceDir == null)
284 sourceDir = destDir;
285 }
286
287
288 /**
289 * Adds a file from the argume
290 *
291 * @param arg a file, could be a wsdl or xsd or a Class
292 */
293 protected void addFile(String arg) throws BadCommandLineException {}
294
295 /**
296 * Parses an option <code>args[i]</code> and return
297 * the number of tokens consumed.
298 *
299 * @return
300 * 0 if the argument is not understood. Returning 0
301 * will let the caller report an error.
302 * @exception BadCommandLineException
303 * If the callee wants to provide a custom message for an error.
304 */
305 protected int parseArguments(String[] args, int i) throws BadCommandLineException {
306 if (args[i].equals("-g")) {
307 debug = true;
308 return 1;
309 } else if (args[i].equals("-Xdebug")) {
310 debugMode = true;
311 return 1;
312 } else if (args[i].equals("-Xendorsed")) {
313 // this option is processed much earlier, so just ignore.
314 return 1;
315 } else if (args[i].equals("-verbose")) {
316 verbose = true;
|
1 /*
2 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
159 }
160
161 private static final Target LOADED_API_VERSION;
162
163 static {
164 // check if we are indeed loading JAX-WS 2.2 API
165 if (Invoker.checkIfLoading22API()) {
166 LOADED_API_VERSION = Target.V2_2;
167 } // check if we are indeed loading JAX-WS 2.1 API
168 else if (Invoker.checkIfLoading21API()) {
169 LOADED_API_VERSION = Target.V2_1;
170 } else {
171 LOADED_API_VERSION = Target.V2_0;
172 }
173 }
174 }
175
176 public Target target = Target.V2_2;
177
178 /**
179 * Type of input schema language. One of the {@code SCHEMA_XXX}
180 * strictly follow the compatibility rules specified in JAXWS spec
181 */
182 public static final int STRICT = 1;
183
184 /**
185 * loosely follow the compatibility rules and allow the use of vendor
186 * binding extensions
187 */
188 public static final int EXTENSION = 2;
189
190 /**
191 * this switch determines how carefully the compiler will follow
192 * the compatibility rules in the spec. Either {@code STRICT}
193 * or {@code EXTENSION}.
194 */
195 public int compatibilityMode = STRICT;
196
197 public boolean isExtensionMode() {
198 return compatibilityMode == EXTENSION;
199 }
200
201 public boolean debug = false;
202
203 /**
204 * -Xdebug - gives complete stack trace
205 */
206 public boolean debugMode = false;
207
208
209 private final List<File> generatedFiles = new ArrayList<File>();
210 private ClassLoader classLoader;
211
212
213 /**
277 i += (j-1);
278 } else {
279 addFile(args[i]);
280 }
281 }
282 if(destDir == null)
283 destDir = new File(".");
284 if(sourceDir == null)
285 sourceDir = destDir;
286 }
287
288
289 /**
290 * Adds a file from the argume
291 *
292 * @param arg a file, could be a wsdl or xsd or a Class
293 */
294 protected void addFile(String arg) throws BadCommandLineException {}
295
296 /**
297 * Parses an option {@code args[i]} and return
298 * the number of tokens consumed.
299 *
300 * @return
301 * 0 if the argument is not understood. Returning 0
302 * will let the caller report an error.
303 * @exception BadCommandLineException
304 * If the callee wants to provide a custom message for an error.
305 */
306 protected int parseArguments(String[] args, int i) throws BadCommandLineException {
307 if (args[i].equals("-g")) {
308 debug = true;
309 return 1;
310 } else if (args[i].equals("-Xdebug")) {
311 debugMode = true;
312 return 1;
313 } else if (args[i].equals("-Xendorsed")) {
314 // this option is processed much earlier, so just ignore.
315 return 1;
316 } else if (args[i].equals("-verbose")) {
317 verbose = true;
|