com.ibm.websphere.ras
Class WsHandler

java.lang.Object
  |
  +--com.ibm.websphere.ras.WsHandler
All Implemented Interfaces:
RASIHandler, RASIMaskChangeGenerator, RASIObject, java.io.Serializable

public class WsHandler
extends java.lang.Object
implements RASIHandler

The purpose of this class is to serve as an opaque placeholder for the virtual WebSphere Handler object that each message and trace logger contain by default. It is documented that users are not allowed to call methods on this Handler.

When a message or trace logger is retrieved from the Manager class, by default a WebSphere Handler is installed in the logger. For efficiency purposes as well as security, we do not install a real Handler. Instead the logger calls the native ras subsystem as appropriate.

We do allow customers to get a reference to this Handler and remove it if they so desire. Once removed the handler cannot be reinserted. We track this in the logger classes themselves. When the user calls getAllHandlers() on a logger, we add a reference to this opaque object to the returned Hashtable. When the user removes a Handler, we sample the class of the handler and if it is of this class, we set the boolean to indicate the Handler has been removed. For subsequent calls to getAllHandlers, we will not add a reference to the returned Hashtable.

See Also:
Serialized Form

Method Summary
 void addFormatter(RASIFormatter formatter)
          Registers a RAS event formatter with this handler.
 void addMaskChangeListener(RASIMaskChangeListener listener)
          Add a RASIMaskChangeListener object to the list of listeners that wish to be notified when either the trace or message mask for this Handler object changes state.
 void addMessageEventClass(java.lang.String name)
          Add the name of a message event class which this object uses.
 void addTraceEventClass(java.lang.String name)
          Add the name of a trace event class which this object uses.
 void closeDevice()
          Close the device to which the handler is sending its log entries, if it is open.
 void fireMaskChangedEvent(RASMaskChangeEvent mc)
          Inform all RASIMaskChangeListener objects that have registered to be notified when either the trace or message mask for this object changes state that such a state change has occurred.
 java.util.Hashtable getConfig()
          The getConfig method required by the RASIObject interface.
 java.lang.String getDescription()
          Get the description of this object.
 java.util.Enumeration getFormatters()
          Return an Enumeration over the list of RASIFormatters maintained by this RASIHandlers.
 java.lang.String getGroup()
          Get the name of the RASManager group with which this object is associated.
 java.util.Enumeration getMaskChangeListeners()
          Return an enumeration over the list of RASIMaskChangeListener objects that have registered to be notified when either the trace or message mask for this object changes state.
 int getMaximumQueueSize()
          Return the maximum number of RASIEvents which this Handler will cache.
 java.util.Enumeration getMessageEventClasses()
          Return an Enumeration over the list of MessageEvent classes this object uses.
 long getMessageMask()
          Return the current state of the message mask for this Handler.
 java.lang.String getName()
          Return the name by which this object is known.
 int getQueueSize()
          Get the current number of RASIEvents in this handler's queue.
 int getRetryInterval()
          Get the amount of time (in milliseconds) that this handler will wait before retrying a failed write.
 java.util.Enumeration getTraceEventClasses()
          Return an Enumeration over the list of MessageEvent classes this object uses.
 long getTraceMask()
          Return the current state of the trace mask for this Handler.
 void logEvent(RASIEvent event)
          Pass a RAS event to the Handler to log in an asynchronous manner, if the Handler supports asynchronous logging.
 void openDevice()
          Open the device to which the handler will send its log entries.
 void removeFormatter(RASIFormatter formatter)
          Remove the specified RAS event formatter from the list of formatters maintained by this handler.
 void removeMaskChangeListener(RASIMaskChangeListener listener)
          Remove the specified RASIMaskChangeListener object from the list of listeners that wish to be notified when either the trace or message mask for this Handler object changes state.
 void removeMessageEventClass(java.lang.String name)
          Remove the name of a message event class from the list of classes which this object uses.
 void removeTraceEventClass(java.lang.String name)
          Remove the name of a trace event class from the list of classes which this object uses.
 void setConfig(java.util.Hashtable ht)
          The setConfig method required by the RASIObject interface.
 void setDescription(java.lang.String desc)
          Set the description of this object.
 void setMaximumQueueSize(int size)
          Set the maximum number of RASIEvents which this handler will hold.
 void setMessageMask(long mask)
          Set the state of the message mask for this Handler to the specified value.
 void setName(java.lang.String name)
          Set the name by which this object is known.
 void setRetryInterval(int interval)
          Set the amount of time (in milliseconds) that this handler will wait before retrying a failed write.
 void setTraceMask(long mask)
          Set the state of the trace mask for this Handler.
 void stop()
          Stop the handler.
 void writeEvent(RASIEvent event)
          Pass a RAS event to the Handler to log in a synchronous manner.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getConfig

