public class OutputBoss extends Boss
OutputBoss' main responsibility is directing output to the user-designated destination, so it provides its own "print-and-clear-messages" function for the other Boss classes to use.
A key point to note is that in BatchMMJ2, Messages are printed and cleared immediately after being generated, they are not accumulated for some later purpose. Therefore, OutputBoss uses messages.reallocateInfoMessages and messages.reallocateErrorMessages when a MaxErrorMessages or MaxInfoMessages runparm is changed. It also uses LangConstants.MAX_ERROR_MESSAGES_DEFAULT and LangConstants.MAX_INFO_MESSAGES_DEFAULT if the relevant runParms are *not* input.
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
captionParm |
protected Dump |
dump |
protected int |
maxErrorMessagesParm |
protected int |
maxInfoMessagesParm |
protected int |
maxStatementPrintCountParm |
protected Messages |
messages |
protected int |
outputVerbosityParm |
protected java.io.PrintWriter |
sysErr |
protected java.io.PrintWriter |
sysOut |
batchFramework, runParm
Constructor and Description |
---|
OutputBoss(BatchFramework batchFramework)
Constructor with BatchFramework for access to environment.
|
Modifier and Type | Method and Description |
---|---|
protected BookManager |
checkBookManagerReady(LogicalSystem logicalSystem)
Checks to see if BookManager is initialized and enabled.
|
protected void |
checkSysErrError()
Check SysErr to see if I/O Error has occurred.
|
protected void |
checkSysOutError()
Check SysOut to see if I/O Error has occurred.
|
void |
close()
Close SysOut and SysErr.
|
protected void |
closeSysErr()
Close SysErr.
|
protected void |
closeSysOut()
Close SysOut.
|
void |
doPrintBookManagerChapters()
Executes the PrintBookManagerChapters command.
|
void |
doPrintBookManagerSectionDetails()
Executes the PrintBookManagerSectionDetails command
|
void |
doPrintBookManagerSections()
Executes the PrintBookManagerSections command.
|
void |
doPrintStatementDetails()
Executes the PrintStatementDetails command, prints any messages, etc.
|
void |
doPrintSyntaxDetails()
Executes the PrintSyntaxDetails command, prints any messages, etc.
|
protected Section |
editBookManagerSectionNbr(int valueFieldNbr,
BookManager bookManager)
Checks to see if BookManager is initialized and enabled.
|
protected void |
editCaption()
Validate Caption Runparm.
|
protected void |
editMaxErrorMessages()
Validate Max Error Messages Runparm.
|
protected void |
editMaxInfoMessages()
Validate Max Info Messages Runparm.
|
protected void |
editMaxStatementPrintCount()
Validate Max Statement Print Count RunParm.
|
protected void |
editOutputVerbosity()
Validate OutputVerbosity Runparm.
|
protected void |
editStartInstrumentationTimer()
Validate StartInstrumentationTimer Runparm.
|
protected void |
editStopInstrumentationTimer()
Validate StopInstrumentationTimer Runparm.
|
protected void |
editSysErrFile()
Validate System Error File Runparm.
|
protected void |
editSysOutFile()
Validate System Output File Runparm.
|
protected java.lang.String |
getCaption()
Get Caption Parm Option.
|
Dump |
getDump()
Get a Dump object.
|
Messages |
getMessages()
Get a Messages object.
|
protected void |
initializeMessages()
Initialize Messages Object.
|
void |
printAndClearMessages()
Print all error/info messages, then clear the messages from the Messages
repository.
|
void |
printException(java.lang.Throwable t)
Print an exception to the console.
|
void |
printException(java.lang.Throwable t,
int v)
Print an exception to the console.
|
void |
sysErrPrint(java.lang.String s)
Common routine for printing to SysErr.
|
void |
sysErrPrintln(java.lang.String s)
Common routine for printing a line to SysErr.
|
void |
sysOutPrint(java.lang.String s)
Common routine for printing to SysOut.
|
void |
sysOutPrint(java.lang.String s,
int v)
Common routine for printing to SysOut.
|
void |
sysOutPrintln(java.lang.String s)
Common routine for printing a line to SysOut.
|
void |
sysOutPrintln(java.lang.String s,
int v)
Common routine for printing a line to SysOut if the input verbosity
number is less than or equal to the OutputVerbosity RunParm
|
accumException, addContext, buildBufferedFileReader, buildBufferedFileWriter, buildPrintWriter, doRunParmCommand, error, error, error, get, getBoolean, getBoolean, getColor, getEnum, getExistingFile, getExistingFile, getExistingFolder, getExistingFolder, getFileCharset, getFileName, getFileNameSuffix, getFileUsage, getInt, getNonBlank, getNonnegInt, getOnOff, getPosInt, getPrintableNoBlanksString, getPrintWriter, getSelectorCount, getSelectorTheorem, getStmt, getTheorem, getYesNo, opt, parseInt, putCommand, putCommand, require
protected java.io.PrintWriter sysOut
protected java.io.PrintWriter sysErr
protected int maxErrorMessagesParm
protected int maxInfoMessagesParm
protected Messages messages
protected int maxStatementPrintCountParm
protected java.lang.String captionParm
protected Dump dump
protected int outputVerbosityParm
public OutputBoss(BatchFramework batchFramework)
batchFramework
- for access to environment.public void printAndClearMessages()
Note: startup errors are gathered and displayed here via calls to methods
in MMJ2FailPopupWindow
. The gathering and displaying are separate
because when the popup window is shown the error messages should already
be displayed on the Command Prompt window -- but that process clears the
messages from the Messages
object. So the messages are
accumulated by MMJ2FailPopupWindow
before being displayed on the
Command Prompt window...
public Messages getMessages()
public void sysOutPrintln(java.lang.String s, int v) throws java.io.IOException
s
- line to print.v
- verbosity of line to print.java.io.IOException
- if an error occurredpublic void sysOutPrintln(java.lang.String s) throws java.io.IOException
s
- line to print.java.io.IOException
- if an error occurredpublic void sysOutPrint(java.lang.String s, int v) throws java.io.IOException
s
- string to print.v
- verbosity of string to print.java.io.IOException
- if an error occurredpublic void sysOutPrint(java.lang.String s) throws java.io.IOException
s
- string to print.java.io.IOException
- if an error occurredpublic void sysErrPrintln(java.lang.String s) throws java.io.IOException
s
- line to print.java.io.IOException
- if an error occurredpublic void sysErrPrint(java.lang.String s) throws java.io.IOException
s
- String to print.java.io.IOException
- if an error occurredpublic void printException(java.lang.Throwable t) throws java.io.IOException
t
- line to print.java.io.IOException
- if an error occurredpublic void printException(java.lang.Throwable t, int v) throws java.io.IOException
t
- line to print.v
- verbosity of line to print.java.io.IOException
- if an error occurredpublic void close()
public void doPrintSyntaxDetails()
public void doPrintStatementDetails()
public void doPrintBookManagerChapters()
public void doPrintBookManagerSections()
public void doPrintBookManagerSectionDetails()
public Dump getDump()
protected void editSysOutFile()
protected void editSysErrFile()
protected void editMaxErrorMessages()
protected void editMaxInfoMessages()
protected void editCaption()
protected java.lang.String getCaption()
protected void editMaxStatementPrintCount()
protected void editOutputVerbosity()
protected void editStartInstrumentationTimer()
protected void editStopInstrumentationTimer()
protected BookManager checkBookManagerReady(LogicalSystem logicalSystem)
Caution: throws IllegalArgumentException if BookManager is not enabled! Ouch.
logicalSystem
- the LogicalSystem in use.protected Section editBookManagerSectionNbr(int valueFieldNbr, BookManager bookManager)
Caution: throws IllegalArgumentException if Section Number is not a positive integer, or if it is not found within the BookManager! Ouch.
valueFieldNbr
- number of value field within RunParm.bookManager
- the BookManager to checkprotected void initializeMessages()
protected void checkSysErrError() throws java.io.IOException
java.io.IOException
- if an error occurredprotected void checkSysOutError() throws java.io.IOException
java.io.IOException
- if an error occurredprotected void closeSysOut()
protected void closeSysErr()