Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.enhydra.servlet.debug
Class DebugManager  view DebugManager download DebugManager.java

java.lang.Object
  extended byorg.enhydra.servlet.debug.DebugManager

public class DebugManager
extends java.lang.Object

Servlet debug manager for monitoring servlet I/O. An instance of this object monitors a single servlet instance. A fixed-sized queue of servlet transaction records is maintained. As a transaction is completed by the servlet, a record is added to the end of the queue. If the queue has reached its maximum size, an element is removed from the head of the queue. Applications wishing to monitor servlet transactions registers with this object and is called when objects are added or removed from the queue. Calling on removal is necessary as one of the main goals of this class is to support presentations that display a list of transaction records. A unique id number is associated with each transaction record. The transaction record ids are sequencially allocated, one with a large number occured after one with a smaller number.

Since:
2.0
Version:
$Revision: 1.4.4.1 $

Field Summary
private  ServletRecordCallback[] callbacks
          List of objects to call on servlet debug events.
private  boolean enabled
          Current monitoring state.
private  ServletRecorderFilter filter
          Filter that is used by this DebugManager.
private  java.lang.String filterID
           
private  int numCallbacks
          Number of valid entries in callbacks.
protected  ServletRecordQueue recordQueue
          Queue of transaction records.
private  java.lang.String servletId
          Servlet being managed.
 
Constructor Summary
DebugManager(java.lang.String servletId, int queueSize, boolean saveResponseData)
          Construct an new servlet debug manager and associate it with a servlet.
 
Method Summary
 void addTransactionCallback(ServletRecordCallback callback, boolean catchUp)
          Registered to be called when a servlet transaction is queued.
protected  void addTransactionRecord(ServletTransactionRecord transactionRecord)
          Add a servlet transaction to the end of the queue.
 void clearRecordQueue()
          Clear all records from the queue.
 void disable()
          Disable recording servlet transactions.
 void enable()
          Enable recording servlet transactions.
 java.lang.String getServlet()
          Get the servlet associated with this object.
 ServletTransactionRecord getTransactionRecord(int transactionId)
          Find a servlet transaction record by id.
 boolean isEnabled()
          Determine if servlets monitoring is enabled.
 void removeTranactionCallback(ServletRecordCallback callback)
          Remove transaction callback that was created with addTransactionCallback.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

servletId

private java.lang.String servletId
Servlet being managed.


enabled

private boolean enabled
Current monitoring state.


recordQueue

protected ServletRecordQueue recordQueue
Queue of transaction records. This is protected so that subclasses may access the queue.


callbacks

private ServletRecordCallback[] callbacks
List of objects to call on servlet debug events. Kept as an array since addition/removal of callbacks is infrequence and the expected number is small. The array may not be full.


numCallbacks

private int numCallbacks
Number of valid entries in callbacks.


filter

private ServletRecorderFilter filter
Filter that is used by this DebugManager.


filterID

private java.lang.String filterID
Constructor Detail

DebugManager

public DebugManager(java.lang.String servletId,
                    int queueSize,
                    boolean saveResponseData)
Construct an new servlet debug manager and associate it with a servlet. Servlet monitoring is initially disabled.

Method Detail

enable

public void enable()
            throws org.enhydra.servlet.connectionMethods.ConnectionMethodException
Enable recording servlet transactions. This adds a filter to the filter manager, and then adds the filter to all channels that map to the servlet.


disable

public void disable()
             throws org.enhydra.servlet.connectionMethods.ConnectionMethodException
Disable recording servlet transactions. This removes the filter from all the channels, then removes the filter from the filter manager.


isEnabled

public boolean isEnabled()
Determine if servlets monitoring is enabled.


getServlet

public java.lang.String getServlet()
Get the servlet associated with this object.


addTransactionCallback

public void addTransactionCallback(ServletRecordCallback callback,
                                   boolean catchUp)
Registered to be called when a servlet transaction is queued.


removeTranactionCallback

public void removeTranactionCallback(ServletRecordCallback callback)
Remove transaction callback that was created with addTransactionCallback.


getTransactionRecord

public ServletTransactionRecord getTransactionRecord(int transactionId)
Find a servlet transaction record by id.


addTransactionRecord

protected void addTransactionRecord(ServletTransactionRecord transactionRecord)
Add a servlet transaction to the end of the queue. Use by the servlet filters.


clearRecordQueue

public void clearRecordQueue()
Clear all records from the queue.