com.izforge.izpack.compiler
Class Compiler

java.lang.Object
  extended byjava.lang.Thread
      extended bycom.izforge.izpack.compiler.Compiler
All Implemented Interfaces:
java.lang.Runnable

public class Compiler
extends java.lang.Thread

The IzPack compiler class.

Author:
Julien Ponge, Tino Schwarze

Nested Class Summary
(package private) static class Compiler.CmdlinePackagerListener
          Used to handle the packager messages in the command-line mode.
(package private)  class Compiler.NativeLibrary
          Represents a native library.
(package private)  class Compiler.Pack
          Represents a pack.
(package private)  class Compiler.PackSource
          Represents a pack data source.
(package private)  class Compiler.Resource
          Represents a resource.
 
Field Summary
protected  java.lang.String basedir
          The base directory.
private  boolean compileFailed
          Error code, set to true if compilation succeeded.
protected  java.lang.String filename
          The XML filename.
static java.lang.String IZPACK_HOME
          The IzPack home directory.
static java.lang.String IZPACK_VERSION
          The IzPack version.
protected  java.io.File keepDirFile
          The directory-keeping special file.
protected  java.lang.String kind
          The installer kind.
protected  java.lang.String output
          The output jar filename.
protected  PackagerListener packagerListener
          The packager listener.
static java.lang.String STANDARD
          Standard installer.
static java.lang.String STANDARD_KUNSTSTOFF
          Standard-Kunststoff installer.
protected  VariableValueMapImpl varMap
          The variables map.
static java.lang.String VERSION
          The compiler version.
static java.lang.String WEB
          Web installer.
static java.lang.String WEB_KUNSTSTOFF
          Web-Kunsstoff installer.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Compiler(java.lang.String filename, java.lang.String basedir, java.lang.String kind, java.lang.String output)
          The constructor.
 
Method Summary
protected  void addFile(java.io.File file, java.lang.String relPath, java.util.List osList, int override, java.util.ArrayList list)
          Recursive method to add files in a pack.
protected  void addFileSet(java.lang.String path, java.lang.String[] includes, java.lang.String[] excludes, java.lang.String relPath, java.util.List osList, java.util.ArrayList list, java.lang.String casesensitive, int override)
          Adds a Ant fileset.
protected  void addSingleFile(java.io.File file, java.lang.String targetFile, java.util.List osList, int override, java.util.ArrayList list)
          Method to add a single file in a pack.
 void compile()
          Compiles.
 void executeCompiler()
          Compiles the installation.
protected  GUIPrefs getGUIPrefs(XMLElement data)
          Returns the GUIPrefs.
protected  Info getInfo(XMLElement data)
          Builds the Info class from the XML tree.
protected  java.util.ArrayList getJars(XMLElement data)
          Returns a list of the jar files to add.
protected  java.util.ArrayList getLangpacksCodes(XMLElement data)
          Returns a list of the ISO3 codes of the langpacks to include.
protected  java.util.ArrayList getNativeLibraries(XMLElement data)
          Returns a list of the native libraries to add.
protected  int getOverrideValue(XMLElement f)
           
protected  Packager getPackager()
          Returns the suitable Packager, depending of the kind variable.
protected  java.util.ArrayList getPacks(XMLElement data)
          Returns a list of the packs to add.
protected  java.util.ArrayList getPanels(XMLElement data)
          Returns a list of the panels names to add.
protected  java.util.ArrayList getResources(XMLElement data)
          Returns a list of the resources to include.
protected  java.util.Properties getVariables(XMLElement data)
          Variable declaration is a fragmention in install.xml like : variable declared in this can be referd in parsable files
protected  XMLElement getXMLTree()
          Returns the XMLElement representing the installation XML file.
static void main(java.lang.String[] args)
          The main method if the compiler is invoked by a command-line call.
 void run()
          The run() method.
 void setPackagerListener(PackagerListener listener)
          Sets the packager listener.
 boolean wasSuccessful()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

VERSION

public static final java.lang.String VERSION
The compiler version.

See Also:
Constant Field Values

IZPACK_VERSION

public static final java.lang.String IZPACK_VERSION
The IzPack version.

See Also:
Constant Field Values

STANDARD

public static final java.lang.String STANDARD
Standard installer.

See Also:
Constant Field Values

STANDARD_KUNSTSTOFF

public static final java.lang.String STANDARD_KUNSTSTOFF
Standard-Kunststoff installer.

See Also:
Constant Field Values

WEB

public static final java.lang.String WEB
Web installer.

See Also:
Constant Field Values

WEB_KUNSTSTOFF

public static final java.lang.String WEB_KUNSTSTOFF
Web-Kunsstoff installer.

See Also:
Constant Field Values

IZPACK_HOME

public static java.lang.String IZPACK_HOME
The IzPack home directory.


filename

protected java.lang.String filename
The XML filename.


basedir

protected java.lang.String basedir
The base directory.


kind

protected java.lang.String kind
The installer kind.


output

protected java.lang.String output
The output jar filename.


packagerListener

protected PackagerListener packagerListener
The packager listener.


varMap

protected VariableValueMapImpl varMap
The variables map.


keepDirFile

protected java.io.File keepDirFile
The directory-keeping special file.


compileFailed

private boolean compileFailed
Error code, set to true if compilation succeeded.

Constructor Detail

Compiler

public Compiler(java.lang.String filename,
                java.lang.String basedir,
                java.lang.String kind,
                java.lang.String output)
The constructor.

Parameters:
filename - The XML filename.
basedir - The base directory.
kind - The installer kind.
output - The installer filename.
Method Detail

setPackagerListener

public void setPackagerListener(PackagerListener listener)
Sets the packager listener.

Parameters:
listener - The listener.

compile

public void compile()
Compiles.


run

public void run()
The run() method.


executeCompiler

public void executeCompiler()
                     throws java.lang.Exception
Compiles the installation.

Throws:
java.lang.Exception - Description of the Exception

wasSuccessful

public boolean wasSuccessful()

getGUIPrefs

protected GUIPrefs getGUIPrefs(XMLElement data)
                        throws java.lang.Exception
Returns the GUIPrefs.

Parameters:
data - The XML data.
Returns:
The GUIPrefs.
Throws:
java.lang.Exception - Description of the Exception

getJars

protected java.util.ArrayList getJars(XMLElement data)
                               throws java.lang.Exception
Returns a list of the jar files to add.

Parameters:
data - The XML data.
Returns:
The jar files list.
Throws:
java.lang.Exception - Description of the Exception

getNativeLibraries

protected java.util.ArrayList getNativeLibraries(XMLElement data)
                                          throws java.lang.Exception
Returns a list of the native libraries to add.

Parameters:
data - The XML data.
Returns:
The native libraries list.
Throws:
java.lang.Exception - Description of the Exception

getPacks

protected java.util.ArrayList getPacks(XMLElement data)
                                throws java.lang.Exception
Returns a list of the packs to add.

Parameters:
data - The XML data.
Returns:
The packs to add list.
Throws:
java.lang.Exception - Description of the Exception

addFileSet

protected void addFileSet(java.lang.String path,
                          java.lang.String[] includes,
                          java.lang.String[] excludes,
                          java.lang.String relPath,
                          java.util.List osList,
                          java.util.ArrayList list,
                          java.lang.String casesensitive,
                          int override)
                   throws java.lang.Exception
Adds a Ant fileset.

Parameters:
path - The path.
includes - The includes rules.
excludes - The excludes rules.
relPath - The relative path.
list - The files list.
casesensitive - Case-sensitive stuff.
override - Behaviour if a file already exists during install
Throws:
java.lang.Exception - Description of the Exception

addFile

protected void addFile(java.io.File file,
                       java.lang.String relPath,
                       java.util.List osList,
                       int override,
                       java.util.ArrayList list)
                throws java.lang.Exception
Recursive method to add files in a pack.

Parameters:
file - The file to add.
relPath - The relative path.
osList - The target OS constraints.
override - Overriding behaviour.
list - The files list.
Throws:
java.lang.Exception - Description of the Exception

addSingleFile

protected void addSingleFile(java.io.File file,
                             java.lang.String targetFile,
                             java.util.List osList,
                             int override,
                             java.util.ArrayList list)
                      throws java.lang.Exception
Method to add a single file in a pack.

Parameters:
file - The file to add.
targetFile - The target to add the file as.
osList - The target OS constraints.
override - Overriding behaviour.
list - The files list.
Throws:
java.lang.Exception - Description of the Exception

getPanels

protected java.util.ArrayList getPanels(XMLElement data)
                                 throws java.lang.Exception
Returns a list of the panels names to add.

Parameters:
data - The XML data.
Returns:
The panels list.
Throws:
java.lang.Exception - Description of the Exception

getResources

protected java.util.ArrayList getResources(XMLElement data)
                                    throws java.lang.Exception
Returns a list of the resources to include.

Parameters:
data - The XML data.
Returns:
The resources list.
Throws:
java.lang.Exception - Description of the Exception

getLangpacksCodes

protected java.util.ArrayList getLangpacksCodes(XMLElement data)
                                         throws java.lang.Exception
Returns a list of the ISO3 codes of the langpacks to include.

Parameters:
data - The XML data.
Returns:
The ISO 3 codes list.
Throws:
java.lang.Exception - Description of the Exception

getInfo

protected Info getInfo(XMLElement data)
                throws java.lang.Exception
Builds the Info class from the XML tree.

Parameters:
data - The XML data.
Returns:
The Info.
Throws:
java.lang.Exception - Description of the Exception

getPackager

protected Packager getPackager()
                        throws java.lang.Exception
Returns the suitable Packager, depending of the kind variable.

Returns:
The packager.
Throws:
java.lang.Exception - Description of the Exception

getVariables

protected java.util.Properties getVariables(XMLElement data)
                                     throws java.lang.Exception
Variable declaration is a fragmention in install.xml like : variable declared in this can be referd in parsable files

Parameters:
data - The XML data.
Returns:
The Properties.
Throws:
java.lang.Exception - Description of the Exception

getXMLTree

protected XMLElement getXMLTree()
                         throws java.lang.Exception
Returns the XMLElement representing the installation XML file.

Returns:
The XML tree.
Throws:
java.lang.Exception - Description of the Exception

getOverrideValue

protected int getOverrideValue(XMLElement f)

main

public static void main(java.lang.String[] args)
The main method if the compiler is invoked by a command-line call.

Parameters:
args - The arguments passed on the command-line.