// Process the Partition, if any.
for ( CreatePartition createPartition : dsBuilder.partitions() )
{
// Create the partition
Partition partition = createPartition.type().newInstance();
partition.setId( createPartition.name() );
partition.setSuffix( createPartition.suffix() );
partition.setSchemaManager( service.getSchemaManager() );
if ( partition instanceof BTreePartition<?> )
{
BTreePartition<Object> btreePartition = ( BTreePartition<Object> ) partition;
btreePartition.setCacheSize( createPartition.cacheSize() );
btreePartition.setPartitionDir( new File( service.getWorkingDirectory(), createPartition.name() ) );
// Process the indexes if any
CreateIndex[] indexes = createPartition.indexes();
for ( CreateIndex createIndex : indexes )
{
Index<? extends Object, ServerEntry, Object> index = createIndex.type().newInstance();
index.setAttributeId( createIndex.attribute() );
index.setCacheSize( createIndex.cacheSize() );
btreePartition.addIndexedAttributes( index );
}
}
partition.setSchemaManager( service.getSchemaManager() );
// Inject the partition into the DirectoryService
service.addPartition( partition );
// Last, process the context entry