Class EditJTI


  • public class EditJTI
    extends java.lang.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  EditJTI.BadArgs
      This exception is used to indicate a problem with the command line arguments.
      static class  EditJTI.Fault
      This exception is used to report problems that arise when using this API.
    • Constructor Summary

      Constructors 
      Constructor Description
      EditJTI()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void edit​(java.lang.String cmd)
      Apply an edit to the current configuration.
      void edit​(java.lang.String... cmds)
      Apply a series of edits to the current configuration.
      void load​(java.io.File inFile)
      Load a configuration file to be edited.
      void load​(java.io.File inFile, TestSuite ts)
      Load a configuration file to be edited.
      void load​(java.io.File inFile, java.net.URLClassLoader loader)
      Load a configuration file to be edited, using a specified class loader to load the interview class.
      static void main​(java.lang.String... args)
      Command line entry point.
      boolean run​(java.lang.String... args)
      Run the utility, without exiting.
      boolean run​(java.lang.String[] args, java.io.PrintWriter out)
      Run the utility, without exiting, writing any messages to a specified stream.
      void save​(java.io.File file)
      Save the edited configuration in a specified file.
      void showPath()
      Show the current question path for the configuration.
      static void usage​(java.io.PrintStream out)
      Print out brief command line help.
      void writeLog​(java.io.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 Detail

      • EditJTI

        public EditJTI()
    • Method Detail

      • main

        public static void main​(java.lang.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​(java.io.PrintStream out)
        Print out brief command line help.
        Parameters:
        out - the stream to which to write the command line help.
      • run

        public boolean run​(java.lang.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​(java.lang.String[] args,
                           java.io.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​(java.io.File inFile)
                  throws java.io.IOException,
                         Interview.Fault
        Load a configuration file to be edited.
        Parameters:
        inFile - the file to be loaded
        Throws:
        java.io.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​(java.io.File inFile,
                         TestSuite ts)
                  throws java.io.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:
        java.io.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​(java.io.File inFile,
                         java.net.URLClassLoader loader)
                  throws java.io.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:
        java.io.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​(java.io.File file)
                  throws java.io.IOException,
                         Interview.Fault
        Save the edited configuration in a specified file.
        Parameters:
        file - The file in which to save the configuration
        Throws:
        java.io.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​(java.io.File logFile)
                      throws java.io.IOException
        Write a log of the questions that determine the current configuration.
        Parameters:
        logFile - the file to which to write the log
        Throws:
        java.io.IOException - if there is a problem while writing the log file
      • edit

        public void edit​(java.lang.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(String)
      • edit

        public void edit​(java.lang.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:
        edit(String[])