public abstract class Tool
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.io.PrintStream |
out
The output stream where this tool writes to.
|
Constructor and Description |
---|
Tool() |
Modifier and Type | Method and Description |
---|---|
static boolean |
isOption(java.lang.String arg,
java.lang.String option)
Check if the argument matches the option.
|
protected void |
printNoDatabaseFilesFound(java.lang.String dir,
java.lang.String db)
Print to the output stream that no database files have been found.
|
abstract void |
runTool(java.lang.String... args)
Run the tool with the given output stream and arguments.
|
void |
setOut(java.io.PrintStream out)
Sets the standard output stream.
|
protected void |
showUsage()
Print the usage of the tool.
|
protected java.sql.SQLException |
showUsageAndThrowUnsupportedOption(java.lang.String option)
Throw a SQLException saying this command line option is not supported.
|
protected java.sql.SQLException |
throwUnsupportedOption(java.lang.String option)
Throw a SQLException saying this command line option is not supported.
|
public void setOut(java.io.PrintStream out)
out
- the new standard output streampublic abstract void runTool(java.lang.String... args) throws java.sql.SQLException
args
- the argument listjava.sql.SQLException
- on failureprotected java.sql.SQLException showUsageAndThrowUnsupportedOption(java.lang.String option) throws java.sql.SQLException
option
- the unsupported optionjava.sql.SQLException
- on failureprotected java.sql.SQLException throwUnsupportedOption(java.lang.String option) throws java.sql.SQLException
option
- the unsupported optionjava.sql.SQLException
- on failureprotected void printNoDatabaseFilesFound(java.lang.String dir, java.lang.String db)
dir
- the directory or nulldb
- the database name or nullprotected void showUsage()
public static boolean isOption(java.lang.String arg, java.lang.String option)
arg
- the argumentoption
- the command line option