org.apache.directory.server.core.factory.PartitionFactory Java Examples

The following examples show how to use org.apache.directory.server.core.factory.PartitionFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LdapService.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Add a new partition to the directory server.
 *
 * @param partitionName - The name of the partition.
 * @param indexes - The attributes to index.
 * @return This Builder for subsequent changes.
 */
public Builder addPartition(final String id, final String partitionName, final int indexSize, final String ... indexes) throws Exception {
    assertNotStarted();
    if (directoryService == null) {
        throw new IllegalStateException("The Directory service has not been created.");
    }

    SchemaManager schemaManager = directoryService.getSchemaManager();
    PartitionFactory partitionFactory = directoryServiceFactory.getPartitionFactory();
    Partition partition = partitionFactory.createPartition(schemaManager, directoryService.getDnFactory(), id, partitionName, 1000, workingDir);
    for (String current : indexes) {
        partitionFactory.addIndex(partition, current, indexSize);
    }
    partition.setCacheService(directoryService.getCacheService());
    partition.initialize();
    directoryService.addPartition(partition);

    return this;
}
 
Example #2
Source File: DirectoryServiceBuilder.java    From wildfly-camel with Apache License 2.0 5 votes vote down vote up
public static SetupResult setupDirectoryService(Class<?> testClass) throws Exception {

        // Define a default class DS then
        DirectoryServiceFactory dsf = DefaultDirectoryServiceFactory.class.newInstance();

        SetupResult result = new SetupResult();
        result.directoryService = dsf.getDirectoryService();
        result.directoryService.getChangeLog().setEnabled(true);

        dsf.init("default" + UUID.randomUUID().toString());

        // Apply the class LDIFs
        ApplyLdifFiles applyLdifFiles = testClass.getAnnotation(ApplyLdifFiles.class);
        if (applyLdifFiles != null) {
            LOG.debug("Applying {} to {}", applyLdifFiles.value(), testClass.getName());
            DSAnnotationProcessor.injectLdifFiles(applyLdifFiles.clazz(), result.directoryService, applyLdifFiles.value());
        }

        // check if it has a LdapServerBuilder then use the DS created above
        CreateLdapServer ldapServerAnnotation = testClass.getAnnotation(CreateLdapServer.class);
        if (ldapServerAnnotation != null) {
            result.ldapServer = ServerAnnotationProcessor.instantiateLdapServer(ldapServerAnnotation, result.directoryService);
            result.ldapServer.setDirectoryService(result.directoryService);
            result.ldapServer.start();
        }

        // print out information which partition factory we use
        DirectoryServiceFactory dsFactory = DefaultDirectoryServiceFactory.class.newInstance();
        PartitionFactory partitionFactory = dsFactory.getPartitionFactory();
        LOG.debug("Using partition factory {}", partitionFactory.getClass().getSimpleName());

        return result;
    }
 
Example #3
Source File: ApacheDirectoryServer.java    From light-oauth2 with Apache License 2.0 5 votes vote down vote up
private static void createPartition(final DirectoryServiceFactory dsf, final SchemaManager schemaManager, final String id,
                                    final String suffix) throws Exception {
    PartitionFactory pf = dsf.getPartitionFactory();
    Partition p = pf.createPartition(schemaManager, id, suffix, 1000, workingDir.toFile());
    pf.addIndex(p, "krb5PrincipalName", 10);
    p.initialize();
    directoryService.addPartition(p);
}
 
Example #4
Source File: ApacheDirectoryServer.java    From light-oauth2 with Apache License 2.0 5 votes vote down vote up
private static void createPartition(final DirectoryServiceFactory dsf, final SchemaManager schemaManager, final String id,
                                    final String suffix) throws Exception {
    PartitionFactory pf = dsf.getPartitionFactory();
    Partition p = pf.createPartition(schemaManager, id, suffix, 1000, workingDir.toFile());
    pf.addIndex(p, "krb5PrincipalName", 10);
    p.initialize();
    directoryService.addPartition(p);
}
 
Example #5
Source File: KerberosKDCUtil.java    From quarkus-http with Apache License 2.0 5 votes vote down vote up
private static void createPartition(final DirectoryServiceFactory dsf, final SchemaManager schemaManager, final String id,
        final String suffix) throws Exception {
    PartitionFactory pf = dsf.getPartitionFactory();
    Partition p = pf.createPartition(schemaManager, id, suffix, 1000, workingDir.toFile());
    pf.addIndex(p, "krb5PrincipalName", 10);
    p.initialize();
    directoryService.addPartition(p);
}
 
