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

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


    private static File workingDir = new File("target/ldapServer");

    private Partition addPartition(String partitionId, String partitionDn) throws Exception {
        // Create a new partition named 'ippon'.
        Partition partition = new JdbmPartition();
        partition.setId(partitionId);
        partition.setSuffix(partitionDn);
        service.addPartition(partition);

        return partition;
    }
View Full Code Here


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

        Partition ipponPartition = addPartition("ippon", "dc=ippon,dc=fr");

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

        // Inject the ippon root entry if it does not already exist
        try {
            service.getAdminSession().lookup(ipponPartition.getSuffixDn());
            System.out.printf("Root %s found ! %n", ipponPartition.getSuffixDn());
        } catch (LdapNameNotFoundException lnnfe) {
            System.out.printf("Root %s not found ! creating it ... %n", ipponPartition.getSuffixDn());

            LdapDN dnippon = new LdapDN("dc=ippon,dc=fr");
            ServerEntry entryippon = service.newEntry(dnippon);
            entryippon.add("objectClass", "top", "domain", "extensibleObject");
            entryippon.add("dc", "ippon");
            service.getAdminSession().add(entryippon);

            System.out.printf("Importing some data ... %n", ipponPartition.getSuffixDn());
            InputStream is = this.getClass().getResource("ipponTestLdapExport.ldif").openStream();
            LdifReader ldifReader = new LdifReader(is);
            for (LdifEntry entry : ldifReader) {
                injectEntry(entry, service);
            }
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

        // 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 );
        service.setDenormalizeOpAttrsEnabled( true );

        // Now we can create as many partitions as we need
        Partition acmePartition = addPartition("acme", "dc=acme,dc=org");

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

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

        // Inject the foo root entry if it does not already exist
        try
        {
            service.getAdminSession().lookup( acmePartition.getSuffixDn() );
        }
        catch ( LdapException lnnfe )
        {
            DN dnBar = new DN( "dc=acme,dc=org" );
            ServerEntry entryBar = service.newEntry( dnBar );
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.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.