use of org.apache.directory.server.core.partition.impl.avl.AvlPartition in project jackrabbit-oak by apache.
the class AbstractServer method setUp.
/**
* Get's the initial context factory for the provider's ou=system context
* root.
*/
protected void setUp() throws Exception {
File cwd = new File("target", "apacheds");
doDelete(cwd);
// setup directory service
directoryService = new DefaultDirectoryService();
directoryService.setShutdownHookEnabled(false);
directoryService.setInstanceLayout(new InstanceLayout(cwd));
cacheService = new CacheService();
cacheService.initialize(directoryService.getInstanceLayout());
SchemaManager schemaManager = new DefaultSchemaManager();
directoryService.setSchemaManager(schemaManager);
directoryService.setDnFactory(new DefaultDnFactory(directoryService.getSchemaManager(), cacheService.getCache("dnCache")));
AvlPartition schLdifPart = new AvlPartition(directoryService.getSchemaManager(), directoryService.getDnFactory());
schLdifPart.setId("schema");
schLdifPart.setSuffixDn(directoryService.getDnFactory().create(ServerDNConstants.CN_SCHEMA_DN));
SchemaPartition schPart = new SchemaPartition(directoryService.getSchemaManager());
schPart.setWrappedPartition(schLdifPart);
directoryService.setSchemaPartition(schPart);
AvlPartition sysPart = new AvlPartition(directoryService.getSchemaManager(), directoryService.getDnFactory());
sysPart.setId(SystemSchemaConstants.SCHEMA_NAME);
sysPart.setSuffixDn(directoryService.getDnFactory().create(ServerDNConstants.SYSTEM_DN));
directoryService.setSystemPartition(sysPart);
AvlPartition examplePart = new AvlPartition(directoryService.getSchemaManager(), directoryService.getDnFactory());
examplePart.setId("example");
examplePart.setSuffixDn(directoryService.getDnFactory().create(EXAMPLE_DN));
examplePart.setCacheService(cacheService);
directoryService.addPartition(examplePart);
// setup ldap server
port = AvailablePortFinder.getNextAvailable(1024);
ldapServer = new LdapServer();
setupLdapServer();
setupSaslMechanisms();
directoryService.startup();
setupExamplePartition();
startLdapServer();
setContexts(ServerDNConstants.ADMIN_SYSTEM_DN, "secret");
}
use of org.apache.directory.server.core.partition.impl.avl.AvlPartition in project activemq-artemis by apache.
the class LdapServer method checkPartition.
private void checkPartition(LdifEntry ldifEntry) throws Exception {
Dn dn = ldifEntry.getDn();
Dn parent = dn.getParent();
try {
directoryService.getAdminSession().exists(parent);
} catch (Exception e) {
System.out.println("Creating new partition for DN=" + dn + "\n");
AvlPartition partition = new AvlPartition(directoryService.getSchemaManager());
partition.setId(dn.getName());
partition.setSuffixDn(dn);
directoryService.addPartition(partition);
}
}
use of org.apache.directory.server.core.partition.impl.avl.AvlPartition in project sonarqube by SonarSource.
the class ApacheDS method startDirectoryService.
private ApacheDS startDirectoryService(String workDirStr) throws Exception {
DefaultDirectoryServiceFactory factory = new DefaultDirectoryServiceFactory();
factory.init(realm);
directoryService = factory.getDirectoryService();
directoryService.getChangeLog().setEnabled(false);
directoryService.setShutdownHookEnabled(false);
directoryService.setAllowAnonymousAccess(true);
File workDir = new File(workDirStr);
if (workDir.exists()) {
FileUtils.deleteDirectory(workDir);
}
InstanceLayout instanceLayout = new InstanceLayout(workDir);
directoryService.setInstanceLayout(instanceLayout);
AvlPartition partition = new AvlPartition(directoryService.getSchemaManager());
partition.setId("Test");
partition.setSuffixDn(new Dn(directoryService.getSchemaManager(), baseDn));
partition.addIndexedAttributes(new AvlIndex<>("ou"), new AvlIndex<>("uid"), new AvlIndex<>("dc"), new AvlIndex<>("objectClass"));
partition.initialize();
directoryService.addPartition(partition);
directoryService.addLast(new KeyDerivationInterceptor());
directoryService.shutdown();
directoryService.startup();
return this;
}
use of org.apache.directory.server.core.partition.impl.avl.AvlPartition in project sonarqube by SonarSource.
the class ApacheDS method startDirectoryService.
private ApacheDS startDirectoryService(String workDirStr) throws Exception {
DefaultDirectoryServiceFactory factory = new DefaultDirectoryServiceFactory();
factory.init(realm);
directoryService = factory.getDirectoryService();
directoryService.getChangeLog().setEnabled(false);
directoryService.setShutdownHookEnabled(false);
directoryService.setAllowAnonymousAccess(true);
File workDir = new File(workDirStr);
if (workDir.exists()) {
FileUtils.deleteDirectory(workDir);
}
InstanceLayout instanceLayout = new InstanceLayout(workDir);
directoryService.setInstanceLayout(instanceLayout);
AvlPartition partition = new AvlPartition(directoryService.getSchemaManager());
partition.setId("Test");
partition.setSuffixDn(new Dn(directoryService.getSchemaManager(), baseDn));
partition.addIndexedAttributes(new AvlIndex<>("ou"), new AvlIndex<>("uid"), new AvlIndex<>("dc"), new AvlIndex<>("objectClass"));
partition.initialize();
directoryService.addPartition(partition);
directoryService.addLast(new KeyDerivationInterceptor());
directoryService.shutdown();
directoryService.startup();
return this;
}
Aggregations