public CompilerOptions getCompilerOptions() {
return doCreateCompilerOptions();
}
protected CompilerOptions doCreateCompilerOptions() {
CompilerOptions options = new CompilerOptions();
if(outDir==null)
throw new Wsdl2JibxException("Out directory must be specified");
if(schemaFilesString==null)
throw new Wsdl2JibxException("Schemas must be specified");
StringTokenizer tokens = new StringTokenizer(schemaFilesString.trim(),",");
this.schemaFilesList = new ArrayList();
while(tokens.hasMoreTokens()) {
String location = tokens.nextToken().trim();
URL url;
try {
if(!location.startsWith("http") && !location.startsWith("file"))
url = new URL("file:///"+new File(location).getAbsolutePath());
else
url = new URL(location);
} catch(MalformedURLException ex) {
throw new Wsdl2JibxException("Error in schema location ["+location+"]", ex);
}
// if(!file.)
// throw new RuntimeException("File "+file.getAbsolutePath()+" does not exist");
this.schemaFilesList.add(url);
}
if(fieldVisibility.equals("public"))
options.setFieldVisibility(JavaSource.PUBLIC);
else if(fieldVisibility.equals("protected"))
options.setFieldVisibility(JavaSource.PROTECTED);
else if(fieldVisibility.equals("private"))
options.setFieldVisibility(JavaSource.PRIVATE);
else if(fieldVisibility.equals("package"))
options.setFieldVisibility(JavaSource.DEFAULT_PROTECTION);
tokens = new StringTokenizer(accessors, ",");
while(tokens.hasMoreTokens()) {
String ac = tokens.nextToken();
if("set".equals(ac))
options.setHasSetter(true);
else if("get".equals(ac))
options.setHasGetter(true);
else if("add".equals(ac))
options.setHasAdder(true);
else if("size".equals(ac))
options.setHasSizer(true);
else if("item".equals(ac))
options.setHasItemer(true);
else
throw new RuntimeException("Accessor "+ac+" unknown");
}
options.setListAsPlainArray(this.plainArrays);
options.setListInterface(this.listInterface);
options.setListImplementation(this.listImplementation);
options.setSerializable(this.serializable);
if(this.licence!=null)
options.setLicence(loadLicence());
options.setBanner(loadBanner());
options.setEncoding(this.encoding);
options.setDisableJibx(this.disableJibx);
options.setUnwrapArrays(this.unwrapArrays);
options.setSchemaFiles(this.schemaFilesList);
options.setUserPackage(this.userPackage);
options.setSimpleDates(this.simpleDates);
File outDirFile = new File(this.outDir);
if(!outDirFile.exists())
throw new RuntimeException("Directory "+outDir+" doest not exist");
options.setOutDir(outDirFile);
options.setKeepAbstract(this.keepAbstract);
options.setForceClasses(this.forceClasses);
options.setVerbose(this.debug);
return options;
}