org.jcoderz.commons
Class LogMessageInfoImpl

java.lang.Object
  extended by org.jcoderz.commons.LogMessageInfoImpl
All Implemented Interfaces:
Serializable, LogMessageInfo
Direct Known Subclasses:
CfgLogMessage, CmnLogMessage, ConLogMessage, RteLogMessage, TssLogMessage, TstLogMessage

public abstract class LogMessageInfoImpl
extends Object
implements LogMessageInfo

This abstract class implements the interface LogMessageInfo.

All parameters are stored as immutable fields. Besides the parameters from the interface, an (unique) error id must be supplied during construction.

Author:
Michael Griffel
See Also:
Serialized Form

Constructor Summary
protected LogMessageInfoImpl(String symbol, int id, Level level, String text, String solution, BusinessImpact businessImpact, Category category, String[] params, String appName, String appNameAbbr, String groupName, String groupNameAbbr)
           
 
Method Summary
 StringBuffer formatMessage(Map parameters, StringBuffer buffer)
          Fills the detail message into the given string buffer with it's parameters substituted.
 String getAppName()
          Returns the application name as string.
 String getAppNameAbbreviation()
          Returns the application name abbreviation as string.
 BusinessImpact getBusinessImpact()
          Returns the possible business impact of the event that triggered this message to be dumped.
 Category getCategory()
          Returns the category of the event that triggered this message to be dumped.
 String getGroupName()
          Returns the group name as string.
 String getGroupNameAbbreviation()
          Returns the group name abbreviation as string.
 Level getLogLevel()
          Returns the log level that should be used (by default) for this message.
 String getMessagePattern()
          Returns the message pattern used to create detailed messages for this message type.
 List getParameterList()
          Returns a List of Strings containing the name of the parameters that are used by this message.
 String getSolution()
          Returns a string describing the possible solution for this message.
 String getSymbol()
          Returns the symbolic name for this log message info.
 int toInt()
          Returns the (unique) integer representation of the log message info.
 String toString()
          Returns the string representation of the log message info.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LogMessageInfoImpl

protected LogMessageInfoImpl(String symbol,
                             int id,
                             Level level,
                             String text,
                             String solution,
                             BusinessImpact businessImpact,
                             Category category,
                             String[] params,
                             String appName,
                             String appNameAbbr,
                             String groupName,
                             String groupNameAbbr)
Method Detail

toInt

public final int toInt()
Returns the (unique) integer representation of the log message info. This integer representation is also called the error identifier an is constructed as defined below:
               +=========+=========+=========+=========+
 ID (32 bit) : |0XXX XXXX|YYYY YYYY|ZZZZ ZZZZ|ZZZZ ZZZZ|
               +=========+=========+=========+=========+

               XXX (7 bit)  -> application @id
               YYY (8 bit)  -> group @id
               ZZZ (16 bit) -> message @id
 
Note: This value should also be printed in its hexadecimal string representation since it could then be easily masked by human readers.

Specified by:
toInt in interface LogMessageInfo
Returns:
the integer representation of the log message info.

toString

public final String toString()
Returns the string representation of the log message info. This is the symbolic string representation as defined in the parameter symbol during construction.

Overrides:
toString in class Object
Returns:
the string representation of the log message info.
See Also:
Object.toString()

getSymbol

public final String getSymbol()
Returns the symbolic name for this log message info.

Specified by:
getSymbol in interface LogMessageInfo
Returns:
the symbolic name for this log message info.

getLogLevel

public final Level getLogLevel()
Returns the log level that should be used (by default) for this message.

Specified by:
getLogLevel in interface LogMessageInfo
Returns:
the log level that should be used (by default) for this message.

getMessagePattern

public final String getMessagePattern()
Returns the message pattern used to create detailed messages for this message type. The string can contain parameters as described for MessageFormat. The order of the parameters is given by the parameter list LogMessageInfo.getParameterList().

Specified by:
getMessagePattern in interface LogMessageInfo
Returns:
the detailed message for this message type with no parameters substituted.

formatMessage

public final StringBuffer formatMessage(Map parameters,
                                        StringBuffer buffer)
Fills the detail message into the given string buffer with it's parameters substituted.

Specified by:
formatMessage in interface LogMessageInfo
Parameters:
parameters - The map of parameters to be substituted.
buffer - the StringBuffer to be filled.
Returns:
the buffer argument.

getSolution

public final String getSolution()
Returns a string describing the possible solution for this message. This might also contain a descriptive text about the reason.

Specified by:
getSolution in interface LogMessageInfo
Returns:
a string describing the possible solution for this message.

getBusinessImpact

public final BusinessImpact getBusinessImpact()
Returns the possible business impact of the event that triggered this message to be dumped.

Specified by:
getBusinessImpact in interface LogMessageInfo
Returns:
the possible business impact of the event that triggered this message to be dumped.

getCategory

public final Category getCategory()
Returns the category of the event that triggered this message to be dumped.

Specified by:
getCategory in interface LogMessageInfo
Returns:
the category of the event that triggered this message to be dumped.

getParameterList

public final List getParameterList()
Returns a List of Strings containing the name of the parameters that are used by this message. The order of the parameter must accord to the parameters used in the message pattern.

Specified by:
getParameterList in interface LogMessageInfo
Returns:
list of possible parameter names (Strings).

getAppName

public String getAppName()
Returns the application name as string.

Specified by:
getAppName in interface LogMessageInfo
Returns:
the application name as string.

getAppNameAbbreviation

public String getAppNameAbbreviation()
Returns the application name abbreviation as string.

Specified by:
getAppNameAbbreviation in interface LogMessageInfo
Returns:
the application name abbreviation as string.

getGroupName

public String getGroupName()
Returns the group name as string.

Specified by:
getGroupName in interface LogMessageInfo
Returns:
the group name as string.

getGroupNameAbbreviation

public String getGroupNameAbbreviation()
Returns the group name abbreviation as string.

Specified by:
getGroupNameAbbreviation in interface LogMessageInfo
Returns:
the group name abbreviation as string.


Copyright 2007 The jCoderZ Project.