Class EditJTI

java.lang.Object
com.sun.javatest.EditJTI

public class EditJTI extends Object
This class provides a utility for command-line editing of configuration (.jti) files. It is intended to be invoked from the command line, as in:
 java com.sun.javatest.EditJIT options...
 
For details of the options, use the -help option.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    This exception is used to indicate a problem with the command line arguments.
    static class 
    This exception is used to report problems that arise when using this API.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    edit(String cmd)
    Apply an edit to the current configuration.
    void
    edit(String... cmds)
    Apply a series of edits to the current configuration.
    void
    load(File inFile)
    Load a configuration file to be edited.
    void
    load(File inFile, TestSuite ts)
    Load a configuration file to be edited.
    void
    load(File inFile, URLClassLoader loader)
    Load a configuration file to be edited, using a specified class loader to load the interview class.
    static void
    main(String... args)
    Command line entry point.
    boolean
    run(String... args)
    Run the utility, without exiting.
    boolean
    run(String[] args, PrintWriter out)
    Run the utility, without exiting, writing any messages to a specified stream.
    void
    save(File file)
    Save the edited configuration in a specified file.
    void
    Show the current question path for the configuration.
    static void
    Print out brief command line help.
    void
    writeLog(File logFile)
    Write a log of the questions that determine the current configuration.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • EditJTI

      public EditJTI()
  • Method Details

    • main

      public static void main(String... args)
      Command line entry point. Run with -help to get brief command line help. Warning: this method uses System.exit and so does not return if called directly.
      Parameters:
      args - Comamnd line arguments.
    • usage

      public static void usage(PrintStream out)
      Print out brief command line help.
      Parameters:
      out - the stream to which to write the command line help.
    • run

      public boolean run(String... args) throws EditJTI.BadArgs, EditJTI.Fault
      Run the utility, without exiting. Any messages are written to the standard output stream.
      Parameters:
      args - command line args
      Returns:
      true if the resulting configuration is valid (complete), and false otherwise.
      Throws:
      EditJTI.BadArgs - if there is an error analysing the args
      EditJTI.Fault - if there is an error executing the args
    • run

      public boolean run(String[] args, PrintWriter out) throws EditJTI.BadArgs, EditJTI.Fault
      Run the utility, without exiting, writing any messages to a specified stream.
      Parameters:
      args - command line args
      out - the stream to which to write any messages
      Returns:
      true if the resulting configuration is valid (complete), and false otherwise.
      Throws:
      EditJTI.BadArgs - if there is an error analysing the args
      EditJTI.Fault - if there is an error executing the args
    • load

      public void load(File inFile) throws IOException, Interview.Fault
      Load a configuration file to be edited.
      Parameters:
      inFile - the file to be loaded
      Throws:
      IOException - if there is a problem reading the file
      Interview.Fault - if there is a problem loading the interview data from the file
    • load

      public void load(File inFile, TestSuite ts) throws IOException, Interview.Fault, EditJTI.Fault
      Load a configuration file to be edited.
      Parameters:
      inFile - the file to be loaded
      ts - the test suite for which the interview is to be loaded
      Throws:
      IOException - if there is a problem reading the file
      Interview.Fault - if there is a problem loading the interview data from the file
      EditJTI.Fault - if there is a problem creating the interview for the testsuite
    • load

      public void load(File inFile, URLClassLoader loader) throws IOException, Interview.Fault, EditJTI.Fault
      Load a configuration file to be edited, using a specified class loader to load the interview class.
      Parameters:
      inFile - the file to be loaded
      loader - the class loader to be used to load the interview class
      Throws:
      IOException - if there is a problem reading the file
      Interview.Fault - if there is a problem loading the interview data from the file
      EditJTI.Fault - if there is a problem creating the interview for the testsuite
    • save

      public void save(File file) throws IOException, Interview.Fault
      Save the edited configuration in a specified file.
      Parameters:
      file - The file in which to save the configuration
      Throws:
      IOException - if there is a problem while writing the file
      Interview.Fault - if there is a problem while saving the interview data
    • showPath

      public void showPath()
      Show the current question path for the configuration.
    • writeLog

      public void writeLog(File logFile) throws IOException
      Write a log of the questions that determine the current configuration.
      Parameters:
      logFile - the file to which to write the log
      Throws:
      IOException - if there is a problem while writing the log file
    • edit

      public void edit(String... cmds) throws EditJTI.Fault
      Apply a series of edits to the current configuration.
      Parameters:
      cmds - the editing commands to be applied
      Throws:
      EditJTI.Fault - if there is a problem while applying the edit commands.
      See Also:
    • edit

      public void edit(String cmd) throws EditJTI.Fault
      Apply an edit to the current configuration.
      Parameters:
      cmd - the editing command to be applied Currently, two forms of command are supported:
      tag-name=value
      Set the response to the question whose value is tag-name to value
      /search/replace/
      For all questions on the current path, change instances of search to replace
      Throws:
      EditJTI.Fault - if there is a problem while applying the edit commands.
      See Also: