Class DefaultAttributeValidationPolicy
java.lang.Object
org.springframework.ldap.ldif.support.DefaultAttributeValidationPolicy
- All Implemented Interfaces:
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 Summary
ConstructorDescriptionDefault constructor.DefaultAttributeValidationPolicy
(boolean ordered) Constructor for indicating whether or not attribute values should be ordered alphabetically. -
Method Summary
Modifier and TypeMethodDescriptionValidates attribute contained in the buffer and returns an LdapAttribute.void
setOrdered
(boolean ordered) Indicates whether or not the attribute values should be ordered alphabetically.
-
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
Validates attribute contained in the buffer and returns an LdapAttribute.Ensures attributes meets one of four prescribed patterns for valid attributes:
- A standard attribute pattern of the form: ATTR_ID[;options]: VALUE
- A Base64 attribute pattern of the form: ATTR_ID[;options]:: BASE64_VALUE
- A url attribute pattern of the form: ATTR_ID[;options]:< URL_VALUE
- A UTF8 attribute pattern of the form: ATTR_ID[;options]: UTF8_VALUE
Upon success an LdapAttribute object is returned.
- Specified by:
parse
in interfaceAttributeValidationPolicy
- 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.
-