com.izforge.izpack.installer
Class CompileWorker

java.lang.Object
  extended by com.izforge.izpack.installer.CompileWorker
All Implemented Interfaces:
java.lang.Runnable

public class CompileWorker
extends java.lang.Object
implements java.lang.Runnable

This class does alle the work for compiling sources. It responsible for

Author:
Tino Schwarze

Nested Class Summary
private static class CompileWorker.CompilationJob
          a compilation job
 
Field Summary
private  java.lang.Thread compilationThread
          We spawn a thread to perform compilation.
private  java.util.ArrayList compilerArgumentsList
           
private  XMLElement compilerArgumentsSpec
           
private  java.lang.String compilerArgumentsToUse
           
private  java.util.ArrayList compilerList
           
private  XMLElement compilerSpec
           
private  java.lang.String compilerToUse
           
private  CompileHandler handler
           
private  AutomatedInstallData idata
           
private  java.util.ArrayList jobs
          Compilation jobs
private  CompileResult result
           
private  XMLElement spec
           
private static java.lang.String SPEC_RESOURCE_NAME
          Name of resource for specifying compilation parameters.
private  VariableSubstitutor vs
           
 
Constructor Summary
CompileWorker(AutomatedInstallData idata, CompileHandler handler)
          The constructor.
 
Method Summary
private  void changeClassPath(java.util.ArrayList classpath, XMLElement child)
          helper: process a <classpath> tag.
private  boolean collectJobs()
          Parse the compilation specification file and create jobs.
private  CompileWorker.CompilationJob collectJobsRecursive(XMLElement node, java.util.ArrayList classpath)
           
private  CompileResult compileJobs()
          perform the actual compilation
 java.util.ArrayList getAvailableArguments()
          Return list of compiler arguments to choose from.
 java.util.ArrayList getAvailableCompilers()
          Return list of compilers to choose from.
 java.lang.String getCompiler()
          Get the compiler used.
 java.lang.String getCompilerArguments()
          Get the compiler arguments used.
 CompileResult getResult()
          Get the result of the compilation.
private  void readChoices(XMLElement element, java.util.ArrayList result)
           
private  boolean readSpec()
           
 void run()
          This is called when the compilation thread is activated.
private  java.util.ArrayList scanDirectory(java.io.File path)
          helper: recursively scan given directory.
 void setCompiler(java.lang.String compiler)
          Set the compiler to use.
 void setCompilerArguments(java.lang.String arguments)
          Set the compiler arguments to use.
 void startThread()
          Start the compilation in a separate thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jobs

private java.util.ArrayList jobs
Compilation jobs


SPEC_RESOURCE_NAME

private static final java.lang.String SPEC_RESOURCE_NAME
Name of resource for specifying compilation parameters.

See Also:
Constant Field Values

vs

private VariableSubstitutor vs

compilationThread

private java.lang.Thread compilationThread
We spawn a thread to perform compilation.


spec

private XMLElement spec

idata

private AutomatedInstallData idata

handler

private CompileHandler handler

compilerSpec

private XMLElement compilerSpec

compilerList

private java.util.ArrayList compilerList

compilerToUse

private java.lang.String compilerToUse

compilerArgumentsSpec

private XMLElement compilerArgumentsSpec

compilerArgumentsList

private java.util.ArrayList compilerArgumentsList

compilerArgumentsToUse

private java.lang.String compilerArgumentsToUse

result

private CompileResult result
Constructor Detail

CompileWorker

public CompileWorker(AutomatedInstallData idata,
                     CompileHandler handler)
              throws java.io.IOException
The constructor.

Parameters:
idata - The installation data.
handler - The handler to notify of progress.
Throws:
java.io.IOException
Method Detail

getAvailableCompilers

public java.util.ArrayList getAvailableCompilers()
Return list of compilers to choose from.

Returns:
ArrayList of String

setCompiler

public void setCompiler(java.lang.String compiler)
Set the compiler to use. The compiler is checked before compilation starts.

Parameters:
compiler - compiler to use (not checked)

getCompiler

public java.lang.String getCompiler()
Get the compiler used.


getAvailableArguments

public java.util.ArrayList getAvailableArguments()
Return list of compiler arguments to choose from.

Returns:
ArrayList of String

setCompilerArguments

public void setCompilerArguments(java.lang.String arguments)
Set the compiler arguments to use.


getCompilerArguments

public java.lang.String getCompilerArguments()
Get the compiler arguments used.


getResult

public CompileResult getResult()
Get the result of the compilation.


startThread

public void startThread()
Start the compilation in a separate thread.


run

public void run()
This is called when the compilation thread is activated. Can also be called directly if asynchronous processing is not desired.

Specified by:
run in interface java.lang.Runnable

readSpec

private boolean readSpec()

readChoices

private void readChoices(XMLElement element,
                         java.util.ArrayList result)

collectJobs

private boolean collectJobs()
                     throws java.lang.Exception
Parse the compilation specification file and create jobs.

Throws:
java.lang.Exception

compileJobs

private CompileResult compileJobs()
perform the actual compilation


collectJobsRecursive

private CompileWorker.CompilationJob collectJobsRecursive(XMLElement node,
                                                          java.util.ArrayList classpath)
                                                   throws java.lang.Exception
Throws:
java.lang.Exception

changeClassPath

private void changeClassPath(java.util.ArrayList classpath,
                             XMLElement child)
                      throws java.lang.Exception
helper: process a <classpath> tag.

Throws:
java.lang.Exception

scanDirectory

private java.util.ArrayList scanDirectory(java.io.File path)
helper: recursively scan given directory.

Returns:
list of files found (might be empty)