com.izforge.izpack.uninstaller
Class Destroyer

java.lang.Object
  extended by java.lang.Thread
      extended by com.izforge.izpack.uninstaller.Destroyer
All Implemented Interfaces:
java.lang.Runnable

public class Destroyer
extends java.lang.Thread

The files destroyer class.

Author:
Julien Ponge

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
private  boolean forceDestroy
          True if the destroyer must force the recursive deletion.
private  AbstractUIProgressHandler handler
          the destroyer listener.
private  java.lang.String installPath
          The installation path.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Destroyer(java.lang.String installPath, boolean forceDestroy, AbstractUIProgressHandler handler)
          The constructor.
 
Method Summary
private  void cleanup(java.io.File file)
          Makes some reccursive cleanups.
private  void execRootScript(java.lang.String aRootScript)
          Removes the given files as root for the given Users
private  java.util.ArrayList<ExecutableFile> getExecutablesList()
          Gets the List of all Executables
private  java.util.ArrayList<java.io.File> getFilesList()
          Returns an ArrayList of the files to delete.
private  java.util.List[] getListenerLists()
          Load the defined uninstall listener objects.
private  java.lang.String getRootScript()
          Gets the root files.
private  void informListeners(java.util.List listeners, int action, java.lang.Object param, AbstractUIProgressHandler handler)
          Informs all listeners.
 void run()
          The run method.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

forceDestroy

private boolean forceDestroy
True if the destroyer must force the recursive deletion.


installPath

private java.lang.String installPath
The installation path.


handler

private AbstractUIProgressHandler handler
the destroyer listener.

Constructor Detail

Destroyer

public Destroyer(java.lang.String installPath,
                 boolean forceDestroy,
                 AbstractUIProgressHandler handler)
The constructor.

Parameters:
installPath - The installation path.
forceDestroy - Shall we force the recursive deletion.
handler - The destroyer listener.
Method Detail

run

public void run()
The run method.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

getFilesList

private java.util.ArrayList<java.io.File> getFilesList()
                                                throws java.lang.Exception
Returns an ArrayList of the files to delete.

Returns:
The files list.
Throws:
java.lang.Exception - Description of the Exception

getExecutablesList

private java.util.ArrayList<ExecutableFile> getExecutablesList()
                                                        throws java.lang.Exception
Gets the List of all Executables

Returns:
The ArrayList of the Executables
Throws:
java.lang.Exception

getRootScript

private java.lang.String getRootScript()
                                throws java.lang.Exception
Gets the root files.

Returns:
The files which should remove by root for another user
Throws:
java.lang.Exception

execRootScript

private void execRootScript(java.lang.String aRootScript)
Removes the given files as root for the given Users

Parameters:
aRootScript - The Script to exec as uninstall time by root.

cleanup

private void cleanup(java.io.File file)
              throws java.lang.Exception
Makes some reccursive cleanups.

Parameters:
file - The file to wipe.
Throws:
java.lang.Exception - Description of the Exception

getListenerLists

private java.util.List[] getListenerLists()
                                   throws java.lang.Exception
Load the defined uninstall listener objects.

Returns:
a list with the defined uninstall listeners
Throws:
java.lang.Exception

informListeners

private void informListeners(java.util.List listeners,
                             int action,
                             java.lang.Object param,
                             AbstractUIProgressHandler handler)
Informs all listeners.

Parameters:
listeners - list with the listener objects
action - identifier which callback should be called
param - parameter for the call
handler - the current progress handler