Example #6
Source File: LdapTestSuite.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private static void createPartition(final DirectoryServiceFactory dsf, final SchemaManager schemaManager, final String id,
        final String suffix, final DirectoryService directoryService, final File workingDir) throws Exception {
    PartitionFactory pf = dsf.getPartitionFactory();
    Partition p = pf.createPartition(schemaManager, id, suffix, 1000, workingDir);
    pf.addIndex(p, "uid", 10);
    pf.addIndex(p, "departmentNumber", 10);
    pf.addIndex(p, "member", 10);
    pf.addIndex(p, "memberOf", 10);
    p.initialize();
    directoryService.addPartition(p);
}
 
Example #7
Source File: InMemoryDirectoryServiceFactory.java    From bouncr with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
public PartitionFactory getPartitionFactory() throws Exception {
    return partitionFactory;
}
 
Example #8
Source File: InMemoryDirectoryServiceFactory.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public PartitionFactory getPartitionFactory() throws Exception {
    return partitionFactory;
}
 
Example #9
Source File: InMemoryDirectoryServiceFactory.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public PartitionFactory getPartitionFactory() throws Exception {
   return partitionFactory;
}
 
Example #10
Source File: CarbonDirectoryServiceFactory.java    From carbon-identity with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public PartitionFactory getPartitionFactory()
        throws Exception {
    return partitionFactory;
}
 
Example #11
Source File: InMemoryDirectoryServiceFactory.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public PartitionFactory getPartitionFactory() throws Exception {
    return partitionFactory;
}
 
Example #12
Source File: InMemoryDirectoryServiceFactory.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public PartitionFactory getPartitionFactory() throws Exception {
    return partitionFactory;
}
 
Example #13
Source File: InMemoryDirectoryServiceFactory.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public PartitionFactory getPartitionFactory() throws Exception {
    return partitionFactory;
}
 
Example #14
Source File: InMemoryDirectoryServiceFactory.java    From wildfly-core with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Constructor which uses provided {@link DirectoryService} and {@link PartitionFactory} implementations.
 *
 * @param directoryService must be not-<code>null</code>
 * @param partitionFactory must be not-<code>null</code>
 */
public InMemoryDirectoryServiceFactory(DirectoryService directoryService, PartitionFactory partitionFactory) {
    this.directoryService = directoryService;
    this.partitionFactory = partitionFactory;
}
 
Example #15
Source File: InMemoryDirectoryServiceFactory.java    From wildfly-core with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Constructor which uses provided {@link DirectoryService} and {@link PartitionFactory} implementations.
 *
 * @param directoryService must be not-<code>null</code>
 * @param partitionFactory must be not-<code>null</code>
 */
public InMemoryDirectoryServiceFactory(DirectoryService directoryService, PartitionFactory partitionFactory) {
    this.directoryService = directoryService;
    this.partitionFactory = partitionFactory;
}
 
Example #16
Source File: InMemoryDirectoryServiceFactory.java    From wildfly-core with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Constructor which uses provided {@link DirectoryService} and {@link PartitionFactory} implementations.
 *
 * @param directoryService must be not-<code>null</code>
 * @param partitionFactory must be not-<code>null</code>
 */
public InMemoryDirectoryServiceFactory(DirectoryService directoryService, PartitionFactory partitionFactory) {
    this.directoryService = directoryService;
    this.partitionFactory = partitionFactory;
}
 
Example #17
Source File: InMemoryDirectoryServiceFactory.java    From wildfly-core with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Constructor which uses provided {@link DirectoryService} and {@link PartitionFactory} implementations.
 *
 * @param directoryService must be not-<code>null</code>
 * @param partitionFactory must be not-<code>null</code>
 */
public InMemoryDirectoryServiceFactory(DirectoryService directoryService, PartitionFactory partitionFactory) {
    this.directoryService = directoryService;
    this.partitionFactory = partitionFactory;
}
 
Example #18
Source File: InMemoryDirectoryServiceFactory.java    From activemq-artemis with Apache License 2.0 2 votes vote down vote up
/**
 * Constructor which uses provided {@link DirectoryService} and {@link PartitionFactory} implementations.
 *
 * @param directoryService must be not-<code>null</code>
 * @param partitionFactory must be not-<code>null</code>
 */
public InMemoryDirectoryServiceFactory(DirectoryService directoryService, PartitionFactory partitionFactory) {
   this.directoryService = directoryService;
   this.partitionFactory = partitionFactory;
}
 
Example #19
Source File: InMemoryDirectoryServiceFactory.java    From bouncr with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Constructor which uses provided {@link DirectoryService} and {@link PartitionFactory} implementations.
 *
 * @param directoryService must be not-<code>null</code>
 * @param partitionFactory must be not-<code>null</code>
 */
public InMemoryDirectoryServiceFactory(DirectoryService directoryService, PartitionFactory partitionFactory) {
    this.directoryService = directoryService;
    this.partitionFactory = partitionFactory;
}