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
116
117 /**
118 * optional, if true JWS file is generated
119 */
120 public boolean isGenerateJWS = false;
121
122 /**
123 * Setting disableSSLHostVerification to true disables the SSL Hostname verification while fetching the wsdls.
124 * -XdisableSSLHostVerification
125 */
126 public boolean disableSSLHostnameVerification;
127
128 /**
129 * Setting useBaseResourceAndURLToLoadWSDL to true causes generated Service classes to load the WSDL file from
130 * a URL generated from the base resource.
131 * -XuseBaseResourceAndURLToLoadWSDL
132 */
133 public boolean useBaseResourceAndURLToLoadWSDL = false;
134
135 /**
136 * JAXB's {@link SchemaCompiler} to be used for handling the schema portion.
137 * This object is also configured through options.
138 */
139 private SchemaCompiler schemaCompiler = XJC.createSchemaCompiler();
140
141 /**
142 * Authentication file
143 */
144 public File authFile = null;
145
146 //can user.home value be null?
147 public static final String defaultAuthfile
148 = System.getProperty("user.home") + System.getProperty("file.separator")
149 + ".metro" + System.getProperty("file.separator") + "auth";
150
151 /**
152 * Setting disableAuthenticator to true disables the DefaultAuthenticator.
153 * -XdisableAuthenticator
154 */
155 public boolean disableAuthenticator;
202 */
203 public List<String> cmdlineJars = new ArrayList<String>();
204
205 /**
206 * Gets all the {@link Plugin}s discovered so far.
207 *
208 * <p>
209 * A plugins are enumerated when this method is called for the first time,
210 * by taking {@link #classpath} into account. That means
211 * "-cp plugin.jar" has to come before you specify options to enable it.
212 */
213 public List<Plugin> getAllPlugins() {
214 if(allPlugins==null) {
215 allPlugins = new ArrayList<Plugin>();
216 allPlugins.addAll(Arrays.asList(findServices(Plugin.class, getClassLoader())));
217 }
218 return allPlugins;
219 }
220
221 /**
222 * Parses arguments and fill fields of this object.
223 *
224 * @exception BadCommandLineException
225 * thrown when there's a problem in the command-line arguments
226 */
227 @Override
228 public final void parseArguments( String[] args ) throws BadCommandLineException {
229
230 for (int i = 0; i < args.length; i++) {
231 if(args[i].length()==0)
232 throw new BadCommandLineException();
233 if (args[i].charAt(0) == '-') {
234 int j = parseArguments(args,i);
235 if(j==0)
236 throw new BadCommandLineException(WscompileMessages.WSCOMPILE_INVALID_OPTION(args[i]));
237 i += (j-1);
238 } else {
239 if(args[i].endsWith(".jar")) {
240
241 try {
276
277 @Override
278 public int parseArguments(String[] args, int i) throws BadCommandLineException {
279 int j = super.parseArguments(args ,i);
280 if(j>0) return j; // understood by the super class
281
282 if (args[i].equals("-b")) {
283 addBindings(requireArgument("-b", args, ++i));
284 return 2;
285 } else if (args[i].equals("-wsdllocation")) {
286 wsdlLocation = requireArgument("-wsdllocation", args, ++i);
287 return 2;
288 } else if (args[i].equals("-XadditionalHeaders")) {
289 additionalHeaders = true;
290 return 1;
291 } else if (args[i].equals("-XdisableSSLHostnameVerification")) {
292 disableSSLHostnameVerification = true;
293 return 1;
294 } else if (args[i].equals("-p")) {
295 defaultPackage = requireArgument("-p", args, ++i);
296 return 2;
297 } else if (args[i].equals("-catalog")) {
298 String catalog = requireArgument("-catalog", args, ++i);
299 try {
300 if (entityResolver == null) {
301 if (catalog != null && catalog.length() > 0)
302 entityResolver = XmlUtil.createEntityResolver(JAXWSUtils.getFileOrURL(JAXWSUtils.absolutize(Util.escapeSpace(catalog))));
303 } else if (catalog != null && catalog.length() > 0) {
304 EntityResolver er = XmlUtil.createEntityResolver(JAXWSUtils.getFileOrURL(JAXWSUtils.absolutize(Util.escapeSpace(catalog))));
305 entityResolver = new ForkEntityResolver(er, entityResolver);
306 }
307 } catch (IOException e) {
308 throw new BadCommandLineException(WscompileMessages.WSIMPORT_FAILED_TO_PARSE(catalog, e.getMessage()));
309 }
310 return 2;
311 } else if (args[i].startsWith("-httpproxy:")) {
312 String value = args[i].substring(11);
313 if (value.length() == 0) {
314 throw new BadCommandLineException(WscompileMessages.WSCOMPILE_INVALID_OPTION(args[i]));
315 }
|
1 /*
2 * Copyright (c) 1997, 2016, 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
116
117 /**
118 * optional, if true JWS file is generated
119 */
120 public boolean isGenerateJWS = false;
121
122 /**
123 * Setting disableSSLHostVerification to true disables the SSL Hostname verification while fetching the wsdls.
124 * -XdisableSSLHostVerification
125 */
126 public boolean disableSSLHostnameVerification;
127
128 /**
129 * Setting useBaseResourceAndURLToLoadWSDL to true causes generated Service classes to load the WSDL file from
130 * a URL generated from the base resource.
131 * -XuseBaseResourceAndURLToLoadWSDL
132 */
133 public boolean useBaseResourceAndURLToLoadWSDL = false;
134
135 /**
136 * Java module name in {@code module-info.java}.
137 */
138 private String javaModule = null;
139
140 /**
141 * JAXB's {@link SchemaCompiler} to be used for handling the schema portion.
142 * This object is also configured through options.
143 */
144 private SchemaCompiler schemaCompiler = XJC.createSchemaCompiler();
145
146 /**
147 * Authentication file
148 */
149 public File authFile = null;
150
151 //can user.home value be null?
152 public static final String defaultAuthfile
153 = System.getProperty("user.home") + System.getProperty("file.separator")
154 + ".metro" + System.getProperty("file.separator") + "auth";
155
156 /**
157 * Setting disableAuthenticator to true disables the DefaultAuthenticator.
158 * -XdisableAuthenticator
159 */
160 public boolean disableAuthenticator;
207 */
208 public List<String> cmdlineJars = new ArrayList<String>();
209
210 /**
211 * Gets all the {@link Plugin}s discovered so far.
212 *
213 * <p>
214 * A plugins are enumerated when this method is called for the first time,
215 * by taking {@link #classpath} into account. That means
216 * "-cp plugin.jar" has to come before you specify options to enable it.
217 */
218 public List<Plugin> getAllPlugins() {
219 if(allPlugins==null) {
220 allPlugins = new ArrayList<Plugin>();
221 allPlugins.addAll(Arrays.asList(findServices(Plugin.class, getClassLoader())));
222 }
223 return allPlugins;
224 }
225
226 /**
227 * Gets Java module name option.
228 * @return Java module name option or {@code null} if this option was not set.
229 */
230 public String getModuleName() {
231 return javaModule;
232 }
233
234 /**
235 * Parses arguments and fill fields of this object.
236 *
237 * @exception BadCommandLineException
238 * thrown when there's a problem in the command-line arguments
239 */
240 @Override
241 public final void parseArguments( String[] args ) throws BadCommandLineException {
242
243 for (int i = 0; i < args.length; i++) {
244 if(args[i].length()==0)
245 throw new BadCommandLineException();
246 if (args[i].charAt(0) == '-') {
247 int j = parseArguments(args,i);
248 if(j==0)
249 throw new BadCommandLineException(WscompileMessages.WSCOMPILE_INVALID_OPTION(args[i]));
250 i += (j-1);
251 } else {
252 if(args[i].endsWith(".jar")) {
253
254 try {
289
290 @Override
291 public int parseArguments(String[] args, int i) throws BadCommandLineException {
292 int j = super.parseArguments(args ,i);
293 if(j>0) return j; // understood by the super class
294
295 if (args[i].equals("-b")) {
296 addBindings(requireArgument("-b", args, ++i));
297 return 2;
298 } else if (args[i].equals("-wsdllocation")) {
299 wsdlLocation = requireArgument("-wsdllocation", args, ++i);
300 return 2;
301 } else if (args[i].equals("-XadditionalHeaders")) {
302 additionalHeaders = true;
303 return 1;
304 } else if (args[i].equals("-XdisableSSLHostnameVerification")) {
305 disableSSLHostnameVerification = true;
306 return 1;
307 } else if (args[i].equals("-p")) {
308 defaultPackage = requireArgument("-p", args, ++i);
309 return 2;
310 } else if (args[i].equals("-m")) {
311 javaModule = requireArgument("-m", args, ++i);
312 return 2;
313 } else if (args[i].equals("-catalog")) {
314 String catalog = requireArgument("-catalog", args, ++i);
315 try {
316 if (entityResolver == null) {
317 if (catalog != null && catalog.length() > 0)
318 entityResolver = XmlUtil.createEntityResolver(JAXWSUtils.getFileOrURL(JAXWSUtils.absolutize(Util.escapeSpace(catalog))));
319 } else if (catalog != null && catalog.length() > 0) {
320 EntityResolver er = XmlUtil.createEntityResolver(JAXWSUtils.getFileOrURL(JAXWSUtils.absolutize(Util.escapeSpace(catalog))));
321 entityResolver = new ForkEntityResolver(er, entityResolver);
322 }
323 } catch (IOException e) {
324 throw new BadCommandLineException(WscompileMessages.WSIMPORT_FAILED_TO_PARSE(catalog, e.getMessage()));
325 }
326 return 2;
327 } else if (args[i].startsWith("-httpproxy:")) {
328 String value = args[i].substring(11);
329 if (value.length() == 0) {
330 throw new BadCommandLineException(WscompileMessages.WSCOMPILE_INVALID_OPTION(args[i]));
331 }
|