What Is Schema Inheritance?
Articles and Tips: article
01 Jan 2001
Takes a look at how attributes are inherited in Novell Directory Services.
All objects have attributes associated with them. These attributes are defined by the object's class. Object classes either have attributes that are directly associated with them, or they can inherit attributes from another class. For instance, when you create new classess, you don't have to directly associate all of the attributes the class needs to the class. Instead, you can designate a super class that hold the attributes the class needs. The new class will then inherit the attributes that are assigned to the designated super class and to all of its super classes.
The NDS schema depends upon class hierarchy and inheritance in order to pass attributes and other characteristics to other classes. Classes that pass characteristics to other classes are called super classes, and these classes create the hierarchy of the schema. Allowing classes to inherit characteristics from super classes means that you can define a number of characteristics only once and these can then be used by multiple classes. This becomes valuable if you are extending the schema to match your company's needs. When you create new classes or attributes, you are extending the schema.
You need to understand schema inheritance if you're extending the schema. Otherwise, the objects you're using and defining already have their attributes associated with them. If you're extending the schema, you'll need to refer to the schema reference. Once, you start using the schema reference the principles behind schema inheritance start becoming more clear. If you're only using the pre-defined classes in the schema, you'll also find the schema reference extremely handy because it provides more detail about each of the NDS schema classes and attribtes than the interface exposes to you. I'll explain how to read and use the schema reference in the next primer column.
The Top Class
The schema inheritance starts with the "Top" class. The Top class is a pre-defined class in the schema, and it's named "Top." All NDS object classes inherit characteristics from the Top class. The Top class passes one mandatory attribute to all the other classes beneath it: the Object Class. This means that all NDS classes will automatically have an Object Class attribute. The Object Class attribute is a list of all the super classes for the class you're creating. If you create a class from the Top class, you will be required to enter a value for the object class attribute that you created. Novell recommends that you avoid creating a class directly from the Top class. You should find other classes in the schema which hold the attributes your class needs. You would only create a class directly from the Top class if no other classes have the attributes your new class requires.
In addition, the Top class passes several optional attributes to all NDS classs, such as: ACL (Access Control List), Back Links Last Referenced Time, Obituary, Used By, as well as other attributes. The NDS object class will also have these attributes as well, but the difference is when you create an object from the class, you will not be required to enter values for these attributes as you are with the mandatory attributes. Basically, all object classes inherit from the Top class the ability to hold values that NDS needs to be able to authenticate and synchronize the object.
The Top class also defines a default ACL template that all object classes inherit. An Access Control List defines the access rights that objects have to each other. The default ACL provides only enough access rights to allow objects to be supervised by the object that created them. When you define an object, you can either use the default ACL that the object inherits from the Top class, or you can modify the ACL to fit your object's needs.
Types of Classes
For inheritance purposes, the NDS schema defines two basic types of classes: effective and non-effective. You can create objects only from effective classes, while non-effective classes exist to provide inheritance. However, you can create other classes from non-effective classes. For example, Figure 1 shows the inheritance of the Printer class.
The Top class is at the top of the inheritance hierarchy, and it passes several characteristics to the Device class
Note: Although the Top class is an effective class, it is the one exception in the schema-effective classes, in that you cannot create objects directly from the Top class.
The Device class is a non-effective class, so you cannot create objects directly from it. In addition to the attributes it inherits from the Top class, the Device class has several optional attributes that pertain to devices. You can derive other classes from a non-effective class, so the Printer class in Example 1 is derived from the Device class. In addition to the attributes it inherits from the Top and Device classes, the Printer class has several optional attributes that pertain specifically to printers. So the Printer class is an effective class and you can use it to create printer objects.
NDS 8 includes a third type of class, called Auxiliary class. With the Auxiliary class, you can create a class definition, label it as auxiliary, and assign that class to a sub-set of objects. For example, suppose you want some of your users, but not all of them, to have certain rights to a database. You can create new attributes to give the rights to these users. However, if you assign this attribute to the User object class, all of your User objects will get the attribute.
To solve this, you can create an auxiliary User object class called "Database Users." The Database Users class contains all of the attributes necessary to let the users you want access the database. You can then associate the Database User auxiliary class with the particular User objects that you select, creating a subset of database users. If in the future, you want to prevent certain users from using the database, you can remove their association with the Database User auxiliary class, thus removing the attributes that allow them to access the database. You can also assign the Database User auxiliary class to additional user objects as needed.
As Figure 1 shows, a class inherits the attributes passed to it through its super-classes. The mandatory attributes (attributes that you must define for an object when you create it) of a classes's super-classes become the classes's mandatory attributes. The optional attribute for each of the classes's super-clases become the classes's optional attributes. In Figure 1, you can see that the Printer class inherits madatory attributes from the Top and Device super-classes. The Printer object also inherits optional attributes from the Top and Device super-classes.
To recap, the NDS schema uses class hierarchy and inheritance as a means to pass attributes and other characteristics down to other classes within its structure. There are two basic types of classes: effective and non-effective; from effective classes you can create objects, while non-effective classes exist to provide inheritance. Remember that schema inheritance starts with the Top class, which every other class inherits from. Classes also inherit from the super-classes defined in their Object Class attribute. You can also create auxiliary classes to assign specific attributes to a group of objects.
* Originally published in Novell AppNotes
The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.