Class LineInvoker
java.lang.Object
uk.ac.starlink.ttools.task.LineInvoker
Invokes the Stilts tasks using a
LineTableEnvironment.- Since:
- 15 Aug 2005
- Author:
- Mark Taylor
-
Constructor Summary
ConstructorsConstructorDescriptionLineInvoker(String toolName, uk.ac.starlink.util.ObjectFactory<uk.ac.starlink.task.Task> taskFactory) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected LineTableEnvironmentCreates a LineTableEnvironment for use with this invoker.protected voidexecute(uk.ac.starlink.task.Executable exec) Executes the given executable.static StringgetParamHelp(TableEnvironment env, String taskName, uk.ac.starlink.task.Parameter<?> param) Returns a help string for a parameter of one of the tasks known to this application.static StringgetPrefixedParameterUsage(uk.ac.starlink.task.Parameter<?>[] params, String prefix) Returns a usage string for a set of parameters, prefixed by a given string.static StringgetStackSummary(Throwable error) Returns a truncated version of a stack trace for user consumption.static StringgetUnusedWarning(String[] unused) Returns a warning string appropriate for the case when one or more words on the command line are never used by a task.intInvokes one of the known tasks given a string of command-line words.
-
Constructor Details
-
LineInvoker
public LineInvoker(String toolName, uk.ac.starlink.util.ObjectFactory<uk.ac.starlink.task.Task> taskFactory) Constructor.- Parameters:
toolName- name of the overall applicationtaskFactory- factory which can create the tasks known to the application
-
-
Method Details
-
invoke
Invokes one of the known tasks given a string of command-line words. Theargsstring will typically come straight out of a staticmain()method. A callback may be supplied to perform configuration that has to be done after logging configuration - presumably because it does some logging itself. It is executed synchronously.- Parameters:
args- argument listloggedConfig- callback for configuration to be done after logging configuration (may be null)
-
createEnvironment
Creates a LineTableEnvironment for use with this invoker. May be overridden by customising subclasses.- Returns:
- new environment for use with invocation
-
execute
protected void execute(uk.ac.starlink.task.Executable exec) throws uk.ac.starlink.task.TaskException, IOException Executes the given executable. This simply calls theExecutable.execute()method, but subclasses can override it to do something different.- Parameters:
exec- executable- Throws:
uk.ac.starlink.task.TaskExceptionIOException
-
getStackSummary
-
getPrefixedParameterUsage
-
getParamHelp
public static String getParamHelp(TableEnvironment env, String taskName, uk.ac.starlink.task.Parameter<?> param) Returns a help string for a parameter of one of the tasks known to this application. May include extended usage information. Consider the result to be a formatted string, that is, one which contains newlines to keep line lengths down to a reasonable level.- Parameters:
env- execution environmenttaskName- task nickname - may be null if heading is not requiredparam- parameter for which usage information is required- Returns:
- usage message
-
getUnusedWarning
-