/**
  * Load the defined uninstall listener objects.
  *
  * @return a list with the defined uninstall listeners
  * @throws Exception
  */
 private List[] getListenerLists() throws Exception {
   ArrayList[] uninstaller = new ArrayList[] {new ArrayList(), new ArrayList()};
   // Load listeners if exist
   InputStream in;
   ObjectInputStream objIn;
   in = Destroyer.class.getResourceAsStream("/uninstallerListeners");
   if (in != null) {
     objIn = new ObjectInputStream(in);
     List listeners = (List) objIn.readObject();
     objIn.close();
     Iterator iter = listeners.iterator();
     while (iter != null && iter.hasNext()) {
       Class clazz = Class.forName(((String) iter.next()));
       UninstallerListener ul = (UninstallerListener) clazz.newInstance();
       if (ul.isFileListener()) uninstaller[1].add(ul);
       uninstaller[0].add(ul);
     }
   }
   return uninstaller;
 }
 /**
  * Informs all listeners.
  *
  * @param listeners list with the listener objects
  * @param action identifier which callback should be called
  * @param param parameter for the call
  * @param handler the current progress handler
  */
 private void informListeners(
     List listeners, int action, Object param, AbstractUIProgressHandler handler) {
   // Iterate the action list.
   Iterator iter = listeners.iterator();
   UninstallerListener il = null;
   while (iter.hasNext()) {
     try {
       il = (UninstallerListener) iter.next();
       switch (action) {
         case UninstallerListener.BEFORE_DELETION:
           il.beforeDeletion((List) param, handler);
           break;
         case UninstallerListener.AFTER_DELETION:
           il.afterDeletion((List) param, handler);
           break;
         case UninstallerListener.BEFORE_DELETE:
           il.beforeDelete((File) param, handler);
           break;
         case UninstallerListener.AFTER_DELETE:
           il.afterDelete((File) param, handler);
           break;
       }
     } catch (Throwable e) { // Catch it to prevent for a block of uninstallation.
       handler.emitError(
           "Skipping custom action because exception caught during " + il.getClass().getName(),
           e.toString());
     }
   }
 }