public class CompilerConfig extends Thread
Modifier and Type | Class and Description |
---|---|
private class |
CompilerConfig.Edge
This class is used for the classification of the edges
|
Thread.State, Thread.UncaughtExceptionHandler
Modifier and Type | Field and Description |
---|---|
protected String |
basedir
The base directory.
|
private Compiler |
compiler
The installer packager compiler
|
protected List |
compilerListeners
List of CompilerListeners which should be called at packaging
|
private String |
filename
The xml install file
|
private String |
installText
The xml install configuration text
|
private static boolean |
NO
Constant for checking attributes.
|
static String |
STANDARD
Standard installer.
|
static String |
VERSION
The compiler version.
|
static String |
WEB
Web installer.
|
private static boolean |
YES
Constant for checking attributes.
|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
CompilerConfig(String basedir,
String kind,
String output,
PackagerListener listener,
String installText) |
CompilerConfig(String filename,
String basedir,
String kind,
String output)
The constructor.
|
CompilerConfig(String filename,
String basedir,
String kind,
String output,
PackagerListener listener)
The constructor.
|
CompilerConfig(String filename,
String basedir,
String kind,
String output,
String compr_format,
int compr_level,
PackagerListener listener,
String installText) |
CompilerConfig(String filename,
String base,
String kind,
String output,
String compr_format,
PackagerListener listener) |
CompilerConfig(String filename,
String basedir,
String kind,
String output,
String compr_format,
PackagerListener listener,
String installText) |
Modifier and Type | Method and Description |
---|---|
private void |
addCompilerListener(CompilerListener pe)
Add a CompilerListener.
|
private void |
addCustomListeners(net.n3.nanoxml.XMLElement data)
This method parses install.xml for defined listeners and put them in the right position.
|
protected void |
addGUIPrefs(net.n3.nanoxml.XMLElement data)
Returns the GUIPrefs.
|
protected void |
addInfo(net.n3.nanoxml.XMLElement data)
Builds the Info class from the XML tree.
|
protected void |
addJars(net.n3.nanoxml.XMLElement data)
Add project specific external jar files to the installer.
|
protected void |
addLangpacks(net.n3.nanoxml.XMLElement data)
Adds the ISO3 codes of the langpacks and associated resources.
|
protected void |
addNativeLibraries(net.n3.nanoxml.XMLElement data)
Add native libraries to the installer.
|
protected void |
addPacks(net.n3.nanoxml.XMLElement data)
Add packs and their contents to the installer.
|
protected void |
addPanels(net.n3.nanoxml.XMLElement data)
Parse panels and their paramters, locate the panels resources and add to the Packager.
|
boolean |
addProperty(String name,
String value)
Add a name value pair to the project property set.
|
protected void |
addRecursively(File file,
String targetdir,
List osList,
int override,
PackInfo pack,
Map additionals)
Recursive method to add files in a pack.
|
protected void |
addResources(net.n3.nanoxml.XMLElement data)
Adds the resources.
|
protected void |
addVariables(net.n3.nanoxml.XMLElement data)
Variable declaration is a fragment of the xml file.
|
private int |
checkBackEdges(Map edges)
This function checks for the existence of back edges.
|
void |
checkDependencies(List packs)
Checks whether the dependencies stated in the configuration file are correct.
|
void |
compile()
Compile the installation
|
private int |
dfs(List packs,
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,
Map names,
Map edges) |
void |
executeCompiler()
Compiles the installation.
|
private URL |
findIzPackResource(String path,
String desc,
net.n3.nanoxml.XMLElement parent)
Look for an IzPack resource either in the compiler jar, or within IZPACK_HOME.
|
private URL |
findProjectResource(String path,
String desc,
net.n3.nanoxml.XMLElement parent)
Look for a project specified resources, which, if not absolute, are sought relative to the
projects basedir.
|
private Map |
getAdditionals(net.n3.nanoxml.XMLElement f)
Calls the reviseAdditionalDataMap method of all registered CompilerListener's.
|
Compiler |
getCompiler()
Access the install compiler
|
private Object[] |
getCompilerListenerInstance(net.n3.nanoxml.XMLElement var)
Returns the compiler listener which is defined in the xml element.
|
private List |
getContainedFilePaths(URL url)
Returns a list which contains the pathes of all files which are included in the given url.
|
private String |
getFullClassName(URL url,
String className)
Returns the qualified class name for the given class.
|
protected int |
getOverrideValue(net.n3.nanoxml.XMLElement f) |
PackagerListener |
getPackagerListener()
Retrieves the packager listener
|
protected net.n3.nanoxml.XMLElement |
getXMLTree()
Returns the XMLElement representing the installation XML file.
|
static void |
main(String[] args)
The main method if the compiler is invoked by a command-line call.
|
private void |
notifyCompilerListener(String callerName,
int state,
net.n3.nanoxml.XMLElement data)
Calls all defined compile listeners notify method with the given data
|
protected void |
parseError(String message)
Create parse error with consistent messages.
|
protected void |
parseError(net.n3.nanoxml.XMLElement parent,
String message)
Create parse error with consistent messages.
|
protected void |
parseError(net.n3.nanoxml.XMLElement parent,
String message,
Throwable cause)
Create a chained parse error with consistent messages.
|
protected void |
parseWarn(net.n3.nanoxml.XMLElement parent,
String message)
Create a parse warning with consistent messages.
|
protected String |
requireAttribute(net.n3.nanoxml.XMLElement element,
String attribute)
Call getAttribute on an element, producing a meaningful error message if not present, or
empty.
|
protected net.n3.nanoxml.XMLElement |
requireChildNamed(net.n3.nanoxml.XMLElement parent,
String name)
Call getFirstChildNamed on the parent, producing a meaningful error message on failure.
|
protected String |
requireContent(net.n3.nanoxml.XMLElement element)
Call getContent on an element, producing a meaningful error message if not present, or empty.
|
protected int |
requireIntAttribute(net.n3.nanoxml.XMLElement element,
String attribute)
Get a required attribute of an element, ensuring it is an integer.
|
protected URL |
requireURLContent(net.n3.nanoxml.XMLElement element)
Call getContent on an element, producing a meaningful error message if not present, or empty,
or a valid URL.
|
protected boolean |
requireYesNoAttribute(net.n3.nanoxml.XMLElement element,
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.
|
static void |
setIzpackHome(String izHome)
Set the IzPack home directory
|
protected void |
substituteAllProperties(net.n3.nanoxml.XMLElement element)
Perform recursive substitution on all properties
|
protected void |
substituteProperties(net.n3.nanoxml.XMLElement data)
Properties declaration is a fragment of the xml file.
|
protected boolean |
validateYesNoAttribute(net.n3.nanoxml.XMLElement element,
String attribute,
boolean defaultValue)
Call getAttribute on an element, producing a meaningful warning if not "yes" or "no".
|
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 String VERSION
public static final String STANDARD
public static final String WEB
private static boolean YES
private static boolean NO
private String installText
protected List compilerListeners
public CompilerConfig(String filename, String basedir, String kind, String output) throws CompilerException
filename
- The XML filename.basedir
- The base directory.kind
- The installer kind.output
- The installer filename.CompilerException
public CompilerConfig(String filename, String basedir, String kind, String output, PackagerListener listener) throws CompilerException
filename
- The XML filename.basedir
- The base directory.kind
- The installer kind.output
- The installer filename.listener
- The PackagerListener.CompilerException
public CompilerConfig(String filename, String base, String kind, String output, String compr_format, PackagerListener listener) throws CompilerException
filename
- The XML filename.kind
- The installer kind.output
- The installer filename.compr_format
- The compression format to be used for packs.listener
- The PackagerListener.CompilerException
public CompilerConfig(String basedir, String kind, String output, PackagerListener listener, String installText) throws CompilerException
basedir
- The base directory.kind
- The installer kind.output
- The installer filename.listener
- The PackagerListener.installText
- The install xml configuration textCompilerException
public CompilerConfig(String filename, String basedir, String kind, String output, String compr_format, PackagerListener listener, String installText) throws CompilerException
filename
- The XML filename.basedir
- The base directory.kind
- The installer kind.output
- The installer filename.compr_format
- The compression format to be used for packs.listener
- The PackagerListener.installText
- The install xml configuration textCompilerException
public CompilerConfig(String filename, String basedir, String kind, String output, String compr_format, int compr_level, PackagerListener listener, String installText) throws CompilerException
filename
- The XML filename.basedir
- The base directory.kind
- The installer kind.output
- The installer filename.compr_format
- The compression format to be used for packs.compr_level
- Compression level to be used if supported.listener
- The PackagerListener.installText
- The install xml configuration textCompilerException
public static void setIzpackHome(String izHome)
izHome
- - the izpack home directorypublic boolean addProperty(String name, String value)
name
- the name of the propertyvalue
- the value to setpublic Compiler getCompiler()
public PackagerListener getPackagerListener()
public void compile()
public void run()
public void executeCompiler() throws Exception
Exception
- Description of the Exceptionpublic boolean wasSuccessful()
protected void addGUIPrefs(net.n3.nanoxml.XMLElement data) throws CompilerException
data
- The XML data.CompilerException
- Description of the Exceptionprotected void addJars(net.n3.nanoxml.XMLElement data) throws Exception
data
- The XML data.Exception
protected void addNativeLibraries(net.n3.nanoxml.XMLElement data) throws Exception
data
- The XML data.Exception
protected void addPacks(net.n3.nanoxml.XMLElement data) throws CompilerException
data
- The XML data.CompilerException
public void checkDependencies(List packs) throws CompilerException
CompilerException
private int dfs(List packs, Map names)
packs
- The graphnames
- The name mapprivate int checkBackEdges(Map edges)
protected void addRecursively(File file, String targetdir, List osList, int override, PackInfo pack, Map additionals) throws 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 existIOException
protected void addPanels(net.n3.nanoxml.XMLElement data) throws CompilerException
data
- The XML data.CompilerException
- Description of the Exceptionprotected void addResources(net.n3.nanoxml.XMLElement data) throws CompilerException
data
- The XML data.CompilerException
- Description of the Exceptionprotected void addLangpacks(net.n3.nanoxml.XMLElement data) throws CompilerException
data
- The XML data.CompilerException
- Description of the Exceptionprotected void addInfo(net.n3.nanoxml.XMLElement data) throws Exception
data
- The XML data. return The Info.Exception
- Description of the Exceptionprotected void addVariables(net.n3.nanoxml.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 Exceptionprotected void substituteProperties(net.n3.nanoxml.XMLElement data) throws CompilerException
<properties> <property name="app.name" value="Property Laden Installer"/> <!-- Ant styles 'location' and 'refid' are not yet supported --> <property file="filename-relative-to-install?"/> <property file="filename-relative-to-install?" prefix="prefix"/> <!-- Ant style 'url' and 'resource' are not yet supported --> <property environment="prefix"/> </properties>variable declared in this can be referred to in parsable files.
data
- The XML data.CompilerException
- Description of the Exceptionprotected void substituteAllProperties(net.n3.nanoxml.XMLElement element) throws CompilerException
CompilerException
protected net.n3.nanoxml.XMLElement getXMLTree() throws CompilerException, IOException
CompilerException
- For problems with the installation fileIOException
- for errors reading the installation fileprotected int getOverrideValue(net.n3.nanoxml.XMLElement f) throws CompilerException
CompilerException
private URL findProjectResource(String path, String desc, net.n3.nanoxml.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 errorsCompilerException
private URL findIzPackResource(String path, String desc, net.n3.nanoxml.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 errorsCompilerException
protected void parseError(String message) throws CompilerException
message
- Brief message explaining errorCompilerException
protected void parseError(net.n3.nanoxml.XMLElement parent, String message) throws CompilerException
parent
- The element in which the error occuredmessage
- Brief message explaining errorCompilerException
protected void parseError(net.n3.nanoxml.XMLElement parent, String message, Throwable cause) throws CompilerException
parent
- The element in which the error occuredmessage
- Brief message explaining errorCompilerException
protected void parseWarn(net.n3.nanoxml.XMLElement parent, String message)
parent
- The element in which the warning occuredmessage
- Warning messageprotected net.n3.nanoxml.XMLElement requireChildNamed(net.n3.nanoxml.XMLElement parent, String name) throws CompilerException
parent
- The element to search for a childname
- Name of the child element to getCompilerException
protected URL requireURLContent(net.n3.nanoxml.XMLElement element) throws CompilerException
element
- The element to get content ofCompilerException
protected String requireContent(net.n3.nanoxml.XMLElement element) throws CompilerException
element
- The element to get content ofCompilerException
protected String requireAttribute(net.n3.nanoxml.XMLElement element, String attribute) throws CompilerException
element
- The element to get the attribute value ofattribute
- The name of the attribute to getCompilerException
protected int requireIntAttribute(net.n3.nanoxml.XMLElement element, String attribute) throws CompilerException
element
- The element to get the attribute value ofattribute
- The name of the attribute to getCompilerException
protected boolean requireYesNoAttribute(net.n3.nanoxml.XMLElement element, String attribute) throws CompilerException
element
- The element to get the attribute value ofattribute
- The name of the attribute to getCompilerException
protected boolean validateYesNoAttribute(net.n3.nanoxml.XMLElement element, 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(String[] args)
args
- The arguments passed on the command-line.private void addCustomListeners(net.n3.nanoxml.XMLElement data) throws Exception
data
- the XML dataException
- Description of the Exceptionprivate List getContainedFilePaths(URL url) throws Exception
url
- url of the jar fileException
private String getFullClassName(URL url, String className) throws Exception
url
- url of the jar file which contains the classclassName
- short name of the class for which the full name should be resolvedException
private Object[] getCompilerListenerInstance(net.n3.nanoxml.XMLElement var) throws Exception
var
- the xml element of the "listener" nodeException
private void addCompilerListener(CompilerListener pe)
pe
- CompilerListener which should be addedprivate void notifyCompilerListener(String callerName, int state, net.n3.nanoxml.XMLElement data) throws CompilerException
callerName
- name of the calling method as stringstate
- CompileListener.BEGIN or ENDdata
- current install dataCompilerException
private Map getAdditionals(net.n3.nanoxml.XMLElement f) throws CompilerException
f
- file releated XML nodeCompilerException
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses