com.ibm.ras
Class RASMaskChangeGenerator

java.lang.Object
  |
  +--com.ibm.ras.RASObject
        |
        +--com.ibm.ras.RASMaskChangeGenerator
All Implemented Interfaces:
java.lang.Cloneable, RASConstants, RASIMaskChangeGenerator, RASIObject, java.io.Serializable
Direct Known Subclasses:
RASLogger

public class RASMaskChangeGenerator
extends RASObject
implements RASIMaskChangeGenerator

RASMaskChangeGenerator implements the RASIMaskChangeGenerator interface. It is responsible for controlling the message and trace masks and for informing RASIMaskChangeListener that a change has occurred in the object's message or trace mask.

RASMaskChangeGenerator also provides methods that allow it to know which RASIEvent classes it can query to learn the event type values that might be used in its message or trace masks. This information can also be presented to a graphical program to display these event types to an end user.

This class provides common function to loggers and handlers and is not intended to be instantiated directly. The RASLogger and Handler classes extend this class.

See Also:
Serialized Form

Fields inherited from interface com.ibm.ras.RASConstants
KEY_CLASS_NAME, KEY_CLIENT, KEY_COMPONENT, KEY_DATE_FORMAT, KEY_DEFAULT_HANDLERS, KEY_DEFAULT_MESSAGE_HANDLERS, KEY_DEFAULT_TRACE_HANDLERS, KEY_DESCRIPTION, KEY_ENCODING, KEY_EXCEPTION, KEY_EXCEPTION_TRACE, KEY_FILE_NAME, KEY_FORMATTER_NAMES, KEY_GROUP, KEY_HANDLER_NAMES, KEY_HEX_DATA, KEY_IS_CIRCULAR, KEY_IS_LOGGING, KEY_IS_SYNC, KEY_LOGGER, KEY_LOGGING_CLASS, KEY_LOGGING_METHOD, KEY_MAX_FILE_SIZE, KEY_MAX_FILES, KEY_MAX_QUEUE_SIZE, KEY_MESSAGE_EVENT_CLASSES, KEY_MESSAGE_FILE, KEY_MESSAGE_MASK, KEY_NAME, KEY_ORGANIZATION, KEY_PRODUCT, KEY_RETRY_INTERVAL, KEY_SEPARATOR, KEY_SERVER, KEY_SOCKET_PORT, KEY_SOCKET_SERVER, KEY_SUPPRESSED_KEYS, KEY_THREAD_ID, KEY_TIME_FORMAT, KEY_TRACE_EVENT_CLASSES, KEY_TRACE_MASK, RAS_VERSION
 
Constructor Summary
RASMaskChangeGenerator()
          Creates a RASMaskChangeGenerator.
RASMaskChangeGenerator(java.lang.String name)
          Creates a RASMaskChangeGenerator.
RASMaskChangeGenerator(java.lang.String name, java.lang.String desc)
          Creates a RASMaskChangeGenerator.
 
Method Summary
 void addMaskChangeListener(RASIMaskChangeListener listener)
          Adds an object that wishes to be informed of changes in the message or trace mask configuration.
 void addMessageEventClass(java.lang.String name)
          Adds the name of a message event class which this object uses.
 void addTraceEventClass(java.lang.String name)
          Adds the name of a trace event class which this object uses.
 void fireMaskChangedEvent(RASMaskChangeEvent mc)
          Tells all RASIMaskChangeListeners that the message or trace mask has been changed.
 java.util.Hashtable getConfig()
          Gets the configuration of this object.
 java.util.Enumeration getMaskChangeListeners()
          Gets the set of objects that wish to be informed of changes in the message or trace mask configuration.
 java.util.Enumeration getMessageEventClasses()
          Gets the set of message event classes which this object uses.
 long getMessageMask()
          Gets the mask which defines the set of message types that will be processed.
 java.util.Enumeration getTraceEventClasses()
          Gets the set of trace event classes which this object uses.
 long getTraceMask()
          Gets the mask which defines the set of trace types that will be processed.
protected  void init()
          Initializes this object, setting default values.
 long messageMaskLongValue(java.lang.String types)
          Gets a composite message mask by asking each of the registered event classes to convert its known mask strings to a long value.
 java.lang.String messageMaskToString(long types)
          Gets a composite message mask by asking each of the registered event classes to convert its known mask to a string value.
 void removeMaskChangeListener(RASIMaskChangeListener listener)
          Removes an object from the list that wishes to be informed of changes in the message or trace mask configuration.
 void removeMessageEventClass(java.lang.String name)
          Removes the name of a message event class from the list of classes which this object uses.
 void removeTraceEventClass(java.lang.String name)
          Removes the name of a trace event class from the list of classes which this object uses.
 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.
 long traceMaskLongValue(java.lang.String types)
          Gets a composite trace mask by asking each of the registered event classes to convert its known mask strings to a long value.
 java.lang.String traceMaskToString(long types)
          Gets a composite trace mask by asking each of the registered event classes to convert its known mask to a string value.
 
Methods inherited from class com.ibm.ras.RASObject
clone, getDescription, getGroup, getName, setDescription, setName
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.ras.RASIObject
getDescription, getGroup, getName, setDescription, setName
 

Constructor Detail

RASMaskChangeGenerator

public RASMaskChangeGenerator()
Creates a RASMaskChangeGenerator. The name and description of this object are empty strings.

RASMaskChangeGenerator

