Class TextFormattedLogMessage
- java.lang.Object
-
- com.unboundid.ldap.sdk.unboundidds.logs.v2.text.TextFormattedLogMessage
-
- All Implemented Interfaces:
LogMessage
,java.io.Serializable
- Direct Known Subclasses:
TextFormattedAccessLogMessage
@NotExtensible @NotMutable @ThreadSafety(level=INTERFACE_THREADSAFE) public class TextFormattedLogMessage extends java.lang.Object implements LogMessage
This class provides a data structure that holds information about a text-formatted log message in the name=value format used by the Ping Identity Directory Server and related server products.
NOTE: This class, and other classes within the
com.unboundid.ldap.sdk.unboundidds
package structure, are only supported for use against Ping Identity, UnboundID, and Nokia/Alcatel-Lucent 8661 server products. These classes provide support for proprietary functionality or for external specifications that are not considered stable or mature enough to be guaranteed to work in an interoperable way with other types of LDAP servers.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
NO_FIELD_NAME
A predefined string that will be used if a field exists in a log message with just a value but no field name.
-
Constructor Summary
Constructors Modifier Constructor Description protected
TextFormattedLogMessage(TextFormattedLogMessage message)
Creates a new text-formatted log message from the provided parsed message.TextFormattedLogMessage(java.lang.String logMessageString)
Creates a new text-formatted log message from the provided string.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Boolean
getBoolean(LogField logField)
Retrieves the value of the specified field as aBoolean
object.java.lang.Double
getDouble(LogField logField)
Retrieves the value of the specified field as aDouble
value.java.util.Map<java.lang.String,java.util.List<java.lang.String>>
getFields()
Retrieves a map of the fields and their corresponding values in this log message.java.util.Date
getGeneralizedTime(LogField logField)
Retrieves the value of the specified field as aDate
object decoded from the generalized time format.java.lang.Integer
getInteger(LogField logField)
Retrieves the value of the specified field as anInteger
value.java.lang.Long
getLong(LogField logField)
Retrieves the value of the specified field as aLong
value.java.util.Date
getRFC3339Timestamp(LogField logField)
Retrieves the value of the specified field as aDate
object decoded from the ISO 8601 format described in RFC 3339.java.lang.String
getString(LogField logField)
Retrieves the value of the specified field as a string.java.util.Date
getTimestamp()
Retrieves the timestamp for this log message.java.lang.String
toString()
Retrieves a string representation of this log message.
-
-
-
Field Detail
-
NO_FIELD_NAME
@NotNull protected static final java.lang.String NO_FIELD_NAME
A predefined string that will be used if a field exists in a log message with just a value but no field name.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TextFormattedLogMessage
protected TextFormattedLogMessage(@NotNull TextFormattedLogMessage message)
Creates a new text-formatted log message from the provided parsed message.- Parameters:
message
- The message to use to create this log message. It must not benull
.
-
TextFormattedLogMessage
public TextFormattedLogMessage(@NotNull java.lang.String logMessageString) throws LogException
Creates a new text-formatted log message from the provided string.- Parameters:
logMessageString
- The string representation of this log message. It must not benull
.- Throws:
LogException
- If the provided string cannot be parsed as a valid text-formatted log message.
-
-
Method Detail
-
getTimestamp
@NotNull public final java.util.Date getTimestamp()
Retrieves the timestamp for this log message.- Specified by:
getTimestamp
in interfaceLogMessage
- Returns:
- The timestamp for this log message.
-
getFields
@NotNull public final java.util.Map<java.lang.String,java.util.List<java.lang.String>> getFields()
Retrieves a map of the fields and their corresponding values in this log message.- Specified by:
getFields
in interfaceLogMessage
- Returns:
- A map of the fields and their corresponding values in this log message.
-
getBoolean
@Nullable public final java.lang.Boolean getBoolean(@NotNull LogField logField) throws LogException
Retrieves the value of the specified field as aBoolean
object. If the field has multiple values, the first will be returned.- Specified by:
getBoolean
in interfaceLogMessage
- Parameters:
logField
- The field for which to retrieve the Boolean value.- Returns:
- The value of the specified field as a
Boolean
object, ornull
if the log message does not have the specified field. - Throws:
LogException
- If the value of the specified field cannot be parsed as a Boolean.
-
getGeneralizedTime
@Nullable public final java.util.Date getGeneralizedTime(@NotNull LogField logField) throws LogException
Retrieves the value of the specified field as aDate
object decoded from the generalized time format. If the field has multiple values, the first will be returned.- Specified by:
getGeneralizedTime
in interfaceLogMessage
- Parameters:
logField
- The field for which to retrieve the timestamp value.- Returns:
- The value of the specified field as a
Date
object, ornull
if the log message does not have the specified field. - Throws:
LogException
- If the value of the specified field cannot be parsed as aDate
in the generalized time format.
-
getDouble
@Nullable public final java.lang.Double getDouble(@NotNull LogField logField) throws LogException
Retrieves the value of the specified field as aDouble
value. If the field has multiple values, the first will be returned.- Specified by:
getDouble
in interfaceLogMessage
- Parameters:
logField
- The field for which to retrieve theDouble
value.- Returns:
- The value of the specified field as a
Double
value, ornull
if the log message does not have the specified field. - Throws:
LogException
- If the value of the specified field cannot be parsed as aDouble
.
-
getInteger
@Nullable public final java.lang.Integer getInteger(@NotNull LogField logField) throws LogException
Retrieves the value of the specified field as anInteger
value. If the field has multiple values, the first will be returned.- Specified by:
getInteger
in interfaceLogMessage
- Parameters:
logField
- The field for which to retrieve theInteger
value.- Returns:
- The
Integer
value of the specified field, ornull
if the log message does not have the specified field. - Throws:
LogException
- If the value of the specified field cannot be parsed as anInteger
.
-
getLong
@Nullable public final java.lang.Long getLong(@NotNull LogField logField) throws LogException
Retrieves the value of the specified field as aLong
value. If the field has multiple values, the first will be returned.- Specified by:
getLong
in interfaceLogMessage
- Parameters:
logField
- The field for which to retrieve theLong
value.- Returns:
- The
Long
value of the specified field, ornull
if the log message does not have the specified field. - Throws:
LogException
- If the value of the specified field cannot be parsed as aLong
.
-
getRFC3339Timestamp
@Nullable public final java.util.Date getRFC3339Timestamp(@NotNull LogField logField) throws LogException
Retrieves the value of the specified field as aDate
object decoded from the ISO 8601 format described in RFC 3339. If the field has multiple values, the first will be returned.- Specified by:
getRFC3339Timestamp
in interfaceLogMessage
- Parameters:
logField
- The field for which to retrieve the timestamp value.- Returns:
- The value of the specified field as a
Date
object, ornull
if the log message does not have the specified field. - Throws:
LogException
- If the value of the specified field cannot be parsed as aDate
in the RFC 3339 format.
-
getString
@Nullable public final java.lang.String getString(@NotNull LogField logField)
Retrieves the value of the specified field as a string. If the field has multiple values, the first will be returned.- Specified by:
getString
in interfaceLogMessage
- Parameters:
logField
- The field for which to retrieve the string value.- Returns:
- The value of the specified field as a string, or
null
if the log message does not have the specified field.
-
toString
@NotNull public final java.lang.String toString()
Retrieves a string representation of this log message.- Specified by:
toString
in interfaceLogMessage
- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string representation of this log message.
-
-