Class DefaultAttributeValidationPolicy

java.lang.Object
org.springframework.ldap.ldif.support.DefaultAttributeValidationPolicy
All Implemented Interfaces:
AttributeValidationPolicy

public class DefaultAttributeValidationPolicy extends Object implements AttributeValidationPolicy
Ensures the buffer represents a valid attribute as defined by RFC2849. Meets the standards imposed by RFC 2849 for the "LDAP Data Interchange Format (LDIF) - Technical Specification". Special attention is called to URL support: RFC 2849 requires that LDIFs support URLs as defined in 1738; however, RFC 1738 has been updated by several RFCs including RFC 1808, RFC 2396, and RFC 3986 (which obsoleted the formers). Unsupported features of this implementation of URL identification include query strings and fragments in HTTP URLs.
  • Constructor Details

    • DefaultAttributeValidationPolicy

      public DefaultAttributeValidationPolicy()
      Default constructor.
    • DefaultAttributeValidationPolicy

      public DefaultAttributeValidationPolicy(boolean ordered)
      Constructor for indicating whether or not attribute values should be ordered alphabetically.
      Parameters:
      ordered - value.
  • Method Details

    • setOrdered

      public void setOrdered(boolean ordered)
      Indicates whether or not the attribute values should be ordered alphabetically.
      Parameters:
      ordered - value.
    • parse

      public Attribute parse(String buffer)
      Validates attribute contained in the buffer and returns an LdapAttribute.

      Ensures attributes meets one of four prescribed patterns for valid attributes:

      1. A standard attribute pattern of the form: ATTR_ID[;options]: VALUE
      2. A Base64 attribute pattern of the form: ATTR_ID[;options]:: BASE64_VALUE
      3. A url attribute pattern of the form: ATTR_ID[;options]:< URL_VALUE
      4. A UTF8 attribute pattern of the form: ATTR_ID[;options]: UTF8_VALUE

      Upon success an LdapAttribute object is returned.

      Specified by:
      parse in interface AttributeValidationPolicy
      Parameters:
      buffer - Buffer containing the line parsed from the resource.
      Returns:
      LdapAttribute representing the attribute parsed.
      Throws:
      InvalidAttributeFormatException - if the attribute does not meet one of the three patterns above or the attribute cannot be parsed.