Package com.sun.javatest
Class EditJTI
- java.lang.Object
-
- com.sun.javatest.EditJTI
-
public class EditJTI extends java.lang.ObjectThis 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-helpoption.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classEditJTI.BadArgsThis exception is used to indicate a problem with the command line arguments.static classEditJTI.FaultThis 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 voidedit(java.lang.String cmd)Apply an edit to the current configuration.voidedit(java.lang.String... cmds)Apply a series of edits to the current configuration.voidload(java.io.File inFile)Load a configuration file to be edited.voidload(java.io.File inFile, TestSuite ts)Load a configuration file to be edited.voidload(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 voidmain(java.lang.String... args)Command line entry point.booleanrun(java.lang.String... args)Run the utility, without exiting.booleanrun(java.lang.String[] args, java.io.PrintWriter out)Run the utility, without exiting, writing any messages to a specified stream.voidsave(java.io.File file)Save the edited configuration in a specified file.voidshowPath()Show the current question path for the configuration.static voidusage(java.io.PrintStream out)Print out brief command line help.voidwriteLog(java.io.File logFile)Write a log of the questions that determine the current configuration.
-
-
-
Method Detail
-
main
public static void main(java.lang.String... args)
Command line entry point. Run with-helpto 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.FaultRun 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
public boolean run(java.lang.String[] args, java.io.PrintWriter out) throws EditJTI.BadArgs, EditJTI.FaultRun 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
public void load(java.io.File inFile) throws java.io.IOException, Interview.FaultLoad a configuration file to be edited.- Parameters:
inFile- the file to be loaded- Throws:
java.io.IOException- if there is a problem reading the fileInterview.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.FaultLoad 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:
java.io.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(java.io.File inFile, java.net.URLClassLoader loader) throws java.io.IOException, Interview.Fault, EditJTI.FaultLoad 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:
java.io.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
public void save(java.io.File file) throws java.io.IOException, Interview.FaultSave 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 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
public void writeLog(java.io.File logFile) throws java.io.IOExceptionWrite 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.FaultApply 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.FaultApply 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[])
-
-