com.izforge.izpack.event
Class SimpleInstallerListener

java.lang.Object
  extended by com.izforge.izpack.event.SimpleInstallerListener
All Implemented Interfaces:
InstallerListener
Direct Known Subclasses:
AntActionInstallerListener, NativeInstallerListener, ProgressBarInstallerListener, SummaryLoggerInstallerListener

public class SimpleInstallerListener
extends java.lang.Object
implements InstallerListener

This class implements all methods of interface InstallerListener, but do not do anything. It can be used as base class to save implementation of unneeded methods.

Additional there are some common helper methods which are used from the base class SpecHelper.

Author:
Klaus Bartz

Field Summary
protected static boolean doInformProgressBar
           
private  AutomatedInstallData installdata
           
protected static java.lang.String LANG_FILE_NAME
          The name of the XML file that specifies the panel langpack
protected static LocaleDatabase langpack
          The packs locale database.
private static java.util.ArrayList progressBarCaller
           
private  SpecHelper specHelper
           
 
Fields inherited from interface com.izforge.izpack.event.InstallerListener
AFTER_DIR, AFTER_FILE, AFTER_PACK, AFTER_PACKS, BEFORE_DIR, BEFORE_FILE, BEFORE_PACK, BEFORE_PACKS
 
Constructor Summary
SimpleInstallerListener()
          The default constructor.
SimpleInstallerListener(boolean useSpecHelper)
          Constructs a simple installer listener.
 
Method Summary
 void afterDir(java.io.File dir, PackFile pf)
          This method will be called from the unpacker after one directory was created.
 void afterFile(java.io.File file, PackFile pf)
          This method will be called from the unpacker after one file was installed.
 void afterPack(Pack pack, java.lang.Integer i, AbstractUIProgressHandler handler)
          This method will be called from the unpacker after the installation of one pack was performed.
 void afterPacks(AutomatedInstallData idata, AbstractUIProgressHandler handler)
          This method will be called from the unpacker after the installation of all packs was performed.
 void beforeDir(java.io.File dir, PackFile pf)
          This method will be called from the unpacker before one directory should be created.
 void beforeFile(java.io.File file, PackFile pf)
          This method will be called from the unpacker before one file should be installed.
 void beforePack(Pack pack, java.lang.Integer i, AbstractUIProgressHandler handler)
          This method will be called from the unpacker before the installation of one pack will be performed.
 void beforePacks(AutomatedInstallData idata, java.lang.Integer npacks, AbstractUIProgressHandler handler)
          This method will be called from the unpacker before the installation of all packs will be performed.
 AutomatedInstallData getInstalldata()
          Returns the current installdata object.
protected  java.lang.String getMsg(java.lang.String id)
          Returns the language dependant message from the resource CustomActionsLang.xml or the common language pack for the given id.
static int getProgressBarCallerCount()
          Returns the count of listeners which are registered as progress bar caller.
protected  int getProgressBarCallerId()
          Returns the progress bar caller id of this object.
 SpecHelper getSpecHelper()
          Returns current specification helper.
protected  boolean informProgressBar()
          Returns whether this object should inform the progress bar or not.
 boolean isFileListener()
          Returns true if this listener would be informed at every file and directory installation, else false.
 void setInstalldata(AutomatedInstallData data)
          Sets the installdata object.
protected  void setProgressBarCaller()
          Sets this object as progress bar caller.
 void setSpecHelper(SpecHelper helper)
          Sets the given specification helper to the current used helper.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

progressBarCaller

private static java.util.ArrayList progressBarCaller

LANG_FILE_NAME

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

See Also:
Constant Field Values

langpack

protected static LocaleDatabase langpack
The packs locale database.


doInformProgressBar

protected static boolean doInformProgressBar

installdata

private AutomatedInstallData installdata

specHelper

private SpecHelper specHelper
Constructor Detail

SimpleInstallerListener

public SimpleInstallerListener()
The default constructor.


SimpleInstallerListener

public SimpleInstallerListener(boolean useSpecHelper)
Constructs a simple installer listener. If useSpecHelper is true, a specification helper will be created.

Parameters:
useSpecHelper -
Method Detail

afterFile

public void afterFile(java.io.File file,
                      PackFile pf)
               throws java.lang.Exception
Description copied from interface: InstallerListener
This method will be called from the unpacker after one file was installed.

Specified by:
afterFile in interface InstallerListener
Parameters:
file - current File object of the just installed file
pf - corresponding PackFile object
Throws:
java.lang.Exception

afterDir

public void afterDir(java.io.File dir,
                     PackFile pf)
              throws java.lang.Exception