public java.util.Hashtable getConfig()
The getConfig method required by the RASIObject interface.

WebSphere Handlers do not support Hashtable-based configuration methods.

Specified by:
getConfig in interface RASIHandler
Returns:
null.

setConfig

public void setConfig(java.util.Hashtable ht)
The setConfig method required by the RASIObject interface.

WebSphere Handlers do not support Hashtable-based configuration methods. This method is a no-operation.

Specified by:
setConfig in interface RASIHandler
Parameters:
ht - a Hashtable or null. Input is ignored.

getName

public java.lang.String getName()
Return the name by which this object is known.

Specified by:
getName in interface RASIObject
Returns:
null is always returned.

setName

public void setName(java.lang.String name)
Set the name by which this object is known.

This method is a no operation.

Specified by:
setName in interface RASIObject
Parameters:
name - The name of this object. Input is ignored.

getDescription

public java.lang.String getDescription()
Get the description of this object.

Specified by:
getDescription in interface RASIObject
Returns:
null is always returned.

setDescription

public void setDescription(java.lang.String desc)
Set the description of this object.

This method is a no-operation.

Specified by:
setDescription in interface RASIObject
Parameters:
desc - The description of this object.

getGroup

public java.lang.String getGroup()
Get the name of the RASManager group with which this object is associated. (This method is only used by the RAS Manager.)

Specified by:
getGroup in interface RASIObject
Returns:
null is always returned.

getMessageMask

public long getMessageMask()
Return the current state of the message mask for this Handler.

Specified by:
getMessageMask in interface RASIMaskChangeGenerator
Returns:
0.

setMessageMask

public void setMessageMask(long mask)
Set the state of the message mask for this Handler to the specified value.

The WebSphere Handler ignores this operation.

Specified by:
setMessageMask in interface RASIMaskChangeGenerator
Parameters:
mask - This value is ignored.

getTraceMask

public long getTraceMask()
Return the current state of the trace mask for this Handler.

Specified by:
getTraceMask in interface RASIMaskChangeGenerator
Returns:
0

setTraceMask

public void setTraceMask(long mask)
Set the state of the trace mask for this Handler.

The WebSphere Handler ignores this operation.

Specified by:
setTraceMask in interface RASIMaskChangeGenerator
Parameters:
mask - This value is ignored.

addMaskChangeListener

public void addMaskChangeListener(RASIMaskChangeListener listener)
Add a RASIMaskChangeListener object to the list of listeners that wish to be notified when either the trace or message mask for this Handler object changes state.

This operation is ignored.

Specified by:
addMaskChangeListener in interface RASIMaskChangeGenerator
Parameters:
listener - The listener as specified by the caller. May be null

removeMaskChangeListener

public void removeMaskChangeListener(RASIMaskChangeListener listener)
Remove the specified RASIMaskChangeListener object from the list of listeners that wish to be notified when either the trace or message mask for this Handler object changes state.

This operation is ignored.

Specified by:
removeMaskChangeListener in interface RASIMaskChangeGenerator
Parameters:
listener - the listener as specified by the caller. May be null

getMaskChangeListeners

public java.util.Enumeration getMaskChangeListeners()
Return an enumeration over the list of RASIMaskChangeListener objects that have registered to be notified when either the trace or message mask for this object changes state.

Specified by:
getMaskChangeListeners in interface RASIMaskChangeGenerator
Returns:
an empty enumeration.

fireMaskChangedEvent

public void fireMaskChangedEvent(RASMaskChangeEvent mc)
Inform all RASIMaskChangeListener objects that have registered to be notified when either the trace or message mask for this object changes state that such a state change has occurred.

This operation is ignored.

Specified by:
fireMaskChangedEvent in interface RASIMaskChangeGenerator
Parameters:
mc - A mask change event, indicating what has changed.

addMessageEventClass

public void addMessageEventClass(java.lang.String name)
Add the name of a message event class which this object uses.

This method is a no-operation.

Specified by:
addMessageEventClass in interface RASIMaskChangeGenerator
Parameters:
name - The event class name.

removeMessageEventClass

