|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
com.izforge.izpack.compiler.Compiler
public class Compiler
The IzPack compiler class. This is now a java bean style class that can be configured using the object representations of the install.xml configuration. The install.xml configuration is now handled by the CompilerConfig class.
CompilerConfig
Nested Class Summary | |
---|---|
(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 |
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
protected java.lang.String |
basedir
The base directory. |
private boolean |
compileFailed
Error code, set to true if compilation succeeded. |
private java.lang.String |
compr_format
|
private int |
compr_level
|
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 IPackager |
packager
Collects and packs files into installation jars, as told. |
private PackagerListener |
packagerlistener
|
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 |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
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<OsConstraint> constraints)
This method parses install.xml for defined listeners and put them in the right position. |
void |
addInstallerRequirement(java.util.List<InstallerRequirement> conditions)
|
void |
addJarContent(java.net.URL content)
Add jar content to the installation. |
void |
addJarContent(java.net.URL content,
java.util.List<java.lang.String> files)
Adds a jar file content to the installer. |
void |
addLangPack(java.lang.String locale,
java.net.URL localeURL,
java.net.URL flagURL)
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. |
void |
addResource(java.lang.String name,
java.net.URL url)
Add a resource to the installation. |
private int |
checkBackEdges(java.util.Map<Compiler.Edge,java.lang.Integer> 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<PackInfo> packs)
Checks whether the dependencies among the given Packs. |
void |
checkExcludes()
Checks whether the excluded packs exist. |
void |
checkExcludes(java.util.List<PackInfo> packs)
This checks if there are more than one preselected packs per excludeGroup. |
void |
compile()
Compiles. |
void |
createInstaller()
Compiles the installation. |
private int |
dfs(java.util.List<PackInfo> packs,
java.util.Map<java.lang.String,PackInfo> 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<java.lang.String,PackInfo> names,
java.util.Map<Compiler.Edge,java.lang.Integer> 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. |
java.util.Map<java.lang.String,Condition> |
getConditions()
|
private java.util.List<java.lang.String> |
getContainedFilePaths(java.net.URL url)
Returns a list which contains the pathes of all files which are included in the given url. |
java.util.Map<java.lang.String,java.util.List<DynamicVariable>> |
getDynamicVariables()
|
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. |
IPackager |
getPackager()
Returns the install packager. |
PackagerListener |
getPackagerListener()
Returns the packager listener. |
java.util.Properties |
getProperties()
Returns 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. |
void |
initPackager(java.lang.String classname)
Initializes the given packager class |
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)
Create parse error with consistent messages. |
java.lang.String |
replaceProperties(java.lang.String value)
Replaces placeholder in the given string with the associated strings. |
void |
run()
The run() method. |
void |
setConditions(java.util.Map<java.lang.String,Condition> conditions)
|
void |
setDynamicVariables(java.util.Map<java.lang.String,java.util.List<DynamicVariable>> dynamicvariables)
|
void |
setGUIPrefs(GUIPrefs prefs)
Sets GUI preferences to the packager. |
void |
setInfo(Info info)
Sets an Info object to the packager. |
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()
Returns whether the installation was successful or not. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, 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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
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 IPackager packager
private boolean compileFailed
private java.util.Properties properties
private VariableSubstitutor propertySubstitutor
private java.lang.String compr_format
private int compr_level
private PackagerListener packagerlistener
Constructor Detail |
---|
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
Method Detail |
---|
public static void setIzpackHome(java.lang.String izHome)
izHome
- - the izpack home directorypublic void initPackager(java.lang.String classname) throws CompilerException
classname
-
CompilerException
public 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)
value
- to be substituted
public void setGUIPrefs(GUIPrefs prefs)
prefs
- preferences to be setpublic void setInfo(Info info) throws java.lang.Exception
info
- Info object to be set
java.lang.Exception
public IPackager getPackager()
public java.util.Properties getProperties()
public java.lang.String getProperty(java.lang.String name)
name
- the name of the property
public boolean setProperty(java.lang.String name, java.lang.String value)
name
- the name of the propertyvalue
- the value to set
public boolean addProperty(java.lang.String name, java.lang.String value)
name
- the name of the propertyvalue
- the value to set
public void addJarContent(java.net.URL content)
content
- public void addJarContent(java.net.URL content, java.util.List<java.lang.String> files)
content
- The url of the jar to add to the installer. We use a URL so the jar may be
nested within another.files
- to be copiedpublic void addCustomJar(CustomData ca, java.net.URL url)
ca
- url
- public void addInstallerRequirement(java.util.List<InstallerRequirement> conditions)
public void addLangPack(java.lang.String locale, java.net.URL localeURL, java.net.URL flagURL)
locale
- localeURL
- flagURL
- 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 checkExcludes() throws CompilerException
CompilerException
public void checkExcludes(java.util.List<PackInfo> packs) throws CompilerException
packs
- list of packs which should be checked
CompilerException
public void checkDependencies(java.util.List<PackInfo> packs) throws CompilerException
packs
- - ListCompilerException
private int dfs(java.util.List<PackInfo> packs, java.util.Map<java.lang.String,PackInfo> names)
packs
- The graphnames
- The name map
private int checkBackEdges(java.util.Map<Compiler.Edge,java.lang.Integer> edges)
edges
- map to be checked
private int dfsVisit(PackInfo u, java.util.Map<java.lang.String,PackInfo> names, java.util.Map<Compiler.Edge,java.lang.Integer> edges)
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 errors
CompilerException
public void parseError(java.lang.String message) throws CompilerException
message
- Brief message explaining error
CompilerException
public void parseError(java.lang.String message, java.lang.Throwable how) throws CompilerException
message
- Brief message explaining errorhow
- throwable which was catched
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<OsConstraint> 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<java.lang.String> getContainedFilePaths(java.net.URL url) throws java.lang.Exception
url
- url of the jar file
java.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 resolved
java.lang.Exception
public java.util.Map<java.lang.String,Condition> getConditions()
public void setConditions(java.util.Map<java.lang.String,Condition> conditions)
conditions
- the conditions to setpublic java.util.Map<java.lang.String,java.util.List<DynamicVariable>> getDynamicVariables()
public void setDynamicVariables(java.util.Map<java.lang.String,java.util.List<DynamicVariable>> dynamicvariables)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |