Class LineInvoker

java.lang.Object
uk.ac.starlink.ttools.task.LineInvoker

public class LineInvoker extends Object
Invokes the Stilts tasks using a LineTableEnvironment.
Since:
15 Aug 2005
Author:
Mark Taylor
  • 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 application
      taskFactory - factory which can create the tasks known to the application
  • Method Details

    • invoke

      public int invoke(String[] args, Runnable loggedConfig)
      Invokes one of the known tasks given a string of command-line words. The args string will typically come straight out of a static main() 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 list
      loggedConfig - callback for configuration to be done after logging configuration (may be null)
    • getStackSummary

      public static String getStackSummary(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 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 array
      prefix - 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 environment
      taskName - task nickname - may be null if heading is not required
      param - parameter for which usage information is required
      Returns:
      usage message
    • getUnusedWarning

      public 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.
      Parameters:
      unused - unused words
      Returns:
      warning lines