Search in sources :

Example 1 with AvlPartitionFactory

use of org.apache.directory.server.core.factory.AvlPartitionFactory in project goodies by sonatype.

the class LdapServer method initPartitions.

private static void initPartitions(DefaultDirectoryService directoryService) throws Exception {
    LdifPartition ldifPartition = new LdifPartition(directoryService.getSchemaManager(), directoryService.getDnFactory());
    ldifPartition.setPartitionPath(new File(directoryService.getInstanceLayout().getPartitionsDirectory(), "schema").toURI());
    SchemaPartition schemaPartition = new SchemaPartition(directoryService.getSchemaManager());
    schemaPartition.setWrappedPartition(ldifPartition);
    directoryService.setSchemaPartition(schemaPartition);
    PartitionFactory partitionFactory = new AvlPartitionFactory();
    Partition systemPartition = partitionFactory.createPartition(directoryService.getSchemaManager(), directoryService.getDnFactory(), "system", ServerDNConstants.SYSTEM_DN, 500, new File(directoryService.getInstanceLayout().getPartitionsDirectory(), "system"));
    systemPartition.setSchemaManager(directoryService.getSchemaManager());
    partitionFactory.addIndex(systemPartition, SchemaConstants.OBJECT_CLASS_AT, 100);
    directoryService.setSystemPartition(systemPartition);
    Partition sonatypePartition = partitionFactory.createPartition(directoryService.getSchemaManager(), directoryService.getDnFactory(), "sonatype", "o=sonatype", 500, new File(directoryService.getInstanceLayout().getPartitionsDirectory(), "sonatype"));
    sonatypePartition.setSchemaManager(directoryService.getSchemaManager());
    partitionFactory.addIndex(sonatypePartition, SchemaConstants.OBJECT_CLASS_AT, 100);
    directoryService.addPartition(sonatypePartition);
    Partition groupsPartition = partitionFactory.createPartition(directoryService.getSchemaManager(), directoryService.getDnFactory(), "groups", "ou=groups,dc=company,dc=com", 500, new File(directoryService.getInstanceLayout().getPartitionsDirectory(), "groups"));
    groupsPartition.setSchemaManager(directoryService.getSchemaManager());
    partitionFactory.addIndex(groupsPartition, SchemaConstants.OBJECT_CLASS_AT, 100);
    directoryService.addPartition(groupsPartition);
    Partition usersPartition = partitionFactory.createPartition(directoryService.getSchemaManager(), directoryService.getDnFactory(), "users", "ou=users,dc=company,dc=com", 500, new File(directoryService.getInstanceLayout().getPartitionsDirectory(), "users"));
    usersPartition.setSchemaManager(directoryService.getSchemaManager());
    partitionFactory.addIndex(usersPartition, SchemaConstants.OBJECT_CLASS_AT, 100);
    directoryService.addPartition(usersPartition);
    Partition acmeBrickPartition = partitionFactory.createPartition(directoryService.getSchemaManager(), directoryService.getDnFactory(), "acme_brick", "dc=acme brick,dc=com", 500, new File(directoryService.getInstanceLayout().getPartitionsDirectory(), "acme_brick"));
    acmeBrickPartition.setSchemaManager(directoryService.getSchemaManager());
    partitionFactory.addIndex(acmeBrickPartition, SchemaConstants.OBJECT_CLASS_AT, 100);
    directoryService.addPartition(acmeBrickPartition);
}
Also used : SchemaPartition(org.apache.directory.server.core.api.schema.SchemaPartition) Partition(org.apache.directory.server.core.api.partition.Partition) LdifPartition(org.apache.directory.server.core.partition.ldif.LdifPartition) SchemaPartition(org.apache.directory.server.core.api.schema.SchemaPartition) LdifPartition(org.apache.directory.server.core.partition.ldif.LdifPartition) AvlPartitionFactory(org.apache.directory.server.core.factory.AvlPartitionFactory) AvlPartitionFactory(org.apache.directory.server.core.factory.AvlPartitionFactory) PartitionFactory(org.apache.directory.server.core.factory.PartitionFactory) File(java.io.File)

Aggregations

File (java.io.File)1 Partition (org.apache.directory.server.core.api.partition.Partition)1 SchemaPartition (org.apache.directory.server.core.api.schema.SchemaPartition)1 AvlPartitionFactory (org.apache.directory.server.core.factory.AvlPartitionFactory)1 PartitionFactory (org.apache.directory.server.core.factory.PartitionFactory)1 LdifPartition (org.apache.directory.server.core.partition.ldif.LdifPartition)1