public class Compiler
extends java.lang.Thread
CompilerConfig
Modifier and Type | Class and Description |
---|---|
(package private) static class |
Compiler.CmdlinePackagerListener
Used to handle the packager messages in the command-line mode.
|
private class |
Compiler.Edge
This class is used for the classification of the edges
|
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
basedir
The base directory.
|
private boolean |
compileFailed
Error code, set to true if compilation succeeded.
|
static java.lang.String |
IZPACK_HOME
The IzPack home directory.
|
static java.lang.String |
IZPACK_VERSION
The IzPack version.
|
protected java.lang.String |
kind
The installer kind.
|
protected java.lang.String |
output
The output jar filename.
|
private Packager |
packager
Collects and packs files into installation jars, as told.
|
private java.util.Properties |
properties
Key/values which are substituted at compile time in the install data
|
private VariableSubstitutor |
propertySubstitutor
Replaces the properties in the install.xml file prior to compiling
|
Constructor and Description |
---|
Compiler(java.lang.String basedir,
java.lang.String kind,
java.lang.String output)
The constructor.
|
Compiler(java.lang.String basedir,
java.lang.String kind,
java.lang.String output,
java.lang.String compr_format)
The constructor.
|
Compiler(java.lang.String basedir,
java.lang.String kind,
java.lang.String output,
java.lang.String compr_format,
int compr_level)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addCustomJar(CustomData ca,
java.net.URL url)
Add a custom jar to the installation.
|
void |
addCustomListener(int type,
java.lang.String className,
java.lang.String jarPath,
java.util.List constraints)
This method parses install.xml for defined listeners and put them in the right position.
|
void |
addJarContent(java.net.URL content)
Add jar content to the installation.
|
void |
addJarContent(java.net.URL content,
java.util.List files)
Add jar content to the installation.
|
void |
addLangPack(java.lang.String iso3,
java.net.URL iso3xmlURL,
java.net.URL iso3FlagURL)
Add a lang pack to the installation.
|
void |
addNativeLibrary(java.lang.String name,
java.net.URL url)
Add a native library to the installation.
|
void |
addNativeUninstallerLibrary(CustomData data)
Add an unistaller library.
|
void |
addPack(PackInfo pack)
Add a pack to the installation.
|
void |
addPanelJar(Panel panel,
java.net.URL url)
Add a panel jar to the installation.
|
boolean |
addProperty(java.lang.String name,
java.lang.String value)
Add a name value pair to the project property set.
|
protected void |
addRecursively(java.io.File file,
java.lang.String targetdir,
java.util.List osList,
int override,
PackInfo pack,
java.util.Map additionals)
Recursive method to add files in a pack.
|
void |
addResource(java.lang.String name,
java.net.URL url)
Add a resource to the installation.
|
private int |
checkBackEdges(java.util.Map edges)
This function checks for the existence of back edges.
|
void |
checkDependencies()
Checks whether the dependencies stated in the configuration file are correct.
|
void |
checkDependencies(java.util.List packs)
Checks whether the dependencies among the given Packs.
|
void |
compile()
Compiles.
|
void |
createInstaller()
Compiles the installation.
|
private int |
dfs(java.util.List packs,
java.util.Map names)
We use the dfs graph search algorithm to check whether the graph is acyclic as described in:
Thomas H.
|
private int |
dfsVisit(PackInfo u,
java.util.Map names,
java.util.Map edges) |
java.net.URL |
findIzPackResource(java.lang.String path,
java.lang.String desc)
Look for an IzPack resource either in the compiler jar, or within IZPACK_HOME.
|
private java.util.List |
getContainedFilePaths(java.net.URL url)
Returns a list which contains the pathes of all files which are included in the given url.
|
private java.lang.String |
getFullClassName(java.net.URL url,
java.lang.String className)
Returns the qualified class name for the given class.
|
java.lang.String |
getKind()
Access the installation kind.
|
Packager |
getPackager()
Get the install packager.
|
PackagerListener |
getPackagerListener()
Retrieves the packager listener
|
java.util.Properties |
getProperties()
Get the properties currently known to the compileer.
|
java.lang.String |
getProperty(java.lang.String name)
Get the value of a property currerntly known to izpack.
|
java.util.Properties |
getVariables()
Get the packager variables.
|
static void |
main(java.lang.String[] args)
The main method if the compiler is invoked by a command-line call.
|
void |
parseError(java.lang.String message)
Create parse error with consistent messages.
|
void |
parseError(java.lang.String message,
java.lang.Throwable how) |
java.lang.String |
replaceProperties(java.lang.String value) |
void |
run()
The run() method.
|
void |
setGUIPrefs(GUIPrefs prefs) |
void |
setInfo(Info info) |
static void |
setIzpackHome(java.lang.String izHome)
Set the IzPack home directory
|
void |
setPackagerListener(PackagerListener listener)
Sets the packager listener.
|
boolean |
setProperty(java.lang.String name,
java.lang.String value)
Add a name value pair to the project property set.
|
boolean |
wasSuccessful() |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public static final java.lang.String IZPACK_VERSION
public static java.lang.String IZPACK_HOME
protected java.lang.String basedir
protected java.lang.String kind
protected java.lang.String output
private Packager packager
private boolean compileFailed
private java.util.Properties properties
private VariableSubstitutor propertySubstitutor
public Compiler(java.lang.String basedir, java.lang.String kind, java.lang.String output) throws CompilerException
basedir
- The base directory.kind
- The installer kind.output
- The installer filename.CompilerException
public Compiler(java.lang.String basedir, java.lang.String kind, java.lang.String output, java.lang.String compr_format) throws CompilerException
basedir
- The base directory.kind
- The installer kind.output
- The installer filename.compr_format
- The format which should be used for the packs.CompilerException
public Compiler(java.lang.String basedir, java.lang.String kind, java.lang.String output, java.lang.String compr_format, int compr_level) throws CompilerException
basedir
- The base directory.kind
- The installer kind.output
- The installer filename.compr_format
- The format which should be used for the packs.compr_level
- Compression level to be used if supported.CompilerException
public static void setIzpackHome(java.lang.String izHome)
izHome
- - the izpack home directorypublic PackagerListener getPackagerListener()
public void setPackagerListener(PackagerListener listener)
listener
- The listener.public java.lang.String getKind()
public java.util.Properties getVariables()
public void compile()
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void createInstaller() throws java.lang.Exception
java.lang.Exception
- Description of the Exceptionpublic boolean wasSuccessful()
public java.lang.String replaceProperties(java.lang.String value) throws CompilerException
CompilerException
public void setGUIPrefs(GUIPrefs prefs)
public void setInfo(Info info) throws java.lang.Exception
java.lang.Exception
public Packager getPackager()
public java.util.Properties getProperties()
public java.lang.String getProperty(java.lang.String name)
name
- the name of the propertypublic boolean setProperty(java.lang.String name, java.lang.String value)
name
- the name of the propertyvalue
- the value to setpublic boolean addProperty(java.lang.String name, java.lang.String value)
name
- the name of the propertyvalue
- the value to setpublic void addJarContent(java.net.URL content)
content
- public void addJarContent(java.net.URL content, java.util.List files)
content
- public void addCustomJar(CustomData ca, java.net.URL url)
ca
- url
- public void addLangPack(java.lang.String iso3, java.net.URL iso3xmlURL, java.net.URL iso3FlagURL)
iso3
- iso3xmlURL
- iso3FlagURL
- public void addNativeLibrary(java.lang.String name, java.net.URL url) throws java.lang.Exception
name
- url
- java.lang.Exception
public void addNativeUninstallerLibrary(CustomData data)
data
- public void addPack(PackInfo pack)
pack
- public void addPanelJar(Panel panel, java.net.URL url)
panel
- url
- public void addResource(java.lang.String name, java.net.URL url)
name
- url
- public void checkDependencies() throws CompilerException
CompilerException
public void checkDependencies(java.util.List packs) throws CompilerException
packs
- - ListCompilerException
private int dfs(java.util.List packs, java.util.Map names)
packs
- The graphnames
- The name mapprivate int checkBackEdges(java.util.Map edges)
private int dfsVisit(PackInfo u, java.util.Map names, java.util.Map edges)
protected void addRecursively(java.io.File file, java.lang.String targetdir, java.util.List osList, int override, PackInfo pack, java.util.Map additionals) throws java.io.IOException
file
- The file to add.targetdir
- The relative path to the parent.osList
- The target OS constraints.override
- Overriding behaviour.pack
- Pack to be packed intoadditionals
- Map which contains additional dataFileNotFoundException
- if the file does not existjava.io.IOException
public java.net.URL findIzPackResource(java.lang.String path, java.lang.String desc) throws CompilerException
path
- the relative path (using '/' as separator) to the resource.desc
- the description of the resource used to report errorsCompilerException
public void parseError(java.lang.String message) throws CompilerException
message
- Brief message explaining errorCompilerException
public void parseError(java.lang.String message, java.lang.Throwable how) throws CompilerException
CompilerException
public static void main(java.lang.String[] args)
args
- The arguments passed on the command-line.public void addCustomListener(int type, java.lang.String className, java.lang.String jarPath, java.util.List constraints) throws java.lang.Exception
type
- The listener type.className
- The class name.jarPath
- The jar path.constraints
- The list of constraints.java.lang.Exception
- Thrown in case an error occurs.private java.util.List getContainedFilePaths(java.net.URL url) throws java.lang.Exception
url
- url of the jar filejava.lang.Exception
private java.lang.String getFullClassName(java.net.URL url, java.lang.String className) throws java.lang.Exception
url
- url of the jar file which contains the classclassName
- short name of the class for which the full name should be resolvedjava.lang.Exception