Package uk.ac.starlink.ttools.task
Class LineInvoker
- java.lang.Object
-
- uk.ac.starlink.ttools.task.LineInvoker
-
public class LineInvoker extends java.lang.Object
Invokes the Stilts tasks using aLineTableEnvironment
.- Since:
- 15 Aug 2005
- Author:
- Mark Taylor
-
-
Constructor Summary
Constructors Constructor Description LineInvoker(java.lang.String toolName, uk.ac.starlink.util.ObjectFactory<uk.ac.starlink.task.Task> taskFactory)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.String
getParamHelp(TableEnvironment env, java.lang.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 java.lang.String
getPrefixedParameterUsage(uk.ac.starlink.task.Parameter<?>[] params, java.lang.String prefix)
Returns a usage string for a set of parameters, prefixed by a given string.static java.lang.String
getStackSummary(java.lang.Throwable error)
Returns a truncated version of a stack trace for user consumption.static java.lang.String
getUnusedWarning(java.lang.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
invoke(java.lang.String[] args, java.lang.Runnable loggedConfig)
Invokes one of the known tasks given a string of command-line words.
-
-
-
Method Detail
-
invoke
public int invoke(java.lang.String[] args, java.lang.Runnable loggedConfig)
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
public static java.lang.String getStackSummary(java.lang.Throwable error)
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 java.lang.String getPrefixedParameterUsage(uk.ac.starlink.task.Parameter<?>[] params, java.lang.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 java.lang.String getParamHelp(TableEnvironment env, java.lang.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
public static java.lang.String getUnusedWarning(java.lang.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.- Parameters:
unused
- unused words- Returns:
- warning lines
-
-