|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.ras.RASObject | +--com.ibm.ras.RASHandler
RASHandler
implements the RASIHandler
interface and is the parent of all classes which process
the output of the RASLogger
classes.
At least one RASHandler
must be associated with
each RASLogger
. This is done through the
RASLogger.addHandler
method.
Each handler operates on its own thread so that log entries can be sent
to their destination at whatever rate the transport can manage. This
means that an application, for example, does not have to wait for each trace
event to be written to disk as it runs. The message and trace data is
accepted from the loggers in the form of RASIEvent
objects.
These are simply an encapsulation of the message or trace data that the
application creates through the RASLogger
methods.
It is possible to direct both message and trace data to the same destination (the console or a socket, for example). However, it is certainly possible to configure separate handlers to direct message and trace data to different destinations (two separate files, for example).
Each event class which a handler processes may be associated with a
formatter, which defines the presentation of the log entries. The use of a
formatter depends on the function of the handler. For example, if the
handler directs data to the console, it should be formatted. However, if
the handler is designed to serialize the message or trace data and transport
it across a network, formatting may not be required. The
RASHandler write
methods require a formatter, but may be
overridden if desired.
(Because a formatter is not required, the methods to get and set the
message and trace formatters are not included in the
RASIHandler
interface, which this object implements.)
RASMessageFormatter
and RASTraceFormatter
are
automatically registered to process the RASMessageEvent
and
RASTraceEvent
classes, respectively.
RASIHandler
,
RASConsoleHandler
,
RASFileHandler
,
RASSocketHandler
,
RASLogger
,
RASEvent
,
RASMessageFormatter
,
RASTraceFormatter
Field Summary | |
boolean |
deviceOpen
A flag which indicates whether the device to which this handler sends log entries is open. |
Constructor Summary | |
RASHandler()
Creates a RASHandler . |
|
RASHandler(java.lang.String name)
Creates a RASHandler . |
|
RASHandler(java.lang.String name,
java.lang.String desc)
Creates a RASHandler . |
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. |
abstract 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 |
run()
Processes any log event objects placed on the handler's queue by a logger. |
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 class com.ibm.ras.RASObject |
getDescription,
getName,
setDescription,
setName |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public boolean deviceOpen
true
when the device is open and
false
otherwise.Constructor Detail |
public RASHandler()
RASHandler
. The name and description of
this object are empty strings.public RASHandler(java.lang.String name)
RASHandler
. The description of this object
is an empty string.name
- The name of this object.public RASHandler(java.lang.String name, java.lang.String desc)
RASHandler
.name
- The name of this object.desc
- The description of this object.Method Detail |
public java.util.Hashtable getConfig()
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
.
The parent and extensions of this object may use additional keys.public void setConfig(java.util.Hashtable ht)
RASManager
to initialize a RAS object. It should not
be necessary for an application to use this method.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.
The parent and extensions of this object may use additional keys.public long getMessageMask()
RASIMessageEvent.TYPE_XXXX
constants.public void setMessageMask(long mask)
RASIMessageEvent.TYPE_XXXX
constants.
The mask value is not validated against these types.mask
- The message mask.public long getTraceMask()
RASITraceEvent.TYPE_XXXX
constants.public void setTraceMask(long mask)
RASITraceEvent.TYPE_XXXX
constants.
The mask value is not validated against these types.mask
- The trace mask.public void addMaskChangeListener(RASIMaskChangeListener listener)
null
or is already registered, this method does nothing.listener
- The mask change listener.public void removeMaskChangeListener(RASIMaskChangeListener listener)
null
or is not registered, this method does
nothing.listener
- The mask change listener.public java.util.Enumeration getMaskChangeListeners()
Enumeration
of mask change listeners. If
no listeners are registered, the Enumeration
is empty.public void addFormatter(RASIFormatter formatter)
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.formatter
- The event formatter.public void removeFormatter(RASIFormatter formatter)
null
or is not registered, this
method does nothing.formatter
- The event formatter.public java.util.Enumeration getFormatters()
Enumeration
of registered formatters. If no
formatters have been registered, the Enumeration
is empty.public void run()
public void stop()
public abstract void openDevice()
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.
public void logEvent(RASIEvent event)
null
,
this method does nothing.event
- A RAS event.public void writeEvent(RASIEvent event)
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.event
- A RAS event.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |