opts.add("schemaCodePrinter");
opts.add("extension");
opts.add("extensionParms");
opts.add("allowmdef");
opts.add("catalog");
CommandLine cl = new CommandLine(args, flags, opts);
String[] badopts = cl.getBadOpts();
if (badopts.length > 0) {
for (int i = 0; i < badopts.length; i++)
System.out.println("Unrecognized option: " + badopts[i]);
return;
}
args = cl.args();
boolean verbose = (cl.getOpt("verbose") != null);
boolean quiet = (cl.getOpt("quiet") != null);
if (verbose)
quiet = false;
String outputfilename = cl.getOpt("out");
String repackage = cl.getOpt("repackage");
String codePrinterClass = cl.getOpt("schemaCodePrinter");
SchemaCodePrinter codePrinter = null;
String name = cl.getOpt("name");
boolean download = (cl.getOpt("dl") != null);
boolean noUpa = (cl.getOpt("noupa") != null);
boolean noPvr = (cl.getOpt("nopvr") != null);
boolean noAnn = (cl.getOpt("noann") != null);
boolean noVDoc = (cl.getOpt("novdoc") != null);
boolean noExt = (cl.getOpt("noext") != null);
boolean nojavac = (cl.getOpt("srconly") != null);
boolean debug = (cl.getOpt("debug") != null);
String allowmdef = cl.getOpt("allowmdef");
Set mdefNamespaces = (allowmdef == null ? Collections.EMPTY_SET
: new HashSet(Arrays.asList(XmlListImpl.split_list(allowmdef))));
List extensions = new ArrayList();
String classesdir = cl.getOpt("d");
File classes = null;
if (classesdir != null)
classes = new File(classesdir);
String srcdir = cl.getOpt("src");
File src = null;
if (srcdir != null)
src = new File(srcdir);
if (nojavac && srcdir == null && classes != null)
src = classes;
// create temp directory
File tempdir = null;
if (src == null || classes == null) {
throw new XBayaRuntimeException("Code gen src directory or classes directory is null");
}
File jarfile = null;
if (outputfilename == null && classes == null && !nojavac)
outputfilename = "xmltypes.jar";
if (outputfilename != null)
jarfile = new File(outputfilename);
if (src == null)
src = IOUtil.createDir(tempdir, "src");
if (classes == null)
classes = IOUtil.createDir(tempdir, "classes");
File[] classpath = null;
String cpString = cl.getOpt("cp");
if (cpString != null) {
String[] cpparts = cpString.split(File.pathSeparator);
List cpList = new ArrayList();
for (int i = 0; i < cpparts.length; i++)
cpList.add(new File(cpparts[i]));
classpath = (File[]) cpList.toArray(new File[cpList.size()]);
} else {
classpath = CodeGenUtil.systemClasspath();
}
String javasource = cl.getOpt("javasource");
String compiler = cl.getOpt("compiler");
String jar = cl.getOpt("jar");
if (verbose && jar != null)
System.out.println("The 'jar' option is no longer supported.");
String memoryInitialSize = cl.getOpt("ms");
String memoryMaximumSize = cl.getOpt("mx");
File[] xsdFiles = cl.filesEndingWith(".xsd");
File[] wsdlFiles = cl.filesEndingWith(".wsdl");
File[] javaFiles = cl.filesEndingWith(".java");
File[] configFiles = cl.filesEndingWith(".xsdconfig");
URL[] urlFiles = cl.getURLs();
if (xsdFiles.length + wsdlFiles.length + urlFiles.length == 0) {
System.out
.println("Could not find any xsd or wsdl files to process.");
return;
}
File baseDir = cl.getBaseDir();
URI baseURI = baseDir == null ? null : baseDir.toURI();
XmlErrorPrinter err = new XmlErrorPrinter(verbose, baseURI);
String catString = cl.getOpt("catalog");
Parameters params = new Parameters();
params.setBaseDir(baseDir);
params.setXsdFiles(xsdFiles);
params.setWsdlFiles(wsdlFiles);