Java Code Examples for org.apache.directory.server.core.api.DirectoryService#getPartitionNexus()

The following examples show how to use org.apache.directory.server.core.api.DirectoryService#getPartitionNexus() . 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: ExceptionInterceptor.java    From MyVirtualDirectory with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void init( DirectoryService directoryService ) throws LdapException
{
    super.init( directoryService );
    nexus = directoryService.getPartitionNexus();
    Value<?> attr = nexus.getRootDse( null ).get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
    subschemSubentryDn = directoryService.getDnFactory().create( attr.getString() );
}
 
Example 2
Source File: SchemaInterceptor.java    From MyVirtualDirectory with Apache License 2.0 5 votes vote down vote up
/**
 * Initialize the Schema Service
 *
 * @param directoryService the directory service core
 * @throws Exception if there are problems during initialization
 */
public void init( DirectoryService directoryService ) throws LdapException
{
    if ( IS_DEBUG )
    {
        LOG.debug( "Initializing SchemaInterceptor..." );
    }

    super.init( directoryService );

    nexus = directoryService.getPartitionNexus();
    topFilter = new TopFilter();
    filters.add( topFilter );

    schemaBaseDn = directoryService.getDnFactory().create( SchemaConstants.OU_SCHEMA );

    // stuff for dealing with subentries (garbage for now)
    Value<?> subschemaSubentry = nexus.getRootDse( null ).get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
    subschemaSubentryDn = directoryService.getDnFactory().create( subschemaSubentry.getString() );
    subschemaSubentryDn.apply( schemaManager );
    subschemaSubentryDnNorm = subschemaSubentryDn.getNormName();

    schemaModificationAttributesDn = directoryService.getDnFactory().create(
        SchemaConstants.SCHEMA_MODIFICATIONS_DN );
    schemaModificationAttributesDn.apply( schemaManager );

    computeSuperiors();

    // Initialize the schema manager
    SchemaLoader loader = directoryService.getSchemaManager().getLoader();
    schemaSubEntryManager = new SchemaSubentryManager( schemaManager, loader, directoryService.getDnFactory() );

    if ( IS_DEBUG )
    {
        LOG.debug( "SchemaInterceptor Initialized !" );
    }
}
 
Example 3
Source File: ExceptionInterceptor.java    From MyVirtualDirectory with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void init( DirectoryService directoryService ) throws LdapException
{
    super.init( directoryService );
    nexus = directoryService.getPartitionNexus();
    Value<?> attr = nexus.getRootDseValue( SUBSCHEMA_SUBENTRY_AT );
    subschemSubentryDn = dnFactory.create( attr.getString() );
}
 
Example 4
Source File: SchemaInterceptor.java    From MyVirtualDirectory with Apache License 2.0 5 votes vote down vote up
/**
 * Initialize the Schema Service
 *
 * @param directoryService the directory service core
 * @throws Exception if there are problems during initialization
 */
public void init( DirectoryService directoryService ) throws LdapException
{
    if ( IS_DEBUG )
    {
        LOG.debug( "Initializing SchemaInterceptor..." );
    }

    super.init( directoryService );

    nexus = directoryService.getPartitionNexus();
    topFilter = new TopFilter();
    filters.add( topFilter );

    schemaBaseDn = dnFactory.create( SchemaConstants.OU_SCHEMA );

    // stuff for dealing with subentries (garbage for now)
    Value<?> subschemaSubentry = nexus.getRootDseValue( SUBSCHEMA_SUBENTRY_AT );
    subschemaSubentryDn = dnFactory.create( subschemaSubentry.getString() );
    subschemaSubentryDnNorm = subschemaSubentryDn.getNormName();

    schemaModificationAttributesDn = dnFactory.create(
        SchemaConstants.SCHEMA_MODIFICATIONS_DN );

    computeSuperiors();

    // Initialize the schema manager
    SchemaLoader loader = directoryService.getSchemaManager().getLoader();
    schemaSubEntryManager = new SchemaSubentryManager( schemaManager, loader, dnFactory );

    if ( IS_DEBUG )
    {
        LOG.debug( "SchemaInterceptor Initialized !" );
    }
}
 
Example 5
Source File: SearchRequestHandler.java    From MyVirtualDirectory with Apache License 2.0 4 votes vote down vote up
/**
 * <p>
 * Determines if a search request is a subSchemaSubEntry search.
 * </p>
 * <p>
 * It is a schema search if:
 * - the base Dn is the Dn of the subSchemaSubEntry of the root DSE
 * - and the scope is BASE OBJECT
 * - and the filter is (objectClass=subschema)
 * (RFC 4512, 4.4,)
 * </p>
 * <p>
 * However in this method we only check the first condition to avoid
 * performance issues.
 * </p>
 *
 * @param session the LDAP session
 * @param req the request issued
 *
 * @return true if the search is on the subSchemaSubEntry, false otherwise
 *
 * @throws Exception the exception
 */
private boolean isSubSchemaSubEntrySearch( LdapSession session, SearchRequest req ) throws Exception
{
    Dn base = req.getBase();
    String baseNormForm = ( base.isSchemaAware() ? base.getNormName() : base.getNormName() );

    DirectoryService ds = session.getCoreSession().getDirectoryService();
    PartitionNexus nexus = ds.getPartitionNexus();

    if ( SUBSCHEMA_SUBENTRY_AT == null )
    {
        SUBSCHEMA_SUBENTRY_AT = session.getCoreSession().getDirectoryService().getSchemaManager().getAttributeType(
            SchemaConstants.SUBSCHEMA_SUBENTRY_AT );
    }

    Value<?> subschemaSubentry = nexus.getRootDseValue( SUBSCHEMA_SUBENTRY_AT );
    Dn subschemaSubentryDn = ds.getDnFactory().create( subschemaSubentry.getString() );
    String subschemaSubentryDnNorm = subschemaSubentryDn.getNormName();

    return subschemaSubentryDnNorm.equals( baseNormForm );
}
 
Example 6
Source File: SearchRequestHandler.java    From MyVirtualDirectory with Apache License 2.0 3 votes vote down vote up
/**
 * <p>
 * Determines if a search request is a subSchemaSubEntry search.
 * </p>
 * <p>
 * It is a schema search if:
 * - the base Dn is the Dn of the subSchemaSubEntry of the root DSE
 * - and the scope is BASE OBJECT
 * - and the filter is (objectClass=subschema)
 * (RFC 4512, 4.4,)
 * </p>
 * <p>
 * However in this method we only check the first condition to avoid
 * performance issues.
 * </p>
 *
 * @param session the LDAP session
 * @param req the request issued
 *
 * @return true if the search is on the subSchemaSubEntry, false otherwise
 *
 * @throws Exception the exception
 */
private boolean isSubSchemaSubEntrySearch( LdapSession session, SearchRequest req ) throws Exception
{
    Dn base = req.getBase();
    String baseNormForm = ( base.isSchemaAware() ? base.getNormName() : base.getNormName() );

    DirectoryService ds = session.getCoreSession().getDirectoryService();
    PartitionNexus nexus = ds.getPartitionNexus();
    Value<?> subschemaSubentry = nexus.getRootDse( null ).get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
    Dn subschemaSubentryDn = new Dn( ds.getSchemaManager(), subschemaSubentry.getString() );
    String subschemaSubentryDnNorm = subschemaSubentryDn.getNormName();

    return subschemaSubentryDnNorm.equals( baseNormForm );
}