public RASMaskChangeGenerator(java.lang.String name)
Creates a RASMaskChangeGenerator. The description of this object is an empty string.
Parameters:
name - The name of this object.

RASMaskChangeGenerator

public RASMaskChangeGenerator(java.lang.String name,
                              java.lang.String desc)
Creates a RASMaskChangeGenerator.
Parameters:
name - The name of this object.
desc - The description of this object.
Method Detail

init

protected void init()
Initializes this object, setting default values.
Overrides:
init in class RASObject

getConfig

public java.util.Hashtable getConfig()
Gets the configuration of this object.
Specified by:
getConfig in interface RASIMaskChangeGenerator
Overrides:
getConfig in class RASObject
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.

messageEventClasses

A blank-delimited list of message event classes which this object uses.

traceEventClasses

A blank-delimited list of trace event classes which this object uses.

All values are Strings. The parent and extensions of this object may use 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 RASIMaskChangeGenerator
Overrides:
setConfig in class RASObject
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.

messageEventClasses

A blank-delimited list of message event classes which this object uses.

traceEventClasses

A blank-delimited list of trace event classes which this object uses.

All values are Strings. If a key is not found, an internal default for that element is set instead. The parent and extensions of this object may use 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.
Specified by:
getMessageMask in interface RASIMaskChangeGenerator
Returns:
The message 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 RASIMessageEvent TYPE_XXXX constants. The mask value is not validated against these types.
Specified by:
setMessageMask in interface RASIMaskChangeGenerator
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.
Specified by:
getTraceMask in interface RASIMaskChangeGenerator
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.
Specified by:
setTraceMask in interface RASIMaskChangeGenerator
Parameters:
mask - The trace mask.

addMaskChangeListener

public void addMaskChangeListener(RASIMaskChangeListener listener)
Adds an object that wishes to be informed of changes in the message or trace mask configuration. If the listener is null or is already registered, this method does nothing.
Specified by:
addMaskChangeListener in interface RASIMaskChangeGenerator
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 message or trace mask configuration. If the listener is null or is not registered, this method does nothing.
Specified by:
removeMaskChangeListener in interface RASIMaskChangeGenerator
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 message or trace mask configuration.
Specified by:
getMaskChangeListeners in interface RASIMaskChangeGenerator
Returns:
An Enumeration of mask change listeners. If no listeners are registered, the Enumeration is empty.

fireMaskChangedEvent

public void fireMaskChangedEvent(RASMaskChangeEvent mc)
Tells all RASIMaskChangeListeners that the message or trace mask has been changed.
Specified by:
fireMaskChangedEvent in interface RASIMaskChangeGenerator
Parameters:
mc - A mask change event, indicating what has changed.

addMessageEventClass

public void addMessageEventClass(java.lang.String name)
Adds the name of a message event class which this object uses. If the event class is null or is already registered, this method does nothing.
Specified by:
addMessageEventClass in interface RASIMaskChangeGenerator
Parameters:
name - The event class name.

removeMessageEventClass

public void removeMessageEventClass(java.lang.String name)
Removes the name of a message event class from the list of classes which this object uses. If the event class is null or is not registered, this method does nothing.
Specified by:
removeMessageEventClass in interface RASIMaskChangeGenerator
Parameters:
name - The event class name.

getMessageEventClasses

public java.util.Enumeration getMessageEventClasses()
Gets the set of message event classes which this object uses.
Specified by:
getMessageEventClasses in interface RASIMaskChangeGenerator
Returns:
An Enumeration of RAS event class names. If no event classes are registered, the Enumeration is empty.

addTraceEventClass

public void addTraceEventClass(java.lang.String name)
Adds the name of a trace event class which this object uses. If the event class is null or is already registered, this method does nothing.
Specified by:
addTraceEventClass in interface RASIMaskChangeGenerator
Parameters:
name - The event class name.

removeTraceEventClass

public void removeTraceEventClass(java.lang.String name)
Removes the name of a trace event class from the list of classes which this object uses. If the event class is null or is not registered, this method does nothing.
Specified by:
removeTraceEventClass in interface RASIMaskChangeGenerator
Parameters:
name - The event class name.

getTraceEventClasses

public java.util.Enumeration getTraceEventClasses()
Gets the set of trace event classes which this object uses.
Specified by:
getTraceEventClasses in interface RASIMaskChangeGenerator
Returns:
An Enumeration of RAS event class names. If no event classes are registered, the Enumeration is empty.

messageMaskLongValue

public long messageMaskLongValue(java.lang.String types)
Gets a composite message mask by asking each of the registered event classes to convert its known mask strings to a long value.
Parameters:
types - A blank-delimited list of event types.
Returns:
The mask value compiled from each registered event class.

messageMaskToString

public java.lang.String messageMaskToString(long types)
Gets a composite message mask by asking each of the registered event classes to convert its known mask to a string value.
Parameters:
types - A message or trace mask.
Returns:
The string corresponding to the event types.

traceMaskLongValue

public long traceMaskLongValue(java.lang.String types)
Gets a composite trace mask by asking each of the registered event classes to convert its known mask strings to a long value.
Parameters:
types - A blank-delimited list of event types.
Returns:
The mask value compiled from each registered event class.

traceMaskToString

public java.lang.String traceMaskToString(long types)
Gets a composite trace mask by asking each of the registered event classes to convert its known mask to a string value.
Parameters:
types - A message or trace mask.
Returns:
The string corresponding to the event types.