Sun Java(TM) System Directory Server 5 2004Q2 Administration Reference |
Chapter 8
About SchemaThis chapter provides an overview of some of the basic concepts of the directory schema, and lists the files in which the schema is described. It describes object classes, attributes, and Object Identifiers (OIDs), and briefly discusses extending server schema and schema checking.
Schema DefinitionThe directory schema is a set of rules that defines how data can be stored in the directory. The data is stored in the form of directory entries. Each entry is a set of attributes and their values. Each entry must have an object class. The object class specifies the kind of object the entry describes and defines the set of attributes it contains. The schema defines the type of entries allowed, their attribute structure and the syntax of the attributes. The schema can be modified and extended if it does not meet your requirements.
To find detailed information about object classes, attributes, and how Directory Server uses the schema, refer to the Directory Server Deployment Planning Guide.
Object Classes
In LDAP, an object class defines the set of attributes that can be used to define an entry. The LDAP standard provides some basic types of object classes, including:
Object classes may be subdivided into three types:
- Structural: indicates the attributes that the entry may have and where each entry may occur in the DIT. This object class represents the corresponding real world object. Entries must belong to a structural object class, so most object classes are structural object classes.
- Auxiliary: indicates the attributes that the entry may have. An auxiliary object class does not represent a real world object, but represents additional attributes that can be associated with a structural object class to supplement its specification. Each entry may belong to only a single structural object class, but may belong to zero or more auxiliary object classes.
- Abstract: defined only as a superclass or template for other (structural) object classes. An abstract object class is a way of collecting a set of attributes that will be common to a set of structural object classes, so that these classes may be derived as subclasses of the abstract class rather than being defined from scratch. An entry may not belong to an abstract object class.
Note
Directory Server currently does not distinguish between structural and auxiliary object classes.
Required and Allowed Attributes
Every object class includes a number of required attributes and allowed attributes. Required attributes must be present in entries using the object class. All entries require the objectClass attribute, which defines the object classes assigned to the entry.
Allowed attributes may be present in entries using the object class.
Example: Object Class = person
Required Attributes
objectClass
cn (common name)
sn (surname)Allowed Attributes
description
seeAlso
telephoneNumber
userPasswordObject Class Inheritance
Each entry must be assigned to one structural object class. All object classes inherit from the top object class. They can also inherit from other object classes. The server’s object class structure determines the list of required and allowed attributes for a particular entry. For example, a person entry is usually defined with the following object class structure:
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgpersonIn this structure, the inetOrgperson inherits from the organizationalPerson and person object classes. Therefore, when you assign the inetOrgperson object class to an entry, it automatically inherits the required and allowed attributes from the superior object class.
Note that object class inheritance is dependent on the order in which the object classes appear in the schema.ldif files. The order in which object classes appear in the .ldif file must be consistent with the object class hierarchy, otherwise the server will not start. An object class that inherits from another object class must therefore appear after this object class in the schema.ldif file.
Attributes
Directory data is represented as attribute-value pairs. Any piece of information in the directory is associated with a descriptive attribute.
For instance, the commonName, or cn, attribute is used to store a person’s name. A person named Barbara (Babs) Jensen can be represented in the directory as
cn: Babs Jensen
Each person entered in the directory can be defined by the collection of attributes in the inetOrgperson object class. Other attributes used to define this entry could include:
givenname: Barbara
surname: Jensen
mail: bjensen@example.comAttribute Syntax
Each attribute has a syntax definition that describes the type of information provided by the attribute.
Attribute syntax is used by Directory Server to perform sorting and pattern matching.
Table 9-1 lists the different syntax methods that can be applied to attributes, and gives an OID and a definition for each syntax method.
Single-Valued and Multi-Valued Attributes
By default, most attributes are multi-valued. This means that an entry can contain the same attribute with multiple values. For example, cn, tel and objectClass are all attributes that can have more than one value. Attributes that are single-valued (only one instance of the attribute can be specified) are noted as such. For example, uidNumber can have only one possible value.
Schema Supported by Directory Server 5.2The schema provided with Sun Java System Directory Server 5.2 is described in a set of files stored in the following directory:
You can modify the schema by creating new object classes and attributes. These modifications are stored in a file called 99user.ldif. You should not modify the standard files provided with Directory Server, because you run the risk of breaking compatibility with other Sun Java System products, or of causing interoperability problems with directory servers from other vendors.
For more information about how Directory Server stores information and suggestions for planning directory schema, refer to the Directory Server Deployment Planning Guide.
The following tables list the schema files that are provided with Sun Java System Directory Server. Table 9-2 lists the schema files that are used by Directory Server.
Table 9-3 lists the schema files that are used by other Sun Java System products.
Object Identifiers (OIDs)Object identifiers (OIDs) are assigned to all attributes and object classes to conform to the LDAP and X.500 standards. An OID is a sequence of integers, typically written as a dot-separated string. When no OID is specified, Directory Server automatically uses ObjectClass_name-oid and attribute_name-oid.
Sun Java System Directory Server uses Sun based OIDs. Previous versions of Directory Server used Netscape based OIDs.
Sun Java System-defined attributes and object classes using the Sun base have the base OID of 1.3.6.1.4.1.42.2.27.9.
Sun Java System-defined attributes and object classes using the Netscape base have the base OID of 2.16.840.1.113730.3
For more information about OIDs, or to request a prefix for your enterprise, please go to the IANA (Internet Assigned Number Authority) website at http://www.iana.org/.
Extending Server SchemaThe Directory Server schema includes hundreds of object classes and attributes that can be used to meet most of your requirements. This schema can be extended with new object classes and attributes that meet evolving requirements for the directory service in the enterprise.
When adding new attributes to the schema, a new object class should be created to contain them (adding a new attribute to an existing object class can compromise Directory Server’s compatibility with existing LDAP clients that rely on the standard LDAP schema and may cause difficulties when upgrading the server).
For more information about extending server schema, refer to the Directory Server Deployment Planning Guide.
Schema CheckingYou should run Directory Server with schema checking turned on.
The schema checking capability of Sun Java System Directory Server checks entries when you add them to the directory or when you modify them, to verify that:
Schema checking also occurs when importing a database using LDIF. For more information, refer to the Directory Server Administration Guide.
Note
In the current version of Directory Server, schema checking does not enforce the validity of values with respect to their syntax.