|
||||||||||
| 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
The IzPack compiler class.
| 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 |
| Field Summary | |
protected java.lang.String |
basedir
The base directory. |
private boolean |
compileFailed
Error code, set to true if compilation succeeded. |
protected java.util.List |
compilerListeners
List of CompilerListeners which should be called at packaging |
protected java.lang.String |
filename
The XML filename. |
private static java.io.File |
home
The IzPack home directory specified or found on startup. |
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. |
private static boolean |
NO
Constant for checking attributes. |
protected java.lang.String |
output
The output jar filename. |
private Packager |
packager
Collects and packs files into installation jars, as told. |
protected PackagerListener |
packagerListener
The packager listener. |
static java.lang.String |
STANDARD
Standard installer. |
static java.lang.String |
VERSION
The compiler version. |
static java.lang.String |
WEB
Web installer. |
private static boolean |
YES
Constant for checking attributes. |
| 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 | |
private void |
addCompilerListener(CompilerListener pe)
Add a CompilerListener. |
private void |
addCustomListeners(XMLElement data)
This method parses install.xml for defined listeners and put they to the right position. |
protected void |
addGUIPrefs(XMLElement data)
Returns the GUIPrefs. |
protected void |
addInfo(XMLElement data)
Builds the Info class from the XML tree. |
protected void |
addJars(XMLElement data)
Add project specific external jar files to the installer. |
protected void |
addLangpacks(XMLElement data)
Adds the ISO3 codes of the langpacks and associated resources. |
protected void |
addNativeLibraries(XMLElement data)
Add native libraries to the installer. |
protected void |
addPacks(XMLElement data)
Add packs and their contents to the installer. |
protected void |
addPanels(XMLElement data)
Parse panels and their paramters, locate the panels resources and add to the Packager. |
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. |
protected void |
addResources(XMLElement data)
Adds the resources. |
protected void |
addVariables(XMLElement data)
Variable declaration is a fragment of the xml file. |
private int |
checkBackEdges(java.util.Map edges)
This function checks for the existence of back edges. |
void |
checkDependencies(java.util.List packs)
Checks whether the dependencies stated in the configuration file are correct. |
void |
compile()
Compiles. |
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)
|
void |
executeCompiler()
Compiles the installation. |
private java.net.URL |
findIzPackResource(java.lang.String path,
java.lang.String desc,
XMLElement parent)
Look for an IzPack resource either in the compiler jar, or within IZPACK_HOME. |
private java.net.URL |
findProjectResource(java.lang.String path,
java.lang.String desc,
XMLElement parent)
Look for a project specified resources, which, if not absolute, are sought relative to the projects basedir. |
private java.util.Map |
getAdditionals(XMLElement f)
Calls the reviseAdditionalDataMap method of all registered CompilerListener's. |
private java.lang.Object[] |
getCompilerListenerInstance(XMLElement var)
Returns the compiler listener which is defined in the xml element. |
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. |
protected int |
getOverrideValue(XMLElement f)
|
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. |
private void |
notifyCompilerListener(java.lang.String callerName,
int state,
XMLElement data)
Calls all defined compile listeners notify method with the given data |
protected void |
parseError(java.lang.String message)
Create parse error with consistent messages. |
protected void |
parseError(XMLElement parent,
java.lang.String message)
Create parse error with consistent messages. |
protected void |
parseError(XMLElement parent,
java.lang.String message,
java.lang.Throwable cause)
Create a chained parse error with consistent messages. |
protected void |
parseWarn(XMLElement parent,
java.lang.String message)
Create a parse warning with consistent messages. |
protected java.lang.String |
requireAttribute(XMLElement element,
java.lang.String attribute)
Call getAttribute on an element, producing a meaningful error message if not present, or empty. |
protected XMLElement |
requireChildNamed(XMLElement parent,
java.lang.String name)
Call getFirstChildNamed on the parent, producing a meaningful error message on failure. |
protected java.lang.String |
requireContent(XMLElement element)
Call getContent on an element, producing a meaningful error message if not present, or empty. |
protected int |
requireIntAttribute(XMLElement element,
java.lang.String attribute)
Get a required attribute of an element, ensuring it is an integer. |
protected java.net.URL |
requireURLContent(XMLElement element)
Call getContent on an element, producing a meaningful error message if not present, or empty, or a valid URL. |
protected boolean |
requireYesNoAttribute(XMLElement element,
java.lang.String attribute)
Call getAttribute on an element, producing a meaningful error message if not present, or one of "yes" or "no". |
void |
run()
The run() method. |
void |
setPackagerListener(PackagerListener listener)
Sets the packager listener. |
protected boolean |
validateYesNoAttribute(XMLElement element,
java.lang.String attribute,
boolean defaultValue)
Call getAttribute on an element, producing a meaningful warning if not "yes" or "no". |
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 |
public static final java.lang.String VERSION
public static final java.lang.String IZPACK_VERSION
public static final java.lang.String STANDARD
public static final java.lang.String WEB
public static java.lang.String IZPACK_HOME
private static boolean YES
private static boolean NO
private static java.io.File home
protected java.lang.String filename
protected java.lang.String basedir
protected java.lang.String kind
protected java.lang.String output
protected PackagerListener packagerListener
protected java.util.List compilerListeners
private Packager packager
private boolean compileFailed
| Constructor Detail |
public Compiler(java.lang.String filename,
java.lang.String basedir,
java.lang.String kind,
java.lang.String output)
filename - The XML filename.basedir - The base directory.kind - The installer kind.output - The installer filename.| Method Detail |
public void setPackagerListener(PackagerListener listener)
listener - The listener.public void compile()
public void run()
public void executeCompiler()
throws java.lang.Exception
java.lang.Exception - Description of the Exceptionpublic boolean wasSuccessful()
protected void addGUIPrefs(XMLElement data)
throws CompilerException
data - The XML data.
return The GUIPrefs.
CompilerException - Description of the Exception
protected void addJars(XMLElement data)
throws java.lang.Exception
data - The XML data.
java.lang.Exception
protected void addNativeLibraries(XMLElement data)
throws java.lang.Exception
data - The XML data.
java.lang.Exception
protected void addPacks(XMLElement data)
throws CompilerException
data - The XML data.
CompilerException
public void checkDependencies(java.util.List packs)
throws CompilerException
CompilerException
private int dfs(java.util.List packs,
java.util.Map names)
packs - The graphnames - The name map
private 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 data
java.io.FileNotFoundException - if the file does not exist
java.io.IOException
protected void addPanels(XMLElement data)
throws CompilerException
data - The XML data.
CompilerException - Description of the Exception
protected void addResources(XMLElement data)
throws CompilerException
data - The XML data.
CompilerException - Description of the Exception
protected void addLangpacks(XMLElement data)
throws CompilerException
data - The XML data.
CompilerException - Description of the Exception
protected void addInfo(XMLElement data)
throws java.lang.Exception
data - The XML data.
return The Info.
java.lang.Exception - Description of the Exception
protected void addVariables(XMLElement data)
throws CompilerException
<variables>
<variable name="nom" value="value"/>
<variable name="foo" value="pippo"/>
</variables>
variable declared in this can be referred to in parsable files.
data - The XML data.
CompilerException - Description of the Exception
protected XMLElement getXMLTree()
throws CompilerException,
java.io.IOException
CompilerException - For problems with the installation file
java.io.IOException - for errors reading the installation file
protected int getOverrideValue(XMLElement f)
throws CompilerException
CompilerException
private java.net.URL findProjectResource(java.lang.String path,
java.lang.String desc,
XMLElement parent)
throws CompilerException
path - the relative path (using '/' as separator) to the resource.desc - the description of the resource used to report errorsparent - the XMLElement the resource is specified in, used to
report errors
CompilerException
private java.net.URL findIzPackResource(java.lang.String path,
java.lang.String desc,
XMLElement parent)
throws CompilerException
path - the relative path (using '/' as separator) to the resource.desc - the description of the resource used to report errorsparent - the XMLElement the resource is specified in, used to
report errors
CompilerException
protected void parseError(java.lang.String message)
throws CompilerException
message - Brief message explaining error
CompilerException
protected void parseError(XMLElement parent,
java.lang.String message)
throws CompilerException
parent - The element in which the error occuredmessage - Brief message explaining error
CompilerException
protected void parseError(XMLElement parent,
java.lang.String message,
java.lang.Throwable cause)
throws CompilerException
parent - The element in which the error occuredmessage - Brief message explaining error
CompilerException
protected void parseWarn(XMLElement parent,
java.lang.String message)
parent - The element in which the warning occuredmessage - Warning message
protected XMLElement requireChildNamed(XMLElement parent,
java.lang.String name)
throws CompilerException
parent - The element to search for a childname - Name of the child element to get
CompilerException
protected java.net.URL requireURLContent(XMLElement element)
throws CompilerException
element - The element to get content of
CompilerException
protected java.lang.String requireContent(XMLElement element)
throws CompilerException
element - The element to get content of
CompilerException
protected java.lang.String requireAttribute(XMLElement element,
java.lang.String attribute)
throws CompilerException
element - The element to get the attribute value ofattribute - The name of the attribute to get
CompilerException
protected int requireIntAttribute(XMLElement element,
java.lang.String attribute)
throws CompilerException
element - The element to get the attribute value ofattribute - The name of the attribute to get
CompilerException
protected boolean requireYesNoAttribute(XMLElement element,
java.lang.String attribute)
throws CompilerException
element - The element to get the attribute value ofattribute - The name of the attribute to get
CompilerException
protected boolean validateYesNoAttribute(XMLElement element,
java.lang.String attribute,
boolean defaultValue)
element - The element to get the attribute value ofattribute - The name of the attribute to getdefaultValue - Value returned if attribute not present or invalidpublic static void main(java.lang.String[] args)
args - The arguments passed on the command-line.
private void addCustomListeners(XMLElement data)
throws java.lang.Exception
data - the XML data
java.lang.Exception - Description of the Exception
private java.util.List 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
private java.lang.Object[] getCompilerListenerInstance(XMLElement var)
throws java.lang.Exception
var - the xml element of the "listener" node
java.lang.Exceptionprivate void addCompilerListener(CompilerListener pe)
pe - CompilerListener which should be added
private void notifyCompilerListener(java.lang.String callerName,
int state,
XMLElement data)
throws CompilerException
callerName - name of the calling method as stringstate - CompileListener.BEGIN or ENDdata - current install data
CompilerException
private java.util.Map getAdditionals(XMLElement f)
throws CompilerException
f - file releated XML node
CompilerException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||