sdsu.logging
Class LoggerMessage

java.lang.Object
  |
  +--sdsu.logging.LoggerMessage
Direct Known Subclasses:
DebugMessage, ErrorMessage, LogMessage, WarningMessage

public abstract class LoggerMessage
extends java.lang.Object
implements Stringizable, java.io.Serializable

LoggerMessage and its subclasses are used by sdsu.logging.Logger. You only need to use this class directly when you are adding a new type of message to the logger. To create a new message type create a new subclass of this class. Pass the actual text of the message as an argument to the constructor of this class. Subclasses must implement the method getMessageType(). You also may wish to override the displayString saveString methods if you wish a different display output for your new message type.

The logging system is based on the logging pattern by Neil Harrison in Pattern Languages of Program Design 3 Eds Martin, Riehle, Buschman, 1998, pp 277-289

Version:
1.0 3 January 1998
Author:
Roger Whitney (whitney@cs.sdsu.edu)
See Also:
Logger, DebugMessage, Serialized Form

Constructor Summary
LoggerMessage(java.lang.String message)
           
 
Method Summary
 java.lang.String displayString()
          Displays a string to be displayed on the screen for this message.
 void fromString(java.lang.String objectString)
          Converts a string to an object.
abstract  java.lang.String getMessageType()
          Returns the type of the message.
 LabeledData getMetaData()
          MetaData for Message contains key-value pair "class=objectClassName".
 java.lang.String logString()
          Displays a string to be saved in a log for this message.
 void setMetaData(LabeledData metaData)
          Required by Stringizable.
 java.lang.String toString()
          Used in sending message to remote loggers.
 java.lang.String toString(java.lang.String header)
          Converts the object to a string with given header information.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LoggerMessage

public LoggerMessage(java.lang.String message)
Method Detail

getMessageType

public abstract java.lang.String getMessageType()
Returns the type of the message.

fromString

public void fromString(java.lang.String objectString)
                throws ConversionException
Converts a string to an object. Used in sending message to remote loggers.
Specified by:
fromString in interface Stringizable
Throws:
ConversionException - If there is a problem converting to object.

setMetaData

public void setMetaData(LabeledData metaData)
Required by Stringizable. Messages does not require metadata internally.
Specified by:
setMetaData in interface Stringizable

getMetaData

public LabeledData getMetaData()
MetaData for Message contains key-value pair "class=objectClassName". Used to recreate proper message object by remote loggers.
Specified by:
getMetaData in interface Stringizable

toString

public java.lang.String toString()
Used in sending message to remote loggers.
Specified by:
toString in interface Stringizable
Overrides:
toString in class java.lang.Object

toString

public java.lang.String toString(java.lang.String header)
Converts the object to a string with given header information. Used in sending message to remote loggers.
Specified by:
toString in interface Stringizable

displayString

public java.lang.String displayString()
Displays a string to be displayed on the screen for this message.

logString

public java.lang.String logString()
Displays a string to be saved in a log for this message.