org.apache.directory.shared.ldap.schema
Class LdapSyntax

java.lang.Object
  extended by org.apache.directory.shared.ldap.schema.AbstractSchemaObject
      extended by org.apache.directory.shared.ldap.schema.LdapSyntax
All Implemented Interfaces:
java.io.Serializable, SchemaObject

public class LdapSyntax
extends AbstractSchemaObject

A syntax definition. Each attribute stored in a directory has a defined syntax (i.e. data type) which constrains the structure and format of its values. The description of each syntax specifies how attribute or assertion values conforming to the syntax are normally represented when transferred in LDAP operations. This representation is referred to as the LDAP-specific encoding to distinguish it from other methods of encoding attribute values.

According to ldapbis [MODELS]:

  4.1.5. LDAP Syntaxes
  
    LDAP Syntaxes of (attribute and assertion) values are described in
    terms of ASN.1 [X.680] and, optionally, have an octet string encoding
    known as the LDAP-specific encoding.  Commonly, the LDAP-specific
    encoding is constrained to string of Universal Character Set (UCS)
    [ISO10646] characters in UTF-8 [UTF-8] form.
 
    Each LDAP syntax is identified by an object identifier (OID).
 
    LDAP syntax definitions are written according to the ABNF:
 
      SyntaxDescription = LPAREN WSP
          numericoid                ; object identifier
          [ SP "DESC" SP qdstring ] ; description
          extensions WSP RPAREN     ; extensions
 
    where:
      [numericoid] is object identifier assigned to this LDAP syntax;
      DESC [qdstring] is a short descriptive string; and
      [extensions] describe extensions.
 

Version:
$Rev: 437007 $
Author:
Apache Directory Project
See Also:
RFC2252 Section 4.3.3, ldapbis [MODELS], DescriptionUtils#getDescription(Syntax), Serialized Form

Field Summary
protected  boolean isHumanReadable
          the human readable flag
static long serialVersionUID
          The serialVersionUID
protected  SyntaxChecker syntaxChecker
          The associated SyntaxChecker
 
Fields inherited from class org.apache.directory.shared.ldap.schema.AbstractSchemaObject
description, extensions, isEnabled, isObsolete, isReadOnly, locked, names, objectType, oid, schemaName, specification
 
Constructor Summary
LdapSyntax(java.lang.String oid)
          Creates a Syntax object using a unique OID.
LdapSyntax(java.lang.String oid, java.lang.String description)
          Creates a Syntax object using a unique OID.
LdapSyntax(java.lang.String oid, java.lang.String description, boolean isHumanReadable)
          Creates a Syntax object using a unique OID.
 
Method Summary
 void addToRegistries(java.util.List<java.lang.Throwable> errors, Registries registries)
          Inject the Syntax into the registries, updating the references to other SchemaObject
 void clear()
          Clear the current SchemaObject : remove all the references to other objects, and all the Maps.
 LdapSyntax copy()
          Copy a LdapSyntax
 boolean equals(java.lang.Object o)
           
 SyntaxChecker getSyntaxChecker()
          Gets the SyntaxChecker used to validate values in accordance with this Syntax.
 boolean isHumanReadable()
          Gets whether or not the Syntax is human readable.
 void removeFromRegistries(java.util.List<java.lang.Throwable> errors, Registries registries)
          Remove the SDyntax from the registries, updating the references to other SchemaObject.
 void setHumanReadable(boolean isHumanReadable)
          Sets the human readable flag value.
 void setSyntaxChecker(SyntaxChecker syntaxChecker)
          Sets the associated SyntaxChecker
 java.lang.String toString()
           
 void updateSyntaxChecker(SyntaxChecker syntaxChecker)
          Update the associated SyntaxChecker, even if the SchemaObject is readOnly
 
Methods inherited from class org.apache.directory.shared.ldap.schema.AbstractSchemaObject
addExtension, addName, compareOid, copy, getDescription, getExtensions, getName, getNames, getObjectType, getOid, getSchemaName, getSpecification, hashCode, isDisabled, isEnabled, isObsolete, isReadOnly, lock, registerOid, setDescription, setEnabled, setExtensions, setNames, setNames, setObsolete, setOid, setReadOnly, setRegistries, setSchemaName, setSpecification
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

public static final long serialVersionUID
The serialVersionUID

See Also:
Constant Field Values

isHumanReadable

protected boolean isHumanReadable
the human readable flag


syntaxChecker

protected SyntaxChecker syntaxChecker
The associated SyntaxChecker

Constructor Detail

LdapSyntax

public LdapSyntax(java.lang.String oid)
Creates a Syntax object using a unique OID.

Parameters:
oid - the OID for this Syntax

LdapSyntax

public LdapSyntax(java.lang.String oid,
                  java.lang.String description)
Creates a Syntax object using a unique OID.

Parameters:
oid - the OID for this Syntax

LdapSyntax

public LdapSyntax(java.lang.String oid,
                  java.lang.String description,
                  boolean isHumanReadable)
Creates a Syntax object using a unique OID.

Parameters:
oid - the OID for this Syntax
Method Detail

isHumanReadable

public boolean isHumanReadable()
Gets whether or not the Syntax is human readable.

Returns:
true if the syntax can be interpreted by humans, false otherwise

setHumanReadable

public void setHumanReadable(boolean isHumanReadable)
Sets the human readable flag value.

Parameters:
isHumanReadable - the human readable flag value to set

getSyntaxChecker

public SyntaxChecker getSyntaxChecker()
Gets the SyntaxChecker used to validate values in accordance with this Syntax.

Returns:
the SyntaxChecker

setSyntaxChecker

public void setSyntaxChecker(SyntaxChecker syntaxChecker)
Sets the associated SyntaxChecker

Parameters:
syntaxChecker - The associated SyntaxChecker

updateSyntaxChecker

public void updateSyntaxChecker(SyntaxChecker syntaxChecker)
Update the associated SyntaxChecker, even if the SchemaObject is readOnly

Parameters:
syntaxChecker - The associated SyntaxChecker

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

addToRegistries

public void addToRegistries(java.util.List<java.lang.Throwable> errors,
                            Registries registries)
                     throws LdapException
Inject the Syntax into the registries, updating the references to other SchemaObject

Specified by:
addToRegistries in interface SchemaObject
Overrides:
addToRegistries in class AbstractSchemaObject
Parameters:
registries - The Registries
errors - The errors we got
Throws:
If - the addition failed
LdapException

removeFromRegistries

public void removeFromRegistries(java.util.List<java.lang.Throwable> errors,
                                 Registries registries)
                          throws LdapException
Remove the SDyntax from the registries, updating the references to other SchemaObject. If one of the referenced SchemaObject does not exist (), an exception is thrown.

Specified by:
removeFromRegistries in interface SchemaObject
Overrides:
removeFromRegistries in class AbstractSchemaObject
Parameters:
registries - The Registries
errors - The errors we got
Throws:
If - the Syntx is not valid
LdapException

copy

public LdapSyntax copy()
Copy a LdapSyntax

Specified by:
copy in interface SchemaObject
Specified by:
copy in class AbstractSchemaObject
Returns:
The copied SchemaObject

equals

public boolean equals(java.lang.Object o)
Specified by:
equals in interface SchemaObject
Overrides:
equals in class AbstractSchemaObject
See Also:
Object#equals()

clear

public void clear()
Clear the current SchemaObject : remove all the references to other objects, and all the Maps.

Specified by:
clear in interface SchemaObject
Overrides:
clear in class AbstractSchemaObject


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.