Description copied from interface: InstallerListener
This method will be called from the unpacker after one directory was created. If parent directories should be created, this method will be called for every directory beginning with the base.

Specified by:
afterDir in interface InstallerListener
Parameters:
dir - current File object of the just created directory
pf - corresponding PackFile object
Throws:
java.lang.Exception

afterPacks

public void afterPacks(AutomatedInstallData idata,
                       AbstractUIProgressHandler handler)
                throws java.lang.Exception
Description copied from interface: InstallerListener
This method will be called from the unpacker after the installation of all packs was performed.

Specified by:
afterPacks in interface InstallerListener
Parameters:
idata - object containing the current installation data
handler - a handler to the current used UIProgressHandler
Throws:
java.lang.Exception

afterPack

public void afterPack(Pack pack,
                      java.lang.Integer i,
                      AbstractUIProgressHandler handler)
               throws java.lang.Exception
Description copied from interface: InstallerListener
This method will be called from the unpacker after the installation of one pack was performed.

Specified by:
afterPack in interface InstallerListener
Parameters:
pack - current pack object
i - current pack number
handler - a handler to the current used UIProgressHandler
Throws:
java.lang.Exception

beforePacks

public void beforePacks(AutomatedInstallData idata,
                        java.lang.Integer npacks,
                        AbstractUIProgressHandler handler)
                 throws java.lang.Exception
Description copied from interface: InstallerListener
This method will be called from the unpacker before the installation of all packs will be performed.

Specified by:
beforePacks in interface InstallerListener
Parameters:
idata - object containing the current installation data
npacks - number of packs which are defined for this installation
handler - a handler to the current used UIProgressHandler
Throws:
java.lang.Exception

beforePack

public void beforePack(Pack pack,
                       java.lang.Integer i,
                       AbstractUIProgressHandler handler)
                throws java.lang.Exception
Description copied from interface: InstallerListener
This method will be called from the unpacker before the installation of one pack will be performed.

Specified by:
beforePack in interface InstallerListener
Parameters:
pack - current pack object
i - current pack number
handler - a handler to the current used UIProgressHandler
Throws:
java.lang.Exception

isFileListener

public boolean isFileListener()
Description copied from interface: InstallerListener
Returns true if this listener would be informed at every file and directory installation, else false. If it is true, the listener will be called two times (before and after) for every action. Handle carefully, else performance problems are possible.

Specified by:
isFileListener in interface InstallerListener
Returns:
true if this listener would be informed at every file and directory installation, else false

beforeFile

public void beforeFile(java.io.File file,
                       PackFile pf)
                throws java.lang.Exception
Description copied from interface: InstallerListener
This method will be called from the unpacker before one file should be installed.

Specified by:
beforeFile in interface InstallerListener
Parameters:
file - current File object of the file which should be installed
pf - corresponding PackFile object
Throws:
java.lang.Exception

beforeDir

public void beforeDir(java.io.File dir,
                      PackFile pf)
               throws java.lang.Exception
Description copied from interface: InstallerListener
This method will be called from the unpacker before one directory should be created. If parent directories should be created also, this method will be called for every directory beginning with the base.

Specified by:
beforeDir in interface InstallerListener
Parameters:
dir - current File object of the just directory which should be created
pf - corresponding PackFile object
Throws:
java.lang.Exception

getSpecHelper

public SpecHelper getSpecHelper()
Returns current specification helper.

Returns:
current specification helper

setSpecHelper

public void setSpecHelper(SpecHelper helper)
Sets the given specification helper to the current used helper.

Parameters:
helper - specification helper which should be used

getInstalldata

public AutomatedInstallData getInstalldata()
Returns the current installdata object.

Returns:
current installdata object

setInstalldata

public void setInstalldata(AutomatedInstallData data)
Sets the installdata object.

Parameters:
data - installdata object which should be set to current

getProgressBarCallerCount

public static int getProgressBarCallerCount()
Returns the count of listeners which are registered as progress bar caller.

Returns:
the count of listeners which are registered as progress bar caller

getProgressBarCallerId

protected int getProgressBarCallerId()
Returns the progress bar caller id of this object.

Returns:
the progress bar caller id of this object

setProgressBarCaller

protected void setProgressBarCaller()
Sets this object as progress bar caller.


informProgressBar

protected boolean informProgressBar()
Returns whether this object should inform the progress bar or not.

Returns:
whether this object should inform the progress bar or not

getMsg

protected java.lang.String getMsg(java.lang.String id)
Returns the language dependant message from the resource CustomActionsLang.xml or the common language pack for the given id. If no string will be found, the id returns.

Parameters:
id - string id for which the message should be resolved
Returns:
the related language dependant message