com.izforge.izpack.installer
Class Unpacker

java.lang.Object
  extended byjava.lang.Thread
      extended bycom.izforge.izpack.installer.Unpacker
All Implemented Interfaces:
java.lang.Runnable

public class Unpacker
extends java.lang.Thread

Unpacker class.

Author:
Julien Ponge, Johannes Lehtinen

Field Summary
private  java.io.File absolute_installpath
          The absolute path of the installation.
private  AbstractUIProgressHandler handler
          The installer listener.
private  AutomatedInstallData idata
          The installdata.
private static java.util.ArrayList instances
          The instances of the unpacker objects.
private static java.lang.String LANG_FILE_NAME
          The name of the XML file that specifies the panel langpack
private  LocaleDatabase langpack
          The packs locale database.
private  UninstallData udata
          The uninstallation data.
private  VariableSubstitutor vs
          The variables substitutor.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Unpacker(AutomatedInstallData idata, AbstractUIProgressHandler handler)
          The constructor.
 
Method Summary
private  boolean fileMatchesOnePattern(java.lang.String filename, java.util.ArrayList patterns)
           
private  java.util.List[] getCustomActions()
          Returns the defined custom actions split into types including a constructed type for the file related installer listeners.
private  java.io.InputStream getPackAsStream(int n)
          Returns a stream to a pack, location depending on if it's web based.
static java.util.ArrayList getRunningInstances()
          Returns the active unpacker instances.
private  void handleAdditionalUninstallData(UninstallData udata, java.util.List[] customData)
          Adds additional unistall data to the uninstall data object.
private  void informListeners(java.util.List[] customActions, int action, java.lang.Object firstParam, java.lang.Object secondParam, java.lang.Object thirdParam)
          Informs all listeners which would be informed at the given action type.
private  boolean mkDirsWithEnhancement(java.io.File dest, PackFile pf, java.util.List[] customActions)
          Creates the given directory recursive and calls the method "afterDir" of each listener with the current file object and the pack file object.
private  void performUpdateChecks(java.util.ArrayList updatechecks)
           
private  java.util.List preparePatterns(java.util.ArrayList list, org.apache.regexp.RECompiler recompiler)
           
private  void putUninstaller()
          Puts the uninstaller.
 void run()
          The run method.
 
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

idata

private AutomatedInstallData idata
The installdata.


handler

private AbstractUIProgressHandler handler
The installer listener.


udata

private UninstallData udata
The uninstallation data.


vs

private VariableSubstitutor vs
The variables substitutor.


instances

private static java.util.ArrayList instances
The instances of the unpacker objects.


absolute_installpath

private java.io.File absolute_installpath
The absolute path of the installation. (NOT the canonical!)


langpack

private LocaleDatabase langpack
The packs locale database.


LANG_FILE_NAME

private static final java.lang.String LANG_FILE_NAME
The name of the XML file that specifies the panel langpack

See Also:
Constant Field Values
Constructor Detail

Unpacker

public Unpacker(AutomatedInstallData idata,
                AbstractUIProgressHandler handler)
The constructor.

Parameters:
idata - The installation data.
handler - The installation progress handler.
Method Detail

getRunningInstances

public static java.util.ArrayList getRunningInstances()
Returns the active unpacker instances.

Returns:
The active unpacker instances.

run

public void run()
The run method.


performUpdateChecks

private void performUpdateChecks(java.util.ArrayList updatechecks)
Parameters:
updatechecks -

fileMatchesOnePattern

private boolean fileMatchesOnePattern(java.lang.String filename,
                                      java.util.ArrayList patterns)
Parameters:
filename -
patterns -
Returns:
true if the file matched one pattern, false if it did not

preparePatterns

private java.util.List preparePatterns(java.util.ArrayList list,
                                       org.apache.regexp.RECompiler recompiler)
Parameters:
list - A list of file name patterns (in ant fileset syntax)
recompiler - The regular expression compiler (used to speed up RE compiling).
Returns:
List of org.apache.regexp.RE

putUninstaller

private void putUninstaller()
                     throws java.lang.Exception
Puts the uninstaller.

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

getPackAsStream

private java.io.InputStream getPackAsStream(int n)
                                     throws java.lang.Exception
Returns a stream to a pack, location depending on if it's web based.

Parameters:
n - The pack number.
Returns:
The stream or null if it could not be found.
Throws:
java.lang.Exception - Description of the Exception

informListeners

private void informListeners(java.util.List[] customActions,
                             int action,
                             java.lang.Object firstParam,
                             java.lang.Object secondParam,
                             java.lang.Object thirdParam)
                      throws java.lang.Exception
Informs all listeners which would be informed at the given action type.

Parameters:
customActions - array of lists with the custom action objects
action - identifier for which callback should be called
firstParam - first parameter for the call
secondParam - second parameter for the call
thirdParam - third parameter for the call
Throws:
java.lang.Exception

getCustomActions

private java.util.List[] getCustomActions()
Returns the defined custom actions split into types including a constructed type for the file related installer listeners.

Returns:
array of lists of custom action data like listeners

handleAdditionalUninstallData

private void handleAdditionalUninstallData(UninstallData udata,
                                           java.util.List[] customData)
Adds additional unistall data to the uninstall data object.

Parameters:
udata - unistall data

mkDirsWithEnhancement

private boolean mkDirsWithEnhancement(java.io.File dest,
                                      PackFile pf,
                                      java.util.List[] customActions)
                               throws java.lang.Exception
Creates the given directory recursive and calls the method "afterDir" of each listener with the current file object and the pack file object. On error an exception is raised.

Parameters:
dest - the directory which should be created
pf - current pack file object
customActions - all defined custom actions
Returns:
false on error, true else
Throws:
java.lang.Exception