|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsbrt.shell.mng.AbstractProcessManager
public abstract class AbstractProcessManager
This class is a skeleton implemenation of KernelProcessManager.
Field Summary | |
---|---|
static java.lang.String |
ALGORITHM
The keyword used to denote an algorithm. |
static java.lang.String |
COMPLETED
The prefix used to denote the number of completed operations. |
static java.lang.String |
DATA_HEADERS
The keyword used to denote the data headers of, say, an output file. |
static java.io.PrintWriter |
DEV_NULL
A print writer that discards all data it receives. |
static java.lang.String |
ELAPSED_TIME
The prefix used to denote the amount of time that has elapsed since an operation was started. |
static java.lang.String |
FILE_FORMAT
The keyword used to denote the name of a file format. |
static java.lang.String |
INPUT_FILE
The keyword used to denote the name of the input file. |
static java.lang.String |
INPUT_FILE_FORMAT
The keyword used to denote the name of an input file format. |
static java.lang.String |
INPUT_FILE_NAME_FILE
The keyword used to denote the name of a file containing a list of file names. |
static java.lang.String |
ITERATIONS
The keyword used to denote the number of iterations. |
static UnmodifiableSet<java.lang.String> |
optionalKeywords
The set of optional keywords in the ManagerInput objects supplied
to instances of this class. |
static java.lang.String |
OUTPUT_FILE_FORMAT
The keyword used to denote the name of an output file format. |
static java.lang.String |
OUTPUT_FILE_NAME
The keyword used to denote the name of the output file. |
static java.lang.String |
OUTPUT_FILE_NAME_FILE
The keyword used to denote the name of a file containing a list of file names for other output files. |
static PercentFormat |
PERCENT
The default format used for percentages. |
static java.lang.String |
PERCENT_COMPLETED
The prefix used to denote the completed percentage of an operation. |
static UnmodifiableSet<java.lang.String> |
requiredKeywords
The set of keywords required to be present in the ManagerInput
objects supplied to instances of this class. |
static java.lang.String |
SEED
The keword used to denote the seed to a pseudorandom number generator. |
static java.lang.String |
ZERO_CUTOFF
The keyword used to denote the maximum numerical value that will still be considered equal to zero. |
Constructor Summary | |
---|---|
AbstractProcessManager()
|
Method Summary | ||
---|---|---|
void |
check(ManagerInput<java.lang.String,java.lang.String> input)
Throws an ApplicationException if this ProcessManager cannot
understand the provided input. |
|
static void |
closeFile(SbrtFile file,
java.io.PrintWriter out)
Closes the provided results manager and prints a descriptive message to the provided print writer. |
|
static void |
closeRm(ResultsManager<?> rm,
java.io.PrintWriter out)
Closes the provided file and prints a descriptive message to the provided print writer. |
|
void |
execute()
Executes the process this process manager controls. |
|
static FileFormat |
getFileFormat(ManagerInput<java.lang.String,java.lang.String> input)
Returns the parsed value for FILE_FORMAT in the provided input. |
|
static FileFormat |
getFileFormat(java.lang.String formatName)
Parses and returns the file format corresponding to the provided string. |
|
static TextInputFile<java.lang.String> |
getFileNameSource(ManagerInput<java.lang.String,java.lang.String> input,
java.io.PrintWriter out)
Returns the parsed value for OUTPUT_FILE_NAME_FILE in the provided input and prints a descriptive message to the provided print writer. |
|
static int |
getIterations(ManagerInput<java.lang.String,java.lang.String> input,
java.io.PrintWriter out)
Returns the parsed value for ITERATIONS in the provided input and prints a descriptive message to the provided print writer. |
|
static long |
getSeed(ManagerInput<java.lang.String,java.lang.String> input,
java.io.PrintWriter out)
Returns the parsed value for SEED in the provided input and prints a descriptive message to the provided print writer. |
|
static FileFormat |
getTextFileFormat(ManagerInput<java.lang.String,java.lang.String> input)
Returns the parsed value for FILE_FORMAT in the provided input. |
|
static FileFormat |
getTextFileFormat(java.lang.String fileFormatString)
Returns the text file format corresponding to the provided string. |
|
static double |
getZeroCutoff(ManagerInput<java.lang.String,java.lang.String> input)
Returns the parsed value for ZERO_CUTOFF in the provided input. |
|
static double |
getZeroCutoff(ManagerInput<java.lang.String,java.lang.String> input,
java.io.PrintWriter out)
Returns the parsed value for ZERO_CUTOFF in the provided input. |
|
static int |
parseInt(java.lang.String number)
Parses the provided string as a int . |
|
static long |
parseLong(java.lang.String number)
Parses the provided string as a long . |
|
static void |
printProgress(java.lang.Double progress,
java.io.PrintWriter out)
Prints the provided progress to the provided print writer. |
|
static void |
printProgress(java.lang.Integer progress,
java.io.PrintWriter out)
Prints the provided progress to the provided print writer. |
|
static void |
printProgress(java.lang.Number progress,
java.io.PrintWriter out)
Prints the provided progress to the provided print writer. |
|
static
|
runProcess(MonitoredProcess<T> process,
ResultsManager<T> resultsManager,
java.io.PrintWriter out)
Runs the provided process using the provided results manager and prints descriptive progress messages to the provided print writer. |
|
void |
setInput(ManagerInput<java.lang.String,java.lang.String> input)
Uses the provided input to prepare this process manager for execution. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface sbrt.shell.mng.ProcessManager |
---|
execute, getOptionalKeys, getRequiredKeys, setInput |
Field Detail |
---|
public static final java.io.PrintWriter DEV_NULL
public static final PercentFormat PERCENT
public static final java.lang.String ZERO_CUTOFF
public static final java.lang.String SEED
public static final java.lang.String COMPLETED
public static final java.lang.String PERCENT_COMPLETED
public static final java.lang.String ELAPSED_TIME
public static final java.lang.String ALGORITHM
public static final java.lang.String ITERATIONS
public static final java.lang.String OUTPUT_FILE_NAME
public static final java.lang.String INPUT_FILE_NAME_FILE
public static final java.lang.String OUTPUT_FILE_NAME_FILE
public static final java.lang.String DATA_HEADERS
public static final java.lang.String INPUT_FILE
public static final java.lang.String FILE_FORMAT
public static final java.lang.String OUTPUT_FILE_FORMAT
public static final java.lang.String INPUT_FILE_FORMAT
public static final UnmodifiableSet<java.lang.String> requiredKeywords
ManagerInput
objects supplied to instances of this class.
public static final UnmodifiableSet<java.lang.String> optionalKeywords
ManagerInput
objects supplied
to instances of this class.
Constructor Detail |
---|
public AbstractProcessManager()
Method Detail |
---|
public static TextInputFile<java.lang.String> getFileNameSource(ManagerInput<java.lang.String,java.lang.String> input, java.io.PrintWriter out)
input
- the input whose OUTPUT_FILE_NAME_FILE
value is to be
parsed.out
- the print writer to which a message is printed.
public void check(ManagerInput<java.lang.String,java.lang.String> input)
ProcessManager
cannot
understand the provided input.
check
in interface ProcessManager<java.lang.String,java.lang.String>
input
- ManagerInputpublic static <T> void runProcess(MonitoredProcess<T> process, ResultsManager<T> resultsManager, java.io.PrintWriter out)
T
- the results type.process
- the process to run.resultsManager
- the results manager with which to supply the
process.out
- the print writer where descriptive progress messages will be
written.public static void closeRm(ResultsManager<?> rm, java.io.PrintWriter out)
rm
- the results manager to close.out
- the print writer to which a message will be printed.
java.lang.NullPointerException
- if either argument is null.public static void closeFile(SbrtFile file, java.io.PrintWriter out)
file
- the file to close.out
- the print writer to which a message will be printed.
java.lang.NullPointerException
- if either argument is null.public static void printProgress(java.lang.Number progress, java.io.PrintWriter out)
progress
- a number representing a progress.out
- the print writer to which the progress will be printed.
java.lang.NullPointerException
- if either argument is null.public static void printProgress(java.lang.Integer progress, java.io.PrintWriter out)
progress
- a number representing a progress.out
- the print writer to which the progress will be printed.
java.lang.NullPointerException
- if either argument is null.public static void printProgress(java.lang.Double progress, java.io.PrintWriter out)
progress
- a number representing a progress.out
- the print writer to which the progress will be printed.
java.lang.NullPointerException
- if either argument is null.public static long parseLong(java.lang.String number)
long
.
number
- the string to parse.
long
value represented by the provided string.public static int parseInt(java.lang.String number)
int
.
number
- the string to parse.
int
value represented by the provided string.public static long getSeed(ManagerInput<java.lang.String,java.lang.String> input, java.io.PrintWriter out)
SEED
, the current
time in milliseconds is returned instead.
input
- the input whose SEED
value is to be parsed.out
- the print writer to which a message is printed.
public static int getIterations(ManagerInput<java.lang.String,java.lang.String> input, java.io.PrintWriter out)
input
- the input whose ITERATIONS
value is to be parsed.out
- the print writer to which a message is printed.
ApplicationException
- if the parsed integer is less than 0.public static FileFormat getFileFormat(ManagerInput<java.lang.String,java.lang.String> input)
input
- the input whose FILE_FORMAT
value is to be parsed.
public static FileFormat getTextFileFormat(java.lang.String fileFormatString)
fileFormatString
- a string parsable by FileFormatFormat.
null
,
or FileFormat.TEXT or FileFormat.GZIP_TEXT.
ApplicationException
- if the provided string cannot be parsed, or is parsed
as any file format other than plain or gzipped text.public static FileFormat getTextFileFormat(ManagerInput<java.lang.String,java.lang.String> input)
input
- the input whose FILE_FORMAT
value is to be parsed.
ApplicationException
- if the parsed format is not a valid
text-based file format.public static FileFormat getFileFormat(java.lang.String formatName)
formatName
- the name of a file format.
public static double getZeroCutoff(ManagerInput<java.lang.String,java.lang.String> input, java.io.PrintWriter out)
input
- the input whose ZERO_CUTOFF
value is to be parsed.out
- the print writer to which a status message will be printed.
0d
if no value for
ZERO_CUTOFF
exists.
ApplicationException
- if the parsed cutoff is infinite, NaN, or <
0.public static double getZeroCutoff(ManagerInput<java.lang.String,java.lang.String> input)
input
- the input whose ZERO_CUTOFF
value is to be parsed.
ApplicationException
- if the parsed cutoff is infinite, NaN, or <
0.public void setInput(ManagerInput<java.lang.String,java.lang.String> input)
setInput
in interface ProcessManager<java.lang.String,java.lang.String>
input
- all of the information required to prepare this process
manager for execution.public void execute()
execute
in interface ProcessManager<java.lang.String,java.lang.String>
java.lang.IllegalStateException
- if no input was provided to this process
manager.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |