com.netscape.certsrv.logging
Class SignedAuditEvent

java.lang.Object
  extended by com.netscape.certsrv.logging.SignedAuditEvent
All Implemented Interfaces:
IBundleLogEvent, ILogEvent, java.io.Serializable

public class SignedAuditEvent
extends java.lang.Object
implements IBundleLogEvent

The log event object that carries message detail of a log event that goes into the Signed Audit Event log. This log has the property of being digitally signed for security considerations.

Version:
$Revision: 1211 $, $Date: 2010-08-18 10:15:37 -0700 (Wed, 18 Aug 2010) $
See Also:
MessageFormat, LogResources, Serialized Form

Field Summary
protected  java.lang.Object[] mParams
           
 
Constructor Summary
SignedAuditEvent(java.lang.Exception e)
          Constructs a message from a base exception.
SignedAuditEvent(java.lang.String msgFormat)
          Constructs a SignedAuditEvent message event.
SignedAuditEvent(java.lang.String msgFormat, java.lang.Exception exception)
          Constructs a message from an exception.
SignedAuditEvent(java.lang.String msgFormat, java.lang.Object[] params)
          Constructs a message event with a list of parameters that will be substituted into the message format.
SignedAuditEvent(java.lang.String msgFormat, java.lang.String param)
          Constructs a message with a parameter.
 
Method Summary
protected  java.lang.String getBundleName()
          Retrieves bundle name.
 java.lang.String getEventType()
          Retrieves log event type.
 int getLevel()
          Retrieves log level.
 java.lang.String getMessage()
          Returns the current message format string.
 boolean getMultiline()
          Retrieves log multiline attribute.
 int getNTEventType()
          Retrieves NT specific log event type.
 java.lang.Object[] getParameters()
          Returns a list of parameters.
 int getSource()
          Retrieves log source.
 long getTimeStamp()
          Retrieves event time stamp.
 void setBundleName(java.lang.String bundle)
          Sets the resource bundle name for this class instance.
 void setEventType(java.lang.String eventType)
          Sets log event type.
 void setLevel(int level)
          Sets log level, NT log event type.
 void setMultiline(boolean multiline)
          Sets log multiline attribute.
 void setSource(int source)
          Sets log source.
 java.lang.String toContent()
          Returns localized message string.
 java.lang.String toContent(java.util.Locale locale)
          Returns the string based on the given locale.
 java.lang.String toString()
          Return string representation of log message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mParams

protected java.lang.Object[] mParams
Constructor Detail

SignedAuditEvent

public SignedAuditEvent(java.lang.String msgFormat)
Constructs a SignedAuditEvent message event.

Parameters:
msgFormat - The message string.

SignedAuditEvent

public SignedAuditEvent(java.lang.String msgFormat,
                        java.lang.String param)
Constructs a message with a parameter. For example,
                new SignedAuditEvent("failed to load {0}", fileName);
 

Parameters:
msgFormat - Details in message string format.
param - Message string parameter.

SignedAuditEvent

public SignedAuditEvent(java.lang.String msgFormat,
                        java.lang.Exception exception)
Constructs a message from an exception. It can be used to carry a signed audit exception that may contain information about the context. For example,
                try {
                ...
                } catch (IOExeption e) {
                        logHandler.log(new SignedAuditEvent("Encountered Signed Audit Error {0}", e);
      }
 

Parameters:
msgFormat - Exception details in message string format.
exception - System exception.

SignedAuditEvent

public SignedAuditEvent(java.lang.Exception e)
Constructs a message from a base exception. This will use the msgFormat from the exception itself.
                try {
                ...
                } catch (Exception e) {
                        logHandler.log(new SignedAuditEvent(e));
      }
 

Parameters:
e - CMS exception.

SignedAuditEvent

public SignedAuditEvent(java.lang.String msgFormat,
                        java.lang.Object[] params)
Constructs a message event with a list of parameters that will be substituted into the message format.

Parameters:
msgFormat - Message string format.
params - List of message format parameters.
Method Detail

getMessage

public java.lang.String getMessage()
Returns the current message format string.

Returns:
Details message.

getParameters

public java.lang.Object[] getParameters()
Returns a list of parameters. These parameters can be used to assist in formatting the message.

Returns:
List of message format parameters.

toContent

public java.lang.String toContent()
Returns localized message string. This method should only be called if a localized string is necessary.

Specified by:
toContent in interface ILogEvent
Returns:
Details message.

toContent

public java.lang.String toContent(java.util.Locale locale)
Returns the string based on the given locale.

Specified by:
toContent in interface ILogEvent
Parameters:
locale - Locale.
Returns:
Details message.

setBundleName

public void setBundleName(java.lang.String bundle)
Sets the resource bundle name for this class instance. This should be overridden by subclasses who have their own resource bundles.

Specified by:
setBundleName in interface IBundleLogEvent
Parameters:
bundle - String with name of resource bundle.

getBundleName

protected java.lang.String getBundleName()
Retrieves bundle name.

Returns:
String with name of resource bundle.

getSource

public int getSource()
Retrieves log source. This is an id of the subsystem responsible for creating the log event.

Specified by:
getSource in interface ILogEvent
Returns:
Integer source id.

setSource

public void setSource(int source)
Sets log source.

Parameters:
source - Integer id of log source.

getLevel

public int getLevel()
Retrieves log level. The log level of an event represents its relative importance or severity within CMS.

Specified by:
getLevel in interface ILogEvent
Returns:
Integer log level value.

getNTEventType

public int getNTEventType()
Retrieves NT specific log event type.

Specified by:
getNTEventType in interface ILogEvent
Returns:
Integer NTEventType value.

setLevel

public void setLevel(int level)
Sets log level, NT log event type. For certain log levels the NT log event type gets set as well.

Parameters:
level - Integer log level value.

getMultiline

public boolean getMultiline()
Retrieves log multiline attribute.

Specified by:
getMultiline in interface ILogEvent
Returns:
Boolean whether or not this event is multiline. A multiline message simply consists of more than one line.

setMultiline

public void setMultiline(boolean multiline)
Sets log multiline attribute. A multiline message consists of more than one line.

Parameters:
multiline - Boolean multiline value.

getTimeStamp

public long getTimeStamp()
Retrieves event time stamp.

Specified by:
getTimeStamp in interface ILogEvent
Returns:
Long integer of the time the event was created.

getEventType

public java.lang.String getEventType()
Retrieves log event type. Each type of event has an associated String type value.

Specified by:
getEventType in interface ILogEvent
Returns:
String containing the type of event.

setEventType

public void setEventType(java.lang.String eventType)
Sets log event type. Each type of event has an associated String type value.

Specified by:
setEventType in interface ILogEvent
Parameters:
eventType - String containing the type of event.

toString

public java.lang.String toString()
Return string representation of log message.

Overrides:
toString in class java.lang.Object
Returns:
String containing log message.