public class CommandLauncher extends AbstractContexed
Command
from the command-line.
This class can be sub-classed to customise the AppContext creation.conn
Constructor and Description |
---|
CommandLauncher(AppContext conn) |
Modifier and Type | Method and Description |
---|---|
static void |
die(java.lang.String errorMessage)
Convenient method for killing the application with an error message
|
static void |
die(java.lang.Throwable t)
Convenient method for killing the application with an error message
|
static void |
exit(AppContext conn,
int exitCode)
Convenient method for doing a normal system exit with a specified code
|
static void |
main(java.lang.String[] args) |
void |
run(java.lang.Class<? extends Command> comm,
java.lang.String[] args)
launch pre-existing command.
|
void |
run(java.lang.String[] args)
run the Command.
|
void |
setErr(java.io.PrintStream err) |
void |
setOut(java.io.PrintStream out) |
static void |
setProp(java.util.Properties prop,
java.util.List<java.lang.String> propKeyVals)
Sets the specified property
|
static Options.Instance |
setupContext(java.lang.String[] args,
java.util.LinkedList<java.lang.String> data,
AppContext context) |
getContext, getLogger, resetLogger
public CommandLauncher(AppContext conn)
public static void main(java.lang.String[] args)
public void run(java.lang.String[] args)
args
- public void run(java.lang.Class<? extends Command> comm, java.lang.String[] args)
comm
- args
- java.lang.Exception
public static Options.Instance setupContext(java.lang.String[] args, java.util.LinkedList<java.lang.String> data, AppContext context)
public static void die(java.lang.String errorMessage)
errorMessage
- The error messagepublic static void die(java.lang.Throwable t)
t
- The Throwable
that caused the error messagepublic static void exit(AppContext conn, int exitCode)
conn
- exitCode
- public static void setProp(java.util.Properties prop, java.util.List<java.lang.String> propKeyVals)
prop
- propKeyVals
- The property key and vlaue (expected format is 'key=value')public void setOut(java.io.PrintStream out)
public void setErr(java.io.PrintStream err)