com.izforge.izpack.installer.event
Class InstallerListeners

java.lang.Object
  extended by com.izforge.izpack.installer.event.InstallerListeners

public class InstallerListeners
extends Object

A container for InstallerListeners that supports notifying each registered listener.

Author:
Tim Anderson

Constructor Summary
InstallerListeners(AutomatedInstallData installData, Prompt prompt)
          Constructs an InstallerListeners.
 
Method Summary
 void add(InstallerListener listener)
          Registers a listener.
 void afterDir(File dir, PackFile packFile, Pack pack)
          Invoked after a directory is created.
 void afterFile(File file, PackFile packFile, Pack pack)
          Invoked after a file is installed.
 void afterPack(Pack pack)
          Invoked after a pack is installed.
 void afterPacks(List<Pack> packs, ProgressListener listener)
          Invoked after packs are installed.
 void beforeDir(File dir, PackFile packFile, Pack pack)
          Invoked before a directory is created.
 void beforeFile(File file, PackFile packFile, Pack pack)
          Invoked before a file is installed.
 void beforePack(Pack pack, int i)
          Invoked before a pack is installed.
 void beforePacks(List<Pack> packs, ProgressListener listener)
          Invoked before packs are installed.
 InstallerListener get(int index)
          Returns the listener at the specified index in the collection.
 List<InstallerListener> getInstallerListeners()
          Returns the installer listeners.
 void initialise()
          Initialises the listeners.
 boolean isFileListener()
          Determines if the listener should be notified of every file and directory installation.
 int size()
          Returns the number of registered listeners.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InstallerListeners

public InstallerListeners(AutomatedInstallData installData,
                          Prompt prompt)
Constructs an InstallerListeners.

Parameters:
installData - the installation data
prompt - the prompt
Method Detail

add

public void add(InstallerListener listener)
Registers a listener.

Parameters:
listener - the listener to add

size

public int size()
Returns the number of registered listeners.

Returns:
the number of registered listeners

get

public InstallerListener get(int index)
Returns the listener at the specified index in the collection.

Parameters:
index - the index into the collection
Returns:
the corresponding listener

getInstallerListeners

public List<InstallerListener> getInstallerListeners()
Returns the installer listeners.

Returns:
the installer listeners

initialise

public void initialise()
Initialises the listeners.

Throws:
IzPackException - if a listener throws an exception

beforePacks

public void beforePacks(List<Pack> packs,
                        ProgressListener listener)
                 throws InstallerException
Invoked before packs are installed.

Parameters:
packs - the packs to install
listener - the progress listener
Throws:
InstallerException - if a listener throws an exception

beforePack

public void beforePack(Pack pack,
                       int i)
                throws InstallerException
Invoked before a pack is installed.

Parameters:
pack - the pack
i - the pack number
Throws:
InstallerException - if a listener throws an exception

isFileListener

public boolean isFileListener()
Determines if the listener should be notified of every file and directory installation.

Returns:
true if the listener should be notified, otherwise false

beforeDir

public void beforeDir(File dir,
                      PackFile packFile,
                      Pack pack)
               throws InstallerException
Invoked before a directory is created.

Parameters:
dir - the directory
packFile - corresponding pack file
pack - the pack that packFile comes from
Throws:
InstallerException - if a listener throws an exception

afterDir

public void afterDir(File dir,
                     PackFile packFile,
                     Pack pack)
              throws InstallerException
Invoked after a directory is created.

Parameters:
dir - the directory
packFile - corresponding pack file
pack - the pack that packFile comes from
Throws:
InstallerException - if a listener throws an exception

beforeFile

public void beforeFile(File file,
                       PackFile packFile,
                       Pack pack)
                throws InstallerException
Invoked before a file is installed.

This implementation only invokes those listeners whose isFileListener() returns true.

Parameters:
file - the file
packFile - corresponding pack file
pack - the pack that packFile comes from
Throws:
InstallerException - if a listener throws an exception

afterFile

public void afterFile(File file,
                      PackFile packFile,
                      Pack pack)
               throws InstallerException
Invoked after a file is installed.

This implementation only invokes those listeners whose isFileListener() returns true.

Parameters:
file - the file
packFile - corresponding pack file
pack - the pack that packFile comes from
Throws:
InstallerException - if a listener throws an exception

afterPack

public void afterPack(Pack pack)
               throws InstallerException
Invoked after a pack is installed.

Parameters:
pack - current pack object
Throws:
InstallerException - if a listener throws an exception

afterPacks

public void afterPacks(List<Pack> packs,
                       ProgressListener listener)
                throws InstallerException
Invoked after packs are installed.

Parameters:
packs - the installed packs
listener - the progress listener
Throws:
InstallerException - if a listener throws an exception


Copyright © 2018. All rights reserved.