com.waveset.task
Class AbstractMonitor

java.lang.Object
  extended bycom.waveset.task.AbstractMonitor
All Implemented Interfaces:
Monitor
Direct Known Subclasses:
ExtendedResultsMonitor

public abstract class AbstractMonitor
extends java.lang.Object
implements Monitor

Defines common behavior for classes that implement Monitor.

This base class lets a task record several types of information:


Field Summary
protected  boolean _monitorError
           
protected  boolean _monitorInfo
           
protected  boolean _monitorProgress
           
protected  boolean _monitorWarning
           
protected  boolean _trace
          Debug flag
static java.lang.String code_id
           
protected static WSTrace trace
           
 
Constructor Summary
AbstractMonitor()
           
 
Method Summary
 boolean checkBreak()
           
protected static java.lang.String formatData(PersistentObject po, java.lang.String actionTaken)
           
 java.lang.Object getProperty(java.lang.String name)
           
 void monitorDeath(java.lang.Throwable throes)
          A task must signal a fatal exception.
 void monitorDone(WavesetResult res)
          A task must signal completion by returning its result.
 void monitorErrorData(PersistentObject po)
           
 void monitorErrorData(PersistentObject po, java.lang.String actionTaken)
           
 void monitorErrorData(java.lang.String s)
           
 void monitorErrorMsg(Message msg)
           
 void monitorErrorMsg(java.lang.String msg)
           
 void monitorErrorMsg(java.lang.Throwable e)
           
 void monitorInputData(PersistentObject po)
           
 void monitorInputData(PersistentObject po, java.lang.String actionTaken)
           
 void monitorInputData(java.lang.String s)
           
protected  void monitorMessage(Message msg)
           
protected  void monitorMessage(java.lang.Object msg, Severity severity)
           
 void monitorOutputData(PersistentObject po)
           
 void monitorOutputData(PersistentObject po, java.lang.String actionTaken)
           
 void monitorOutputData(java.lang.String s)
           
 void monitorOutputMsg(Message msg)
           
 void monitorOutputMsg(java.lang.String msg)
           
 void monitorProgress(java.lang.String s)
          A task reports (terse) progress such as "Extracted 127 of 129 accounts read.".
 void monitorWarningMsg(Message msg)
           
 void monitorWarningMsg(java.lang.String msg)
           
 void monitorWarningMsg(java.lang.Throwable e)
           
protected static void println(java.lang.Object o)
          Ubiquitous macro.
 void setMonitorProgress(boolean b)
           
 void setMonitorSeverity(Severity severity)
          Specify the threshold for monitoring.
 void setProperty(java.lang.String name, java.lang.Object value)
           
 void setTrace(boolean b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

code_id

public static final java.lang.String code_id
See Also:
Constant Field Values

trace

protected static WSTrace trace

_trace

protected boolean _trace
Debug flag


_monitorProgress

protected boolean _monitorProgress

_monitorError

protected boolean _monitorError

_monitorWarning

protected boolean _monitorWarning

_monitorInfo

protected boolean _monitorInfo
Constructor Detail

AbstractMonitor

public AbstractMonitor()
Method Detail

setTrace

public void setTrace(boolean b)

monitorInputData

public void monitorInputData(java.lang.String s)
Specified by:
monitorInputData in interface Monitor

monitorOutputData

public void monitorOutputData(java.lang.String s)
Specified by:
monitorOutputData in interface Monitor

monitorErrorData

public void monitorErrorData(java.lang.String s)
Specified by:
monitorErrorData in interface Monitor

monitorMessage

protected void monitorMessage(Message msg)

monitorProgress

public void monitorProgress(java.lang.String s)
A task reports (terse) progress such as "Extracted 127 of 129 accounts read.".

Specified by:
monitorProgress in interface Monitor

monitorDone

public void monitorDone(WavesetResult res)
Description copied from interface: Monitor
A task must signal completion by returning its result.

Specified by:
monitorDone in interface Monitor

monitorDeath

public void monitorDeath(java.lang.Throwable throes)
Description copied from interface: Monitor
A task must signal a fatal exception.

This allows the monitor to free any resources, as well as to report the untimely death of the subject task in a standard way.

Specified by:
monitorDeath in interface Monitor

checkBreak

public boolean checkBreak()
Specified by:
checkBreak in interface Monitor
Returns:
true if you want the task to kill itself, false if you want the task to continue.

setMonitorProgress

public void setMonitorProgress(boolean b)
Specified by:
setMonitorProgress in interface Monitor

setMonitorSeverity

public void setMonitorSeverity(Severity severity)
Description copied from interface: Monitor
Specify the threshold for monitoring.

If the threshold is null Severity.OK (the default), then everything will be monitored.

Setting the threshold to Severity.WARNING will suppress informational messages.

Setting the threshold to Severity.ERROR will suppress both informational and warning messages.

Setting the threshold to null suppresses all of informational, warning, and non-fatal error messages.

NOTE: This threshold does not affect the behavior of monitorDone, monitorDeath, checkBreak, or monitorProgress.

Specified by:
setMonitorSeverity in interface Monitor

monitorInputData

public void monitorInputData(PersistentObject po)
Specified by:
monitorInputData in interface Monitor

monitorInputData

public void monitorInputData(PersistentObject po,
                             java.lang.String actionTaken)
Specified by:
monitorInputData in interface Monitor

monitorOutputData

public void monitorOutputData(PersistentObject po)
Specified by:
monitorOutputData in interface Monitor

monitorOutputData

public void monitorOutputData(PersistentObject po,
                              java.lang.String actionTaken)
Specified by:
monitorOutputData in interface Monitor

monitorOutputMsg

public void monitorOutputMsg(Message msg)
Specified by:
monitorOutputMsg in interface Monitor

monitorOutputMsg

public void monitorOutputMsg(java.lang.String msg)
Specified by:
monitorOutputMsg in interface Monitor

monitorErrorData

public void monitorErrorData(PersistentObject po)
Specified by:
monitorErrorData in interface Monitor

monitorErrorData

public void monitorErrorData(PersistentObject po,
                             java.lang.String actionTaken)
Specified by:
monitorErrorData in interface Monitor

monitorWarningMsg

public void monitorWarningMsg(Message msg)
Specified by:
monitorWarningMsg in interface Monitor

monitorWarningMsg

public void monitorWarningMsg(java.lang.Throwable e)
Specified by:
monitorWarningMsg in interface Monitor

monitorWarningMsg

public void monitorWarningMsg(java.lang.String msg)
Specified by:
monitorWarningMsg in interface Monitor

monitorErrorMsg

public void monitorErrorMsg(Message msg)
Specified by:
monitorErrorMsg in interface Monitor

monitorErrorMsg

public void monitorErrorMsg(java.lang.Throwable e)
Specified by:
monitorErrorMsg in interface Monitor

monitorErrorMsg

public void monitorErrorMsg(java.lang.String msg)
Specified by:
monitorErrorMsg in interface Monitor

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
Specified by:
setProperty in interface Monitor

getProperty

public java.lang.Object getProperty(java.lang.String name)
Specified by:
getProperty in interface Monitor

monitorMessage

protected void monitorMessage(java.lang.Object msg,
                              Severity severity)

formatData

protected static java.lang.String formatData(PersistentObject po,
                                             java.lang.String actionTaken)

println

protected static void println(java.lang.Object o)
Ubiquitous macro.