public void removeMessageEventClass(java.lang.String name)
Remove the name of a message event class from the list of classes which this object uses.

This method is a no-operation.

Specified by:
removeMessageEventClass in interface RASIMaskChangeGenerator
Parameters:
name - The event class name.

getMessageEventClasses

public java.util.Enumeration getMessageEventClasses()
Return an Enumeration over the list of MessageEvent classes this object uses.

Specified by:
getMessageEventClasses in interface RASIMaskChangeGenerator
Returns:
an empty Enumeration.

addTraceEventClass

public void addTraceEventClass(java.lang.String name)
Add the name of a trace event class which this object uses.

This method is a no operation.

Specified by:
addTraceEventClass in interface RASIMaskChangeGenerator
Parameters:
name - The event class name.

removeTraceEventClass

public void removeTraceEventClass(java.lang.String name)
Remove the name of a trace event class from the list of classes which this object uses.

This method is a no operation.

Specified by:
removeTraceEventClass in interface RASIMaskChangeGenerator
Parameters:
name - The event class name.

getTraceEventClasses

public java.util.Enumeration getTraceEventClasses()
Return an Enumeration over the list of MessageEvent classes this object uses.

Since this Handler does not support trace events, an empty Enumeration is always returned.

Specified by:
getTraceEventClasses in interface RASIMaskChangeGenerator
Returns:
an empty Enumeration.

getMaximumQueueSize

public int getMaximumQueueSize()
Return the maximum number of RASIEvents which this Handler will cache.

Specified by:
getMaximumQueueSize in interface RASIHandler
Returns:
0

setMaximumQueueSize

public void setMaximumQueueSize(int size)
                         throws java.lang.IllegalStateException
Set the maximum number of RASIEvents which this handler will hold.

This operation is ignored.

Specified by:
setMaximumQueueSize in interface RASIHandler
Parameters:
size - The maximum queue size.
Throws:
java.lang.IllegalStateException - is required on the method signature. However, this exception is never thrown by the implementation.

getRetryInterval

public int getRetryInterval()
Get the amount of time (in milliseconds) that this handler will wait before retrying a failed write.

Specified by:
getRetryInterval in interface RASIHandler
Returns:
0

setRetryInterval

public void setRetryInterval(int interval)
Set the amount of time (in milliseconds) that this handler will wait before retrying a failed write.

This method is a no-operation.

Specified by:
setRetryInterval in interface RASIHandler
Parameters:
interval - the new value for the retry interval

getQueueSize

public int getQueueSize()
Get the current number of RASIEvents in this handler's queue.

Specified by:
getQueueSize in interface RASIHandler
Returns:
0

addFormatter

public void addFormatter(RASIFormatter formatter)
Registers a RAS event formatter with this handler.

This method is a no-operations

Specified by:
addFormatter in interface RASIHandler
Parameters:
formatter - The event formatter. May be null.

removeFormatter

public void removeFormatter(RASIFormatter formatter)
Remove the specified RAS event formatter from the list of formatters maintained by this handler.

This method is a no operation.

Specified by:
removeFormatter in interface RASIHandler
Parameters:
formatter - The event formatter. May be null.

getFormatters

public java.util.Enumeration getFormatters()
Return an Enumeration over the list of RASIFormatters maintained by this RASIHandlers.

Specified by:
getFormatters in interface RASIHandler
Returns:
an empty enumeration.

openDevice

public void openDevice()
Open the device to which the handler will send its log entries.

This method is a no-operation.

Specified by:
openDevice in interface RASIHandler

closeDevice

public void closeDevice()
Close the device to which the handler is sending its log entries, if it is open.

This method is a no-operation.

Specified by:
closeDevice in interface RASIHandler

stop

public void stop()
Stop the handler.

This method is a no-operation.

Specified by:
stop in interface RASIHandler

logEvent

public void logEvent(RASIEvent event)
Pass a RAS event to the Handler to log in an asynchronous manner, if the Handler supports asynchronous logging.

This method is a no-operation.

Specified by:
logEvent in interface RASIHandler
Parameters:
event - A RAS event whose message type is currently being processed by this Handler. Null is tolerated.

writeEvent

public void writeEvent(RASIEvent event)
Pass a RAS event to the Handler to log in a synchronous manner.

This method is a no-operation.

Specified by:
writeEvent in interface RASIHandler
Parameters:
event - A RAS event whose message type is currently being processed by this Handler. Null is tolerated.