Class LogFieldSyntax<T>

java.lang.Object
com.unboundid.ldap.sdk.unboundidds.logs.v2.syntax.LogFieldSyntax<T>
Type Parameters:
T - The type of value represented by this syntax.
Direct Known Subclasses:
BooleanLogFieldSyntax, CommaDelimitedStringListLogFieldSyntax, DNLogFieldSyntax, FilterLogFieldSyntax, FloatingPointLogFieldSyntax, GeneralizedTimeLogFieldSyntax, IntegerLogFieldSyntax, JSONLogFieldSyntax, RFC3339TimestampLogFieldSyntax, StringLogFieldSyntax

This class defines the base class for syntaxes that may be used for field values in log messages.
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.
  • Field Details

  • Constructor Details

    • LogFieldSyntax

      protected LogFieldSyntax(int maxStringLengthCharacters)
      Creates a new instance of this log field syntax implementation.
      Parameters:
      maxStringLengthCharacters - The maximum length (in characters) to use for strings within values. Strings that are longer than this should be truncated before inclusion in the log. This value must be greater than or equal to zero.
  • Method Details

    • getMaxStringLengthCharacters

      Retrieves the maximum length (in characters) to use for strings within values. Strings that are longer than this should be truncated before inclusion in the log.
      Returns:
      The maximum length (in characters) to use for strings within values.
    • getSyntaxName

      @NotNull public abstract String getSyntaxName()
      Retrieves the name for this syntax.
      Returns:
      The name for this syntax.
    • valueToSanitizedString

      Encodes the provided value to a sanitized string representation suitable for inclusion in a log message. The sanitized string should at least be cleaned of control characters and other non-printable characters, but depending on the syntax, it may clean other characters as well.
      Parameters:
      value - The value to be encoded. It must not be null.
      Returns:
      The encoded representation of the value. It must not be null, but may be empty.
    • valueToSanitizedString

      public abstract void valueToSanitizedString(@NotNull T value, @NotNull ByteStringBuffer buffer)
      Encodes the provided value to a sanitized string representation suitable for inclusion in a log message. The sanitized string should at least be cleaned of control characters and other non-printable characters, but depending on the syntax, it may clean other characters as well.
      Parameters:
      value - The value to be encoded. It must not be null.
      buffer - The buffer to which the string representation should be appended. It must not be null.
    • logSanitizedFieldToTextFormattedLog

      public abstract void logSanitizedFieldToTextFormattedLog(@NotNull String fieldName, @NotNull T fieldValue, @NotNull ByteStringBuffer buffer)
      Appends a sanitized representation of the specified field (both field name and value) for a text-formatted log message to the given buffer.
      Parameters:
      fieldName - The name for the field. It must not be null.
      fieldValue - The value to use for the field. It must not be null.
      buffer - The buffer to which the sanitized log field should be appended. It must not be null.
    • logSanitizedFieldToJSONFormattedLog

      public abstract void logSanitizedFieldToJSONFormattedLog(@NotNull String fieldName, @NotNull T fieldValue, @NotNull JSONBuffer buffer)
      Appends a sanitized representation of the specified field (both field name and value) for a JSON-formatted log message to the given buffer.
      Parameters:
      fieldName - The name for the field. It must not be null.
      fieldValue - The value to use for the field. It must not be null.
      buffer - The buffer to which the sanitized log field should be appended. It must not be null.
    • logSanitizedValueToJSONFormattedLog

      public abstract void logSanitizedValueToJSONFormattedLog(@NotNull T value, @NotNull JSONBuffer buffer)
      Appends a sanitized representation of the provided value (without a field name, as might be suitable for a value included in a JSON array) for a JSON-formatted log message to the given buffer.
      Parameters:
      value - The value to be appended to the buffer. It must not be null.
      buffer - The buffer to which the sanitized value should be appended. It must not be null.
    • sanitize

      @NotNull protected final String sanitize(@NotNull String string)
      Retrieves a sanitized version of the provided string.
      Parameters:
      string - The string to be sanitized. It must not be null.
      Returns:
      The sanitized version of the provided string.
    • sanitize

      protected final void sanitize(@NotNull String string, @NotNull ByteStringBuffer buffer)
      Appends an appropriately sanitized version of the provided string to the given buffer.
      Parameters:
      string - The string to be sanitized. It must not be null.
      buffer - The buffer to which the sanitized representation should be appended. It must not be null.
    • parseValue

      Attempts to parse the provided string as a value in accordance with this syntax.
      Parameters:
      valueString - The string to be parsed.
      Returns:
      The value that was parsed.
      Throws:
      RedactedValueException - If the provided value has been redacted (either the complete value or one or more of its components), and the redacted form cannot be represented in this syntax.
      TokenizedValueException - If the provided value has been tokenized (either the complete value or one or more of its components), and the redacted form cannot be represented in this syntax.
      LogSyntaxException - If the provided value cannot be parsed in accordance with this syntax.
    • valueStringIsCompletelyRedacted

      public boolean valueStringIsCompletelyRedacted(@NotNull String valueString)
      Determines whether the provided value string represents a value that has been completely redacted.
      Parameters:
      valueString - The value for which to make the determination. It must not be null.
      Returns:
      true if the provided value string represents a value that has been completely redacted, or false if not.
    • completelyRedactedValueConformsToSyntax

      public abstract boolean completelyRedactedValueConformsToSyntax()
      Indicates whether values that have been completely redacted still conform to this syntax.
      Returns:
      true if values that have been completely redacted still conform to this syntax, or false if not.
    • redactEntireValue

      Retrieves a string that may be included in a log message to indicate that the entire value for a field with this syntax has been redacted.
      Returns:
      A string that may be included in a log message to indicate that the entire value for a field with this syntax has been redacted.
    • redactEntireValue

      Appends a string representation of a redacted entire value to the provided buffer.
      Parameters:
      buffer - The buffer to which the redacted string representation should be appended. It must not be null.
    • logCompletelyRedactedFieldToTextFormattedLog

      Appends a completely redacted representation of the specified field (both field name and value) for a text-formatted log message to the given buffer.
      Parameters:
      fieldName - The name for the field. It must not be null.
      buffer - The buffer to which the sanitized log field should be appended. It must not be null.
    • logCompletelyRedactedFieldToJSONFormattedLog

      Appends a completely redacted representation of the specified field (both field name and value) for a JSON-formatted log message to the given buffer.
      Parameters:
      fieldName - The name for the field. It must not be null.
      buffer - The buffer to which the sanitized log field should be appended. It must not be null.
    • logCompletelyRedactedValueToJSONFormattedLog

      Appends a completely redacted representation of a value (without a field name, as might be suitable for a value included in a JSON array) for a JSON-formatted log message to the given buffer.
      Parameters:
      buffer - The buffer to which the redacted value should be appended. It must not be null.
    • supportsRedactedComponents

      public abstract boolean supportsRedactedComponents()
      Indicates whether this syntax supports redacting individual components of the entire value.
      Returns:
      true if this syntax supports redacting individual components of the entire value, or false if not.
    • valueStringIncludesRedactedComponent

      Determines whether the provided value string represents a value that has had one or more components redacted.
      Parameters:
      valueString - The value for which to make the determination. It must not be null.
      Returns:
      true if the provided value string represents a value that has had one or more components redacted, or false if not.
    • valueWithRedactedComponentsConformsToSyntax

      Indicates whether values with one or more redacted components still conform to this syntax.
      Returns:
      true if values with one or more redacted components still conform to this syntax.
    • redactComponents

      Retrieves a string that provides a representation of the given value with zero or more of its components redacted. If this syntax does not support redacted components, then the entire value should be redacted.
      Parameters:
      value - The value for which to obtain the redacted representation. It must not be null.
      Returns:
      A string representation of the given value with zero or more of its components redacted.
    • redactComponents

      public void redactComponents(@NotNull T value, @NotNull ByteStringBuffer buffer)
      Appends a string representation of the given value with redacted components to the provided buffer.
      Parameters:
      value - The value for which to obtain the redacted representation. It must not be null.
      buffer - The buffer to which the redacted string representation should be appended. It must not be null.
    • logRedactedComponentsFieldToTextFormattedLog

      public abstract void logRedactedComponentsFieldToTextFormattedLog(@NotNull String fieldName, @NotNull T fieldValue, @NotNull ByteStringBuffer buffer)
      Appends a representation of the specified field (both field name and value) with redacted value components for a text-formatted log message to the given buffer. If this syntax does not support redacting components within a value, then it should redact the entire value.
      Parameters:
      fieldName - The name for the field. It must not be null.
      fieldValue - The value to use for the field. It must not be null.
      buffer - The buffer to which the sanitized log field should be appended. It must not be null.
    • logRedactedComponentsFieldToJSONFormattedLog

      public abstract void logRedactedComponentsFieldToJSONFormattedLog(@NotNull String fieldName, @NotNull T fieldValue, @NotNull JSONBuffer buffer)
      Appends a representation of the specified field (both field name and value) with redacted value components for a JSON-formatted log message to the given buffer. If this syntax does not support redacting components within a value, then it should redact the entire value.
      Parameters:
      fieldName - The name for the field. It must not be null.
      fieldValue - The value to use for the field. It must not be null.
      buffer - The buffer to which the sanitized log field should be appended. It must not be null.
    • logRedactedComponentsValueToJSONFormattedLog

      Appends a representation of the provided value (without a field name, as might be suitable for a value included in a JSON array) with redacted components for a JSON-formatted log message to the given buffer. If this syntax does not support redacting components within a value, then it should redact the entire value.
      Parameters:
      value - The value to be appended to the buffer in redacted form. It must not be null.
      buffer - The buffer to which the redacted value should be appended. It must not be null.
    • valueStringIsCompletelyTokenized

      public boolean valueStringIsCompletelyTokenized(@NotNull String valueString)
      Determines whether the provided value string represents a value that has been completely tokenized.
      Parameters:
      valueString - The value for which to make the determination. It must not be null.
      Returns:
      true if the provided value string represents a value that has been completely tokenized, or false if not.
    • completelyTokenizedValueConformsToSyntax

      public abstract boolean completelyTokenizedValueConformsToSyntax()
      Indicates whether values that have been completely tokenized still conform to this syntax.
      Returns:
      true if values that have been completely tokenized still conform to this syntax, or false if not.
    • tokenizeEntireValue

      @NotNull public String tokenizeEntireValue(@NotNull T value, @NotNull byte[] pepper)
      Retrieves a string that represents a tokenized representation of the provided value.

      The resulting token will protect the provided value by representing it in a way that makes it at infeasible to determine what the original value was. However, tokenizing the same value with the same pepper should consistently yield the same token value, so that it will be possible to identify the same value across multiple log messages.
      Parameters:
      value - The value for which to generate the token. It must not be null.
      pepper - A pepper used to provide brute-force protection for the resulting token. The pepper value should be kept secret so that it is not available to unauthorized users who might be able to view log information, although the same pepper value should be consistently provided when tokenizing values so that the same value will consistently yield the same token. It must not be null and should not be empty.
      Returns:
      A string that represents a tokenized representation of the provided value.
    • tokenizeEntireValue

      public abstract void tokenizeEntireValue(@NotNull T value, @NotNull byte[] pepper, @NotNull ByteStringBuffer buffer)
      Appends a tokenized representation of the provided value to the given buffer.

      The resulting token will protect the provided value by representing it in a way that makes it at infeasible to determine what the original value was. However, tokenizing the same value with the same pepper should consistently yield the same token value, so that it will be possible to identify the same value across multiple log messages.
      Parameters:
      value - The value for which to generate the token. It must not be null.
      pepper - A pepper used to provide brute-force protection for the resulting token. The pepper value should be kept secret so that it is not available to unauthorized users who might be able to view log information, although the same pepper value should be consistently provided when tokenizing values so that the same value will consistently yield the same token. It must not be null and should not be empty.
      buffer - The buffer to which the tokenized representation should be appended. It must not be null.
    • logCompletelyTokenizedFieldToTextFormattedLog

      public abstract void logCompletelyTokenizedFieldToTextFormattedLog(@NotNull String fieldName, @NotNull T fieldValue, @NotNull byte[] pepper, @NotNull ByteStringBuffer buffer)
      Appends a completely tokenized representation of the specified field (both field name and value) for a text-formatted log message to the given buffer.
      Parameters:
      fieldName - The name for the field. It must not be null.
      fieldValue - The value to use for the field. It must not be null.
      pepper - A pepper used to provide brute-force protection for the resulting token. The pepper value should be kept secret so that it is not available to unauthorized users who might be able to view log information, although the same pepper value should be consistently provided when tokenizing values so that the same value will consistently yield the same token. It must not be null and should not be empty.
      buffer - The buffer to which the sanitized log field should be appended. It must not be null.
    • logCompletelyTokenizedFieldToJSONFormattedLog

      public abstract void logCompletelyTokenizedFieldToJSONFormattedLog(@NotNull String fieldName, @NotNull T fieldValue, @NotNull byte[] pepper, @NotNull JSONBuffer buffer)
      Appends a completely tokenized representation of the specified field (both field name and value) for a JSON-formatted log message to the given buffer.
      Parameters:
      fieldName - The name for the field. It must not be null.
      fieldValue - The value to use for the field. It must not be null.
      pepper - A pepper used to provide brute-force protection for the resulting token. The pepper value should be kept secret so that it is not available to unauthorized users who might be able to view log information, although the same pepper value should be consistently provided when tokenizing values so that the same value will consistently yield the same token. It must not be null and should not be empty.
      buffer - The buffer to which the sanitized log field should be appended. It must not be null.
    • logCompletelyTokenizedValueToJSONFormattedLog

      public abstract void logCompletelyTokenizedValueToJSONFormattedLog(@NotNull T value, @NotNull byte[] pepper, @NotNull JSONBuffer buffer)
      Appends a completely tokenized representation of the provided value (without a field name, as might be suitable for a value included in a JSON array) for a JSON-formatted log message to the given buffer.
      Parameters:
      value - The value to be appended to the buffer in tokenized form. It must not be null.
      pepper - A pepper used to provide brute-force protection for the resulting token. The pepper value should be kept secret so that it is not available to unauthorized users who might be able to view log information, although the same pepper value should be consistently provided when tokenizing values so that the same value will consistently yield the same token. It must not be null and should not be empty.
      buffer - The buffer to which the tokenized value should be appended. It must not be null.
    • supportsTokenizedComponents

      public abstract boolean supportsTokenizedComponents()
      Indicates whether this syntax supports tokenizing individual components of the entire value.
      Returns:
      true if this syntax supports tokenizing individual components of the entire value, or false if not.
    • valueStringIncludesTokenizedComponent

      Determines whether the provided value string represents a value that has had one or more components tokenized.
      Parameters:
      valueString - The value for which to make the determination. It must not be null.
      Returns:
      true if the provided value string represents a value that has had one or more components tokenized, or false if not.
    • valueWithTokenizedComponentsConformsToSyntax

      Indicates whether values with one or more tokenized components still conform to this syntax.
      Returns:
      true if values with one or more tokenized components still conform to this syntax.
    • tokenizeComponents

      @NotNull public String tokenizeComponents(@NotNull T value, @NotNull byte[] pepper)
      Retrieves a string that provides a representation of the given value with zero or more of its components tokenized. If this syntax does not support tokenized components, then the entire value should be tokenized.

      The resulting tokens will protect components of the provided value by representing them in a way that makes it at infeasible to determine what the original components were. However, tokenizing the same value with the same pepper should consistently yield the same token value, so that it will be possible to identify the same value across multiple log messages.
      Parameters:
      value - The value whose components should be tokenized. It must not be null.
      pepper - A pepper used to provide brute-force protection for the resulting token. The pepper value should be kept secret so that it is not available to unauthorized users who might be able to view log information, although the same pepper value should be consistently provided when tokenizing values so that the same value will consistently yield the same token. It must not be null and should not be empty.
      Returns:
      A string that represents a tokenized representation of the provided value.
    • tokenizeComponents

      public void tokenizeComponents(@NotNull T value, @NotNull byte[] pepper, @NotNull ByteStringBuffer buffer)
      Appends a string representation of the given value with zero or more of its components tokenized to the provided buffer. If this syntax does not support tokenized components, then the entire value should be tokenized.

      The resulting tokens will protect components of the provided value by representing them in a way that makes it at infeasible to determine what the original components were. However, tokenizing the same value with the same pepper should consistently yield the same token value, so that it will be possible to identify the same value across multiple log messages.
      Parameters:
      value - The value whose components should be tokenized. It must not be null.
      pepper - A pepper used to provide brute-force protection for the resulting token. The pepper value should be kept secret so that it is not available to unauthorized users who might be able to view log information, although the same pepper value should be consistently provided when tokenizing values so that the same value will consistently yield the same token. It must not be null and should not be empty.
      buffer - The buffer to which the tokenized representation should be appended. It must not be null.
    • logTokenizedComponentsFieldToTextFormattedLog

      public abstract void logTokenizedComponentsFieldToTextFormattedLog(@NotNull String fieldName, @NotNull T fieldValue, @NotNull byte[] pepper, @NotNull ByteStringBuffer buffer)
      Appends a representation of the specified field (both field name and value) with tokenized value components for a text-formatted log message to the given buffer. If this syntax does not support tokenizing components within a value, then it should tokenize the entire value.
      Parameters:
      fieldName - The name for the field. It must not be null.
      fieldValue - The value to use for the field. It must not be null.
      pepper - A pepper used to provide brute-force protection for the resulting token. The pepper value should be kept secret so that it is not available to unauthorized users who might be able to view log information, although the same pepper value should be consistently provided when tokenizing values so that the same value will consistently yield the same token. It must not be null and should not be empty.
      buffer - The buffer to which the sanitized log field should be appended. It must not be null.
    • logTokenizedComponentsFieldToJSONFormattedLog

      public abstract void logTokenizedComponentsFieldToJSONFormattedLog(@NotNull String fieldName, @NotNull T fieldValue, @NotNull byte[] pepper, @NotNull JSONBuffer buffer)
      Appends a representation of the specified field (both field name and value) with tokenized value components for a JSON-formatted log message to the given buffer. If this syntax does not support tokenizing components within a value, then it should tokenize the entire value.
      Parameters:
      fieldName - The name for the field. It must not be null.
      fieldValue - The value to use for the field. It must not be null.
      pepper - A pepper used to provide brute-force protection for the resulting token. The pepper value should be kept secret so that it is not available to unauthorized users who might be able to view log information, although the same pepper value should be consistently provided when tokenizing values so that the same value will consistently yield the same token. It must not be null and should not be empty.
      buffer - The buffer to which the sanitized log field should be appended. It must not be null.
    • logTokenizedComponentsValueToJSONFormattedLog

      public abstract void logTokenizedComponentsValueToJSONFormattedLog(@NotNull T value, @NotNull byte[] pepper, @NotNull JSONBuffer buffer)
      Appends a representation of the provided value (without a field name, as might be suitable for a value included in a JSON array) with tokenized value components for a JSON-formatted log message to the given buffer. If this syntax does not support tokenizing components within a value, then it should tokenize the entire value.
      Parameters:
      value - The value to be appended to the buffer in tokenized form. It must not be null.
      pepper - A pepper used to provide brute-force protection for the resulting token. The pepper value should be kept secret so that it is not available to unauthorized users who might be able to view log information, although the same pepper value should be consistently provided when tokenizing values so that the same value will consistently yield the same token. It must not be null and should not be empty.
      buffer - The buffer to which the tokenized value should be appended. It must not be null.
    • tokenize

      @NotNull protected final String tokenize(@NotNull String string, @NotNull byte[] pepper)
      Retrieves a tokenized representation of the provided string.
      Parameters:
      string - The string to be tokenized. It must not be null.
      pepper - A pepper used to provide brute-force protection for the resulting token. The pepper value should be kept secret so that it is not available to unauthorized users who might be able to view log information, although the same pepper value should be consistently provided when tokenizing values so that the same value will consistently yield the same token. It must not be null and should not be empty.
      Returns:
      A tokenized representation of the provided string.
    • tokenize

      protected final void tokenize(@NotNull String string, @NotNull byte[] pepper, @NotNull ByteStringBuffer buffer)
      Appends a tokenized representation of the provided string to the given buffer.
      Parameters:
      string - The string to be tokenized. It must not be null.
      pepper - A pepper used to provide brute-force protection for the resulting token. The pepper value should be kept secret so that it is not available to unauthorized users who might be able to view log information, although the same pepper value should be consistently provided when tokenizing values so that the same value will consistently yield the same token. It must not be null and should not be empty.
      buffer - The buffer to which the tokenized representation should be appended. It must not be null.
    • tokenize

      protected final void tokenize(@NotNull byte[] bytes, @NotNull byte[] pepper, @NotNull ByteStringBuffer buffer)
      Appends a tokenized representation of the provided bytes to the given buffer.
      Parameters:
      bytes - The bytes to be tokenized. It must not be null.
      pepper - A pepper used to provide brute-force protection for the resulting token. The pepper value should be kept secret so that it is not available to unauthorized users who might be able to view log information, although the same pepper value should be consistently provided when tokenizing values so that the same value will consistently yield the same token. It must not be null and should not be empty.
      buffer - The buffer to which the tokenized representation should be appended. It must not be null.
    • sha256

      @NotNull protected final byte[] sha256(@NotNull ByteStringBuffer buffer)
      Retrieves a SHA-256 digest of the contents of the provided buffer.
      Parameters:
      buffer - The buffer containing the data to digest. It must not be null.
      Returns:
      The bytes that comprise the SHA-256 digest.
    • getTemporaryBuffer

      Retrieves a temporary thread-local buffer that may be used during processing. When it is no longer needed, the buffer should be returned with the releaseTemporaryBuffer(ByteStringBuffer) method.
      Returns:
      A temporary thread-local buffer that may be used during processing.
    • releaseTemporaryBuffer

      Releases the provided temporary buffer.
      Parameters:
      buffer - The buffer to release. It must not be null.