new java.util.Timer(true).schedule(new TimerTask() {
public void run() {
try {
FirstPanel first=(FirstPanel)wizardComponents.getWizardPanel(1);
SecondPanel option=(SecondPanel)wizardComponents.getWizardPanel(3);
WSDL2JavaOutputPanel output=(WSDL2JavaOutputPanel)wizardComponents.getWizardPanel(5);
boolean isServerside,isServiceXML,isGenerateServerSideInterface = false;
if (option.getGenerateAll()){
isServerside = true;
isServiceXML = true;
isGenerateServerSideInterface = true;
}else{
isServerside = option.isServerside();
isServiceXML =option.isServerXML();
isGenerateServerSideInterface = option.getGenerateServerSideInterface();
}
codegenBean.setPackageName(option.getPackageName());
codegenBean.setLanguage(option.getSelectedLanguage());
codegenBean.setPortName(option.getPortName());
codegenBean.setServiceName(option.getServiceName());
codegenBean.setDatabindingName(option.getDatabinderName());
codegenBean.setAsyncOnly(option.isAsyncOnlyOn());
codegenBean.setSyncOnly(option.isSyncOnlyOn());
codegenBean.setTestCase(option.isGenerateTestCase());
codegenBean.setGenerateAll(option.getGenerateAll());
codegenBean.setServerXML(isServiceXML);
codegenBean.setServerSide(isServerside);
codegenBean.setServerSideInterface(isGenerateServerSideInterface);
codegenBean.setOutput(output.getOutputLocation());
codegenBean.setNamespace2packageList(option.getNs2PkgMapping());
codegenBean.setWSDLFileName(first.getWSDLFileName());
codegenBean.generate();
//Add the codegen libs that are coming with the plugin to the project lib that has been created
if (output.getAxis2PluginLibCopyCheckBoxSelection()){
java.net.URL resource = WizardPanel.class.getResource("/icons/icon.png");
String path =new File(resource.getPath()).getParentFile().getParentFile().getParentFile().getPath();
System.out.println(path);
String pluginLibLocation = path+File.separator+"lib";
addLibsToProjectLib(pluginLibLocation, output.getOutputLocation());
}
//Add the libraries on the plugin lib directory to the created project lib
if (output.getAxisLibCopyCheckBoxSelection() && output.oktoLoadLibs()){
String libDirectory = output.getAxisJarsLocation();
addLibsToProjectLib(libDirectory, output.getOutputLocation());
}
//This will Create a jar file from the codegen results and add to the output
//locations lib directory
if (output.getCreateJarCheckBoxSelection()){
File tempClassFile=codegenBean.getTemp();
tempClassFile.mkdir();
File srcTemp=new File(tempClassFile.getPath()+File.separator+"src");
srcTemp.mkdir();
copyDirectory(new File(output.getOutputLocation()+File.separator+"src"),srcTemp);
//Compile the source to another directory
SrcCompiler srcCompileTool = new SrcCompiler();
srcCompileTool.compileSource(tempClassFile.getPath());
//create the jar file and add that to the lib directory
String projectLib = output.getOutputLocation()+File.separator+"lib";
JarFileWriter jarFileWriter = new JarFileWriter();
String jarFileName = "CodegenResults.jar";
if (!output.getJarFilename().equals("")){
jarFileName=output.getJarFilename();
}
output.setJarFileName(jarFileName);
File tempClass = new File(tempClassFile.getPath()+File.separator+"classes");
jarFileWriter.writeJarFile(new File(projectLib), jarFileName, tempClass);
//Delete the temp folders
deleteDir(tempClassFile );