com.ibm.ras
Interface RASIHandler

All Known Implementing Classes:
RASHandler

public abstract interface RASIHandler
extends RASIObject

RASIHandler defines the methods that must be implemented to process RASEvents generated by a RASLogger. Within the RAS Toolkit, RASIHandler is implemented by the RASHandler class.


Method Summary
 void addFormatter(RASIFormatter formatter)
          Registers a RAS event formatter with this handler.
 void addMaskChangeListener(RASIMaskChangeListener listener)
          Adds an object that wishes to be informed of changes in the handler's message or trace mask configuration.
 java.util.Hashtable getConfig()
          Gets the configuration of this object.
 java.util.Enumeration getFormatters()
          Gets the set of formatters associated with this handler.
 java.util.Enumeration getMaskChangeListeners()
          Gets the set of objects that wish to be informed of changes in the handler's message or trace mask configuration.
 long getMessageMask()
          Gets the mask which defines the set of message types that will be processed.
 long getTraceMask()
          Gets the mask which defines the set of trace types that will be processed.
 void logEvent(RASIEvent event)
          Passes a RAS event asynchronously from a logger to a handler.
 void openDevice()
          Opens the device to which the handler will send its log entries.
 void removeFormatter(RASIFormatter formatter)
          Removes a RAS event formatter from this handler.
 void removeMaskChangeListener(RASIMaskChangeListener listener)
          Removes an object from the list that wishes to be informed of changes in the handler's message or trace mask configuration.
 void setConfig(java.util.Hashtable ht)
          Sets the configuration of this object.
 void setMessageMask(long mask)
          Sets the mask which defines the set of message types that will be processed.
 void setTraceMask(long mask)
          Sets the mask which defines the set of trace types that will be processed.
 void stop()
          Stops the handler.
 void writeEvent(RASIEvent event)
          Passes a RAS event synchronously from a logger to a handler.
 
Methods inherited from interface com.ibm.ras.RASIObject
getDescription, getName, setDescription, setName
 

Method Detail

getConfig

public java.util.Hashtable getConfig()
Gets the configuration of this object.
Specified by:
getConfig in interface RASIObject
Returns:
A Hashtable containing the configuration. This object inserts the following key/value pairs into the the configuration:
         "messageMask"   The mask which selects the message types
                         to be processed.
         "traceMask"     The mask which selects the trace types
                         to be processed.
         
All values are Strings. Extensions to this object may add additional keys.

setConfig

public void setConfig(java.util.Hashtable ht)
Sets the configuration of this object. This method is used by a RASManager to initialize a RAS object. It should not be necessary for an application to use this method.
Specified by:
setConfig in interface RASIObject
Parameters:
ht - A Hashtable containing the configuration. This object searches for the following keys:
            "messageMask"   The mask which selects the message types
                            to be processed.
            "traceMask"     The mask which selects the trace types
                            to be processed.
            
All values are Strings. If a key is not found, that configuration element is not updated. Extensions to this object may add additional keys.

getMessageMask

public long getMessageMask()
Gets the mask which defines the set of message types that will be processed. Possible values are defined by the logical OR of the RASIMessageEvent.TYPE_XXXX constants.
Returns:
The trace mask.

setMessageMask

public void setMessageMask(long mask)
Sets the mask which defines the set of message types that will be processed. Possible values are defined by the logical OR of the RASIMessageEvent.TYPE_XXXX constants. The mask value is not validated against these types.
Parameters:
mask - The message mask.

getTraceMask

public long getTraceMask()
Gets the mask which defines the set of trace types that will be processed. Possible values are defined by the logical OR of the RASITraceEvent.TYPE_XXXX constants.
Returns:
The trace mask.

setTraceMask

public void setTraceMask(long mask)
Sets the mask which defines the set of trace types that will be processed. Possible values are defined by the RASITraceEvent.TYPE_XXXX constants. The mask value is not validated against these types.
Parameters:
mask - The trace mask.

addMaskChangeListener

public void addMaskChangeListener(RASIMaskChangeListener listener)
Adds an object that wishes to be informed of changes in the handler's message or trace mask configuration. If the listener is null or is already registered, this method does nothing.
Parameters:
listener - The mask change listener.

removeMaskChangeListener

public void removeMaskChangeListener(RASIMaskChangeListener listener)
Removes an object from the list that wishes to be informed of changes in the handler's message or trace mask configuration. If the listener is null or is not registered, this method does nothing.
Parameters:
listener - The mask change listener.

getMaskChangeListeners

public java.util.Enumeration getMaskChangeListeners()
Gets the set of objects that wish to be informed of changes in the handler's message or trace mask configuration.
Returns:
An Enumeration of mask change listeners. If no listeners are registered, the Enumeration is empty.

addFormatter

public void addFormatter(RASIFormatter formatter)
Registers a RAS event formatter with this handler. The formatter must be configured with the set of RASIEvent classes which it supports before this method is called. If the formatter is null, this method does nothing. If the formatter supports an event class which is already registered with this handler, this new formatter replaces the old one.
Parameters:
formatter - The event formatter.

removeFormatter

public void removeFormatter(RASIFormatter formatter)
Removes a RAS event formatter from this handler. If the formatter is null or is not registered, this method does nothing.
Parameters:
formatter - The event formatter.

getFormatters

public java.util.Enumeration getFormatters()
Gets the set of formatters associated with this handler.
Returns:
An Enumeration of registered formatters. If no formatters have been registered, the Enumeration is empty.

stop

public void stop()
Stops the handler. This method should be called when a handler is no longer needed. Be careful not to stop a handler prematurely if it is shared by more than one logger.

openDevice

public void openDevice()
Opens the device to which the handler will send its log entries. If an error occurs during this process, the handler will write a message to System.err.

The caller should ensure that this method is not called if the device is already open or if cannot tolerate attempts to reopen it.


logEvent

public void logEvent(RASIEvent event)
Passes a RAS event asynchronously from a logger to a handler. The log entry is saved for processing by the handler. The logger must compare the message type against the handler's message mask before calling this method. If the log event is null, this method does nothing.
Parameters:
event - A RAS event.

writeEvent

public void writeEvent(RASIEvent event)
Passes a RAS event synchronously from a logger to a handler. The handler processes the log entry immediately by calling the format method of the configured formatter and then the println method of the configured print writer. The logger must compare the event type against the handler's message or trace mask before calling this method. If the log event is null, this method does nothing.
Parameters:
event - A RAS event.