You can customize the data types available by extending directory schema, even while OpenDJ is running, and then add your new data without restarting the server. Here’s how to get started.
When you open OpenDJ Control Panel in the Schema list you see Manage Schema. Click Manage Schema to open the window that you can use to view and update the directory schema, which define object classes, attribute types, matching rules, and attribute syntaxes.
- Object classes govern which attributes a directory entry must include and may optionally include.
- Attribute types define the individual attributes.
- Matching rules how to sort and compare attribute values for different syntaxes and languages.
- Attribute syntaxes identify syntax rules for attribute values.
If you cannot find a standard definition that fits your needs, you can use the New Attribute… and New Object Class… buttons to add your own definitions.
For example, assume you want to add an attribute called blogURL, an optional attribute attached to entries that correspond to people in your directory.
To define the attribute type, click New Attribute… and fill in the fields, then click OK.
- Name: blogURL
- OID: my-blog-url-temp-oid
- Description: Link to a blog
As the object class for an entry defines what attributes the entry can have, you need to define not only the attribute type blogURL, but also the object class that tells the directory, “This entry can have a blogURL attribute.” Call the object class blogAuthor. Since a person might have a blogURL, but blogURL does not warrant its own, standalone object, this object class is going to be an Auxiliary object class, rather than a Structural object class.
To define the object class, click New Object Class… and fill in the fields, then click OK.
- Name: blogAuthor
- OID: my-blog-author-temp-oid
- Description: A blogger
- Optional Attributes: blogURL
- Extra options > Type: Auxiliary
Now if you search for blog in the Manage Schema window, you can see your attribute type and object class.
To try it out, go back to OpenDJ Control Panel and open the Manage Entries window.
Find a person who has a blog, and click the Edit… button next to the list of object classes on the entry, so you can use the Edit Object Class window to add the blogAuthor auxiliary object class.
Clear Only Show Attributes with Values to display a number of fields for optional attributes, including blogURL. Then add the blogURL in the field provided and click Save Changes.
Here’s a representation of my result in LDIF format.
$ ./OpenDJ/bin/ldapsearch -p 1389 -b dc=example,dc=com uid=mark dn: uid=mark,ou=People,dc=example,dc=com tomcatRole: Admin uid: mark facsimileTelephoneNumber: +1 408 555 4661 blogURL: https://marginnotes2.wordpress.com/ objectClass: person objectClass: organizationalPerson objectClass: inetOrgPerson objectClass: posixAccount objectClass: top objectClass: tomcatRoleAllowed objectClass: blogAuthor givenName: Mark cn: Mark Craig sn: Craig telephoneNumber: +1 408 555 1846 roomNumber: 3819 homeDirectory: /home/mark mail: email@example.com l: Santa Clara ou: Accounting ou: People uidNumber: 1000 gidNumber: 119
That’s it. Oh, by the way, you can of course do all of this on the command line, too. Have a good weekend.