...
The last piece of information we have to set is the entry associated with the top level element of the partition : the context entry. As a partition is characterized by a suffix and an associated entry, this is the place to declare this entry. For instance, for the dc=example, dc=com partition, the context entry is :
Code Block |
---|
objectClass: top objectClass: domain objectClass: extensibleObject dc: example |
It should be clear that this entry must be valid. We can consider that the partition suffix is the entry's DN. In our example, this is dc=example, dc=com.
Environment setting
After this first initialization done, we have to augment the envirnoment with some specific properties. Up to this point, the environment contains :
Property | Value | Description |
---|---|---|
java.naming.security.principal | uid=admin,ou=system | Admin user DN |
java.naming.security.authentication | simple | Authentication mechanism used for this user |
java.naming.security.credentials | secret | Admin password : THIS MUST BE CHANGED !!! |
We will add those properties :
Property | Value | Description |
---|---|---|
java.naming.provider.url | ou=system | The system partition URL |
java.naming.factory.initial | org.apache.directory.server.jndi.ServerContextFactory | Initial context factory which will be used to create the inital context. |
org.apache.directory.server.core.configuration.Configuration | Initialized configuration | This property holds the previously initialized configuration |
Now, we have to reach the last two steps : instanciate the server before starting it, and create a thread which will be responsible of saving modified entries from the cache to the disk.
Server instanciation
The configuration has been read, we now have to instanciate the server. This is done throw a JNDI invocation of the InitialDirContext() method :
Code Block |
---|
new InitialDirContext( env );
|
where env is the environment we have set in the previous steps. This method calls the getInitialContext() from the ServerContextFactory class which has been associated with the java.naming.factory.initial property.