UnderstandingAttributeSyntaxes

Attribute Syntaxes#

Attribute syntaxes are essentially data type definitions. The syntax for an attribute type indicates the type of data meant to be held by the corresponding values. This can be used to determine whether a particular value is acceptable for a given attribute, as well as to provide information about how the server should interact with existing values.

The Sun Java System Directory Server 5.x does not support the ability to reject values that violates the constraints of the associated attribute syntax. This capability has been added in the Sun Java System Directory Server 6.0, although it is off by default for compatibility reasons (in order to support existing deployments where there may be attribute values that violate the associated syntax). OpenDS also supports the ability to reject values that violate the associated attribute syntax, and this is the default behavior for the purposes of standards compliance. For compatibility reasons, it is possible to completely disable this attribute syntax checking if necessary, but it is also possible to accept values that violate the associated syntax but log a warning message to the server's error log every time this occurs. Note, however, that because OpenDS is much more standards compliant in its use of schema elements than the Sun Java System Directory Server, if attributes are allowed to have values that violate their associated syntax then matching operations may not behave as expected with such values.

The Attribute Syntax Description Format#

The attribute syntax description format is described in RFC 4512, section 4.1.5. The definition is as follows:

     SyntaxDescription = LPAREN WSP
         numericoid                 ; object identifier
         [ SP "DESC" SP qdstring ]  ; description
         extensions WSP RPAREN      ; extensions

The elements of the attribute syntax description include:

For example, the following is the attribute syntax description for the standard directory string syntax:

    ( 1.3.6.1.4.1.1466.115.121.1.15 DESC 'Directory String' ) 
In this case, the OID is "1.3.6.1.4.1.1466.115.121.1.15" and the description is "Directory String". There are no extensions.

Commonly-Used Attribute Syntaxes#

There are a number of attribute syntaxes defined in LDAP, both in the core protocol specification, as well as other related RFCs and Internet Drafts. Many of these attribute syntaxes are defined in RFC 4517, (LDAP Syntaxes and Matching Rules) in section 3.3. Some of the most commonly-used attribute syntaxes include:

The OpenDS Attribute Syntax Implementation#

Like matching rules, attribute syntaxes require logic to determine whether a given value is appropriate and therefore they are be implemented as Java classes. These classes must be subclasses of org.opends.server.api.AttributeSyntax. The most important method in this class is:

public boolean valueIsAcceptable(ByteString value,
                                 StringBuilder invalidReason)

This method is used to determine whether a given value is acceptable according to the constraints for that syntax.

The OpenDS implementation also contains four additional methods that may be used to specify default matching rules for use in conjunction with that attribute syntax:

public EqualityMatchingRule getEqualityMatchingRule()

public OrderingMatchingRule getOrderingMatchingRule()

public SubstringMatchingRule getSubstringMatchingRule()

public ApproximateMatchingRule getApproximateMatchingRule()

These methods will be used to provide the default matching rules for an attribute type if no explicit rules are specified. Attribute types will be discussed in greater detail in the next section.

Attribute syntax objects may be retrieved from the server schema using their OIDs.

More Information#

There might be more information for this subject on one of the following: