Package uk.ac.starlink.ttools.task
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 TypeMethodDescriptionstatic 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.static String
getPrefixedParameterUsage
(uk.ac.starlink.task.Parameter<?>[] params, String prefix) Returns a usage string for a set of parameters, prefixed by a given string.static String
getStackSummary
(Throwable error) Returns a truncated version of a stack trace for user consumption.static String
getUnusedWarning
(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.int
Invokes 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. Theargs
string 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)
-
getStackSummary
Returns a truncated version of a stack trace for user consumption. This gives the error message for each throwable in the cause chain, but not line numbers etc.- Parameters:
error
- exception to summarise- Returns:
- multiline text summary
-
getPrefixedParameterUsage
public static String getPrefixedParameterUsage(uk.ac.starlink.task.Parameter<?>[] params, String prefix) Returns a usage string for a set of parameters, prefixed by a given string.- Parameters:
params
- parameter arrayprefix
- string to prepend to the first line- Returns:
- usage string
-
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
Returns a warning string appropriate for the case when one or more words on the command line are never used by a task.- Parameters:
unused
- unused words- Returns:
- warning lines
-