com.bluemarsh.jswat.report
Class Category

java.lang.Object
  |
  +--com.bluemarsh.jswat.report.Category
All Implemented Interfaces:
com.bluemarsh.config.ConfigureListener, java.util.EventListener

public class Category
extends java.lang.Object
implements com.bluemarsh.config.ConfigureListener

Class Category is a singleton that provides access to a set of reporting categories. Each reporting category has a set of reporters that present logging events to the user in one way or another.

Version:
1.0 4/7/01
Author:
Nathan Fiedler

Field Summary
protected  java.lang.String categoryName
          Name of this category instance.
protected static java.util.Hashtable instances
          Table of instances of Category.
protected  boolean isEnabled
          True if this category is enabled.
protected  ReporterGroup reporterGroup
          Reporter group where logging events are sent.
 
Constructor Summary
protected Category(java.lang.String name)
          Protected since this is a singleton.
 
Method Summary
 void configurationChanged()
          Invoked when the configuration has been accepted by the user.
static Category getDefaultInstance()
          Retrieves the default logging category.
 java.lang.String getName()
          Returns the name of this category.
static Category instanceOf(java.lang.String name)
          Retrieves the instance of the named logging category.
 boolean isEnabled()
          Returns the enabled status of this category.
 void report(java.lang.String msg)
          Report a new debugging message to this category.
 void setEnabled(boolean enable)
          Set the enabled state of this category.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instances

protected static java.util.Hashtable instances
Table of instances of Category.

categoryName

protected java.lang.String categoryName
Name of this category instance.

isEnabled

protected boolean isEnabled
True if this category is enabled.

reporterGroup

protected ReporterGroup reporterGroup
Reporter group where logging events are sent.
Constructor Detail

Category

protected Category(java.lang.String name)
Protected since this is a singleton.
Parameters:
name - category name.
Method Detail

configurationChanged

public void configurationChanged()
Invoked when the configuration has been accepted by the user.
Specified by:
configurationChanged in interface com.bluemarsh.config.ConfigureListener

getDefaultInstance

public static Category getDefaultInstance()
Retrieves the default logging category. This is meant as a fallback in those situations where the code generating the event has no category assigned to it.
Returns:
instance of default Category.

getName

public java.lang.String getName()
Returns the name of this category.
Returns:
category name.

instanceOf

public static Category instanceOf(java.lang.String name)
Retrieves the instance of the named logging category. If the named category does not exist, one will be created.
Parameters:
name - name of Category to get instance of.
Returns:
instance of named Category.

isEnabled

public boolean isEnabled()
Returns the enabled status of this category.
Returns:
true if enabled, false if disabled.

report

public void report(java.lang.String msg)
Report a new debugging message to this category. A logging event will be created and dispatched to any listening reporters.
Parameters:
msg - debugging message to report.

setEnabled

public void setEnabled(boolean enable)
Set the enabled state of this category.
Parameters:
enable - true to enable this category, false to disable.