com.ibm.wbi
Class Monitor

com.ibm.wbi.Meg
  |
  +--com.ibm.wbi.Monitor
Direct Known Subclasses:
HttpMonitor

public abstract class Monitor
extends Meg

A Monitor has the opportunity to "Monitor" the response after the Generator invoked in the Meg chain and either before all, after all, or after a specific Editor. A Monitor can not modify the request/response in any way.


Field Summary
static int EDITOR
          A Monitor that is run after a particular Editor.
static int END
          A Monitor that is run after all Editors.
static int START
          A Monitor that is run before all Editors.
 
Fields inherited from class com.ibm.wbi.Meg
COPYRIGHT, GENERATOR, MONITOR, REQUEST_EDITOR, UNDEFINED
 
Constructor Summary
Monitor()
          Constructs a new Monitor with default characteristics and is enabled.
Monitor(java.lang.String name, java.lang.String condition, int priority)
          Construct a new Monitor with specified characteristics and that is enabled.
Monitor(java.lang.String name, java.lang.String condition, int priority, boolean enabled)
          Construct a new Monitor with specified characteristics.
 
Method Summary
 int getMonitorType()
          Get the Monitor type.
 int getType()
          Get the Meg type associated with a Monitor.
abstract  void handleRequest(RequestEvent event)
          The method called to handle a request that satisfies the Meg's condition.
 void setMonitorType(int type)
          Set the Monitor type.
 
Methods inherited from class com.ibm.wbi.Meg
forwardRequest, getCondition, getEnabled, getMegProperty, getMegProperty, getMegPropertyKeys, getName, getPlugin, getPriority, getSystemContext, initialize, initialize, isEnabled, isMegApplicable, loadMegResources, run, setCondition, setEnabled, setMegProperty, setName, setPriority, setSystemContext, setup, setup, setup, setup
 

Field Detail

START

public static final int START
A Monitor that is run before all Editors.

END

public static final int END
A Monitor that is run after all Editors.

EDITOR

public static final int EDITOR
A Monitor that is run after a particular Editor.
Constructor Detail

Monitor

public Monitor()
Constructs a new Monitor with default characteristics and is enabled.

Monitor

public Monitor(java.lang.String name,
               java.lang.String condition,
               int priority)
Construct a new Monitor with specified characteristics and that is enabled.
Parameters:
name - The name of the Monitor.
condition - The condition under which the Monitor is invoked
priority - The priority of the Monitor incase of a condition tie.

Monitor

public Monitor(java.lang.String name,
               java.lang.String condition,
               int priority,
               boolean enabled)
Construct a new Monitor with specified characteristics.
Parameters:
name - The name of the Monitor.
condition - The condition under which the Monitor is invoked
priority - The priority of the Monitor incase of a condition tie.
Method Detail

getMonitorType

public final int getMonitorType()
Get the Monitor type.
Returns:
One of START, EDITOR, END.

setMonitorType

public final void setMonitorType(int type)
Set the Monitor type.
Parameters:
type - One of START, EDITOR, END.

getType

public int getType()
Get the Meg type associated with a Monitor.
Overrides:
getType in class Meg
Returns:
Always returns Meg.MONITOR.

handleRequest

public abstract void handleRequest(RequestEvent event)
                            throws java.io.IOException
The method called to handle a request that satisfies the Meg's condition. A Monitor can not modify the input or output streams.
Overrides:
handleRequest in class Meg
Parameters:
event - The RequestEvent used to monitor the request or response.
Throws:
java.io.IOException - Can be thrown if an exception was generated by the Meg while processing the MegInputStream.