...
Now just modify the server.xml file to add this line :
Code Block |
---|
...
<apacheDS id="apacheDS"
synchPeriodMillis="15000"
allowAnonymousAccess="false">
<directoryService>#directoryService</directoryService>
<!-- We load the SevenSeas root context entry here -->
<ldifDirectory>sevenSeasRoot.ldif</ldifDirectory>
...
|
The contextEntry will be loaded when the server will be started the first time.
Adding a partition programmatically
The same o=sevenseas partition can be created through the application code using the Partition and DirectoryService API
Here is the sample code to create a new partition o=sevenseas and its context entry programmatically
Code Block | ||||
---|---|---|---|---|
| ||||
JdbmPartition sevenseasPartition = new JdbmPartition(); sevenseasPartition.setId("sevenseas"); sevenseasPartition.setSuffix("o=sevenseas"); sevenseasPartition.setCacheSize(1000); sevenseasPartition.init(directoryService); // Create some indices (optional) Set<Index<?,ServerEntry>> indexedAttrs = new HashSet<Index<?, ServerEntry>>(); indexedAttrs.add( new JdbmIndex<Object, ServerEntry>("objectClass")); indexedAttrs.add( new JdbmIndex<Object, ServerEntry>("o")); sevenseasPartition.setIndexedAttributes( indexedAttrs ); //Add partition to the directory service directoryService.addPartition(sevenseasPartition); // start the directory service directoryService.startup(); // create the context entry ServerEntry entry = new DefaultServerEntry( directoryService.getRegistries(), new LdapDN( "o=sevenseas") ); entry.put( "objectClass", "top", "organization" ); entry.put("o","sevenseas"); // add the context entry AddContextPartitionOperationContext adOpContext = new AddContextPartitionOperationContext( directoryService.getAdminSession(), sevenseasPartition ); adOpContext.add( entry, null ); directoryService.getPartitionNexus().addContextPartition( adOpContext ); |
More configuration options for a JDBM partition
...