org.schmant
Class Launcher

java.lang.Object
  extended by org.schmant.Launcher

public final class Launcher
extends Object

Launcher class for launching Schmant builds. This is the Java class that is run by the different Schmant start scripts (schmant.sh, schmant.bat).

When run, this class does the following:

  1. Parses the program arguments (see the Programmer's Guide).
  2. Instantiates this class and calls the launch(LauncherSettings, Bindings, ReportFactory, ReportLineFormatter) method.

Since:
0.5
Author:
Karl Gustafsson

Field Summary
static String PROP_SCRIPT_FILE
          Property containing the path to the running script file as a String.
 
Constructor Summary
Launcher()
           
 
Method Summary
 Object launch(LauncherSettings ls, Bindings bnd)
          Calling this method is equivalent to calling launch(LauncherSettings, Bindings, ReportFactory, ReportLineFormatter) without a custom ReportFactory and ReportLineFormatter.
 Object launch(LauncherSettings ls, Bindings bnd, ReportFactory rf, ReportLineFormatter rlf)
          Use the launcher settings to run the script.
static void main(String[] args)
          Run a Schmant script.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_SCRIPT_FILE

public static final String PROP_SCRIPT_FILE
Property containing the path to the running script file as a String. It is available in the global props variable in the script.

See Also:
Constant Field Values
Constructor Detail

Launcher

public Launcher()
Method Detail

launch

public Object launch(LauncherSettings ls,
                     Bindings bnd)
              throws IOException,
                     InterruptedException,
                     RuntimeException
Calling this method is equivalent to calling launch(LauncherSettings, Bindings, ReportFactory, ReportLineFormatter) without a custom ReportFactory and ReportLineFormatter.

Parameters:
ls - The launcher settings.
bnd - Initial bindings. May be null
Returns:
The object returned from the script that was run.
Throws:
ScriptException - On build script failures such as failed builds.
IOException - On I/O errors when launching the script.
InterruptedException - If we're interrupted while setting up the script. Script executors generally swallow these kinds of exceptions, so if the script is interrupted, this method will call a ScriptException.
RuntimeException - On various other errors.

launch

public Object launch(LauncherSettings ls,
                     Bindings bnd,
                     ReportFactory rf,
                     ReportLineFormatter rlf)
              throws IOException,
                     InterruptedException,
                     RuntimeException
Use the launcher settings to run the script.

Parameters:
ls - The launcher settings.
bnd - Initial bindings. May be null
rf - If this parameter is set, this ReportFactory instance is used instead of the report factory configuration from ls (if any).
rlf - If this parameter is set, this ReportLineFormatter instance is used instead of the report line formatter configuration from lf (if any).
Returns:
The object returned from the script that was run.
Throws:
ScriptException - On build script failures such as failed builds.
IOException - On I/O errors when launching the script.
InterruptedException - If we're interrupted while setting up the script. Script executors generally swallow these kinds of exceptions, so if the script is interrupted, this method will call a ScriptException.
RuntimeException - On various other errors.

main

public static void main(String[] args)
Run a Schmant script. This method parses the command line arguments and then calls the launch(LauncherSettings, Bindings, ReportFactory, ReportLineFormatter) method.

The program exits with exit code 0 if it was successful, or with exit code 1 if it was terminated due to an error.

See the Programmer's Guide for accepted command line arguments and environment variables.

Parameters:
args - The program arguments.