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

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


     * This method initializes a partition from existing partition directory.
     */
    public void initializeExistingPartition(PartitionInfo partitionInfo) throws
                                                                         DirectoryServerException {

        Partition existingPartition = null;
        try {
            existingPartition = partitionFactory.createPartition(
                    partitionInfo.getPartitionId(), partitionInfo.getRootDN(), PARTITION_CACHE_SIZE,
                    new File(this.workingDirectory, partitionInfo.getPartitionId()));
            existingPartition.setSchemaManager(directoryService.getSchemaManager());

            if (logger.isDebugEnabled()) {
                logger.debug("Partition" + partitionInfo.getPartitionId() +
                        " created from existing partition directory.");
            }
View Full Code Here


     * @inheritDoc
     */
    public void removePartition(String partitionSuffix)
            throws DirectoryServerException {

        Partition partition = getPartition(partitionSuffix);

        if (partition == null) {
            String msg = "Error deleting partition. Could not find a partition with suffix " +
                         partitionSuffix;
            logger.error(msg);
View Full Code Here

    }

    private Partition getPartition(String partitionSuffix) {
        Set availablePartitions = this.directoryService.getPartitions();
        Partition partition;

        for (Object object : availablePartitions) {
            partition = (Partition) object;
            if (partition.getSuffix().equals(partitionSuffix)) {
                return partition;
            }
        }

        return null;
View Full Code Here

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

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

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

        directoryService.setSystemPartition(systemPartition);
View Full Code Here

        }

        nisEntry = connection.lookup( "cn=nis,ou=schema" );
        isNisDisabled = nisEntry.contains( "m-disabled", "TRUE" );

        Partition systemPartition = getService().getSystemPartition();
        DirectoryServiceFactory dsFactory = DefaultDirectoryServiceFactory.class.newInstance();
        dsFactory.getPartitionFactory().addIndex( systemPartition, "gidNumber", 100 );
       
        // Restart the service so that the index is created
        getService().shutdown();
View Full Code Here

    @Test
    public void testAddAndRemove() throws Exception
    {
        DirectoryServiceFactory dsFactory = DefaultDirectoryServiceFactory.class.newInstance();
        PartitionFactory partitionFactory = dsFactory.getPartitionFactory();
        Partition partition = partitionFactory.createPartition( getService().getSchemaManager(), "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

    {
        /** A structure to hold all the partitions */
        DnBranchNode<Partition> partitionLookupTree = new DnBranchNode<Partition>();
       
        DN suffix = new DN( "dc=example, dc=com" );
        Partition partition = new JdbmPartition();
        partition.setSuffix( suffix.getName() );
       
        partitionLookupTree.add( suffix, partition );
       
        assertNotNull( partitionLookupTree );
        assertTrue( partitionLookupTree instanceof DnBranchNode );
View Full Code Here

    {
        /** A structure to hold all the partitions */
        DnBranchNode<Partition> partitionLookupTree = new DnBranchNode<Partition>();
       
        DN suffix1 = new DN( "dc=example, dc=com" );
        Partition partition1 = new JdbmPartition();
        partition1.setSuffix( suffix1.getName() );
       
        partitionLookupTree.add( suffix1, partition1 );
       
        DN suffix2 = new DN( "ou=system" );
        Partition partition2 = new JdbmPartition();
        partition2.setSuffix( suffix2.getName() );
       
        partitionLookupTree.add( suffix2, partition2 );

        assertNotNull( partitionLookupTree );
        assertTrue( partitionLookupTree instanceof DnBranchNode );
View Full Code Here

    {
        /** A structure to hold all the partitions */
        DnBranchNode<Partition> partitionLookupTree = new DnBranchNode<Partition>();
       
        DN suffix1 = new DN( "dc=com" );
        Partition partition1 = new JdbmPartition();
        partition1.setSuffix( suffix1.getName() );
       
        partitionLookupTree.add( suffix1, partition1 );
       
        DN suffix2 = new DN( "dc=example, dc=com" );
        Partition partition2 = new JdbmPartition();
        partition2.setSuffix( suffix2.getName() );
       
        try
        {
            partitionLookupTree.add( suffix2, partition2 );
            fail();
View Full Code Here

    {
        /** A structure to hold all the partitions */
        DnBranchNode<Partition> partitionLookupTree = new DnBranchNode<Partition>();
       
        DN suffix1 = new DN( "dc=example1, dc=com" );
        Partition partition1 = new JdbmPartition();
        partition1.setSuffix( suffix1.getName() );
       
        partitionLookupTree.add( suffix1, partition1 );
       
        DN suffix2 = new DN( "dc=example2, dc=com" );
        Partition partition2 = new JdbmPartition();
        partition2.setSuffix( suffix2.getName() );
       
        partitionLookupTree.add( suffix2, partition2 );

        assertNotNull( partitionLookupTree );
       
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.