com.ibm.ras
Class RASMessageEvent

java.lang.Object
  |
  +--com.ibm.ras.RASEvent
        |
        +--com.ibm.ras.RASMessageEvent

public class RASMessageEvent
extends RASEvent
implements RASIMessageEvent

A RASMessageEvent encapsulates all of the information generated by a RASMessageLogger. It is not necessary to create a RASMessageEvent directly, as the message logger handles this task. However, the methods of this class are public, should it be necessary to extend RASMessageEvent.

A RASMessageEvent contains the following components:

The RASMessageEvent type is defined by the set of RASIMessageEvent.TYPE_XXXX constants. Values 0x0000L up to, but not including, 0x01000L are reserved. Extensions to the RASMessageEvent class may use values outside this range for additional types. The constant DEFAULT_MESSAGE_MASK contains the message types that the handlers log by default. It includes all message types.

See Also:
RASEvent, RASMessageLogger, RASHandler, Serialized Form

Constructor Summary
RASMessageEvent(long type, java.lang.String text, java.lang.String[] parms, java.lang.String messageFile, java.lang.String className, java.lang.String methodName, java.lang.String org, java.lang.String prod, java.lang.String comp, java.lang.String server, java.lang.String client, java.lang.Exception exception)
          Creates a RASMessageEvent.
 
Method Summary
 java.lang.String getMessageFile()
          Gets the base message file name used to format a message.
 java.util.Hashtable getSupportedTypes()
          Gets the complete set of event types supported by this class.
static long maskLongValue(java.lang.String types)
          Converts a String representation of the message mask to its long equivalent.
static java.lang.String maskToString(long types)
          Converts a long containing the logical OR of one or more RASIMessageEvent.TYPE_XXXX constants to its String equivalent.
 void setMessageFile(java.lang.String messageFile)
          Sets the base message file name used to format a message.
 
Methods inherited from class com.ibm.ras.RASEvent
getAttribute, getParameters, getText, getTimeStamp, getType, isMessageEvent, setAttribute, setMessageEvent, setParameters, setText, setTimeStamp, setType
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RASMessageEvent

public RASMessageEvent(long type,
                       java.lang.String text,
                       java.lang.String[] parms,
                       java.lang.String messageFile,
                       java.lang.String className,
                       java.lang.String methodName,
                       java.lang.String org,
                       java.lang.String prod,
                       java.lang.String comp,
                       java.lang.String server,
                       java.lang.String client,
                       java.lang.Exception exception)
Creates a RASMessageEvent. The caller is expected to provide a message type, key and, if needed, any Object parameters for the message text. If any of the other parameters are not needed, they must be set to an empty string ("") or null.
Parameters:
type - The message type.
text - The message text, or a message key if the message file is not null.
parms - An array of Strings to be displayed with the message.
messageFile - The base message file name.
className - The class.
methodName - The method.
org - The organization.
prod - The product.
comp - The component.
server - The server.
client - The client.
exception - An exception.
Method Detail

getMessageFile

public java.lang.String getMessageFile()
Gets the base message file name used to format a message.
Returns:
A message file name.

setMessageFile

public void setMessageFile(java.lang.String messageFile)
Sets the base message file name used to format a message.
Parameters:
messageFile - The message file names.

getSupportedTypes

public java.util.Hashtable getSupportedTypes()
Gets the complete set of event types supported by this class.

This method can be used by a graphical log manager to display the set of types and allow a user to select those to be monitored. Every extending class should override this method to add the types it supports to the Hashtable returned by its parent.

Returns:
A Hashtable containing the values of all of the event types. The names of the types are used as keys and are returned in the current locale. The type values, normally kept as longs, are returned as Longs because of the Hashtable requirement that all elements be Objects.
Overrides:
getSupportedTypes in class RASEvent

maskLongValue

public static long maskLongValue(java.lang.String types)
Converts a String representation of the message mask to its long equivalent. The string must have the following format:
 String types = "TYPE_INFO TYPE_WARN";
 
DEFAULT_MESSAGE_MASK may also be included in the string. (These values are the names of the RASIMessageEvent.TYPE_XXXX constants.) Every extending class should override this method to add the types it supports to the value returned by its parent.

Unknown values in the String are ignored.

Parameters:
types - The blank-delimited String to be converted.
Returns:
The long equivalent of the String, formed by the logical OR of each element in the String.

maskToString

public static java.lang.String maskToString(long types)
Converts a long containing the logical OR of one or more RASIMessageEvent.TYPE_XXXX constants to its String equivalent. The string will have the following format:
 String types = "TYPE_INFO TYPE_WARN";
 
Every extending class should override this method to add the types it supports to the value returned by its parent.

Unknown values in the long are ignored.

Parameters:
types - The message mask.
Returns:
The String equivalent of the message mask.