Package org.apache.directory.server.core.partition.impl.btree.jdbm

Examples of org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition


            ldapServer = new LdapServer();
            ldapServer.setTransports( new TcpTransport( consumerPort ) );
            ldapServer.setDirectoryService( dirService );
           
            DN suffix = new DN( config.getBaseDn() );
            JdbmPartition partition = new JdbmPartition();
            partition.setSuffix( suffix.getName() );
            partition.setId( "syncrepl" );
            partition.setPartitionDir( new File( workDir, partition.getId() ) );
            partition.setSyncOnWrite( true );
            partition.setSchemaManager( dirService.getSchemaManager() );

            // Add objectClass attribute for the system partition
            Set<Index<?, Entry, Long>> indexedAttrs = new HashSet<Index<?, Entry, Long>>();
            indexedAttrs.add( new JdbmIndex<Object, Entry>( SchemaConstants.ENTRY_UUID_AT ) );
            ( ( JdbmPartition ) partition ).setIndexedAttributes( indexedAttrs );

            partition.initialize();

            dirService.addPartition( partition );

            dirService.startup();
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 = new JdbmPartition();
        systemPartition.setId( "system" );
        ( ( JdbmPartition ) systemPartition ).setCacheSize( 500 );
        systemPartition.setSuffix( ServerDNConstants.SYSTEM_DN );
        systemPartition.setSchemaManager( service.getSchemaManager() );
        ( ( JdbmPartition ) systemPartition ).setPartitionDir( new File( service.getWorkingDirectory(), "system" ) );

        // Add objectClass attribute for the system partition
        Set<Index<?, Entry, Long>> indexedAttrs = new HashSet<Index<?, Entry, Long>>();
        indexedAttrs.add( new JdbmIndex<Object, Entry>( SchemaConstants.OBJECT_CLASS_AT ) );
View Full Code Here

     */
    public JdbmPartition createPartition( SchemaManager schemaManager, String id, String suffix, int cacheSize,
        File workingDirectory )
        throws Exception
    {
        JdbmPartition partition = new JdbmPartition( schemaManager );
        partition.setId( id );
        partition.setSuffixDn( new Dn( suffix ) );
        partition.setCacheSize( 500 );
        partition.setPartitionPath( workingDirectory.toURI() );

        return partition;
    }
View Full Code Here

        if ( !( partition instanceof JdbmPartition ) )
        {
            throw new IllegalArgumentException( "Partition must be a JdbmPartition" );
        }

        JdbmPartition jdbmPartition = ( JdbmPartition ) partition;
        Set<Index<?, Entry, Long>> indexedAttributes = jdbmPartition.getIndexedAttributes();

        JdbmIndex<Object, Entry> index = new JdbmIndex<Object, Entry>( attributeId );
        index.setCacheSize( cacheSize );

        indexedAttributes.add( index );
        jdbmPartition.setIndexedAttributes( indexedAttributes );
    }
View Full Code Here

     * @throws Exception If the partition can't be added
     */
    private Partition addPartition( String partitionId, String partitionDn ) throws Exception
    {
        // Create a new partition named 'foo'.
        JdbmPartition partition = new JdbmPartition();
        partition.setId( partitionId );
        partition.setPartitionDir( new File( service.getWorkingDirectory(), partitionId ) );
        partition.setSuffix( partitionDn );
        service.addPartition( partition );

        return partition;
    }
View Full Code Here

        int port = Integer.valueOf(getParameter(LDAP_PORT, DEFAULT_LDAP_PORT));
        long start = System.currentTimeMillis();
        try
        {
            JdbmPartition partition = getDefaultPartition();
            reset(new File(getParameter(LDAP_WORKING_DIR, DEFAULT_WORKING_DIRECTORY)));
            service.addPartition(partition);
            configureLdapServer(port);
            configureLdifDirectory(new File(getParameter(LDAP_LDIF_DIR, DEFAULT_LDIF_DIRECTORY)));
            apacheDs.startup();
View Full Code Here

            - start);
    }

    private JdbmPartition getDefaultPartition() throws LdapInvalidDnException
    {
        JdbmPartition partition = new JdbmPartition();

        partition.setId("springframework.org");
        partition.setSuffix("dc=springframework,dc=org");
        return partition;
    }
View Full Code Here

    private JdbmPartition createSystemPartition(final DefaultDirectoryService service,
        final File workingDirectory) throws Exception
    {
        JdbmPartitionFactory partitionFactory = new JdbmPartitionFactory();
        JdbmPartition systemPartition =
            partitionFactory.createPartition("system", ServerDNConstants.SYSTEM_DN, 500,
                new File(workingDirectory, "system"));
        partitionFactory.addIndex(systemPartition, SchemaConstants.OBJECT_CLASS_AT, 100);

        systemPartition.setSchemaManager(service.getSchemaManager());
        return systemPartition;
    }
View Full Code Here

       
        // Disable the ChangeLog system
        service.getChangeLog().setEnabled( true );
        service.setDenormalizeOpAttrsEnabled( true );
       
        Partition partition = new JdbmPartition();
        partition.setId( "foo" );
        partition.setSuffix( baseDN );
        service.addPartition( partition );
       
        service.setWorkingDirectory(workingDir);
        server = new LdapServer();
        server.setDirectoryService(service);
        server.setTransports(new  TcpTransport(port));
        service.startup();
        server.start();
       
        // Inject the sevenSeas root entry if it does not already exist
        if (!service.getAdminSession().exists(partition.getSuffixDn()))
        {
            LdapDN dn = new LdapDN( baseDN );
            ServerEntry entry = service.newEntry( dn );
            entry.add( "objectClass", "top", "domain", "extensibleObject" );
            entry.add( "dc", "foo" );
View Full Code Here

TOP

Related Classes of org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition

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.