Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In order to be a partition, class HelloWorldPartition implements the corresponding interface from org.apache.directory.server.core.partition. It has an association to it's only entry (which will hold the "hello, world" method). This entry is created in the init life cycle method of the partition, which looks like this:

Code Block
java
java
...
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;
}
...

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 readonly read only partition, the implementation in our case is minimalistic. Here is the _delete method as an example.

...