com.izforge.izpack.installer
Class CompileWorker.CompilationJob

java.lang.Object
  extended by com.izforge.izpack.installer.CompileWorker.CompilationJob
Enclosing class:
CompileWorker

private static class CompileWorker.CompilationJob
extends java.lang.Object

a compilation job


Field Summary
private  java.util.ArrayList classpath
           
private  java.util.ArrayList<java.io.File> files
           
private  AutomatedInstallData idata
           
private  LocaleDatabase langpack
           
private  CompileHandler listener
           
private static int MAX_CMDLINE_SIZE
           
private  java.lang.String name
           
 
Constructor Summary
CompileWorker.CompilationJob(CompileHandler listener, AutomatedInstallData idata, java.lang.String name, java.util.ArrayList<java.io.File> files, java.util.ArrayList classpath)
          Construct new compilation job.
 
Method Summary
 CompileResult checkCompiler(java.lang.String compiler, java.util.ArrayList<java.lang.String> arguments)
          Check whether the given compiler works.
 java.lang.String getName()
          Get the name of the job.
 int getSize()
          Get the number of files in this job.
 CompileResult perform(java.lang.String compiler, java.util.ArrayList<java.lang.String> arguments)
          Perform this job - start compilation.
private  int runCompiler(FileExecutor executor, java.lang.String[] output, java.util.List<java.lang.String> cmdline)
          Internal helper method.
private  int runEclipseCompiler(java.lang.String[] output, java.util.List<java.lang.String> cmdline)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listener

private CompileHandler listener

name

private java.lang.String name

files

private java.util.ArrayList<java.io.File> files

classpath

private java.util.ArrayList classpath

langpack

private LocaleDatabase langpack

idata

private AutomatedInstallData idata

MAX_CMDLINE_SIZE

private static final int MAX_CMDLINE_SIZE
See Also:
Constant Field Values
Constructor Detail

CompileWorker.CompilationJob

public CompileWorker.CompilationJob(CompileHandler listener,
                                    AutomatedInstallData idata,
                                    java.lang.String name,
                                    java.util.ArrayList<java.io.File> files,
                                    java.util.ArrayList classpath)
Construct new compilation job.

Parameters:
listener - The listener to report progress to.
idata - The installation data.
name - The name of the job.
files - The files to compile.
classpath - The class path to use.
Method Detail

getName

public java.lang.String getName()
Get the name of the job.

Returns:
The name or an empty string if there is no name.

getSize

public int getSize()
Get the number of files in this job.

Returns:
The number of files to compile.

perform

public CompileResult perform(java.lang.String compiler,
                             java.util.ArrayList<java.lang.String> arguments)
Perform this job - start compilation.

Parameters:
compiler - The compiler to use.
arguments - The compiler arguments to use.
Returns:
The result.

runCompiler

private int runCompiler(FileExecutor executor,
                        java.lang.String[] output,
                        java.util.List<java.lang.String> cmdline)
Internal helper method.

Parameters:
executor - The executor, only used when using external compiler.
output - The output from the compiler ([0] = stdout, [1] = stderr)
Returns:
The result of the compilation.

runEclipseCompiler

private int runEclipseCompiler(java.lang.String[] output,
                               java.util.List<java.lang.String> cmdline)

checkCompiler

public CompileResult checkCompiler(java.lang.String compiler,
                                   java.util.ArrayList<java.lang.String> arguments)
Check whether the given compiler works.

This performs two steps:

  1. check whether we can successfully call "compiler -help"
  2. check whether we can successfully call "compiler -help arguments" (not all compilers return an error here)

On failure, the method CompileHandler#errorCompile is called with a descriptive error message.

Parameters:
compiler - the compiler to use
arguments - additional arguments to pass to the compiler
Returns:
false on error