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);
}
Aggregations