From commits-return-34402-apmail-directory-commits-archive=directory.apache.org@directory.apache.org Wed Aug 29 14:24:02 2012 Return-Path: X-Original-To: apmail-directory-commits-archive@www.apache.org Delivered-To: apmail-directory-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C989EDD65 for ; Wed, 29 Aug 2012 14:24:01 +0000 (UTC) Received: (qmail 51685 invoked by uid 500); 29 Aug 2012 14:24:01 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 51601 invoked by uid 500); 29 Aug 2012 14:24:01 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 51582 invoked by uid 99); 29 Aug 2012 14:24:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Aug 2012 14:24:01 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Aug 2012 14:23:57 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id B66C123888FD for ; Wed, 29 Aug 2012 14:23:14 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1378574 [1/6] - in /directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src: main/java/org/apache/directory/server/core/partition/impl/avl/ main/java/org/apache/directory/server/core/partition/impl/btree/ main/java/org/apache/director... Date: Wed, 29 Aug 2012 14:23:11 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120829142314.B66C123888FD@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: elecharny Date: Wed Aug 29 14:23:08 2012 New Revision: 1378574 URL: http://svn.apache.org/viewvc?rev=1378574&view=rev Log: o Use UUID instead of Long in all the places it's used. We also assume that we use UUID, so no need to have an extra generic parameter. Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/avl/AvlPartition.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/EntryCursorAdaptor.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexCursorAdaptor.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractIndexCursor.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/EmptyIndexCursor.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/MasterTable.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/SingletonIndexCursor.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlIndex.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlMasterTable.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndex.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/Evaluator.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/SearchEngine.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/AllEntriesCursor.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/AndCursor.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/ApproximateCursor.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/ChildrenCursor.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/DescendantCursor.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/EqualityCursor.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/GreaterEqCursor.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/LessEqCursor.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/NotCursor.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/OneLevelScopeCursor.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/OrCursor.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/PresenceCursor.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/SubstringCursor.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/SubtreeScopeCursor.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/AndEvaluator.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/ApproximateEvaluator.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/EqualityEvaluator.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/GreaterEqEvaluator.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/LeafEvaluator.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/LessEqEvaluator.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/NotEvaluator.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/OneLevelScopeEvaluator.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/OrEvaluator.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/PresenceEvaluator.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/SubstringEvaluator.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/SubtreeScopeEvaluator.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/CursorBuilder.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EvaluatorBuilder.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ScanCountComparator.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/AbstractIndexCursorTest.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/EmptyIndexCursorTest.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/SingletonIndexCursorTest.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/StoreUtils.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndexTest.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeTest.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OrCursorTest.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeTest.java Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/avl/AvlPartition.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/avl/AvlPartition.java?rev=1378574&r1=1378573&r2=1378574&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/avl/AvlPartition.java (original) +++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/avl/AvlPartition.java Wed Aug 29 14:23:08 2012 @@ -21,10 +21,10 @@ package org.apache.directory.server.core import java.net.URI; +import java.util.UUID; import org.apache.directory.server.constants.ApacheSchemaConstants; import org.apache.directory.server.core.partition.impl.btree.AbstractBTreePartition; -import org.apache.directory.server.core.partition.impl.btree.LongComparator; import org.apache.directory.server.xdbm.Index; import org.apache.directory.server.xdbm.impl.avl.AvlIndex; import org.apache.directory.server.xdbm.impl.avl.AvlMasterTable; @@ -36,6 +36,7 @@ import org.apache.directory.server.xdbm. import org.apache.directory.server.xdbm.search.impl.NoOpOptimizer; import org.apache.directory.shared.ldap.model.entry.Entry; import org.apache.directory.shared.ldap.model.schema.SchemaManager; +import org.apache.directory.shared.ldap.model.schema.comparators.UuidComparator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -45,7 +46,7 @@ import org.slf4j.LoggerFactory; * * @author Apache Directory Project */ -public class AvlPartition extends AbstractBTreePartition +public class AvlPartition extends AbstractBTreePartition { /** static logger */ private static final Logger LOG = LoggerFactory.getLogger( AvlPartition.class ); @@ -67,8 +68,8 @@ public class AvlPartition extends Abstra { if ( !initialized ) { - EvaluatorBuilder evaluatorBuilder = new EvaluatorBuilder( this, schemaManager ); - CursorBuilder cursorBuilder = new CursorBuilder( this, evaluatorBuilder ); + EvaluatorBuilder evaluatorBuilder = new EvaluatorBuilder( this, schemaManager ); + CursorBuilder cursorBuilder = new CursorBuilder( this, evaluatorBuilder ); // setup optimizer and registries for parent if ( !optimizerEnabled ) @@ -77,10 +78,10 @@ public class AvlPartition extends Abstra } else { - optimizer = new DefaultOptimizer( this ); + optimizer = new DefaultOptimizer( this ); } - searchEngine = new DefaultSearchEngine( this, cursorBuilder, evaluatorBuilder, optimizer ); + searchEngine = new DefaultSearchEngine( this, cursorBuilder, evaluatorBuilder, optimizer ); if ( isInitialized() ) { @@ -88,7 +89,7 @@ public class AvlPartition extends Abstra } // Create the master table (the table containing all the entries) - master = new AvlMasterTable( id, new LongComparator(), null, false ); + master = new AvlMasterTable( id, UuidComparator.INSTANCE, null, false ); super.doInit(); } @@ -98,18 +99,18 @@ public class AvlPartition extends Abstra /** * {@inheritDoc} */ - public Long getDefaultId() + public UUID getDefaultId() { - return 1L; + return new UUID( 0L, 1L ); } /** * {@inheritDoc} */ - public Long getRootId() + public UUID getRootId() { - return 0L; + return new UUID( 0L, 0L ); } @@ -143,7 +144,7 @@ public class AvlPartition extends Abstra @Override - protected Index convertAndInit( Index index ) throws Exception + protected Index convertAndInit( Index index ) throws Exception { AvlIndex avlIndex; Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java?rev=1378574&r1=1378573&r2=1378574&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java (original) +++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java Wed Aug 29 14:23:08 2012 @@ -29,6 +29,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Set; +import java.util.UUID; import java.util.concurrent.atomic.AtomicBoolean; import org.apache.directory.server.constants.ApacheSchemaConstants; @@ -96,14 +97,14 @@ import org.slf4j.LoggerFactory; * * @author Apache Directory Project */ -public abstract class AbstractBTreePartition> extends AbstractPartition implements - Store +public abstract class AbstractBTreePartition extends AbstractPartition implements + Store { /** static logger */ private static final Logger LOG = LoggerFactory.getLogger( AbstractBTreePartition.class ); /** the search engine used to search the database */ - protected SearchEngine searchEngine; + protected SearchEngine searchEngine; /** The optimizer to use during search operation */ protected Optimizer optimizer; @@ -120,47 +121,47 @@ public abstract class AbstractBTreeParti /** true if we sync disks on every write operation */ protected AtomicBoolean isSyncOnWrite = new AtomicBoolean( true ); - /** The suffix ID */ - private volatile ID suffixId; + /** The suffix UUID */ + private volatile UUID suffixId; /** The path in which this Partition stores files */ protected URI partitionPath; /** The set of indexed attributes */ - private Set> indexedAttributes; + private Set> indexedAttributes; /** the master table storing entries by primary key */ - protected MasterTable master; + protected MasterTable master; - /** a map of attributeType numeric ID to user userIndices */ - protected Map> userIndices = new HashMap>(); + /** a map of attributeType numeric UUID to user userIndices */ + protected Map> userIndices = new HashMap>(); - /** a map of attributeType numeric ID to system userIndices */ - protected Map> systemIndices = new HashMap>(); + /** a map of attributeType numeric UUID to system userIndices */ + protected Map> systemIndices = new HashMap>(); /** the relative distinguished name index */ - protected Index, Entry, ID> rdnIdx; + protected Index, Entry, UUID> rdnIdx; /** a system index on objectClass attribute*/ - protected Index objectClassIdx; + protected Index objectClassIdx; /** the attribute presence index */ - protected Index presenceIdx; + protected Index presenceIdx; /** a system index on entryUUID attribute */ - protected Index entryUuidIdx; + protected Index entryUuidIdx; /** a system index on entryCSN attribute */ - protected Index entryCsnIdx; + protected Index entryCsnIdx; /** a system index on aliasedObjectName attribute */ - protected Index aliasIdx; + protected Index aliasIdx; /** the subtree scope alias index */ - protected Index subAliasIdx; + protected Index subAliasIdx; /** the one level scope alias index */ - protected Index oneAliasIdx; + protected Index oneAliasIdx; /** Cached attributes types to avoid lookup all over the code */ protected AttributeType OBJECT_CLASS_AT; @@ -186,7 +187,7 @@ public abstract class AbstractBTreeParti { this.schemaManager = schemaManager; - indexedAttributes = new HashSet>(); + indexedAttributes = new HashSet>(); // Initialize Attribute types used all over this method OBJECT_CLASS_AT = schemaManager.getAttributeType( SchemaConstants.OBJECT_CLASS_AT ); @@ -284,56 +285,57 @@ public abstract class AbstractBTreeParti // add missing system indices if ( getPresenceIndex() == null ) { - Index index = createSystemIndex( ApacheSchemaConstants.APACHE_PRESENCE_AT_OID, + Index index = createSystemIndex( ApacheSchemaConstants.APACHE_PRESENCE_AT_OID, partitionPath, NO_REVERSE ); addIndex( index ); } if ( getRdnIndex() == null ) { - Index, Entry, ID> index = createSystemIndex( ApacheSchemaConstants.APACHE_RDN_AT_OID, + Index, Entry, UUID> index = createSystemIndex( + ApacheSchemaConstants.APACHE_RDN_AT_OID, partitionPath, WITH_REVERSE ); addIndex( index ); } if ( getAliasIndex() == null ) { - Index index = createSystemIndex( ApacheSchemaConstants.APACHE_ALIAS_AT_OID, + Index index = createSystemIndex( ApacheSchemaConstants.APACHE_ALIAS_AT_OID, partitionPath, WITH_REVERSE ); addIndex( index ); } if ( getOneAliasIndex() == null ) { - Index index = createSystemIndex( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID, + Index index = createSystemIndex( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID, partitionPath, WITH_REVERSE ); addIndex( index ); } if ( getSubAliasIndex() == null ) { - Index index = createSystemIndex( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID, + Index index = createSystemIndex( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID, partitionPath, WITH_REVERSE ); addIndex( index ); } if ( getObjectClassIndex() == null ) { - Index index = createSystemIndex( SchemaConstants.OBJECT_CLASS_AT_OID, partitionPath, + Index index = createSystemIndex( SchemaConstants.OBJECT_CLASS_AT_OID, partitionPath, NO_REVERSE ); addIndex( index ); } if ( getEntryUuidIndex() == null ) { - Index index = createSystemIndex( SchemaConstants.ENTRY_UUID_AT_OID, partitionPath, + Index index = createSystemIndex( SchemaConstants.ENTRY_UUID_AT_OID, partitionPath, NO_REVERSE ); addIndex( index ); } if ( getEntryCsnIndex() == null ) { - Index index = createSystemIndex( SchemaConstants.ENTRY_CSN_AT_OID, partitionPath, + Index index = createSystemIndex( SchemaConstants.ENTRY_CSN_AT_OID, partitionPath, NO_REVERSE ); addIndex( index ); } @@ -341,20 +343,21 @@ public abstract class AbstractBTreeParti // convert and initialize system indices for ( String oid : systemIndices.keySet() ) { - Index index = systemIndices.get( oid ); + Index index = systemIndices.get( oid ); index = convertAndInit( index ); systemIndices.put( oid, index ); } // set index shortcuts - rdnIdx = ( Index, Entry, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_RDN_AT_OID ); - presenceIdx = ( Index ) systemIndices.get( ApacheSchemaConstants.APACHE_PRESENCE_AT_OID ); - aliasIdx = ( Index ) systemIndices.get( ApacheSchemaConstants.APACHE_ALIAS_AT_OID ); - oneAliasIdx = ( Index ) systemIndices.get( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID ); - subAliasIdx = ( Index ) systemIndices.get( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID ); - objectClassIdx = ( Index ) systemIndices.get( SchemaConstants.OBJECT_CLASS_AT_OID ); - entryUuidIdx = ( Index ) systemIndices.get( SchemaConstants.ENTRY_UUID_AT_OID ); - entryCsnIdx = ( Index ) systemIndices.get( SchemaConstants.ENTRY_CSN_AT_OID ); + rdnIdx = ( Index, Entry, UUID> ) systemIndices + .get( ApacheSchemaConstants.APACHE_RDN_AT_OID ); + presenceIdx = ( Index ) systemIndices.get( ApacheSchemaConstants.APACHE_PRESENCE_AT_OID ); + aliasIdx = ( Index ) systemIndices.get( ApacheSchemaConstants.APACHE_ALIAS_AT_OID ); + oneAliasIdx = ( Index ) systemIndices.get( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID ); + subAliasIdx = ( Index ) systemIndices.get( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID ); + objectClassIdx = ( Index ) systemIndices.get( SchemaConstants.OBJECT_CLASS_AT_OID ); + entryUuidIdx = ( Index ) systemIndices.get( SchemaConstants.ENTRY_UUID_AT_OID ); + entryCsnIdx = ( Index ) systemIndices.get( SchemaConstants.ENTRY_CSN_AT_OID ); } @@ -364,7 +367,7 @@ public abstract class AbstractBTreeParti protected void setupUserIndices() throws Exception { // convert and initialize system indices - Map> tmp = new HashMap>(); + Map> tmp = new HashMap>(); for ( String oid : userIndices.keySet() ) { @@ -374,7 +377,7 @@ public abstract class AbstractBTreeParti if ( mr != null ) { - Index index = userIndices.get( oid ); + Index index = userIndices.get( oid ); index = convertAndInit( index ); tmp.put( oid, index ); } @@ -394,7 +397,7 @@ public abstract class AbstractBTreeParti * * @return the search engine */ - public SearchEngine getSearchEngine() + public SearchEngine getSearchEngine() { return searchEngine; } @@ -404,25 +407,13 @@ public abstract class AbstractBTreeParti // Miscellaneous abstract methods // ----------------------------------------------------------------------- /** - * {@inheritDoc}} - */ - public abstract ID getDefaultId(); - - - /** - * {@inheritDoc} - */ - public abstract ID getRootId(); - - - /** * Convert and initialize an index for a specific store implementation. * * @param index the index * @return the converted and initialized index * @throws Exception */ - protected abstract Index convertAndInit( Index index ) throws Exception; + protected abstract Index convertAndInit( Index index ) throws Exception; /** @@ -456,7 +447,7 @@ public abstract class AbstractBTreeParti MultiException errors = new MultiException( I18n.err( I18n.ERR_577 ) ); - for ( Index index : userIndices.values() ) + for ( Index index : userIndices.values() ) { try { @@ -470,7 +461,7 @@ public abstract class AbstractBTreeParti } } - for ( Index index : systemIndices.values() ) + for ( Index index : systemIndices.values() ) { try { @@ -527,7 +518,7 @@ public abstract class AbstractBTreeParti { if ( LOG.isDebugEnabled() ) { - dumpRdnIdx( getRootId(), "" ); + dumpRdnIdx( Partition.ROOT_ID, "" ); System.out.println( "-----------------------------" ); } } @@ -537,24 +528,24 @@ public abstract class AbstractBTreeParti { if ( LOG.isDebugEnabled() ) { - dumpRdnIdx( getRootId(), 1, "" ); + dumpRdnIdx( Partition.ROOT_ID, 1, "" ); System.out.println( "-----------------------------" ); } } - public void dumpRdnIdx( ID id, String tabs ) throws Exception + public void dumpRdnIdx( UUID id, String tabs ) throws Exception { // Start with the root - Cursor, ID>> cursor = rdnIdx.forwardCursor(); + Cursor, UUID>> cursor = rdnIdx.forwardCursor(); - IndexEntry, ID> startingPos = new ForwardIndexEntry, ID>(); + IndexEntry, UUID> startingPos = new ForwardIndexEntry, UUID>(); startingPos.setKey( new ParentIdAndRdn( id, ( Rdn[] ) null ) ); cursor.before( startingPos ); while ( cursor.next() ) { - IndexEntry, ID> entry = cursor.get(); + IndexEntry, UUID> entry = cursor.get(); System.out.println( tabs + entry ); } @@ -562,19 +553,19 @@ public abstract class AbstractBTreeParti } - private void dumpRdnIdx( ID id, int nbSibbling, String tabs ) throws Exception + private void dumpRdnIdx( UUID id, int nbSibbling, String tabs ) throws Exception { // Start with the root - Cursor, ID>> cursor = rdnIdx.forwardCursor(); + Cursor, UUID>> cursor = rdnIdx.forwardCursor(); - IndexEntry, ID> startingPos = new ForwardIndexEntry, ID>(); + IndexEntry, UUID> startingPos = new ForwardIndexEntry, UUID>(); startingPos.setKey( new ParentIdAndRdn( id, ( Rdn[] ) null ) ); cursor.before( startingPos ); int countChildren = 0; while ( cursor.next() && ( countChildren < nbSibbling ) ) { - IndexEntry, ID> entry = cursor.get(); + IndexEntry, UUID> entry = cursor.get(); System.out.println( tabs + entry ); countChildren++; @@ -612,7 +603,7 @@ public abstract class AbstractBTreeParti throw ne; } - ID parentId = null; + UUID parentId = null; // // Suffix entry cannot have a parent since it is the root so it is @@ -620,19 +611,19 @@ public abstract class AbstractBTreeParti // entry sequences start at 1. // Dn parentDn = null; - ParentIdAndRdn key = null; + ParentIdAndRdn key = null; if ( entryDn.equals( suffixDn ) ) { - parentId = getRootId(); - key = new ParentIdAndRdn( parentId, suffixDn.getRdns() ); + parentId = Partition.ROOT_ID; + key = new ParentIdAndRdn( parentId, suffixDn.getRdns() ); } else { parentDn = entryDn.getParent(); parentId = getEntryId( parentDn ); - key = new ParentIdAndRdn( parentId, entryDn.getRdn() ); + key = new ParentIdAndRdn( parentId, entryDn.getRdn() ); } // don't keep going if we cannot find the parent Id @@ -641,14 +632,25 @@ public abstract class AbstractBTreeParti throw new LdapNoSuchObjectException( I18n.err( I18n.ERR_216_ID_FOR_PARENT_NOT_FOUND, parentDn ) ); } - // Get a new ID for the added entry - ID id = master.getNextId( entry ); + // Get a new UUID for the added entry if it does not have any already + Attribute entryUUID = entry.get( ENTRY_UUID_AT ); + + UUID id = null; + + if ( entryUUID == null ) + { + id = master.getNextId( entry ); + } + else + { + id = UUID.fromString( entryUUID.getString() ); + } // Update the RDN index rdnIdx.add( key, id ); // Update the parent's nbChildren and nbDescendants values - if ( parentId != getRootId() ) + if ( parentId != Partition.ROOT_ID ) { updateRdnIdx( parentId, ADD_CHILD, 0 ); } @@ -701,7 +703,7 @@ public abstract class AbstractBTreeParti throw new LdapSchemaViolationException( ResultCodeEnum.OBJECT_CLASS_VIOLATION, msg ); } - entryUuidIdx.add( entryUuid.getString(), id ); + entryUuidIdx.add( UUID.fromString( entryUuid.getString() ), id ); // Now work on the user defined userIndices for ( Attribute attribute : entry ) @@ -711,7 +713,7 @@ public abstract class AbstractBTreeParti if ( hasUserIndexOn( attributeType ) ) { - Index idx = ( Index ) getUserIndex( attributeType ); + Index idx = ( Index ) getUserIndex( attributeType ); // here lookup by attributeId is OK since we got attributeId from // the entry via the enumeration - it's in there as is for sure @@ -732,8 +734,6 @@ public abstract class AbstractBTreeParti // And finally add the entry into the master table master.put( id, entry ); - dumpRdnIdx(); - if ( isSyncOnWrite.get() ) { sync(); @@ -745,6 +745,7 @@ public abstract class AbstractBTreeParti } catch ( Exception e ) { + e.printStackTrace(); throw new LdapException( e ); } } @@ -760,7 +761,7 @@ public abstract class AbstractBTreeParti { Dn dn = deleteContext.getDn(); - ID id = getEntryId( dn ); + UUID id = getEntryId( dn ); // don't continue if id is null if ( id == null ) @@ -768,7 +769,9 @@ public abstract class AbstractBTreeParti throw new LdapNoSuchObjectException( I18n.err( I18n.ERR_699, dn ) ); } - if ( getChildCount( id ) > 0 ) + int childCount = getChildCount( id ); + + if ( childCount > 0 ) { LdapContextNotEmptyException cnee = new LdapContextNotEmptyException( I18n.err( I18n.ERR_700, dn ) ); //cnee.setRemainingName( dn ); @@ -780,16 +783,16 @@ public abstract class AbstractBTreeParti } - protected void updateRdnIdx( ID parentId, boolean addRemove, int nbDescendant ) throws Exception + protected void updateRdnIdx( UUID parentId, boolean addRemove, int nbDescendant ) throws Exception { boolean isFirst = true; - if ( parentId.equals( getRootId() ) ) + if ( parentId.equals( Partition.ROOT_ID ) ) { return; } - ParentIdAndRdn parent = rdnIdx.reverseLookup( parentId ); + ParentIdAndRdn parent = rdnIdx.reverseLookup( parentId ); while ( parent != null ) { @@ -832,7 +835,7 @@ public abstract class AbstractBTreeParti * @param id The id of the entry to delete * @throws Exception If the deletion failed */ - public void delete( ID id ) throws LdapException + public void delete( UUID id ) throws LdapException { try { @@ -842,7 +845,7 @@ public abstract class AbstractBTreeParti if ( entry == null ) { // Not allowed - throw new LdapNoSuchObjectException( "Cannot find an entry for ID " + id ); + throw new LdapNoSuchObjectException( "Cannot find an entry for UUID " + id ); } Attribute objectClass = entry.get( OBJECT_CLASS_AT ); @@ -859,7 +862,7 @@ public abstract class AbstractBTreeParti } // Update the parent's nbChildren and nbDescendants values - ParentIdAndRdn parent = rdnIdx.reverseLookup( id ); + ParentIdAndRdn parent = rdnIdx.reverseLookup( id ); updateRdnIdx( parent.getParentId(), REMOVE_CHILD, 0 ); // Update the rdn, oneLevel, subLevel, entryCsn and entryUuid indexes @@ -868,7 +871,7 @@ public abstract class AbstractBTreeParti dumpRdnIdx(); entryCsnIdx.drop( entry.get( ENTRY_CSN_AT ).getString(), id ); - entryUuidIdx.drop( entry.get( ENTRY_UUID_AT ).getString(), id ); + entryUuidIdx.drop( UUID.fromString( entry.get( ENTRY_UUID_AT ).getString() ), id ); // Update the user indexes for ( Attribute attribute : entry ) @@ -878,7 +881,7 @@ public abstract class AbstractBTreeParti if ( hasUserIndexOn( attributeType ) ) { - Index index = getUserIndex( attributeType ); + Index index = getUserIndex( attributeType ); // here lookup by attributeId is ok since we got attributeId from // the entry via the enumeration - it's in there as is for sure @@ -893,12 +896,6 @@ public abstract class AbstractBTreeParti master.remove( id ); - // if this is a context entry reset the master table counter - if ( id.equals( getDefaultId() ) ) - { - master.resetCounter(); - } - if ( isSyncOnWrite.get() ) { sync(); @@ -920,7 +917,7 @@ public abstract class AbstractBTreeParti public EntryFilteringCursor list( ListOperationContext listContext ) throws LdapException { return new BaseEntryFilteringCursor( - new EntryCursorAdaptor( this, + new EntryCursorAdaptor( this, list( getEntryId( listContext.getDn() ) ) ), listContext ); } @@ -928,15 +925,15 @@ public abstract class AbstractBTreeParti /** * {@inheritDoc} */ - public final Cursor> list( ID id ) throws LdapException + public final Cursor> list( UUID id ) throws LdapException { try { // We use the OneLevel index to get all the entries from a starting point // and below up to the number of children - Cursor, ID>> cursor = rdnIdx.forwardCursor(); + Cursor, UUID>> cursor = rdnIdx.forwardCursor(); - IndexEntry, ID> startingPos = new ForwardIndexEntry, ID>(); + IndexEntry, UUID> startingPos = new ForwardIndexEntry, UUID>(); startingPos.setKey( new ParentIdAndRdn( id, ( Rdn[] ) null ) ); cursor.before( startingPos ); @@ -962,14 +959,14 @@ public abstract class AbstractBTreeParti try { SearchScope scope = searchContext.getScope(); - Cursor> underlying; + Cursor> underlying; Dn dn = searchContext.getDn(); AliasDerefMode derefMode = searchContext.getAliasDerefMode(); ExprNode filter = searchContext.getFilter(); underlying = searchEngine.cursor( dn, derefMode, filter, scope ); - return new BaseEntryFilteringCursor( new EntryCursorAdaptor( this, underlying ), searchContext ); + return new BaseEntryFilteringCursor( new EntryCursorAdaptor( this, underlying ), searchContext ); } catch ( LdapException le ) { @@ -978,6 +975,7 @@ public abstract class AbstractBTreeParti } catch ( Exception e ) { + e.printStackTrace(); throw new LdapOperationErrorException( e.getMessage(), e ); } } @@ -991,7 +989,7 @@ public abstract class AbstractBTreeParti */ public Entry lookup( LookupOperationContext lookupContext ) throws LdapException { - ID id = getEntryId( lookupContext.getDn() ); + UUID id = getEntryId( lookupContext.getDn() ); if ( id == null ) { @@ -1085,13 +1083,13 @@ public abstract class AbstractBTreeParti /** - * Get back an entry knowing its ID + * Get back an entry knowing its UUID * - * @param id The Entry ID we want to get back + * @param id The Entry UUID we want to get back * @return The found Entry, or null if not found * @throws Exception If the lookup failed for any reason (except a not found entry) */ - public Entry lookup( ID id ) throws LdapException + public Entry lookup( UUID id ) throws LdapException { try { @@ -1116,13 +1114,13 @@ public abstract class AbstractBTreeParti /** - * Get back an entry knowing its ID + * Get back an entry knowing its UUID * - * @param id The Entry ID we want to get back + * @param id The Entry UUID we want to get back * @return The found Entry, or null if not found * @throws Exception If the lookup failed for any reason (except a not found entry) */ - public Entry lookup( ID id, Dn dn ) throws LdapException + public Entry lookup( UUID id, Dn dn ) throws LdapException { try { @@ -1172,7 +1170,7 @@ public abstract class AbstractBTreeParti */ public synchronized final Entry modify( Dn dn, Modification... mods ) throws Exception { - ID id = getEntryId( dn ); + UUID id = getEntryId( dn ); Entry entry = master.get( id ); for ( Modification mod : mods ) @@ -1221,7 +1219,7 @@ public abstract class AbstractBTreeParti * @throws Exception if index alteration or attribute addition fails */ @SuppressWarnings("unchecked") - private void modifyAdd( ID id, Entry entry, Attribute mods ) throws Exception + private void modifyAdd( UUID id, Entry entry, Attribute mods ) throws Exception { if ( entry instanceof ClonedServerEntry ) { @@ -1241,7 +1239,7 @@ public abstract class AbstractBTreeParti } else if ( hasUserIndexOn( attributeType ) ) { - Index index = getUserIndex( attributeType ); + Index index = getUserIndex( attributeType ); for ( Value value : mods ) { @@ -1283,7 +1281,7 @@ public abstract class AbstractBTreeParti * fails. */ @SuppressWarnings("unchecked") - private void modifyReplace( ID id, Entry entry, Attribute mods ) throws Exception + private void modifyReplace( UUID id, Entry entry, Attribute mods ) throws Exception { if ( entry instanceof ClonedServerEntry ) { @@ -1315,18 +1313,18 @@ public abstract class AbstractBTreeParti } else if ( hasUserIndexOn( attributeType ) ) { - Index index = getUserIndex( attributeType ); + Index index = getUserIndex( attributeType ); // if the id exists in the index drop all existing attribute // value index entries and add new ones if ( index.reverse( id ) ) { - ( ( Index ) index ).drop( id ); + ( ( Index ) index ).drop( id ); } for ( Value value : mods ) { - ( ( Index ) index ).add( value.getNormValue(), id ); + ( ( Index ) index ).add( value.getNormValue(), id ); } /* @@ -1380,7 +1378,7 @@ public abstract class AbstractBTreeParti * @throws Exception if index alteration or attribute modification fails. */ @SuppressWarnings("unchecked") - private void modifyRemove( ID id, Entry entry, Attribute mods ) throws Exception + private void modifyRemove( UUID id, Entry entry, Attribute mods ) throws Exception { if ( entry instanceof ClonedServerEntry ) { @@ -1415,7 +1413,7 @@ public abstract class AbstractBTreeParti } else if ( hasUserIndexOn( attributeType ) ) { - Index index = getUserIndex( attributeType ); + Index index = getUserIndex( attributeType ); /* * If there are no attribute values in the modifications then this @@ -1516,7 +1514,7 @@ public abstract class AbstractBTreeParti public synchronized final void move( Dn oldDn, Dn newSuperiorDn, Dn newDn, Entry modifiedEntry ) throws Exception { // Check that the parent Dn exists - ID newParentId = getEntryId( newSuperiorDn ); + UUID newParentId = getEntryId( newSuperiorDn ); if ( newParentId == null ) { @@ -1527,7 +1525,7 @@ public abstract class AbstractBTreeParti } // Now check that the new entry does not exist - ID newId = getEntryId( newDn ); + UUID newId = getEntryId( newDn ); if ( newId != null ) { @@ -1539,8 +1537,8 @@ public abstract class AbstractBTreeParti } // Get the entry and the old parent IDs - ID entryId = getEntryId( oldDn ); - ID oldParentId = getParentId( entryId ); + UUID entryId = getEntryId( oldDn ); + UUID oldParentId = getParentId( entryId ); /* * All aliases including and below oldChildDn, will be affected by @@ -1554,7 +1552,7 @@ public abstract class AbstractBTreeParti // Update the Rdn index // First drop the old entry - ParentIdAndRdn movedEntry = rdnIdx.reverseLookup( entryId ); + ParentIdAndRdn movedEntry = rdnIdx.reverseLookup( entryId ); updateRdnIdx( oldParentId, REMOVE_CHILD, movedEntry.getNbDescendants() ); @@ -1585,7 +1583,7 @@ public abstract class AbstractBTreeParti // the below case arises only when the move( Dn oldDn, Dn newSuperiorDn, Dn newDn ) is called // directly using the Store API, in this case the value of modified entry will be null - // we need to lookup the entry to update the parent ID + // we need to lookup the entry to update the parent UUID if ( modifiedEntry == null ) { modifiedEntry = lookup( entryId ); @@ -1646,7 +1644,7 @@ public abstract class AbstractBTreeParti boolean deleteOldRdn ) throws Exception { // Check that the old entry exists - ID oldId = getEntryId( oldDn ); + UUID oldId = getEntryId( oldDn ); if ( oldId == null ) { @@ -1657,7 +1655,7 @@ public abstract class AbstractBTreeParti } // Check that the new superior exist - ID newSuperiorId = getEntryId( newSuperiorDn ); + UUID newSuperiorId = getEntryId( newSuperiorDn ); if ( newSuperiorId == null ) { @@ -1670,7 +1668,7 @@ public abstract class AbstractBTreeParti Dn newDn = newSuperiorDn.add( newRdn ); // Now check that the new entry does not exist - ID newId = getEntryId( newDn ); + UUID newId = getEntryId( newDn ); if ( newId != null ) { @@ -1682,7 +1680,7 @@ public abstract class AbstractBTreeParti } // First, rename - // Get the old ID + // Get the old UUID if ( modifiedEntry == null ) { modifiedEntry = master.get( oldId ); @@ -1713,12 +1711,12 @@ public abstract class AbstractBTreeParti * @param modifiedEntry the modified entry * @throws Exception if something goes wrong */ - private void moveAndRename( Dn oldDn, ID entryId, Dn newSuperior, Rdn newRdn, Entry modifiedEntry ) + private void moveAndRename( Dn oldDn, UUID entryId, Dn newSuperior, Rdn newRdn, Entry modifiedEntry ) throws Exception { // Get the child and the new parent to be entries and Ids - ID newParentId = getEntryId( newSuperior ); - ID oldParentId = getParentId( entryId ); + UUID newParentId = getEntryId( newSuperior ); + UUID oldParentId = getParentId( entryId ); /* * All aliases including and below oldChildDn, will be affected by @@ -1734,7 +1732,7 @@ public abstract class AbstractBTreeParti * Update the Rdn index */ // First drop the old entry - ParentIdAndRdn movedEntry = rdnIdx.reverseLookup( entryId ); + ParentIdAndRdn movedEntry = rdnIdx.reverseLookup( entryId ); updateRdnIdx( oldParentId, REMOVE_CHILD, movedEntry.getNbDescendants() ); @@ -1800,7 +1798,7 @@ public abstract class AbstractBTreeParti } - private void rename( ID oldId, Rdn newRdn, boolean deleteOldRdn, Entry entry ) throws Exception + private void rename( UUID oldId, Rdn newRdn, boolean deleteOldRdn, Entry entry ) throws Exception { if ( entry == null ) { @@ -1830,7 +1828,7 @@ public abstract class AbstractBTreeParti if ( hasUserIndexOn( newRdnAttrType ) ) { - Index index = getUserIndex( newRdnAttrType ); + Index index = getUserIndex( newRdnAttrType ); ( ( Index ) index ).add( newNormValue, oldId ); // Make sure the altered entry shows the existence of the new attrib @@ -1886,7 +1884,7 @@ public abstract class AbstractBTreeParti if ( hasUserIndexOn( oldRdnAttrType ) ) { - Index index = getUserIndex( oldRdnAttrType ); + Index index = getUserIndex( oldRdnAttrType ); ( ( Index ) index ).drop( oldNormValue, id ); /* @@ -1913,7 +1911,7 @@ public abstract class AbstractBTreeParti @SuppressWarnings("unchecked") public synchronized final void rename( Dn dn, Rdn newRdn, boolean deleteOldRdn, Entry entry ) throws Exception { - ID oldId = getEntryId( dn ); + UUID oldId = getEntryId( dn ); rename( oldId, newRdn, deleteOldRdn, entry ); @@ -1923,10 +1921,10 @@ public abstract class AbstractBTreeParti * We only need to update the Rdn index. * No need to calculate the new Dn. */ - ID parentId = getParentId( oldId ); + UUID parentId = getParentId( oldId ); // Get the old parentIdAndRdn to get the nb of children and descendant - ParentIdAndRdn parentIdAndRdn = rdnIdx.reverseLookup( oldId ); + ParentIdAndRdn parentIdAndRdn = rdnIdx.reverseLookup( oldId ); // Now we can drop it rdnIdx.drop( oldId ); @@ -1965,7 +1963,7 @@ public abstract class AbstractBTreeParti { try { - ID id = getEntryId( entryContext.getDn() ); + UUID id = getEntryId( entryContext.getDn() ); Entry entry = lookup( id, entryContext.getDn() ); @@ -1985,10 +1983,10 @@ public abstract class AbstractBTreeParti * updates the CSN index * * @param entry the entry having entryCSN attribute - * @param id ID of the entry + * @param id UUID of the entry * @throws Exception */ - private void updateCsnIndex( Entry entry, ID id ) throws Exception + private void updateCsnIndex( Entry entry, UUID id ) throws Exception { String entryCsn = entry.get( SchemaConstants.ENTRY_CSN_AT ).getString(); entryCsnIdx.drop( id ); @@ -2006,10 +2004,10 @@ public abstract class AbstractBTreeParti * @return the normalized Dn of the entry * @throws Exception */ - protected Dn buildEntryDn( ID id ) throws Exception + protected Dn buildEntryDn( UUID id ) throws Exception { - ID parentId = id; - ID rootId = getRootId(); + UUID parentId = id; + UUID rootId = Partition.ROOT_ID; // Create an array of 10 rdns, just in case. We will extend it if needed Rdn[] rdnArray = new Rdn[10]; @@ -2017,7 +2015,7 @@ public abstract class AbstractBTreeParti do { - ParentIdAndRdn cur = rdnIdx.reverseLookup( parentId ); + ParentIdAndRdn cur = rdnIdx.reverseLookup( parentId ); Rdn[] rdns = cur.getRdns(); for ( Rdn rdn : rdns ) @@ -2055,11 +2053,11 @@ public abstract class AbstractBTreeParti /** * {@inheritDoc} */ - public final int getChildCount( ID id ) throws LdapException + public final int getChildCount( UUID id ) throws LdapException { try { - ParentIdAndRdn parentIdAndRdn = rdnIdx.reverseLookup( id ); + ParentIdAndRdn parentIdAndRdn = rdnIdx.reverseLookup( id ); return parentIdAndRdn.getNbChildren(); } @@ -2073,7 +2071,7 @@ public abstract class AbstractBTreeParti /** * {@inheritDoc} */ - public final Dn getEntryDn( ID id ) throws Exception + public final Dn getEntryDn( UUID id ) throws Exception { return buildEntryDn( id ); } @@ -2082,24 +2080,24 @@ public abstract class AbstractBTreeParti /** * {@inheritDoc} */ - public final ID getEntryId( Dn dn ) throws LdapException + public final UUID getEntryId( Dn dn ) throws LdapException { try { if ( Dn.isNullOrEmpty( dn ) ) { - return getRootId(); + return Partition.ROOT_ID; } - ParentIdAndRdn suffixKey = new ParentIdAndRdn( getRootId(), suffixDn.getRdns() ); + ParentIdAndRdn suffixKey = new ParentIdAndRdn( Partition.ROOT_ID, suffixDn.getRdns() ); // Check into the Rdn index, starting with the partition Suffix - ID currentId = rdnIdx.forwardLookup( suffixKey ); + UUID currentId = rdnIdx.forwardLookup( suffixKey ); for ( int i = dn.size() - suffixDn.size(); i > 0; i-- ) { Rdn rdn = dn.getRdn( i - 1 ); - ParentIdAndRdn currentRdn = new ParentIdAndRdn( currentId, rdn ); + ParentIdAndRdn currentRdn = new ParentIdAndRdn( currentId, rdn ); currentId = rdnIdx.forwardLookup( currentRdn ); if ( currentId == null ) @@ -2120,9 +2118,9 @@ public abstract class AbstractBTreeParti /** * {@inheritDoc} */ - public ID getParentId( ID childId ) throws Exception + public UUID getParentId( UUID childId ) throws Exception { - ParentIdAndRdn key = rdnIdx.reverseLookup( childId ); + ParentIdAndRdn key = rdnIdx.reverseLookup( childId ); if ( key == null ) { @@ -2136,11 +2134,11 @@ public abstract class AbstractBTreeParti /** * Retrieve the SuffixID */ - protected ID getSuffixId() throws Exception + protected UUID getSuffixId() throws Exception { if ( suffixId == null ) { - ParentIdAndRdn key = new ParentIdAndRdn( getRootId(), suffixDn.getRdns() ); + ParentIdAndRdn key = new ParentIdAndRdn( Partition.ROOT_ID, suffixDn.getRdns() ); suffixId = rdnIdx.forwardLookup( key ); } @@ -2155,11 +2153,11 @@ public abstract class AbstractBTreeParti /** * {@inheritDoc} */ - public void addIndex( Index index ) throws Exception + public void addIndex( Index index ) throws Exception { checkInitialized( "addIndex" ); - // Check that the index ID is valid + // Check that the index UUID is valid AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( index.getAttributeId() ); if ( attributeType == null ) @@ -2190,9 +2188,9 @@ public abstract class AbstractBTreeParti * Add some new indexes * @param indexes The added indexes */ - public void addIndexedAttributes( Index... indexes ) + public void addIndexedAttributes( Index... indexes ) { - for ( Index index : indexes ) + for ( Index index : indexes ) { indexedAttributes.add( index ); } @@ -2203,7 +2201,7 @@ public abstract class AbstractBTreeParti * Set the list of indexes for this partition * @param indexedAttributes The list of indexes */ - public void setIndexedAttributes( Set> indexedAttributes ) + public void setIndexedAttributes( Set> indexedAttributes ) { this.indexedAttributes = indexedAttributes; } @@ -2212,7 +2210,7 @@ public abstract class AbstractBTreeParti /** * @return The list of indexed attributes */ - public Set> getIndexedAttributes() + public Set> getIndexedAttributes() { return indexedAttributes; } @@ -2239,7 +2237,7 @@ public abstract class AbstractBTreeParti /** * {@inheritDoc} */ - public Index getIndex( AttributeType attributeType ) throws IndexNotFoundException + public Index getIndex( AttributeType attributeType ) throws IndexNotFoundException { String id = attributeType.getOid(); @@ -2260,7 +2258,7 @@ public abstract class AbstractBTreeParti /** * {@inheritDoc} */ - public Index getUserIndex( AttributeType attributeType ) throws IndexNotFoundException + public Index getUserIndex( AttributeType attributeType ) throws IndexNotFoundException { if ( attributeType == null ) { @@ -2281,7 +2279,7 @@ public abstract class AbstractBTreeParti /** * {@inheritDoc} */ - public Index getSystemIndex( AttributeType attributeType ) throws IndexNotFoundException + public Index getSystemIndex( AttributeType attributeType ) throws IndexNotFoundException { if ( attributeType == null ) { @@ -2303,9 +2301,9 @@ public abstract class AbstractBTreeParti * {@inheritDoc} */ @SuppressWarnings("unchecked") - public Index getAliasIndex() + public Index getAliasIndex() { - return ( Index ) systemIndices.get( ApacheSchemaConstants.APACHE_ALIAS_AT_OID ); + return ( Index ) systemIndices.get( ApacheSchemaConstants.APACHE_ALIAS_AT_OID ); } @@ -2313,9 +2311,9 @@ public abstract class AbstractBTreeParti * {@inheritDoc} */ @SuppressWarnings("unchecked") - public Index getOneAliasIndex() + public Index getOneAliasIndex() { - return ( Index ) systemIndices.get( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID ); + return ( Index ) systemIndices.get( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID ); } @@ -2323,9 +2321,9 @@ public abstract class AbstractBTreeParti * {@inheritDoc} */ @SuppressWarnings("unchecked") - public Index getSubAliasIndex() + public Index getSubAliasIndex() { - return ( Index ) systemIndices.get( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID ); + return ( Index ) systemIndices.get( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID ); } @@ -2333,9 +2331,9 @@ public abstract class AbstractBTreeParti * {@inheritDoc} */ @SuppressWarnings("unchecked") - public Index getObjectClassIndex() + public Index getObjectClassIndex() { - return ( Index ) systemIndices.get( SchemaConstants.OBJECT_CLASS_AT_OID ); + return ( Index ) systemIndices.get( SchemaConstants.OBJECT_CLASS_AT_OID ); } @@ -2343,9 +2341,9 @@ public abstract class AbstractBTreeParti * {@inheritDoc} */ @SuppressWarnings("unchecked") - public Index getEntryUuidIndex() + public Index getEntryUuidIndex() { - return ( Index ) systemIndices.get( SchemaConstants.ENTRY_UUID_AT_OID ); + return ( Index ) systemIndices.get( SchemaConstants.ENTRY_UUID_AT_OID ); } @@ -2353,9 +2351,9 @@ public abstract class AbstractBTreeParti * {@inheritDoc} */ @SuppressWarnings("unchecked") - public Index getEntryCsnIndex() + public Index getEntryCsnIndex() { - return ( Index ) systemIndices.get( SchemaConstants.ENTRY_CSN_AT_OID ); + return ( Index ) systemIndices.get( SchemaConstants.ENTRY_CSN_AT_OID ); } @@ -2363,9 +2361,9 @@ public abstract class AbstractBTreeParti * {@inheritDoc} */ @SuppressWarnings("unchecked") - public Index getPresenceIndex() + public Index getPresenceIndex() { - return ( Index ) systemIndices.get( ApacheSchemaConstants.APACHE_PRESENCE_AT_OID ); + return ( Index ) systemIndices.get( ApacheSchemaConstants.APACHE_PRESENCE_AT_OID ); } @@ -2373,9 +2371,9 @@ public abstract class AbstractBTreeParti * {@inheritDoc} */ @SuppressWarnings("unchecked") - public Index, Entry, ID> getRdnIndex() + public Index, Entry, UUID> getRdnIndex() { - return ( Index, Entry, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_RDN_AT_OID ); + return ( Index, Entry, UUID> ) systemIndices.get( ApacheSchemaConstants.APACHE_RDN_AT_OID ); } @@ -2420,12 +2418,12 @@ public abstract class AbstractBTreeParti * not allowed due to chaining or cycle formation. * @throws Exception if the wrappedCursor btrees cannot be altered */ - protected void addAliasIndices( ID aliasId, Dn aliasDn, String aliasTarget ) throws Exception + protected void addAliasIndices( UUID aliasId, Dn aliasDn, String aliasTarget ) throws Exception { Dn normalizedAliasTargetDn; // Name value of aliasedObjectName - ID targetId; // Id of the aliasedObjectName + UUID targetId; // Id of the aliasedObjectName Dn ancestorDn; // Name of an alias entry relative - ID ancestorId; // Id of an alias entry relative + UUID ancestorId; // Id of an alias entry relative // Access aliasedObjectName, normalize it and generate the Name normalizedAliasTargetDn = new Dn( schemaManager, aliasTarget ); @@ -2535,10 +2533,10 @@ public abstract class AbstractBTreeParti * @throws LdapException if we cannot parse ldap names * @throws Exception if we cannot delete index values in the database */ - protected void dropAliasIndices( ID aliasId ) throws Exception + protected void dropAliasIndices( UUID aliasId ) throws Exception { String targetDn = aliasIdx.reverseLookup( aliasId ); - ID targetId = getEntryId( new Dn( schemaManager, targetDn ) ); + UUID targetId = getEntryId( new Dn( schemaManager, targetDn ) ); if ( targetId == null ) { @@ -2550,7 +2548,7 @@ public abstract class AbstractBTreeParti Dn aliasDn = getEntryDn( aliasId ); Dn ancestorDn = aliasDn.getParent(); - ID ancestorId = getEntryId( ancestorDn ); + UUID ancestorId = getEntryId( ancestorDn ); /* * We cannot just drop all tuples in the one level and subtree userIndices @@ -2589,7 +2587,7 @@ public abstract class AbstractBTreeParti */ protected void dropMovedAliasIndices( final Dn movedBase ) throws Exception { - ID movedBaseId = getEntryId( movedBase ); + UUID movedBaseId = getEntryId( movedBase ); if ( aliasIdx.reverseLookup( movedBaseId ) != null ) { @@ -2606,10 +2604,10 @@ public abstract class AbstractBTreeParti * @param movedBase the base where the move occurred * @throws Exception if userIndices fail */ - protected void dropAliasIndices( ID aliasId, Dn movedBase ) throws Exception + protected void dropAliasIndices( UUID aliasId, Dn movedBase ) throws Exception { String targetDn = aliasIdx.reverseLookup( aliasId ); - ID targetId = getEntryId( new Dn( schemaManager, targetDn ) ); + UUID targetId = getEntryId( new Dn( schemaManager, targetDn ) ); Dn aliasDn = getEntryDn( aliasId ); /* @@ -2617,7 +2615,7 @@ public abstract class AbstractBTreeParti * moved base. This is the first ancestor effected by the move. */ Dn ancestorDn = new Dn( schemaManager, movedBase.getRdn( movedBase.size() - 1 ) ); - ID ancestorId = getEntryId( ancestorDn ); + UUID ancestorId = getEntryId( ancestorDn ); /* * We cannot just drop all tuples in the one level and subtree userIndices @@ -2651,15 +2649,15 @@ public abstract class AbstractBTreeParti //--------------------------------------------------------------------------------------------- // Debug methods //--------------------------------------------------------------------------------------------- - private void dumpIndex( OutputStream stream, Index index ) + private void dumpIndex( OutputStream stream, Index index ) { try { - Cursor> cursor = ( Cursor ) index.forwardCursor(); + Cursor> cursor = ( Cursor ) index.forwardCursor(); while ( cursor.next() ) { - IndexEntry entry = cursor.get(); + IndexEntry entry = cursor.get(); System.out.println( entry ); } @@ -2722,7 +2720,7 @@ public abstract class AbstractBTreeParti /** * {@inheritDoc} */ - public MasterTable getMasterTable() + public MasterTable getMasterTable() { return master; } Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/EntryCursorAdaptor.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/EntryCursorAdaptor.java?rev=1378574&r1=1378573&r2=1378574&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/EntryCursorAdaptor.java (original) +++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/EntryCursorAdaptor.java Wed Aug 29 14:23:08 2012 @@ -20,6 +20,8 @@ package org.apache.directory.server.core.partition.impl.btree; +import java.util.UUID; + import org.apache.directory.server.xdbm.IndexEntry; import org.apache.directory.shared.ldap.model.cursor.AbstractCursor; import org.apache.directory.shared.ldap.model.cursor.ClosureMonitor; @@ -34,16 +36,16 @@ import org.slf4j.LoggerFactory; * * @author Apache Directory Project */ -public class EntryCursorAdaptor> extends AbstractCursor +public class EntryCursorAdaptor extends AbstractCursor { /** A dedicated log for cursors */ private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" ); - private final AbstractBTreePartition db; - private final Cursor> indexCursor; + private final AbstractBTreePartition db; + private final Cursor> indexCursor; - public EntryCursorAdaptor( AbstractBTreePartition db, Cursor> indexCursor ) + public EntryCursorAdaptor( AbstractBTreePartition db, Cursor> indexCursor ) { LOG_CURSOR.debug( "Creating EntryCursorAdaptor {}", this ); this.db = db; @@ -136,7 +138,7 @@ public class EntryCursorAdaptor indexEntry = indexCursor.get(); + IndexEntry indexEntry = indexCursor.get(); if ( indexEntry.getEntry() == null ) { Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexCursorAdaptor.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexCursorAdaptor.java?rev=1378574&r1=1378573&r2=1378574&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexCursorAdaptor.java (original) +++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexCursorAdaptor.java Wed Aug 29 14:23:08 2012 @@ -21,6 +21,7 @@ package org.apache.directory.server.core import java.util.Iterator; +import java.util.UUID; import org.apache.directory.server.xdbm.AbstractIndexCursor; import org.apache.directory.server.xdbm.ForwardIndexEntry; @@ -41,15 +42,15 @@ import org.slf4j.LoggerFactory; * * @author Apache Directory Project */ -public class IndexCursorAdaptor extends AbstractIndexCursor +public class IndexCursorAdaptor extends AbstractIndexCursor { /** A dedicated log for cursors */ private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" ); @SuppressWarnings("unchecked") final Cursor wrappedCursor; - final ForwardIndexEntry forwardEntry; - final ReverseIndexEntry reverseEntry; + final ForwardIndexEntry forwardEntry; + final ReverseIndexEntry reverseEntry; /** @@ -68,13 +69,13 @@ public class IndexCursorAdaptor e if ( forwardIndex ) { - forwardEntry = new ForwardIndexEntry(); + forwardEntry = new ForwardIndexEntry(); reverseEntry = null; } else { forwardEntry = null; - reverseEntry = new ReverseIndexEntry(); + reverseEntry = new ReverseIndexEntry(); } } @@ -85,13 +86,13 @@ public class IndexCursorAdaptor e } - public void before( IndexEntry element ) throws Exception + public void before( IndexEntry element ) throws Exception { wrappedCursor.before( element.getTuple() ); } - public void after( IndexEntry element ) throws Exception + public void after( IndexEntry element ) throws Exception { wrappedCursor.after( element.getTuple() ); } @@ -140,17 +141,17 @@ public class IndexCursorAdaptor e @SuppressWarnings("unchecked") - public IndexEntry get() throws Exception + public IndexEntry get() throws Exception { if ( forwardEntry != null ) { - Tuple tuple = wrappedCursor.get(); + Tuple tuple = wrappedCursor.get(); forwardEntry.setTuple( tuple, null ); return forwardEntry; } else { - Tuple tuple = wrappedCursor.get(); + Tuple tuple = wrappedCursor.get(); reverseEntry.setTuple( tuple, null ); return reverseEntry; } @@ -177,9 +178,9 @@ public class IndexCursorAdaptor e } - public Iterator> iterator() + public Iterator> iterator() { - return new CursorIterator>( this ); + return new CursorIterator>( this ); } Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractIndexCursor.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractIndexCursor.java?rev=1378574&r1=1378573&r2=1378574&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractIndexCursor.java (original) +++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractIndexCursor.java Wed Aug 29 14:23:08 2012 @@ -20,6 +20,8 @@ package org.apache.directory.server.xdbm; +import java.util.UUID; + import org.apache.directory.shared.ldap.model.cursor.AbstractCursor; @@ -28,7 +30,7 @@ import org.apache.directory.shared.ldap. * * @author Apache Directory Project */ -public abstract class AbstractIndexCursor extends AbstractCursor> +public abstract class AbstractIndexCursor extends AbstractCursor> { /** Tells if there are some element available in the cursor */ private boolean available = false; @@ -57,7 +59,7 @@ public abstract class AbstractIndexCurso /** * {@inheritDoc} */ - public void after( IndexEntry element ) throws Exception + public void after( IndexEntry element ) throws Exception { throw new UnsupportedOperationException( getUnsupportedMessage() ); } @@ -66,7 +68,7 @@ public abstract class AbstractIndexCurso /** * {@inheritDoc} */ - public void before( IndexEntry element ) throws Exception + public void before( IndexEntry element ) throws Exception { throw new UnsupportedOperationException( getUnsupportedMessage() ); } Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/EmptyIndexCursor.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/EmptyIndexCursor.java?rev=1378574&r1=1378573&r2=1378574&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/EmptyIndexCursor.java (original) +++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/EmptyIndexCursor.java Wed Aug 29 14:23:08 2012 @@ -19,6 +19,8 @@ package org.apache.directory.server.xdbm; +import java.util.UUID; + import org.apache.directory.server.i18n.I18n; import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException; import org.slf4j.Logger; @@ -30,7 +32,7 @@ import org.slf4j.LoggerFactory; * * @author Apache Directory Project */ -public class EmptyIndexCursor extends AbstractIndexCursor +public class EmptyIndexCursor extends AbstractIndexCursor { /** A dedicated log for cursors */ private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" ); @@ -45,7 +47,7 @@ public class EmptyIndexCursor ext /** * {@inheritDoc} */ - public void before( IndexEntry element ) throws Exception + public void before( IndexEntry element ) throws Exception { checkNotClosed( "before()" ); } @@ -63,7 +65,7 @@ public class EmptyIndexCursor ext /** * {@inheritDoc} */ - public void after( IndexEntry element ) throws Exception + public void after( IndexEntry element ) throws Exception { checkNotClosed( "after()" ); } @@ -109,7 +111,7 @@ public class EmptyIndexCursor ext } - public IndexEntry get() throws Exception + public IndexEntry get() throws Exception { checkNotClosed( "get()" ); throw new InvalidCursorPositionException( I18n.err( I18n.ERR_703 ) ); @@ -119,7 +121,7 @@ public class EmptyIndexCursor ext /** * {@inheritDoc} */ - public void afterValue( ID id, K indexValue ) throws Exception + public void afterValue( UUID id, K indexValue ) throws Exception { checkNotClosed( "after()" ); } @@ -128,7 +130,7 @@ public class EmptyIndexCursor ext /** * {@inheritDoc} */ - public void beforeValue( ID id, K indexValue ) throws Exception + public void beforeValue( UUID id, K indexValue ) throws Exception { checkNotClosed( "after()" ); } Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/MasterTable.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/MasterTable.java?rev=1378574&r1=1378573&r2=1378574&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/MasterTable.java (original) +++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/MasterTable.java Wed Aug 29 14:23:08 2012 @@ -20,12 +20,15 @@ package org.apache.directory.server.xdbm; +import java.util.UUID; + + /** * A master table used to store indexable entries. * * @author Apache Directory Project */ -public interface MasterTable extends Table +public interface MasterTable extends Table { /** the base name for the db file for this table */ String DBF = "master"; @@ -42,14 +45,5 @@ public interface MasterTable exte * @return the current value of this MasterTable's sequence incremented by one * @throws Exception on failure to update the id sequence */ - ID getNextId( E entry ) throws Exception; - - - /** - * Resets the root ID to 0, this method should be called after deleting the - * context entry of the partition - * - * @throws Exception in case of any failure while resetting the root id value - */ - void resetCounter() throws Exception; + UUID getNextId( E entry ) throws Exception; } \ No newline at end of file Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/SingletonIndexCursor.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/SingletonIndexCursor.java?rev=1378574&r1=1378573&r2=1378574&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/SingletonIndexCursor.java (original) +++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/SingletonIndexCursor.java Wed Aug 29 14:23:08 2012 @@ -19,6 +19,8 @@ package org.apache.directory.server.xdbm; +import java.util.UUID; + import org.apache.directory.server.i18n.I18n; import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException; import org.slf4j.Logger; @@ -30,7 +32,7 @@ import org.slf4j.LoggerFactory; * * @author Apache Directory Project */ -public class SingletonIndexCursor extends AbstractIndexCursor +public class SingletonIndexCursor extends AbstractIndexCursor { /** A dedicated log for cursors */ private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" ); @@ -38,10 +40,10 @@ public class SingletonIndexCursor private boolean beforeFirst = true; private boolean afterLast; private boolean onSingleton; - private final IndexEntry singleton; + private final IndexEntry singleton; - public SingletonIndexCursor( IndexEntry singleton ) + public SingletonIndexCursor( IndexEntry singleton ) { LOG_CURSOR.debug( "Creating SingletonIndexCursor {}", this ); this.singleton = singleton; @@ -177,7 +179,7 @@ public class SingletonIndexCursor } - public IndexEntry get() throws Exception + public IndexEntry get() throws Exception { checkNotClosed( "()" ); Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java?rev=1378574&r1=1378573&r2=1378574&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java (original) +++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java Wed Aug 29 14:23:08 2012 @@ -26,6 +26,7 @@ import java.util.Collections; import java.util.HashSet; import java.util.Iterator; import java.util.Set; +import java.util.UUID; import org.apache.directory.server.constants.ApacheSchemaConstants; import org.apache.directory.shared.ldap.model.constants.SchemaConstants; @@ -43,7 +44,7 @@ import org.apache.directory.shared.ldap. * * @author Apache Directory Project */ -public interface Store> +public interface Store { /* * W H Y H A V E A S T O R E I N T E R F A C E ? @@ -122,14 +123,6 @@ public interface Store index ) throws Exception; + void addIndex( Index index ) throws Exception; //------------------------------------------------------------------------ @@ -175,49 +168,49 @@ public interface Store getPresenceIndex(); + Index getPresenceIndex(); /** * @return The Alias system index */ - Index getAliasIndex(); + Index getAliasIndex(); /** * @return The OneAlias system index */ - Index getOneAliasIndex(); + Index getOneAliasIndex(); /** * @return The SubAlias system index */ - Index getSubAliasIndex(); + Index getSubAliasIndex(); /** * @return The Rdn system index */ - Index, E, ID> getRdnIndex(); + Index, E, UUID> getRdnIndex(); /** * @return The ObjectClass system index */ - Index getObjectClassIndex(); + Index getObjectClassIndex(); /** * @return The EntryUUID system index */ - Index getEntryUuidIndex(); + Index getEntryUuidIndex(); /** * @return The EntryCSN system index */ - Index getEntryCsnIndex(); + Index getEntryCsnIndex(); /** @@ -269,7 +262,7 @@ public interface Storeor system index * @throws IndexNotFoundException If the index does not exist */ - Index getIndex( AttributeType attributeType ) throws IndexNotFoundException; + Index getIndex( AttributeType attributeType ) throws IndexNotFoundException; /** @@ -278,7 +271,7 @@ public interface Store getUserIndex( AttributeType attributeType ) throws IndexNotFoundException; + Index getUserIndex( AttributeType attributeType ) throws IndexNotFoundException; /** @@ -287,7 +280,7 @@ public interface Store getSystemIndex( AttributeType attributeType ) throws IndexNotFoundException; + Index getSystemIndex( AttributeType attributeType ) throws IndexNotFoundException; /** @@ -296,7 +289,7 @@ public interface Storenull if the Dn doesn't exists */ - ID getEntryId( Dn dn ) throws Exception; + UUID getEntryId( Dn dn ) throws Exception; /** @@ -305,18 +298,18 @@ public interface Store> list( ID id ) throws Exception; + Cursor> list( UUID id ) throws Exception; /** - * Get back an entry knowing its ID + * Get back an entry knowing its UUID * - * @param id The Entry ID we want to get back + * @param id The Entry UUID we want to get back * @return The found Entry, or null if not found * @throws Exception If the lookup failed for any reason (except a not found entry) */ - Entry lookup( ID id ) throws Exception; + Entry lookup( UUID id ) throws Exception; /** - * Get back an entry knowing its ID + * Get back an entry knowing its UUID * - * @param id The Entry ID we want to get back + * @param id The Entry UUID we want to get back * @param dn The entry DN when we have it * @return The found Entry, or null if not found * @throws Exception If the lookup failed for any reason (except a not found entry) */ - Entry lookup( ID id, Dn dn ) throws Exception; + Entry lookup( UUID id, Dn dn ) throws Exception; /** - * Gets the count of immediate children of the given entry ID. + * Gets the count of immediate children of the given entry UUID. * - * @param id the entry ID + * @param id the entry UUID * @return the child count * @throws Exception on failures to access the underlying store */ - int getChildCount( ID id ) throws Exception; + int getChildCount( UUID id ) throws Exception; /** @@ -428,7 +421,7 @@ public interface StoreoneAlias index *
  • subAlias index
  • * - *

    The Alias index is not updated, as the entry ID won't change.

    + *

    The Alias index is not updated, as the entry UUID won't change.

    *

    We have a few check we must do before moving the entry : *

      *
    • The destination must not exist @@ -446,16 +439,8 @@ public interface Store getMasterTable(); + MasterTable getMasterTable(); }