com.izforge.izpack.util
Class FileExecutor

java.lang.Object
  extended bycom.izforge.izpack.util.FileExecutor

public class FileExecutor
extends java.lang.Object

Executes a bunch of files. This class is intended to do a system dependent installation postprocessing. Executable file can be any file installed with current package. After execution the file can be optionally removed. Before execution on Unix systems execution flag will be set on processed file.

Author:
Olexij Tkatchenko

Nested Class Summary
private static class FileExecutor.MonitorInputStream
          This is a grabber for stdout and stderr.
 
Field Summary
private  java.util.Collection files
          The files to execute.
 
Constructor Summary
FileExecutor()
          Constructs a new executor.
FileExecutor(java.util.Collection files)
          Constructs a new executor.
 
Method Summary
 int executeCommand(java.lang.String[] params, java.lang.String[] output)
          Executed a system command and waits for completion.
 int executeFiles(int currentStage, AbstractUIHandler handler)
          Executes files specified at construction time.
private  boolean stopThread(java.lang.Thread t, FileExecutor.MonitorInputStream m)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

files

private java.util.Collection files
The files to execute.

Constructor Detail

FileExecutor

public FileExecutor(java.util.Collection files)
Constructs a new executor. The executable files specified must have pretranslated paths (variables expanded and file separator characters converted if necessary).

Parameters:
files - the executable files to process

FileExecutor

public FileExecutor()
Constructs a new executor.

Method Detail

stopThread

private boolean stopThread(java.lang.Thread t,
                           FileExecutor.MonitorInputStream m)

executeCommand

public int executeCommand(java.lang.String[] params,
                          java.lang.String[] output)
Executed a system command and waits for completion.

Parameters:
params - system command as string array
output - contains output of the command index 0 = standard output index 1 = standard error
Returns:
exit status of process

executeFiles

public int executeFiles(int currentStage,
                        AbstractUIHandler handler)
Executes files specified at construction time.

Parameters:
currentStage - the stage of the installation
handler - The AbstractUIHandler to notify on errors.
Returns:
0 on success, else the exit status of the last failed command