Package org.apache.ldap.server.configuration

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


        }
    }

    private MutableContextPartitionConfiguration processPartition(
            Partition partition) {
        MutableContextPartitionConfiguration mcpc = new MutableContextPartitionConfiguration();
        mcpc.setName(partition.getName());
        mcpc.setSuffix(partition.getSuffix());
        IndexedAttributes indexedAttributes = partition.getIndexedAttributes();
        if (indexedAttributes != null) {
            String attributeList[] = indexedAttributes
                    .getIndexedAttributeArray();
            if (attributeList != null) {
                Set set = new HashSet();
                for (int i = 0; i < attributeList.length; i++) {
                    set.add(attributeList[i]);
                }
                mcpc.setIndexedAttributes(set);
            }
        }

        ContextEntry contextEntry = partition.getContextEntry();
        if (contextEntry != null) {
            Attribute[] attributeList = contextEntry.getAttributeArray();
            if (attributeList != null) {
                BasicAttributes attrs = new BasicAttributes(true);
                for (int i = 0; i < attributeList.length; i++) {
                    BasicAttribute attr = new BasicAttribute(attributeList[i]
                            .getId());
                    String values[] = attributeList[i].getValueArray();
                    for (int j = 0; j < values.length; j++) {
                        attr.add(values[j]);
                    }
                    attrs.put(attr);
                }
                mcpc.setContextEntry(attrs);
            }
        }

        return mcpc;
    }
View Full Code Here


            {
                cfg = ( ContextPartitionConfiguration ) i.next();
                ContextPartition partition = cfg.getContextPartition();
               
                // Turn on default indices
                MutableContextPartitionConfiguration mcfg =
                    new MutableContextPartitionConfiguration();
                mcfg.setName( cfg.getName() );
                mcfg.setSuffix( cfg.getSuffix() );
                mcfg.setContextEntry( cfg.getContextEntry() );
                mcfg.setContextPartition( partition );
               
                Set indexedAttrs = cfg.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 );
               
                partition.init( factoryCfg, mcfg );
                initializedPartitions.add( 0, partition );
                register( partition );
            }
View Full Code Here


    private void initializeSystemPartition( ContextFactoryConfiguration factoryCfg ) throws NamingException
    {
        // initialize system partition first
        MutableContextPartitionConfiguration systemCfg = new MutableContextPartitionConfiguration();
        system = new JdbmContextPartition(); // using default implementation.
        systemCfg.setName( "system" );
        systemCfg.setSuffix( ContextPartitionNexus.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();
        Attribute objectClassAttr = new BasicAttribute( "objectClass" );
        objectClassAttr.add( "top" );
        objectClassAttr.add( "organizationalUnit" );
        systemEntry.put( objectClassAttr );
        systemEntry.put( "creatorsName", ContextPartitionNexus.ADMIN_PRINCIPAL ) ;
        systemEntry.put( "createTimestamp", DateUtils.getGeneralizedTime() ) ;
        systemEntry.put(
                NamespaceTools.getRdnAttribute( ContextPartitionNexus.SYSTEM_PARTITION_SUFFIX ),
                NamespaceTools.getRdnValue( ContextPartitionNexus.SYSTEM_PARTITION_SUFFIX ) ) ;
        systemCfg.setContextEntry( systemEntry );

        system.init( factoryCfg, systemCfg );
        register( system );
    }
View Full Code Here

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

        MutableContextPartitionConfiguration pcfg;
       
        // Add partition 'testing'
        pcfg = new MutableContextPartitionConfiguration();
        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 MutableContextPartitionConfiguration();
        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 MutableContextPartitionConfiguration();
        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


    private void initializeSystemPartition() throws NamingException
    {
        // initialize system partition first
        MutableContextPartitionConfiguration systemCfg = new MutableContextPartitionConfiguration();
        system = new JdbmContextPartition(); // using default implementation.
        systemCfg.setName( "system" );
        systemCfg.setSuffix( ContextPartitionNexus.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", ContextPartitionNexus.ADMIN_PRINCIPAL ) ;
        systemEntry.put( "createTimestamp", DateUtils.getGeneralizedTime() ) ;
        systemEntry.put(
                NamespaceTools.getRdnAttribute( ContextPartitionNexus.SYSTEM_PARTITION_SUFFIX ),
                NamespaceTools.getRdnValue( ContextPartitionNexus.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( ContextPartitionConfiguration config ) throws NamingException
    {
        ContextPartition partition = config.getContextPartition();

        // Turn on default indices
        MutableContextPartitionConfiguration mcfg =
            new MutableContextPartitionConfiguration();
        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

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

        MutableContextPartitionConfiguration pcfg;
       
        // Add partition 'testing'
        pcfg = new MutableContextPartitionConfiguration();
        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 MutableContextPartitionConfiguration();
        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 MutableContextPartitionConfiguration();
        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

        }
    }

    private MutableContextPartitionConfiguration processPartition(
            Partition partition) {
        MutableContextPartitionConfiguration mcpc = new MutableContextPartitionConfiguration();
        mcpc.setName(partition.getName());
        mcpc.setSuffix(partition.getSuffix());
        IndexedAttributes indexedAttributes = partition.getIndexedAttributes();
        if (indexedAttributes != null) {
            String attributeList[] = indexedAttributes
                    .getIndexedAttributeArray();
            if (attributeList != null) {
                Set set = new HashSet();
                for (int i = 0; i < attributeList.length; i++) {
                    set.add(attributeList[i]);
                }
                mcpc.setIndexedAttributes(set);
            }
        }

        ContextEntry contextEntry = partition.getContextEntry();
        if (contextEntry != null) {
            Attribute[] attributeList = contextEntry.getAttributeArray();
            if (attributeList != null) {
                BasicAttributes attrs = new BasicAttributes(true);
                for (int i = 0; i < attributeList.length; i++) {
                    BasicAttribute attr = new BasicAttribute(attributeList[i]
                            .getId());
                    String values[] = attributeList[i].getValueArray();
                    for (int j = 0; j < values.length; j++) {
                        attr.add(values[j]);
                    }
                    attrs.put(attr);
                }
                mcpc.setContextEntry(attrs);
            }
        }

        return mcpc;
    }
View Full Code Here

TOP

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

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.