...
Code Block | ||||
---|---|---|---|---|
| ||||
... public void init(DirectoryService core) throws Exception { // Create LDAP DN suffixDn = new LdapDN(suffix); suffixDn.normalize(core.getRegistries().getAttributeTypeRegistry().getNormalizerMapping()); Rdn rdn = suffixDn.getRdn(); // Create the only entry in this partition ServerEntry entry = new DefaultServerEntry(core .getRegistries(), this.suffixDn); entry.put(SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, SchemaConstants.ORGANIZATIONAL_UNIT_OC); entry.put(SchemaConstants.OU_AT, rdn.getUpValue().toString()); entry.put("description", "hello, world", "a minimal partition"); this.helloEntry = entry; } ... |
We assume that the suffix starts with "ou=" in order to create an entry of object class organizational unit. If someone tries to set a suffix which starts with another attribute for the RDN, the setSuffix will throw an exception.
The Partition interface requires to implement many methods for all the operations a partition should support (adding, deleting, modifying entries ...). Due to the fact, that this is a read only partition, the implementation in our case is minimalistic. Here is the delete method as an example.
...