Package org.apache.directory.server.core.partition

Examples of org.apache.directory.server.core.partition.Partition


    {
        /** A structure to hold all the partitions */
        DnNode<Partition> partitionLookupTree = new DnNode<Partition>();

        Dn suffix1 = new Dn( "dc=example1, dc=com" );
        Partition partition1 = new JdbmPartition();
        partition1.setSuffix( suffix1 );

        partitionLookupTree.add( suffix1, partition1 );

        Dn suffix2 = new Dn( "dc=example2, dc=com" );
        Partition partition2 = new JdbmPartition();
        partition2.setSuffix( suffix2 );

        partitionLookupTree.add( suffix2, partition2 );

        assertNotNull( partitionLookupTree );

View Full Code Here


            if ( partitionBean.isDisabled() )
            {
                continue;
            }
           
            Partition partition = createPartition( directoryService, partitionBean );
           
            if ( partition != null )
            {
                partitions.put( partitionBean.getPartitionId(), partition );
            }
View Full Code Here

        directoryService.setInterceptors( interceptors );
       
        // Partitions
        Map<String, Partition> partitions = createPartitions( directoryService, directoryServiceBean.getPartitions() );

        Partition systemPartition = partitions.remove( "system" );

        if ( systemPartition == null )
        {
            //throw new Exception( I18n.err( I18n.ERR_505 ) );
        }
View Full Code Here

        // change the working directory to something that is unique
        // on the system and somewhere either under target directory
        // or somewhere in a temp area of the machine.

        // Inject the System Partition
        Partition systemPartition = partitionFactory.createPartition( "system", ServerDNConstants.SYSTEM_DN, 500,
            new File( directoryService.getInstanceLayout().getPartitionsDirectory(), "system" ) );
        systemPartition.setSchemaManager( directoryService.getSchemaManager() );

        partitionFactory.addIndex( systemPartition, SchemaConstants.OBJECT_CLASS_AT, 100 );

        directoryService.setSystemPartition( systemPartition );
    }
