You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2012/08/29 16:23:11 UTC
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...
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 <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class AvlPartition extends AbstractBTreePartition<Long>
+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<Long> evaluatorBuilder = new EvaluatorBuilder<Long>( this, schemaManager );
- CursorBuilder<Long> cursorBuilder = new CursorBuilder<Long>( 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<Entry, Long>( this );
+ optimizer = new DefaultOptimizer<Entry>( this );
}
- searchEngine = new DefaultSearchEngine<Long>( 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<Entry>( id, new LongComparator(), null, false );
+ master = new AvlMasterTable<Entry>( 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<?, Entry, Long> convertAndInit( Index<?, Entry, Long> index ) throws Exception
+ protected Index<?, Entry, UUID> convertAndInit( Index<?, Entry, UUID> index ) throws Exception
{
AvlIndex<?, Entry> 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 <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public abstract class AbstractBTreePartition<ID extends Comparable<ID>> extends AbstractPartition implements
- Store<Entry, ID>
+public abstract class AbstractBTreePartition extends AbstractPartition implements
+ Store<Entry>
{
/** static logger */
private static final Logger LOG = LoggerFactory.getLogger( AbstractBTreePartition.class );
/** the search engine used to search the database */
- protected SearchEngine<Entry, ID> searchEngine;
+ protected SearchEngine<Entry> 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<Index<?, Entry, ID>> indexedAttributes;
+ private Set<Index<?, Entry, UUID>> indexedAttributes;
/** the master table storing entries by primary key */
- protected MasterTable<ID, Entry> master;
+ protected MasterTable<Entry> master;
- /** a map of attributeType numeric ID to user userIndices */
- protected Map<String, Index<?, Entry, ID>> userIndices = new HashMap<String, Index<?, Entry, ID>>();
+ /** a map of attributeType numeric UUID to user userIndices */
+ protected Map<String, Index<?, Entry, UUID>> userIndices = new HashMap<String, Index<?, Entry, UUID>>();
- /** a map of attributeType numeric ID to system userIndices */
- protected Map<String, Index<?, Entry, ID>> systemIndices = new HashMap<String, Index<?, Entry, ID>>();
+ /** a map of attributeType numeric UUID to system userIndices */
+ protected Map<String, Index<?, Entry, UUID>> systemIndices = new HashMap<String, Index<?, Entry, UUID>>();
/** the relative distinguished name index */
- protected Index<ParentIdAndRdn<ID>, Entry, ID> rdnIdx;
+ protected Index<ParentIdAndRdn<UUID>, Entry, UUID> rdnIdx;
/** a system index on objectClass attribute*/
- protected Index<String, Entry, ID> objectClassIdx;
+ protected Index<String, Entry, UUID> objectClassIdx;
/** the attribute presence index */
- protected Index<String, Entry, ID> presenceIdx;
+ protected Index<String, Entry, UUID> presenceIdx;
/** a system index on entryUUID attribute */
- protected Index<String, Entry, ID> entryUuidIdx;
+ protected Index<UUID, Entry, UUID> entryUuidIdx;
/** a system index on entryCSN attribute */
- protected Index<String, Entry, ID> entryCsnIdx;
+ protected Index<String, Entry, UUID> entryCsnIdx;
/** a system index on aliasedObjectName attribute */
- protected Index<String, Entry, ID> aliasIdx;
+ protected Index<String, Entry, UUID> aliasIdx;
/** the subtree scope alias index */
- protected Index<ID, Entry, ID> subAliasIdx;
+ protected Index<UUID, Entry, UUID> subAliasIdx;
/** the one level scope alias index */
- protected Index<ID, Entry, ID> oneAliasIdx;
+ protected Index<UUID, Entry, UUID> 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<Index<?, Entry, ID>>();
+ indexedAttributes = new HashSet<Index<?, Entry, UUID>>();
// 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<String, Entry, ID> index = createSystemIndex( ApacheSchemaConstants.APACHE_PRESENCE_AT_OID,
+ Index<String, Entry, UUID> index = createSystemIndex( ApacheSchemaConstants.APACHE_PRESENCE_AT_OID,
partitionPath, NO_REVERSE );
addIndex( index );
}
if ( getRdnIndex() == null )
{
- Index<ParentIdAndRdn<ID>, Entry, ID> index = createSystemIndex( ApacheSchemaConstants.APACHE_RDN_AT_OID,
+ Index<ParentIdAndRdn<UUID>, Entry, UUID> index = createSystemIndex(
+ ApacheSchemaConstants.APACHE_RDN_AT_OID,
partitionPath, WITH_REVERSE );
addIndex( index );
}
if ( getAliasIndex() == null )
{
- Index<String, Entry, ID> index = createSystemIndex( ApacheSchemaConstants.APACHE_ALIAS_AT_OID,
+ Index<String, Entry, UUID> index = createSystemIndex( ApacheSchemaConstants.APACHE_ALIAS_AT_OID,
partitionPath, WITH_REVERSE );
addIndex( index );
}
if ( getOneAliasIndex() == null )
{
- Index<ID, Entry, ID> index = createSystemIndex( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID,
+ Index<UUID, Entry, UUID> index = createSystemIndex( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID,
partitionPath, WITH_REVERSE );
addIndex( index );
}
if ( getSubAliasIndex() == null )
{
- Index<ID, Entry, ID> index = createSystemIndex( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID,
+ Index<UUID, Entry, UUID> index = createSystemIndex( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID,
partitionPath, WITH_REVERSE );
addIndex( index );
}
if ( getObjectClassIndex() == null )
{
- Index<String, Entry, ID> index = createSystemIndex( SchemaConstants.OBJECT_CLASS_AT_OID, partitionPath,
+ Index<String, Entry, UUID> index = createSystemIndex( SchemaConstants.OBJECT_CLASS_AT_OID, partitionPath,
NO_REVERSE );
addIndex( index );
}
if ( getEntryUuidIndex() == null )
{
- Index<String, Entry, ID> index = createSystemIndex( SchemaConstants.ENTRY_UUID_AT_OID, partitionPath,
+ Index<UUID, Entry, UUID> index = createSystemIndex( SchemaConstants.ENTRY_UUID_AT_OID, partitionPath,
NO_REVERSE );
addIndex( index );
}
if ( getEntryCsnIndex() == null )
{
- Index<String, Entry, ID> index = createSystemIndex( SchemaConstants.ENTRY_CSN_AT_OID, partitionPath,
+ Index<String, Entry, UUID> 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<?, Entry, ID> index = systemIndices.get( oid );
+ Index<?, Entry, UUID> index = systemIndices.get( oid );
index = convertAndInit( index );
systemIndices.put( oid, index );
}
// set index shortcuts
- rdnIdx = ( Index<ParentIdAndRdn<ID>, Entry, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_RDN_AT_OID );
- presenceIdx = ( Index<String, Entry, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_PRESENCE_AT_OID );
- aliasIdx = ( Index<String, Entry, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_ALIAS_AT_OID );
- oneAliasIdx = ( Index<ID, Entry, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID );
- subAliasIdx = ( Index<ID, Entry, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID );
- objectClassIdx = ( Index<String, Entry, ID> ) systemIndices.get( SchemaConstants.OBJECT_CLASS_AT_OID );
- entryUuidIdx = ( Index<String, Entry, ID> ) systemIndices.get( SchemaConstants.ENTRY_UUID_AT_OID );
- entryCsnIdx = ( Index<String, Entry, ID> ) systemIndices.get( SchemaConstants.ENTRY_CSN_AT_OID );
+ rdnIdx = ( Index<ParentIdAndRdn<UUID>, Entry, UUID> ) systemIndices
+ .get( ApacheSchemaConstants.APACHE_RDN_AT_OID );
+ presenceIdx = ( Index<String, Entry, UUID> ) systemIndices.get( ApacheSchemaConstants.APACHE_PRESENCE_AT_OID );
+ aliasIdx = ( Index<String, Entry, UUID> ) systemIndices.get( ApacheSchemaConstants.APACHE_ALIAS_AT_OID );
+ oneAliasIdx = ( Index<UUID, Entry, UUID> ) systemIndices.get( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID );
+ subAliasIdx = ( Index<UUID, Entry, UUID> ) systemIndices.get( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID );
+ objectClassIdx = ( Index<String, Entry, UUID> ) systemIndices.get( SchemaConstants.OBJECT_CLASS_AT_OID );
+ entryUuidIdx = ( Index<UUID, Entry, UUID> ) systemIndices.get( SchemaConstants.ENTRY_UUID_AT_OID );
+ entryCsnIdx = ( Index<String, Entry, UUID> ) 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<String, Index<?, Entry, ID>> tmp = new HashMap<String, Index<?, Entry, ID>>();
+ Map<String, Index<?, Entry, UUID>> tmp = new HashMap<String, Index<?, Entry, UUID>>();
for ( String oid : userIndices.keySet() )
{
@@ -374,7 +377,7 @@ public abstract class AbstractBTreeParti
if ( mr != null )
{
- Index<?, Entry, ID> index = userIndices.get( oid );
+ Index<?, Entry, UUID> 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<Entry, ID> getSearchEngine()
+ public SearchEngine<Entry> 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<?, Entry, ID> convertAndInit( Index<?, Entry, ID> index ) throws Exception;
+ protected abstract Index<?, Entry, UUID> convertAndInit( Index<?, Entry, UUID> index ) throws Exception;
/**
@@ -456,7 +447,7 @@ public abstract class AbstractBTreeParti
MultiException errors = new MultiException( I18n.err( I18n.ERR_577 ) );
- for ( Index<?, Entry, ID> index : userIndices.values() )
+ for ( Index<?, Entry, UUID> index : userIndices.values() )
{
try
{
@@ -470,7 +461,7 @@ public abstract class AbstractBTreeParti
}
}
- for ( Index<?, Entry, ID> index : systemIndices.values() )
+ for ( Index<?, Entry, UUID> 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<IndexEntry<ParentIdAndRdn<ID>, ID>> cursor = rdnIdx.forwardCursor();
+ Cursor<IndexEntry<ParentIdAndRdn<UUID>, UUID>> cursor = rdnIdx.forwardCursor();
- IndexEntry<ParentIdAndRdn<ID>, ID> startingPos = new ForwardIndexEntry<ParentIdAndRdn<ID>, ID>();
+ IndexEntry<ParentIdAndRdn<UUID>, UUID> startingPos = new ForwardIndexEntry<ParentIdAndRdn<UUID>, UUID>();
startingPos.setKey( new ParentIdAndRdn( id, ( Rdn[] ) null ) );
cursor.before( startingPos );
while ( cursor.next() )
{
- IndexEntry<ParentIdAndRdn<ID>, ID> entry = cursor.get();
+ IndexEntry<ParentIdAndRdn<UUID>, 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<IndexEntry<ParentIdAndRdn<ID>, ID>> cursor = rdnIdx.forwardCursor();
+ Cursor<IndexEntry<ParentIdAndRdn<UUID>, UUID>> cursor = rdnIdx.forwardCursor();
- IndexEntry<ParentIdAndRdn<ID>, ID> startingPos = new ForwardIndexEntry<ParentIdAndRdn<ID>, ID>();
+ IndexEntry<ParentIdAndRdn<UUID>, UUID> startingPos = new ForwardIndexEntry<ParentIdAndRdn<UUID>, UUID>();
startingPos.setKey( new ParentIdAndRdn( id, ( Rdn[] ) null ) );
cursor.before( startingPos );
int countChildren = 0;
while ( cursor.next() && ( countChildren < nbSibbling ) )
{
- IndexEntry<ParentIdAndRdn<ID>, ID> entry = cursor.get();
+ IndexEntry<ParentIdAndRdn<UUID>, 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<ID> key = null;
+ ParentIdAndRdn<UUID> key = null;
if ( entryDn.equals( suffixDn ) )
{
- parentId = getRootId();
- key = new ParentIdAndRdn<ID>( parentId, suffixDn.getRdns() );
+ parentId = Partition.ROOT_ID;
+ key = new ParentIdAndRdn<UUID>( parentId, suffixDn.getRdns() );
}
else
{
parentDn = entryDn.getParent();
parentId = getEntryId( parentDn );
- key = new ParentIdAndRdn<ID>( parentId, entryDn.getRdn() );
+ key = new ParentIdAndRdn<UUID>( 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<Object, Entry, ID> idx = ( Index<Object, Entry, ID> ) getUserIndex( attributeType );
+ Index<Object, Entry, UUID> idx = ( Index<Object, Entry, UUID> ) 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<ID> parent = rdnIdx.reverseLookup( parentId );
+ ParentIdAndRdn<UUID> 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<ID> parent = rdnIdx.reverseLookup( id );
+ ParentIdAndRdn<UUID> 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<?, Entry, ID> index = getUserIndex( attributeType );
+ Index<?, Entry, UUID> 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<ID>( this,
+ new EntryCursorAdaptor( this,
list( getEntryId( listContext.getDn() ) ) ), listContext );
}
@@ -928,15 +925,15 @@ public abstract class AbstractBTreeParti
/**
* {@inheritDoc}
*/
- public final Cursor<IndexEntry<ID, ID>> list( ID id ) throws LdapException
+ public final Cursor<IndexEntry<UUID, UUID>> 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<IndexEntry<ParentIdAndRdn<ID>, ID>> cursor = rdnIdx.forwardCursor();
+ Cursor<IndexEntry<ParentIdAndRdn<UUID>, UUID>> cursor = rdnIdx.forwardCursor();
- IndexEntry<ParentIdAndRdn<ID>, ID> startingPos = new ForwardIndexEntry<ParentIdAndRdn<ID>, ID>();
+ IndexEntry<ParentIdAndRdn<UUID>, UUID> startingPos = new ForwardIndexEntry<ParentIdAndRdn<UUID>, 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<IndexEntry<ID, ID>> underlying;
+ Cursor<IndexEntry<UUID, UUID>> 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<ID>( 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<?, Entry, ID> index = getUserIndex( attributeType );
+ Index<?, Entry, UUID> 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<?, Entry, ID> index = getUserIndex( attributeType );
+ Index<?, Entry, UUID> 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<?, Entry, ID> ) index ).drop( id );
+ ( ( Index<?, Entry, UUID> ) index ).drop( id );
}
for ( Value<?> value : mods )
{
- ( ( Index<Object, Entry, ID> ) index ).add( value.getNormValue(), id );
+ ( ( Index<Object, Entry, UUID> ) 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<?, Entry, ID> index = getUserIndex( attributeType );
+ Index<?, Entry, UUID> 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<ID> movedEntry = rdnIdx.reverseLookup( entryId );
+ ParentIdAndRdn<UUID> 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<ID> movedEntry = rdnIdx.reverseLookup( entryId );
+ ParentIdAndRdn<UUID> 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<?, Entry, ID> index = getUserIndex( newRdnAttrType );
+ Index<?, Entry, UUID> 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<?, Entry, ID> index = getUserIndex( oldRdnAttrType );
+ Index<?, Entry, UUID> 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<ID> parentIdAndRdn = rdnIdx.reverseLookup( oldId );
+ ParentIdAndRdn<UUID> 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<ID> cur = rdnIdx.reverseLookup( parentId );
+ ParentIdAndRdn<UUID> 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<ID> parentIdAndRdn = rdnIdx.reverseLookup( id );
+ ParentIdAndRdn<UUID> 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<ID> suffixKey = new ParentIdAndRdn<ID>( getRootId(), suffixDn.getRdns() );
+ ParentIdAndRdn<UUID> suffixKey = new ParentIdAndRdn<UUID>( 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<ID> currentRdn = new ParentIdAndRdn<ID>( currentId, rdn );
+ ParentIdAndRdn<UUID> currentRdn = new ParentIdAndRdn<UUID>( 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<ID> key = rdnIdx.reverseLookup( childId );
+ ParentIdAndRdn<UUID> 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<ID> key = new ParentIdAndRdn<ID>( getRootId(), suffixDn.getRdns() );
+ ParentIdAndRdn<UUID> key = new ParentIdAndRdn<UUID>( Partition.ROOT_ID, suffixDn.getRdns() );
suffixId = rdnIdx.forwardLookup( key );
}
@@ -2155,11 +2153,11 @@ public abstract class AbstractBTreeParti
/**
* {@inheritDoc}
*/
- public void addIndex( Index<?, Entry, ID> index ) throws Exception
+ public void addIndex( Index<?, Entry, UUID> 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<?, Entry, ID>... indexes )
+ public void addIndexedAttributes( Index<?, Entry, UUID>... indexes )
{
- for ( Index<?, Entry, ID> index : indexes )
+ for ( Index<?, Entry, UUID> 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<Index<?, Entry, ID>> indexedAttributes )
+ public void setIndexedAttributes( Set<Index<?, Entry, UUID>> indexedAttributes )
{
this.indexedAttributes = indexedAttributes;
}
@@ -2212,7 +2210,7 @@ public abstract class AbstractBTreeParti
/**
* @return The list of indexed attributes
*/
- public Set<Index<?, Entry, ID>> getIndexedAttributes()
+ public Set<Index<?, Entry, UUID>> getIndexedAttributes()
{
return indexedAttributes;
}
@@ -2239,7 +2237,7 @@ public abstract class AbstractBTreeParti
/**
* {@inheritDoc}
*/
- public Index<?, Entry, ID> getIndex( AttributeType attributeType ) throws IndexNotFoundException
+ public Index<?, Entry, UUID> getIndex( AttributeType attributeType ) throws IndexNotFoundException
{
String id = attributeType.getOid();
@@ -2260,7 +2258,7 @@ public abstract class AbstractBTreeParti
/**
* {@inheritDoc}
*/
- public Index<?, Entry, ID> getUserIndex( AttributeType attributeType ) throws IndexNotFoundException
+ public Index<?, Entry, UUID> getUserIndex( AttributeType attributeType ) throws IndexNotFoundException
{
if ( attributeType == null )
{
@@ -2281,7 +2279,7 @@ public abstract class AbstractBTreeParti
/**
* {@inheritDoc}
*/
- public Index<?, Entry, ID> getSystemIndex( AttributeType attributeType ) throws IndexNotFoundException
+ public Index<?, Entry, UUID> getSystemIndex( AttributeType attributeType ) throws IndexNotFoundException
{
if ( attributeType == null )
{
@@ -2303,9 +2301,9 @@ public abstract class AbstractBTreeParti
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public Index<String, Entry, ID> getAliasIndex()
+ public Index<String, Entry, UUID> getAliasIndex()
{
- return ( Index<String, Entry, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_ALIAS_AT_OID );
+ return ( Index<String, Entry, UUID> ) systemIndices.get( ApacheSchemaConstants.APACHE_ALIAS_AT_OID );
}
@@ -2313,9 +2311,9 @@ public abstract class AbstractBTreeParti
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public Index<ID, Entry, ID> getOneAliasIndex()
+ public Index<UUID, Entry, UUID> getOneAliasIndex()
{
- return ( Index<ID, Entry, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID );
+ return ( Index<UUID, Entry, UUID> ) systemIndices.get( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID );
}
@@ -2323,9 +2321,9 @@ public abstract class AbstractBTreeParti
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public Index<ID, Entry, ID> getSubAliasIndex()
+ public Index<UUID, Entry, UUID> getSubAliasIndex()
{
- return ( Index<ID, Entry, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID );
+ return ( Index<UUID, Entry, UUID> ) systemIndices.get( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID );
}
@@ -2333,9 +2331,9 @@ public abstract class AbstractBTreeParti
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public Index<String, Entry, ID> getObjectClassIndex()
+ public Index<String, Entry, UUID> getObjectClassIndex()
{
- return ( Index<String, Entry, ID> ) systemIndices.get( SchemaConstants.OBJECT_CLASS_AT_OID );
+ return ( Index<String, Entry, UUID> ) systemIndices.get( SchemaConstants.OBJECT_CLASS_AT_OID );
}
@@ -2343,9 +2341,9 @@ public abstract class AbstractBTreeParti
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public Index<String, Entry, ID> getEntryUuidIndex()
+ public Index<String, Entry, UUID> getEntryUuidIndex()
{
- return ( Index<String, Entry, ID> ) systemIndices.get( SchemaConstants.ENTRY_UUID_AT_OID );
+ return ( Index<String, Entry, UUID> ) systemIndices.get( SchemaConstants.ENTRY_UUID_AT_OID );
}
@@ -2353,9 +2351,9 @@ public abstract class AbstractBTreeParti
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public Index<String, Entry, ID> getEntryCsnIndex()
+ public Index<String, Entry, UUID> getEntryCsnIndex()
{
- return ( Index<String, Entry, ID> ) systemIndices.get( SchemaConstants.ENTRY_CSN_AT_OID );
+ return ( Index<String, Entry, UUID> ) systemIndices.get( SchemaConstants.ENTRY_CSN_AT_OID );
}
@@ -2363,9 +2361,9 @@ public abstract class AbstractBTreeParti
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public Index<String, Entry, ID> getPresenceIndex()
+ public Index<String, Entry, UUID> getPresenceIndex()
{
- return ( Index<String, Entry, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_PRESENCE_AT_OID );
+ return ( Index<String, Entry, UUID> ) systemIndices.get( ApacheSchemaConstants.APACHE_PRESENCE_AT_OID );
}
@@ -2373,9 +2371,9 @@ public abstract class AbstractBTreeParti
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public Index<ParentIdAndRdn<ID>, Entry, ID> getRdnIndex()
+ public Index<ParentIdAndRdn<UUID>, Entry, UUID> getRdnIndex()
{
- return ( Index<ParentIdAndRdn<ID>, Entry, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_RDN_AT_OID );
+ return ( Index<ParentIdAndRdn<UUID>, 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<?, Entry, ID> index )
+ private void dumpIndex( OutputStream stream, Index<?, Entry, UUID> index )
{
try
{
- Cursor<IndexEntry<?, ID>> cursor = ( Cursor ) index.forwardCursor();
+ Cursor<IndexEntry<?, UUID>> cursor = ( Cursor ) index.forwardCursor();
while ( cursor.next() )
{
- IndexEntry<?, ID> entry = cursor.get();
+ IndexEntry<?, UUID> entry = cursor.get();
System.out.println( entry );
}
@@ -2722,7 +2720,7 @@ public abstract class AbstractBTreeParti
/**
* {@inheritDoc}
*/
- public MasterTable<ID, Entry> getMasterTable()
+ public MasterTable<Entry> 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 <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class EntryCursorAdaptor<ID extends Comparable<ID>> extends AbstractCursor<Entry>
+public class EntryCursorAdaptor extends AbstractCursor<Entry>
{
/** A dedicated log for cursors */
private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" );
- private final AbstractBTreePartition<ID> db;
- private final Cursor<IndexEntry<ID, ID>> indexCursor;
+ private final AbstractBTreePartition db;
+ private final Cursor<IndexEntry<UUID, UUID>> indexCursor;
- public EntryCursorAdaptor( AbstractBTreePartition<ID> db, Cursor<IndexEntry<ID, ID>> indexCursor )
+ public EntryCursorAdaptor( AbstractBTreePartition db, Cursor<IndexEntry<UUID, UUID>> indexCursor )
{
LOG_CURSOR.debug( "Creating EntryCursorAdaptor {}", this );
this.db = db;
@@ -136,7 +138,7 @@ public class EntryCursorAdaptor<ID exten
*/
public Entry get() throws Exception
{
- IndexEntry<ID, ID> indexEntry = indexCursor.get();
+ IndexEntry<UUID, UUID> 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 <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class IndexCursorAdaptor<K, ID> extends AbstractIndexCursor<K, ID>
+public class IndexCursorAdaptor<K> extends AbstractIndexCursor<K>
{
/** A dedicated log for cursors */
private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" );
@SuppressWarnings("unchecked")
final Cursor<Tuple> wrappedCursor;
- final ForwardIndexEntry<K, ID> forwardEntry;
- final ReverseIndexEntry<K, ID> reverseEntry;
+ final ForwardIndexEntry<K, UUID> forwardEntry;
+ final ReverseIndexEntry<K, UUID> reverseEntry;
/**
@@ -68,13 +69,13 @@ public class IndexCursorAdaptor<K, ID> e
if ( forwardIndex )
{
- forwardEntry = new ForwardIndexEntry<K, ID>();
+ forwardEntry = new ForwardIndexEntry<K, UUID>();
reverseEntry = null;
}
else
{
forwardEntry = null;
- reverseEntry = new ReverseIndexEntry<K, ID>();
+ reverseEntry = new ReverseIndexEntry<K, UUID>();
}
}
@@ -85,13 +86,13 @@ public class IndexCursorAdaptor<K, ID> e
}
- public void before( IndexEntry<K, ID> element ) throws Exception
+ public void before( IndexEntry<K, UUID> element ) throws Exception
{
wrappedCursor.before( element.getTuple() );
}
- public void after( IndexEntry<K, ID> element ) throws Exception
+ public void after( IndexEntry<K, UUID> element ) throws Exception
{
wrappedCursor.after( element.getTuple() );
}
@@ -140,17 +141,17 @@ public class IndexCursorAdaptor<K, ID> e
@SuppressWarnings("unchecked")
- public IndexEntry<K, ID> get() throws Exception
+ public IndexEntry<K, UUID> get() throws Exception
{
if ( forwardEntry != null )
{
- Tuple<K, ID> tuple = wrappedCursor.get();
+ Tuple<K, UUID> tuple = wrappedCursor.get();
forwardEntry.setTuple( tuple, null );
return forwardEntry;
}
else
{
- Tuple<ID, K> tuple = wrappedCursor.get();
+ Tuple<UUID, K> tuple = wrappedCursor.get();
reverseEntry.setTuple( tuple, null );
return reverseEntry;
}
@@ -177,9 +178,9 @@ public class IndexCursorAdaptor<K, ID> e
}
- public Iterator<IndexEntry<K, ID>> iterator()
+ public Iterator<IndexEntry<K, UUID>> iterator()
{
- return new CursorIterator<IndexEntry<K, ID>>( this );
+ return new CursorIterator<IndexEntry<K, UUID>>( 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 <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public abstract class AbstractIndexCursor<V, ID> extends AbstractCursor<IndexEntry<V, ID>>
+public abstract class AbstractIndexCursor<V> extends AbstractCursor<IndexEntry<V, UUID>>
{
/** 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<V, ID> element ) throws Exception
+ public void after( IndexEntry<V, UUID> element ) throws Exception
{
throw new UnsupportedOperationException( getUnsupportedMessage() );
}
@@ -66,7 +68,7 @@ public abstract class AbstractIndexCurso
/**
* {@inheritDoc}
*/
- public void before( IndexEntry<V, ID> element ) throws Exception
+ public void before( IndexEntry<V, UUID> 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 <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class EmptyIndexCursor<K, ID> extends AbstractIndexCursor<K, ID>
+public class EmptyIndexCursor<K> extends AbstractIndexCursor<K>
{
/** A dedicated log for cursors */
private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" );
@@ -45,7 +47,7 @@ public class EmptyIndexCursor<K, ID> ext
/**
* {@inheritDoc}
*/
- public void before( IndexEntry<K, ID> element ) throws Exception
+ public void before( IndexEntry<K, UUID> element ) throws Exception
{
checkNotClosed( "before()" );
}
@@ -63,7 +65,7 @@ public class EmptyIndexCursor<K, ID> ext
/**
* {@inheritDoc}
*/
- public void after( IndexEntry<K, ID> element ) throws Exception
+ public void after( IndexEntry<K, UUID> element ) throws Exception
{
checkNotClosed( "after()" );
}
@@ -109,7 +111,7 @@ public class EmptyIndexCursor<K, ID> ext
}
- public IndexEntry<K, ID> get() throws Exception
+ public IndexEntry<K, UUID> get() throws Exception
{
checkNotClosed( "get()" );
throw new InvalidCursorPositionException( I18n.err( I18n.ERR_703 ) );
@@ -119,7 +121,7 @@ public class EmptyIndexCursor<K, ID> 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<K, ID> 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 <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public interface MasterTable<ID, E> extends Table<ID, E>
+public interface MasterTable<E> extends Table<UUID, E>
{
/** the base name for the db file for this table */
String DBF = "master";
@@ -42,14 +45,5 @@ public interface MasterTable<ID, E> 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 <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class SingletonIndexCursor<V, ID> extends AbstractIndexCursor<V, ID>
+public class SingletonIndexCursor<V> extends AbstractIndexCursor<V>
{
/** A dedicated log for cursors */
private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" );
@@ -38,10 +40,10 @@ public class SingletonIndexCursor<V, ID>
private boolean beforeFirst = true;
private boolean afterLast;
private boolean onSingleton;
- private final IndexEntry<V, ID> singleton;
+ private final IndexEntry<V, UUID> singleton;
- public SingletonIndexCursor( IndexEntry<V, ID> singleton )
+ public SingletonIndexCursor( IndexEntry<V, UUID> singleton )
{
LOG_CURSOR.debug( "Creating SingletonIndexCursor {}", this );
this.singleton = singleton;
@@ -177,7 +179,7 @@ public class SingletonIndexCursor<V, ID>
}
- public IndexEntry<V, ID> get() throws Exception
+ public IndexEntry<V, UUID> 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 <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public interface Store<E, ID extends Comparable<ID>>
+public interface Store<E>
{
/*
* 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<E, ID extends Com
/**
- * Gets the root ID of this store implementation.
- *
- * @return the root ID
- */
- ID getRootId();
-
-
- /**
* Sets the flag telling the server to flush on disk when some
* modification has been done.
* @param isSyncOnWrite A boolean set to true if we have to flush on disk
@@ -166,7 +159,7 @@ public interface Store<E, ID extends Com
* @param index The index to add
* @throws Exception If the addition failed
*/
- void addIndex( Index<?, E, ID> index ) throws Exception;
+ void addIndex( Index<?, E, UUID> index ) throws Exception;
//------------------------------------------------------------------------
@@ -175,49 +168,49 @@ public interface Store<E, ID extends Com
/**
* @return The Presence system index
*/
- Index<String, E, ID> getPresenceIndex();
+ Index<String, E, UUID> getPresenceIndex();
/**
* @return The Alias system index
*/
- Index<String, E, ID> getAliasIndex();
+ Index<String, E, UUID> getAliasIndex();
/**
* @return The OneAlias system index
*/
- Index<ID, E, ID> getOneAliasIndex();
+ Index<UUID, E, UUID> getOneAliasIndex();
/**
* @return The SubAlias system index
*/
- Index<ID, E, ID> getSubAliasIndex();
+ Index<UUID, E, UUID> getSubAliasIndex();
/**
* @return The Rdn system index
*/
- Index<ParentIdAndRdn<ID>, E, ID> getRdnIndex();
+ Index<ParentIdAndRdn<UUID>, E, UUID> getRdnIndex();
/**
* @return The ObjectClass system index
*/
- Index<String, E, ID> getObjectClassIndex();
+ Index<String, E, UUID> getObjectClassIndex();
/**
* @return The EntryUUID system index
*/
- Index<String, E, ID> getEntryUuidIndex();
+ Index<String, E, UUID> getEntryUuidIndex();
/**
* @return The EntryCSN system index
*/
- Index<String, E, ID> getEntryCsnIndex();
+ Index<String, E, UUID> getEntryCsnIndex();
/**
@@ -269,7 +262,7 @@ public interface Store<E, ID extends Com
* @return The associated user <strong>or</strong> system index
* @throws IndexNotFoundException If the index does not exist
*/
- Index<?, E, ID> getIndex( AttributeType attributeType ) throws IndexNotFoundException;
+ Index<?, E, UUID> getIndex( AttributeType attributeType ) throws IndexNotFoundException;
/**
@@ -278,7 +271,7 @@ public interface Store<E, ID extends Com
* @return The associated user index
* @throws IndexNotFoundException If the index does not exist
*/
- Index<?, E, ID> getUserIndex( AttributeType attributeType ) throws IndexNotFoundException;
+ Index<?, E, UUID> getUserIndex( AttributeType attributeType ) throws IndexNotFoundException;
/**
@@ -287,7 +280,7 @@ public interface Store<E, ID extends Com
* @return The associated system index
* @throws IndexNotFoundException If the index does not exist
*/
- Index<?, E, ID> getSystemIndex( AttributeType attributeType ) throws IndexNotFoundException;
+ Index<?, E, UUID> getSystemIndex( AttributeType attributeType ) throws IndexNotFoundException;
/**
@@ -296,7 +289,7 @@ public interface Store<E, ID extends Com
* @param dn the normalized entry Dn
* @return the entry's id, or <code>null</code> 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<E, ID extends Com
* @param id the entry's id
* @return the entry's Dn
*/
- Dn getEntryDn( ID id ) throws Exception;
+ Dn getEntryDn( UUID id ) throws Exception;
/**
- * Gets the ID of an entry's parent using the child entry's ID.
+ * Gets the UUID of an entry's parent using the child entry's UUID.
* Note that the suffix entry returns 0, which does not map to any entry.
*
- * @param childId the ID of the entry
- * @return the id of the parent entry or zero if the suffix entry ID is used
+ * @param childId the UUID of the entry
+ * @return the id of the parent entry or zero if the suffix entry UUID is used
* @throws Exception on failures to access the underlying store
*/
- ID getParentId( ID childId ) throws Exception;
+ UUID getParentId( UUID childId ) throws Exception;
/**
@@ -331,10 +324,10 @@ public interface Store<E, ID extends Com
/**
* Delete an entry from the store
*
- * @param id The Entry ID we want to delete
+ * @param id The Entry UUID we want to delete
* @throws Exception If the deletion failed for any reason
*/
- void delete( ID id ) throws Exception;
+ void delete( UUID id ) throws Exception;
/**
@@ -344,38 +337,38 @@ public interface Store<E, ID extends Com
* @return an IndexEntry Cursor over the child entries
* @throws Exception on failures to access the underlying store
*/
- Cursor<IndexEntry<ID, ID>> list( ID id ) throws Exception;
+ Cursor<IndexEntry<UUID, UUID>> 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 Store<E, ID extends Com
* <li><b>oneAlias</b> index</li>
* <li><b>subAlias</b> index</li>
* </ul>
- * <p>The <b>Alias</b> index is not updated, as the entry ID won't change.</p>
+ * <p>The <b>Alias</b> index is not updated, as the entry UUID won't change.</p>
* <p>We have a few check we must do before moving the entry :
* <ul>
* <li>The destination must not exist
@@ -446,16 +439,8 @@ public interface Store<E, ID extends Com
/**
- * Gets the default ID.
- *
- * @return the default ID.
- */
- ID getDefaultId() throws Exception;
-
-
- /**
* Expose the Master table
* @return The masterTable instance
*/
- MasterTable<ID, E> getMasterTable();
+ MasterTable<E> getMasterTable();
}