com.ibm.ras
Class RASSocketHandler

java.lang.Object
  |
  +--com.ibm.ras.RASObject
        |
        +--com.ibm.ras.RASHandler
              |
              +--com.ibm.ras.RASSocketHandler

public class RASSocketHandler
extends RASHandler

RASSocketHandler implements a RASHandler that writes to a TCP socket. If the server or port is changed through the setServer or setPort method, call the connect method to open a socket to the server.

The default server is "localhost" and the default port is 9991.

See Also:
RASHandler

Fields inherited from class com.ibm.ras.RASHandler
deviceOpen
 
Constructor Summary
RASSocketHandler()
          Creates a RASSocketHandler.
RASSocketHandler(java.lang.String name)
          Creates a RASSocketHandler.
RASSocketHandler(java.lang.String name, java.lang.String desc)
          Creates a RASSocketHandler.
RASSocketHandler(java.lang.String name, java.lang.String desc, java.lang.String server, int port)
          Creates a RASSocketHandler.
 
Method Summary
 java.util.Hashtable getConfig()
          Gets the configuration of this object.
 int getPort()
          Gets the port number of the TCP socket.
 java.lang.String getServer()
          Gets the server to which the handler connects.
 void openDevice()
          Opens the device to which the handler will send its log entries.
 void setConfig(java.util.Hashtable ht)
          Sets the configuration of this object.
 void setPort(int port)
          Sets the port number of the TCP socket.
 void setServer(java.lang.String server)
          Sets the name of the server to which the handler connects.
 
Methods inherited from class com.ibm.ras.RASHandler
addFormatter, addMaskChangeListener, getFormatters, getMaskChangeListeners, getMessageMask, getTraceMask, logEvent, removeFormatter, removeMaskChangeListener, run, setMessageMask, setTraceMask, stop, writeEvent
 
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
 

Constructor Detail

RASSocketHandler

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

RASSocketHandler

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

RASSocketHandler

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

RASSocketHandler

public RASSocketHandler(java.lang.String name,
                        java.lang.String desc,
                        java.lang.String server,
                        int port)
Creates a RASSocketHandler.
Parameters:
name - The name of this object.
desc - The description of this object.
server - The name of the server to which this handler connects.
port - The TCP port number on which this handler connects.
Method Detail

getConfig

public java.util.Hashtable getConfig()
Gets the configuration of this object.
Returns:
A Hashtable containing the configuration. This object inserts the following key/value pairs into the configuration:
         "port"   The TCP port on which this handler will connect.
         "server" The name of the server to which this handler
                  will connect.
         
All values are Strings. The parent and extensions of this object may add additional keys.
Overrides:
getConfig in class RASHandler

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.
Parameters:
ht - A Hashtable containing the configuration. This object searches for the following keys:
            "port"   The TCP port on which this handler will connect.
            "server" The name of the server to which this handler
                     will connect.
            
All values are Strings. If a key is not found, that configuration element is not updated. The parent and extensions of this object may add additional keys.
Overrides:
setConfig in class RASHandler

getPort

public int getPort()
Gets the port number of the TCP socket.
Returns:
The TCP port number on which the handler connects. If a port has not been set, the default 9991 is returned.

setPort

public void setPort(int port)
Sets the port number of the TCP socket.
Parameters:
port - The TCP port number on which the handler connects.

getServer

public java.lang.String getServer()
Gets the server to which the handler connects.
Returns:
The name of the server. If a server has not been set, the default "localhost" is returned.

setServer

public void setServer(java.lang.String server)
Sets the name of the server to which the handler connects. If the server name is null, the current server is not changed.
Parameters:
server - The name of the server.

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.

Overrides:
openDevice in class RASHandler