Package org.apache.ldap.server.configuration

Examples of org.apache.ldap.server.configuration.MutableDirectoryPartitionConfiguration


    String suffix = "dc=Apache,dc=Org";

    public void setUp() throws Exception
    {

        MutableDirectoryPartitionConfiguration partition = new MutableDirectoryPartitionConfiguration();
        partition.setName( "apache" );
        partition.setSuffix( suffix );

        Set indexedAttributes = new HashSet();
        indexedAttributes.add( "objectClass" );
        indexedAttributes.add( "ou" );
        indexedAttributes.add( "uid" );
        partition.setIndexedAttributes( indexedAttributes );

        Attributes attrs = new BasicAttributes( true );
        Attribute objectClass = new BasicAttribute( "objectClass" );
        objectClass.add( "top" );
        objectClass.add( "domain" );
        objectClass.add( "extensibleObject" );
        attrs.put( objectClass );
        attrs.put( "dc", "Apache" );

        partition.setContextEntry( attrs );

        Set partitions = new HashSet();
        partitions.add( partition );

        configuration.setContextPartitionConfigurations( partitions );
View Full Code Here



    private DirectoryPartitionConfiguration initializeSystemPartition() throws NamingException
    {
        // initialize system partition first
        MutableDirectoryPartitionConfiguration systemCfg = new MutableDirectoryPartitionConfiguration();
        system = new JdbmDirectoryPartition(); // using default implementation.
        systemCfg.setName( "system" );
        systemCfg.setSuffix( DirectoryPartitionNexus.SYSTEM_PARTITION_SUFFIX );
        systemCfg.setContextPartition( system );
       
        // Add indexed attributes for system partition
        Set indexedSystemAttrs = new HashSet();
        indexedSystemAttrs.add( Oid.ALIAS );
        indexedSystemAttrs.add( Oid.EXISTANCE );
        indexedSystemAttrs.add( Oid.HIERARCHY );
        indexedSystemAttrs.add( Oid.NDN );
        indexedSystemAttrs.add( Oid.ONEALIAS );
        indexedSystemAttrs.add( Oid.SUBALIAS );
        indexedSystemAttrs.add( Oid.UPDN );
        systemCfg.setIndexedAttributes( indexedSystemAttrs );
       
        // Add context entry for system partition
        Attributes systemEntry = new BasicAttributes( true );
        Attribute objectClassAttr = new BasicAttribute( "objectClass" );
        objectClassAttr.add( "top" );
        objectClassAttr.add( "organizationalUnit" );
        systemEntry.put( objectClassAttr );
        systemEntry.put( "creatorsName", DirectoryPartitionNexus.ADMIN_PRINCIPAL ) ;
        systemEntry.put( "createTimestamp", DateUtils.getGeneralizedTime() ) ;
        systemEntry.put(
                NamespaceTools.getRdnAttribute( DirectoryPartitionNexus.SYSTEM_PARTITION_SUFFIX ),
                NamespaceTools.getRdnValue( DirectoryPartitionNexus.SYSTEM_PARTITION_SUFFIX ) ) ;
        systemCfg.setContextEntry( systemEntry );

        system.init( factoryCfg, systemCfg );
        String key = system.getSuffix( true ).toString();
        if( partitions.containsKey( key ) )
        {
View Full Code Here

    public synchronized void addContextPartition( DirectoryPartitionConfiguration config ) throws NamingException
    {
        DirectoryPartition partition = config.getContextPartition();

        // Turn on default indices
        MutableDirectoryPartitionConfiguration mcfg =
            new MutableDirectoryPartitionConfiguration();
        mcfg.setName( config.getName() );
        mcfg.setSuffix( config.getSuffix() );
        mcfg.setContextEntry( config.getContextEntry() );
        mcfg.setContextPartition( partition );
       
        Set indexedAttrs = config.getIndexedAttributes();
        indexedAttrs.add( Oid.ALIAS );
        indexedAttrs.add( Oid.EXISTANCE );
        indexedAttrs.add( Oid.HIERARCHY );
        indexedAttrs.add( Oid.NDN );
        indexedAttrs.add( Oid.ONEALIAS );
        indexedAttrs.add( Oid.SUBALIAS );
        indexedAttrs.add( Oid.UPDN );
        mcfg.setIndexedAttributes( indexedAttrs );
       
        String key = config.getSuffix();
        if( partitions.containsKey( key ) )
        {
            throw new ConfigurationException( "Duplicate partition suffix: " + key );
View Full Code Here

        }
        else if ( this.getName().equals( "testUserAuthOnMixedCaseSuffix" ) )
        {
            Set partitions = new HashSet();
            partitions.addAll( configuration.getContextPartitionConfigurations() );
            MutableDirectoryPartitionConfiguration partition = new MutableDirectoryPartitionConfiguration();
            partition.setSuffix( "dc=aPache,dc=org" );
            Attributes entry = new BasicAttributes( "dc", "aPache", true );
            Attribute oc = new BasicAttribute( "objectClass" );
            entry.put( oc );
            oc.add( "top" );
            oc.add( "domain" );
            partition.setName( "apache" );
            partition.setContextEntry( entry );
            partition.setIndexedAttributes( Collections.singleton( "dc" ) );
            partitions.add( partition );
            configuration.setContextPartitionConfigurations( partitions );
  }
        else if ( this.getName().equals( "testAnonymousBindsEnabledBaseSearch" ) )
        {
            // allow anonymous access
            configuration.setAllowAnonymousAccess( true );
           
            // create a partition to search
            Set partitions = new HashSet();
            partitions.addAll( configuration.getContextPartitionConfigurations() );
            MutableDirectoryPartitionConfiguration partition = new MutableDirectoryPartitionConfiguration();
            partition.setSuffix( "dc=apache,dc=org" );
            Attributes entry = new BasicAttributes( "dc", "apache", true );
            Attribute oc = new BasicAttribute( "objectClass" );
            entry.put( oc );
            oc.add( "top" );
            oc.add( "domain" );
            partition.setName( "apache" );
            partition.setContextEntry( entry );
            partition.setIndexedAttributes( Collections.singleton( "dc" ) );
            partitions.add( partition );
            configuration.setContextPartitionConfigurations( partitions );
        }
View Full Code Here

    {
        BasicAttributes attrs;
        Set indexedAttrs;
        Set pcfgs = new HashSet();

        MutableDirectoryPartitionConfiguration pcfg;
       
        // Add partition 'testing'
        pcfg = new MutableDirectoryPartitionConfiguration();
        pcfg.setName( "testing" );
        pcfg.setSuffix( "ou=testing" );
       
        indexedAttrs = new HashSet();
        indexedAttrs.add( "ou" );
        indexedAttrs.add( "objectClass" );
        pcfg.setIndexedAttributes( indexedAttrs );

        attrs = new BasicAttributes( true );
        BasicAttribute attr = new BasicAttribute( "objectClass" );
        attr.add( "top" );
        attr.add( "organizationalUnit" );
        attr.add( "extensibleObject" );
        attrs.put( attr );
        attr = new BasicAttribute( "ou" );
        attr.add( "testing" );
        attrs.put( attr );
        pcfg.setContextEntry( attrs );
       
        pcfgs.add( pcfg );
       
        // Add partition 'example'
        pcfg = new MutableDirectoryPartitionConfiguration();
        pcfg.setName( "example" );
        pcfg.setSuffix( "dc=example" );
       
        indexedAttrs = new HashSet();
        indexedAttrs.add( "ou" );
        indexedAttrs.add( "dc" );
        indexedAttrs.add( "objectClass" );
        pcfg.setIndexedAttributes( indexedAttrs );
       
        attrs = new BasicAttributes( true );
        attr = new BasicAttribute( "objectClass" );
        attr.add( "top" );
        attr.add( "domain" );
        attr.add( "extensibleObject" );
        attrs.put( attr );
        attr = new BasicAttribute( "dc" );
        attr.add( "example" );
        attrs.put( attr );
        pcfg.setContextEntry( attrs );
       
        pcfgs.add( pcfg );

        // Add partition 'MixedCase'
        pcfg = new MutableDirectoryPartitionConfiguration();
        pcfg.setName( "mixedcase" );
        pcfg.setSuffix( "dc=MixedCase" );
       
        indexedAttrs = new HashSet();
        indexedAttrs.add( "dc" );
        indexedAttrs.add( "objectClass" );
        pcfg.setIndexedAttributes( indexedAttrs );

        attrs = new BasicAttributes( true );
        attr = new BasicAttribute( "objectClass" );
        attr.add( "top" );
        attr.add( "domain" );
        attr.add( "extensibleObject" );
        attrs.put( attr );
        attr = new BasicAttribute( "dc" );
        attr.add( "MixedCase" );
        attrs.put( attr );
        pcfg.setContextEntry( attrs );
       
        pcfgs.add( pcfg );
       
        configuration.setContextPartitionConfigurations( pcfgs );
View Full Code Here

TOP

Related Classes of org.apache.ldap.server.configuration.MutableDirectoryPartitionConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.