Package com.sun.javatest
Class EditJTI
java.lang.Object
com.sun.javatest.EditJTI
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 ClassesModifier and TypeClassDescriptionstatic 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 -
Method Summary
Modifier and TypeMethodDescriptionvoid
Apply an edit to the current configuration.void
Apply a series of edits to the current configuration.void
Load a configuration file to be edited.void
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
Command line entry point.boolean
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 the edited configuration in a specified file.void
showPath()
Show the current question path for the configuration.static void
usage
(PrintStream out) Print out brief command line help.void
Write a log of the questions that determine the current configuration.
-
Constructor Details
-
EditJTI
public EditJTI()
-
-
Method Details
-
main
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
Print out brief command line help.- Parameters:
out
- the stream to which to write the command line help.
-
run
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 argsEditJTI.Fault
- if there is an error executing the args
-
run
Run the utility, without exiting, writing any messages to a specified stream.- Parameters:
args
- command line argsout
- 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 argsEditJTI.Fault
- if there is an error executing the args
-
load
Load a configuration file to be edited.- Parameters:
inFile
- the file to be loaded- Throws:
IOException
- if there is a problem reading the fileInterview.Fault
- if there is a problem loading the interview data from the file
-
load
Load a configuration file to be edited.- Parameters:
inFile
- the file to be loadedts
- the test suite for which the interview is to be loaded- Throws:
IOException
- if there is a problem reading the fileInterview.Fault
- if there is a problem loading the interview data from the fileEditJTI.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 loadedloader
- the class loader to be used to load the interview class- Throws:
IOException
- if there is a problem reading the fileInterview.Fault
- if there is a problem loading the interview data from the fileEditJTI.Fault
- if there is a problem creating the interview for the testsuite
-
save
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 fileInterview.Fault
- if there is a problem while saving the interview data
-
showPath
public void showPath()Show the current question path for the configuration. -
writeLog
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
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
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:
-