View Full Code Here

    @Test
    public void testAddAndRemove() throws Exception
    {
        PartitionFactory partitionFactory = DefaultDirectoryServiceFactory.DEFAULT.getPartitionFactory();
        Partition partition = partitionFactory.createPartition( "removable", "ou=removable", 100, getService()
            .getInstanceLayout().getPartitionsDirectory() );

        // Test AddContextPartition
        getService().addPartition( partition );

        Dn suffixDn = new Dn( getService().getSchemaManager(), "ou=removable" );

        Entry ctxEntry = new DefaultEntry(
            getService().getSchemaManager(),
            suffixDn.toString(),
            "objectClass: top",
            "objectClass: organizationalUnit",
            "ou: removable",
            "entryCSN", new CsnFactory( 1 ).newInstance().toString(),
            "entryUUID", UUID.randomUUID().toString() );

        partition.add( new AddOperationContext( getService().getAdminSession(), ctxEntry ) );

        LdapConnection connection = IntegrationUtils.getAdminConnection( getService() );

        assertNotNull( connection.lookup( "ou=removable" ) );
View Full Code Here

        dsf.init( dsBuilder.name() );

        // Process the Partition, if any.
        for ( CreatePartition createPartition : dsBuilder.partitions() )
        {
            Partition partition;

            // Determine the partition type
            if ( createPartition.type() == Partition.class )
            {
                // The annotation does not specify a specific partition type.
                // We use the partition factory to create partition and index
                // instances.
                PartitionFactory partitionFactory = dsf.getPartitionFactory();
                partition = partitionFactory.createPartition( createPartition
                        .name(), createPartition.suffix(), createPartition
                        .cacheSize(), new File( service.getInstanceLayout()
                        .getPartitionsDirectory(), createPartition.name() ) );

                CreateIndex[] indexes = createPartition.indexes();
               
                for ( CreateIndex createIndex : indexes )
                {
                    partitionFactory.addIndex( partition,
                            createIndex.attribute(), createIndex.cacheSize() );
                }
            }
            else
            {
                // The annotation contains a specific partition type, we use
                // that type.
                partition = createPartition.type().newInstance();
                partition.setId( createPartition.name() );
                partition.setSuffix( new Dn( service.getSchemaManager(), createPartition.suffix() ) );

                if ( partition instanceof BTreePartition<?> )
                {
                    BTreePartition<?> btreePartition = ( BTreePartition<?> ) partition;
                    btreePartition.setCacheSize( createPartition.cacheSize() );
                    btreePartition.setPartitionPath( new File( service
                            .getInstanceLayout().getPartitionsDirectory(),
                            createPartition.name() ).toURI() );

                    // Process the indexes if any
                    CreateIndex[] indexes = createPartition.indexes();

                    for ( CreateIndex createIndex : indexes )
                    {
                        // The annotation does not specify a specific index
                        // type.
                        // We use the generic index implementation.
                        JdbmIndex index = new JdbmIndex();
                        index.setAttributeId( createIndex.attribute() );

                        btreePartition.addIndexedAttributes( index );
                    }
                }
            }

            partition.setSchemaManager( service.getSchemaManager() );

            // Inject the partition into the DirectoryService
            service.addPartition( partition );

            // Last, process the context entry
View Full Code Here

        // first load the schema
        initSchemaPartition(servletContext);

        // then the system partition
        // this is a MANDATORY partition
        Partition systemPartition = addPartition("system", ServerDNConstants.SYSTEM_DN);
        service.setSystemPartition(systemPartition);

        // Disable the ChangeLog system
        service.getChangeLog().setEnabled(false);
        service.setDenormalizeOpAttrsEnabled(true);

        // Now we can create as many partitions as we need
        Partition ispPartition = addPartition("isp", "o=isp");
        addIndex(ispPartition, "objectClass", "ou", "uid");

        // And start the service
        service.startup();

        // Inject the foo root entry if it does not already exist
        try {
            service.getAdminSession().lookup(ispPartition.getSuffixDn());
        } catch (LdapException lnnfe) {
            DN dnIsp = new DN("o=isp");
            ServerEntry rootEntry = service.newEntry(dnIsp);
            rootEntry.add("objectClass", "top", "organization");
            rootEntry.add("o", "isp");
View Full Code Here

     */
    @Test
    public void testImportContextEntryRefreshesRootDSE() throws Exception
    {
        // add a new partition
        Partition partition = new JdbmPartition();
        partition.setId( "example" );
        partition.setSuffix( new Dn( "dc=example,dc=com" ) );
        ldapServer.getDirectoryService().addPartition( partition );

        // refresh root DSE and ensure that the partition is in root DSE
        browserViewBot.selectEntry( "DIT", "Root DSE" );
        browserViewBot.refresh();
View Full Code Here

      // first load the schema
      initSchemaPartition();

      // then the system partition
      // this is a MANDATORY partition
      Partition systemPartition = addPartition( "system", ServerDNConstants.SYSTEM_DN );
      service.setSystemPartition( systemPartition );

      // Disable the ChangeLog system
      service.getChangeLog().setEnabled( false );

      // Create a new partition
      Partition partition = addPartition("eXoTestPartition", "dc=exoplatform,dc=org");

      // Index some attributes on the partition
      addIndex(partition, "objectClass", "ou", "uid" );

      service.setShutdownHookEnabled(false);

      service.startup();

      // Inject the eXo root entry if it does not already exist
      if ( !service.getAdminSession().exists( partition.getSuffixDn() ) )
      {
          DN dnExo = new DN( "dc=exoplatform,dc=org" );
          ServerEntry entryExo = service.newEntry( dnExo );
          entryExo.add( "objectClass", "top", "domain", "extensibleObject" );
          entryExo.add( "dc", "exoplatform" );
View Full Code Here

        // first load the schema
        initSchemaPartition(servletContext);

        // then the system partition
        // this is a MANDATORY partition
        final Partition systemPartition = addPartition("system", ServerDNConstants.SYSTEM_DN);
        service.setSystemPartition(systemPartition);

        // Disable the ChangeLog system
        service.getChangeLog().setEnabled(false);
        service.setDenormalizeOpAttrsEnabled(true);

        // Now we can create as many partitions as we need
        final Partition ispPartition = addPartition("isp", "o=isp");
        addIndex(ispPartition, "objectClass", "ou", "uid");

        // And start the service
        service.startup();
View Full Code Here

TOP

Related Classes of org.apache.directory.server.core.partition.Partition

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.