You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by sa...@apache.org on 2011/11/09 18:04:47 UTC
svn commit: r1199852 [1/5] - in
/directory/apacheds/branches/apacheds-txns/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: saya
Date: Wed Nov 9 17:04:46 2011
New Revision: 1199852
URL: http://svn.apache.org/viewvc?rev=1199852&view=rev
Log:
Removed genrics from AbstractBtreePartition.java. Changed AVL partition to use UUID instead of Long.
Modified:
directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/avl/AvlPartition.java
directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java
directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/EntryCursorAdaptor.java
directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexAssertion.java
directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexCursorAdaptor.java
directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java
directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlIndex.java
directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlMasterTable.java
directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndex.java
directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java
directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/StoreUtils.java
directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java
directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndexTest.java
directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java
directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java
directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java
directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeTest.java
directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OrCursorTest.java
directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java
directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java
directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeTest.java
Modified: directory/apacheds/branches/apacheds-txns/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-txns/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/avl/AvlPartition.java?rev=1199852&r1=1199851&r2=1199852&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/avl/AvlPartition.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/avl/AvlPartition.java Wed Nov 9 17:04:46 2011
@@ -21,11 +21,13 @@ 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.core.api.partition.index.Index;
+import org.apache.directory.server.core.api.partition.index.UUIDComparator;
import org.apache.directory.server.xdbm.impl.avl.AvlIndex;
import org.apache.directory.server.xdbm.impl.avl.AvlMasterTable;
import org.apache.directory.server.xdbm.impl.avl.AvlRdnIndex;
@@ -45,7 +47,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 +69,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,42 +79,23 @@ public class AvlPartition extends Abstra
}
else
{
- optimizer = new DefaultOptimizer<Entry, Long>( this );
+ optimizer = new DefaultOptimizer( this );
}
- searchEngine = new DefaultSearchEngine<Long>( this, cursorBuilder, evaluatorBuilder, optimizer );
+ searchEngine = new DefaultSearchEngine( this, cursorBuilder, evaluatorBuilder, optimizer );
if ( isInitialized() )
{
return;
}
-
+
// Create the master table (the table containing all the entries)
- master = new AvlMasterTable<Entry>( id, new LongComparator(), null, false );
+ master = new AvlMasterTable( id, UUIDComparator.INSTANCE, null, false );
super.doInit();
}
}
-
- /**
- * {@inheritDoc}
- */
- public Long getDefaultId()
- {
- return 1L;
- }
-
-
- /**
- * {@inheritDoc}
- */
- public Long getRootId()
- {
- return 0L;
- }
-
-
/**
* {@inheritDoc}
*/
@@ -143,17 +126,17 @@ public class AvlPartition extends Abstra
@Override
- protected Index<?, Entry, Long> convertAndInit( Index<?, Entry, Long> index ) throws Exception
+ protected Index<?> convertAndInit( Index<?> index ) throws Exception
{
- AvlIndex<?, Entry> avlIndex;
+ AvlIndex<?> avlIndex;
if ( index.getAttributeId().equals( ApacheSchemaConstants.APACHE_RDN_AT_OID ) )
{
- avlIndex = new AvlRdnIndex<Entry>( index.getAttributeId() );
+ avlIndex = new AvlRdnIndex( index.getAttributeId() );
}
- else if ( index instanceof AvlIndex<?, ?> )
+ else if ( index instanceof AvlIndex<?> )
{
- avlIndex = (AvlIndex<?, Entry> ) index;
+ avlIndex = (AvlIndex<?> ) index;
}
else
{
Modified: directory/apacheds/branches/apacheds-txns/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-txns/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java?rev=1199852&r1=1199851&r2=1199852&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java Wed Nov 9 17:04:46 2011
@@ -30,6 +30,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.UUID;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.naming.directory.SearchControls;
@@ -60,6 +61,7 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.api.partition.index.IndexNotFoundException;
import org.apache.directory.server.core.api.partition.index.MasterTable;
import org.apache.directory.server.core.api.partition.index.ParentIdAndRdn;
+import org.apache.directory.server.core.api.partition.index.UUIDComparator;
import org.apache.directory.server.xdbm.Store;
import org.apache.directory.server.xdbm.search.Optimizer;
import org.apache.directory.server.xdbm.search.SearchEngine;
@@ -100,13 +102,13 @@ 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
{
/** 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 searchEngine;
/** The optimizer to use during search operation */
protected Optimizer optimizer;
@@ -124,52 +126,52 @@ public abstract class AbstractBTreeParti
protected AtomicBoolean isSyncOnWrite = new AtomicBoolean( true );
/** The suffix ID */
- private volatile ID suffixId;
+ 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<?>> indexedAttributes;
/** the master table storing entries by primary key */
- protected MasterTable<ID, Entry> master;
+ protected MasterTable master;
/** a map of attributeType numeric ID to user userIndices */
- protected Map<String, Index<?, Entry, ID>> userIndices = new HashMap<String, Index<?, Entry, ID>>();
+ protected Map<String, Index<?>> userIndices = new HashMap<String, Index<?>>();
/** a map of attributeType numeric ID to system userIndices */
- protected Map<String, Index<?, Entry, ID>> systemIndices = new HashMap<String, Index<?, Entry, ID>>();
+ protected Map<String, Index<?>> systemIndices = new HashMap<String, Index<?>>();
/** the relative distinguished name index */
- protected Index<ParentIdAndRdn<ID>, Entry, ID> rdnIdx;
+ protected Index<ParentIdAndRdn> rdnIdx;
/** a system index on objectClass attribute*/
- protected Index<String, Entry, ID> objectClassIdx;
+ protected Index<String> objectClassIdx;
/** the parent child relationship index */
- protected Index<ID, Entry, ID> oneLevelIdx;
+ protected Index<UUID> oneLevelIdx;
/** a system index on the entries of descendants of root Dn */
- protected Index<ID, Entry, ID> subLevelIdx;
+ protected Index<UUID> subLevelIdx;
/** the attribute presence index */
- protected Index<String, Entry, ID> presenceIdx;
+ protected Index<String> presenceIdx;
/** a system index on entryUUID attribute */
- protected Index<String, Entry, ID> entryUuidIdx;
+ protected Index<String> entryUuidIdx;
/** a system index on entryCSN attribute */
- protected Index<String, Entry, ID> entryCsnIdx;
+ protected Index<String> entryCsnIdx;
/** a system index on aliasedObjectName attribute */
- protected Index<String, Entry, ID> aliasIdx;
+ protected Index<String> aliasIdx;
/** the subtree scope alias index */
- protected Index<ID, Entry, ID> subAliasIdx;
+ protected Index<UUID> subAliasIdx;
/** the one level scope alias index */
- protected Index<ID, Entry, ID> oneAliasIdx;
+ protected Index<UUID> oneAliasIdx;
/** Cached attributes types to avoid lookup all over the code */
protected AttributeType OBJECT_CLASS_AT;
@@ -188,7 +190,7 @@ public abstract class AbstractBTreeParti
{
this.schemaManager = schemaManager;
- indexedAttributes = new HashSet<Index<?, Entry, ID>>();
+ indexedAttributes = new HashSet<Index<?>>();
// Initialize Attribute types used all over this method
OBJECT_CLASS_AT = schemaManager.getAttributeType( SchemaConstants.OBJECT_CLASS_AT );
@@ -285,70 +287,70 @@ public abstract class AbstractBTreeParti
// add missing system indices
if ( getPresenceIndex() == null )
{
- Index<String, Entry, ID> index = new GenericIndex<String, Entry, ID>( ApacheSchemaConstants.APACHE_PRESENCE_AT_OID ) ;
+ Index<String> index = new GenericIndex<String>( ApacheSchemaConstants.APACHE_PRESENCE_AT_OID ) ;
index.setWkDirPath( partitionPath );
addIndex( index );
}
if ( getOneLevelIndex() == null )
{
- Index<ID, Entry, ID> index = new GenericIndex<ID, Entry, ID>( ApacheSchemaConstants.APACHE_ONE_LEVEL_AT_OID );
+ Index<UUID> index = new GenericIndex<UUID>( ApacheSchemaConstants.APACHE_ONE_LEVEL_AT_OID );
index.setWkDirPath( partitionPath );
addIndex( index );
}
if ( getSubLevelIndex() == null )
{
- Index<ID, Entry, ID> index = new GenericIndex<ID, Entry, ID>( ApacheSchemaConstants.APACHE_SUB_LEVEL_AT_OID );
+ Index<UUID> index = new GenericIndex<UUID>( ApacheSchemaConstants.APACHE_SUB_LEVEL_AT_OID );
index.setWkDirPath( partitionPath );
addIndex( index );
}
if ( getRdnIndex() == null )
{
- Index<ParentIdAndRdn<ID>, Entry, ID> index = new GenericIndex<ParentIdAndRdn<ID>, Entry, ID>( ApacheSchemaConstants.APACHE_RDN_AT_OID );
+ Index<ParentIdAndRdn> index = new GenericIndex<ParentIdAndRdn>( ApacheSchemaConstants.APACHE_RDN_AT_OID );
index.setWkDirPath( partitionPath );
addIndex( index );
}
if ( getAliasIndex() == null )
{
- Index<String, Entry, ID> index = new GenericIndex<String, Entry, ID>( ApacheSchemaConstants.APACHE_ALIAS_AT_OID );
+ Index<String> index = new GenericIndex<String>( ApacheSchemaConstants.APACHE_ALIAS_AT_OID );
index.setWkDirPath( partitionPath );
addIndex( index );
}
if ( getOneAliasIndex() == null )
{
- Index<ID, Entry, ID> index = new GenericIndex<ID, Entry, ID>( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID );
+ Index<UUID> index = new GenericIndex<UUID>( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID );
index.setWkDirPath( partitionPath );
addIndex( index );
}
if ( getSubAliasIndex() == null )
{
- Index<ID, Entry, ID> index = new GenericIndex<ID, Entry, ID>( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID );
+ Index<UUID> index = new GenericIndex<UUID>( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID );
index.setWkDirPath( partitionPath );
addIndex( index );
}
if ( getObjectClassIndex() == null )
{
- Index<String, Entry, ID> index = new GenericIndex<String, Entry, ID>( SchemaConstants.OBJECT_CLASS_AT_OID );
+ Index<String> index = new GenericIndex<String>( SchemaConstants.OBJECT_CLASS_AT_OID );
index.setWkDirPath( partitionPath );
addIndex( index );
}
if ( getEntryUuidIndex() == null )
{
- Index<String, Entry, ID> index = new GenericIndex<String, Entry, ID>( SchemaConstants.ENTRY_UUID_AT_OID );
+ Index<String> index = new GenericIndex<String>( SchemaConstants.ENTRY_UUID_AT_OID );
index.setWkDirPath( partitionPath );
addIndex( index );
}
if ( getEntryCsnIndex() == null )
{
- Index<String, Entry, ID> index = new GenericIndex<String, Entry, ID>( SchemaConstants.ENTRY_CSN_AT_OID );
+ Index<String> index = new GenericIndex<String>( SchemaConstants.ENTRY_CSN_AT_OID );
index.setWkDirPath( partitionPath );
addIndex( index );
}
@@ -356,22 +358,22 @@ public abstract class AbstractBTreeParti
// convert and initialize system indices
for ( String oid : systemIndices.keySet() )
{
- Index<?, Entry, ID> index = systemIndices.get( oid );
+ Index<?> 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 );
- oneLevelIdx = ( Index<ID, Entry, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_ONE_LEVEL_AT_OID );
- subLevelIdx = ( Index<ID, Entry, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_SUB_LEVEL_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> ) systemIndices.get( ApacheSchemaConstants.APACHE_RDN_AT_OID );
+ presenceIdx = ( Index<String> ) systemIndices.get( ApacheSchemaConstants.APACHE_PRESENCE_AT_OID );
+ oneLevelIdx = ( Index<UUID> ) systemIndices.get( ApacheSchemaConstants.APACHE_ONE_LEVEL_AT_OID );
+ subLevelIdx = ( Index<UUID> ) systemIndices.get( ApacheSchemaConstants.APACHE_SUB_LEVEL_AT_OID );
+ aliasIdx = ( Index<String> ) systemIndices.get( ApacheSchemaConstants.APACHE_ALIAS_AT_OID );
+ oneAliasIdx = ( Index<UUID> ) systemIndices.get( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID );
+ subAliasIdx = ( Index<UUID> ) systemIndices.get( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID );
+ objectClassIdx = ( Index<String> ) systemIndices.get( SchemaConstants.OBJECT_CLASS_AT_OID );
+ entryUuidIdx = ( Index<String> ) systemIndices.get( SchemaConstants.ENTRY_UUID_AT_OID );
+ entryCsnIdx = ( Index<String> ) systemIndices.get( SchemaConstants.ENTRY_CSN_AT_OID );
}
@@ -381,7 +383,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<?>> tmp = new HashMap<String, Index<?>>();
for ( String oid : userIndices.keySet() )
{
@@ -391,7 +393,7 @@ public abstract class AbstractBTreeParti
if ( mr != null )
{
- Index<?, Entry, ID> index = userIndices.get( oid );
+ Index<?> index = userIndices.get( oid );
index = convertAndInit( index );
tmp.put( oid, index );
}
@@ -411,7 +413,7 @@ public abstract class AbstractBTreeParti
*
* @return the search engine
*/
- public SearchEngine<Entry, ID> getSearchEngine()
+ public SearchEngine getSearchEngine()
{
return searchEngine;
}
@@ -420,17 +422,6 @@ 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.
@@ -439,7 +430,7 @@ public abstract class AbstractBTreeParti
* @return the converted and initialized index
* @throws Exception
*/
- protected abstract Index<?, Entry, ID> convertAndInit( Index<?, Entry, ID> index ) throws Exception;
+ protected abstract Index<?> convertAndInit( Index<?> index ) throws Exception;
/**
@@ -473,7 +464,7 @@ public abstract class AbstractBTreeParti
MultiException errors = new MultiException( I18n.err( I18n.ERR_577 ) );
- for ( Index<?, Entry, ID> index : userIndices.values() )
+ for ( Index<?> index : userIndices.values() )
{
try
{
@@ -487,7 +478,7 @@ public abstract class AbstractBTreeParti
}
}
- for ( Index<?, Entry, ID> index : systemIndices.values() )
+ for ( Index<?> index : systemIndices.values() )
{
try
{
@@ -524,6 +515,8 @@ public abstract class AbstractBTreeParti
*/
protected void doInit() throws Exception
{
+ UUIDComparator.INSTANCE.setSchemaManager( schemaManager );
+
setupSystemIndices();
setupUserIndices();
}
@@ -549,7 +542,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
@@ -557,19 +550,19 @@ public abstract class AbstractBTreeParti
// entry sequences start at 1.
//
Dn parentDn = null;
- ParentIdAndRdn<ID> key = null;
+ ParentIdAndRdn key = null;
if ( entryDn.equals( suffixDn ) )
{
parentId = getRootId();
- key = new ParentIdAndRdn<ID>( parentId, suffixDn.getRdns() );
+ key = new ParentIdAndRdn( parentId, suffixDn.getRdns() );
}
else
{
parentDn = entryDn.getParent();
parentId = getEntryId( parentDn );
- key = new ParentIdAndRdn<ID>( parentId, entryDn.getRdn() );
+ key = new ParentIdAndRdn( parentId, entryDn.getRdn() );
}
// don't keep going if we cannot find the parent Id
@@ -579,7 +572,7 @@ public abstract class AbstractBTreeParti
}
// Get a new ID for the added entry
- ID id = master.getNextId( entry );
+ UUID id = master.getNextId( entry );
// Update the RDN index
rdnIdx.add( key, id );
@@ -611,7 +604,7 @@ public abstract class AbstractBTreeParti
oneLevelIdx.add( parentId, id );
// Update the SubLevel index
- ID tempId = parentId;
+ UUID tempId = parentId;
while ( ( tempId != null ) && ( !tempId.equals( getRootId() ) ) && ( !tempId.equals( getSuffixId() ) ) )
{
@@ -652,7 +645,7 @@ public abstract class AbstractBTreeParti
if ( hasUserIndexOn( attributeType ) )
{
- Index<Object, Entry, ID> idx = ( Index<Object, Entry, ID> ) getUserIndex( attributeType );
+ Index<Object> idx = ( Index<Object> ) 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
@@ -713,7 +706,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 )
@@ -738,7 +731,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
{
@@ -779,7 +772,7 @@ public abstract class AbstractBTreeParti
if ( hasUserIndexOn( attributeType ) )
{
- Index<?, Entry, ID> 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
@@ -821,7 +814,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 );
}
@@ -829,14 +822,14 @@ public abstract class AbstractBTreeParti
/**
* {@inheritDoc}
*/
- public final IndexCursor<ID, Entry, ID> list( ID id ) throws LdapException
+ public final IndexCursor<UUID> list( UUID id ) throws LdapException
{
try
{
// We use the OneLevel index to get all the entries from a starting point
// and below
- IndexCursor<ID, Entry, ID> cursor = oneLevelIdx.forwardCursor( id );
- cursor.beforeValue( id, null );
+ IndexCursor<UUID> cursor = oneLevelIdx.forwardCursor( id );
+ cursor.beforeFirst();
return cursor;
}
@@ -859,14 +852,14 @@ public abstract class AbstractBTreeParti
try
{
SearchControls searchCtls = searchContext.getSearchControls();
- IndexCursor<ID, Entry, ID> underlying;
+ IndexCursor<UUID> underlying;
Dn dn = searchContext.getDn();
AliasDerefMode derefMode = searchContext.getAliasDerefMode();
ExprNode filter = searchContext.getFilter();
underlying = searchEngine.cursor( dn, derefMode, filter, searchCtls );
- return new BaseEntryFilteringCursor( new EntryCursorAdaptor<ID>( this, underlying ), searchContext );
+ return new BaseEntryFilteringCursor( new EntryCursorAdaptor( this, underlying ), searchContext );
}
catch ( LdapException le )
{
@@ -888,7 +881,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 )
{
@@ -983,7 +976,7 @@ public abstract class AbstractBTreeParti
* @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
{
@@ -1032,7 +1025,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 )
@@ -1081,7 +1074,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 )
{
@@ -1101,7 +1094,7 @@ public abstract class AbstractBTreeParti
}
else if ( hasUserIndexOn( attributeType ) )
{
- Index<?, Entry, ID> index = getUserIndex( attributeType );
+ Index<?> index = getUserIndex( attributeType );
for ( Value<?> value : mods )
{
@@ -1143,7 +1136,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 )
{
@@ -1170,18 +1163,18 @@ public abstract class AbstractBTreeParti
}
else if ( hasUserIndexOn( attributeType ) )
{
- Index<?, Entry, ID> 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<?, Entry, ID> ) index ).drop( id );
+ ( ( Index<?> ) index ).drop( id );
}
for ( Value<?> value : mods )
{
- ( ( Index<Object, Entry, ID> ) index ).add( value.getValue(), id );
+ ( ( Index<Object> ) index ).add( value.getValue(), id );
}
/*
@@ -1235,7 +1228,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 )
{
@@ -1267,7 +1260,7 @@ public abstract class AbstractBTreeParti
}
else if ( hasUserIndexOn( attributeType ) )
{
- Index<?, Entry, ID> index = getUserIndex( attributeType );
+ Index<?> index = getUserIndex( attributeType );
/*
* If there are no attribute values in the modifications then this
@@ -1368,7 +1361,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 )
{
@@ -1379,7 +1372,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 )
{
@@ -1391,8 +1384,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
@@ -1415,7 +1408,7 @@ public abstract class AbstractBTreeParti
// Update the Rdn index
rdnIdx.drop( entryId );
- ParentIdAndRdn<ID> key = new ParentIdAndRdn<ID>( newParentId, oldDn.getRdn() );
+ ParentIdAndRdn key = new ParentIdAndRdn( newParentId, oldDn.getRdn() );
rdnIdx.add( key, entryId );
@@ -1498,7 +1491,7 @@ public abstract class AbstractBTreeParti
public synchronized final void moveAndRename( Dn oldDn, Dn newSuperiorDn, Rdn newRdn, Entry modifiedEntry, boolean deleteOldRdn ) throws Exception
{
// Check that the old entry exists
- ID oldId = getEntryId( oldDn );
+ UUID oldId = getEntryId( oldDn );
if ( oldId == null )
{
@@ -1509,7 +1502,7 @@ public abstract class AbstractBTreeParti
}
// Check that the new superior exist
- ID newSuperiorId = getEntryId( newSuperiorDn );
+ UUID newSuperiorId = getEntryId( newSuperiorDn );
if ( newSuperiorId == null )
{
@@ -1522,7 +1515,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 )
{
@@ -1558,11 +1551,11 @@ public abstract class AbstractBTreeParti
* @param modifiedEntry the modified entry
* @throws Exception if something goes wrong
*/
- private void moveAndRename( Dn oldDn, ID childId, Dn newSuperior, Rdn newRdn, Entry modifiedEntry ) throws Exception
+ private void moveAndRename( Dn oldDn, UUID childId, 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( childId );
+ UUID newParentId = getEntryId( newSuperior );
+ UUID oldParentId = getParentId( childId );
/*
* All aliases including and below oldChildDn, will be affected by
@@ -1587,7 +1580,7 @@ public abstract class AbstractBTreeParti
* Update the Rdn index
*/
rdnIdx.drop( childId );
- ParentIdAndRdn<ID> key = new ParentIdAndRdn<ID>( newParentId, newRdn );
+ ParentIdAndRdn key = new ParentIdAndRdn( newParentId, newRdn );
rdnIdx.add( key, childId );
/*
@@ -1657,7 +1650,7 @@ public abstract class AbstractBTreeParti
@SuppressWarnings("unchecked")
public synchronized final void rename( Dn dn, Rdn newRdn, boolean deleteOldRdn, Entry entry ) throws Exception
{
- ID id = getEntryId( dn );
+ UUID id = getEntryId( dn );
if ( entry == null )
{
@@ -1688,7 +1681,7 @@ public abstract class AbstractBTreeParti
if ( hasUserIndexOn( newRdnAttrType ) )
{
- Index<?, Entry, ID> index = getUserIndex( newRdnAttrType );
+ Index<?> index = getUserIndex( newRdnAttrType );
( ( Index ) index ).add( newNormValue, id );
// Make sure the altered entry shows the existence of the new attrib
@@ -1744,7 +1737,7 @@ public abstract class AbstractBTreeParti
if ( hasUserIndexOn( oldRdnAttrType ) )
{
- Index<?, Entry, ID> index = getUserIndex( oldRdnAttrType );
+ Index<?> index = getUserIndex( oldRdnAttrType );
( ( Index ) index ).drop( oldNormValue, id );
/*
@@ -1768,9 +1761,9 @@ public abstract class AbstractBTreeParti
* No need to calculate the new Dn.
*/
- ID parentId = getParentId( id );
+ UUID parentId = getParentId( id );
rdnIdx.drop( id );
- ParentIdAndRdn<ID> key = new ParentIdAndRdn<ID>( parentId, newRdn );
+ ParentIdAndRdn key = new ParentIdAndRdn( parentId, newRdn );
rdnIdx.add( key, id );
master.put( id, entry );
@@ -1803,7 +1796,7 @@ public abstract class AbstractBTreeParti
{
try
{
- ID id = getEntryId( entryContext.getDn() );
+ UUID id = getEntryId( entryContext.getDn() );
Entry entry = lookup( id );
@@ -1826,7 +1819,7 @@ public abstract class AbstractBTreeParti
* @param id ID of the entry
* @throws Exception
*/
- private void updateCsnIndex( Entry entry, ID id ) throws Exception
+ private void updateCsnIndex( Entry entry, UUID id ) throws Exception
{
entryCsnIdx.drop( id );
entryCsnIdx.add( entry.get( SchemaConstants.ENTRY_CSN_AT ).getString(), id );
@@ -1841,10 +1834,10 @@ public abstract class AbstractBTreeParti
* @param newParentId new parent's id
* @throws Exception
*/
- private void updateSubLevelIndex( ID entryId, ID oldParentId, ID newParentId ) throws Exception
+ private void updateSubLevelIndex( UUID entryId, UUID oldParentId, UUID newParentId ) throws Exception
{
- ID tempId = oldParentId;
- List<ID> parentIds = new ArrayList<ID>();
+ UUID tempId = oldParentId;
+ List<UUID> parentIds = new ArrayList<UUID>();
// find all the parents of the oldParentId
while ( ( tempId != null ) && !tempId.equals( getRootId() ) && !tempId.equals( getSuffixId() ) )
@@ -1854,9 +1847,9 @@ public abstract class AbstractBTreeParti
}
// find all the children of the childId
- Cursor<IndexEntry<ID, ID>> cursor = subLevelIdx.forwardCursor( entryId );
+ Cursor<IndexEntry<UUID>> cursor = subLevelIdx.forwardCursor( entryId );
- List<ID> childIds = new ArrayList<ID>();
+ List<UUID> childIds = new ArrayList<UUID>();
childIds.add( entryId );
while ( cursor.next() )
@@ -1867,9 +1860,9 @@ public abstract class AbstractBTreeParti
cursor.close();
// detach the childId and all its children from oldParentId and all it parents excluding the root
- for ( ID pid : parentIds )
+ for ( UUID pid : parentIds )
{
- for ( ID cid : childIds )
+ for ( UUID cid : childIds )
{
subLevelIdx.drop( pid, cid );
}
@@ -1886,9 +1879,9 @@ public abstract class AbstractBTreeParti
}
// attach the childId and all its children to newParentId and all it parents excluding the root
- for ( ID id : parentIds )
+ for ( UUID id : parentIds )
{
- for ( ID cid : childIds )
+ for ( UUID cid : childIds )
{
subLevelIdx.add( id, cid );
}
@@ -1906,17 +1899,17 @@ 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 = getRootId();
StringBuilder upName = new StringBuilder();
boolean isFirst = true;
do
{
- ParentIdAndRdn<ID> cur = rdnIdx.reverseLookup( parentId );
+ ParentIdAndRdn cur = rdnIdx.reverseLookup( parentId );
Rdn[] rdns = cur.getRdns();
for ( Rdn rdn : rdns )
@@ -1955,7 +1948,7 @@ public abstract class AbstractBTreeParti
/**
* {@inheritDoc}
*/
- public final int getChildCount( ID id ) throws LdapException
+ public final int getChildCount( UUID id ) throws LdapException
{
try
{
@@ -1971,7 +1964,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 );
}
@@ -1980,7 +1973,7 @@ public abstract class AbstractBTreeParti
/**
* {@inheritDoc}
*/
- public final ID getEntryId( Dn dn ) throws LdapException
+ public final UUID getEntryId( Dn dn ) throws LdapException
{
try
{
@@ -1989,15 +1982,15 @@ public abstract class AbstractBTreeParti
return getRootId();
}
- ParentIdAndRdn<ID> suffixKey = new ParentIdAndRdn<ID>( getRootId(), suffixDn.getRdns() );
+ ParentIdAndRdn suffixKey = new ParentIdAndRdn( getRootId(), 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 currentRdn = new ParentIdAndRdn( currentId, rdn );
currentId = rdnIdx.forwardLookup( currentRdn );
if ( currentId == null )
@@ -2018,9 +2011,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 key = rdnIdx.reverseLookup( childId );
if ( key == null )
{
@@ -2034,11 +2027,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 key = new ParentIdAndRdn( getRootId(), suffixDn.getRdns() );
suffixId = rdnIdx.forwardLookup( key );
}
@@ -2053,7 +2046,7 @@ public abstract class AbstractBTreeParti
/**
* {@inheritDoc}
*/
- public void addIndex( Index<?, Entry, ID> index ) throws Exception
+ public void addIndex( Index<?> index ) throws Exception
{
checkInitialized( "addIndex" );
@@ -2088,9 +2081,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<?>... indexes )
{
- for ( Index<?, Entry, ID> index : indexes )
+ for ( Index<?> index : indexes )
{
indexedAttributes.add( index );
}
@@ -2101,7 +2094,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<?>> indexedAttributes )
{
this.indexedAttributes = indexedAttributes;
}
@@ -2110,7 +2103,7 @@ public abstract class AbstractBTreeParti
/**
* @return The list of indexed attributes
*/
- public Set<Index<?, Entry, ID>> getIndexedAttributes()
+ public Set<Index<?>> getIndexedAttributes()
{
return indexedAttributes;
}
@@ -2136,7 +2129,7 @@ public abstract class AbstractBTreeParti
/**
* {@inheritDoc}
*/
- public Index<?, Entry, ID> getIndex( AttributeType attributeType ) throws IndexNotFoundException
+ public Index<?> getIndex( AttributeType attributeType ) throws IndexNotFoundException
{
String id = attributeType.getOid();
@@ -2157,7 +2150,7 @@ public abstract class AbstractBTreeParti
/**
* {@inheritDoc}
*/
- public Index<?, Entry, ID> getUserIndex( AttributeType attributeType ) throws IndexNotFoundException
+ public Index<?> getUserIndex( AttributeType attributeType ) throws IndexNotFoundException
{
if ( attributeType == null )
{
@@ -2178,7 +2171,7 @@ public abstract class AbstractBTreeParti
/**
* {@inheritDoc}
*/
- public Index<?, Entry, ID> getSystemIndex( AttributeType attributeType ) throws IndexNotFoundException
+ public Index<?> getSystemIndex( AttributeType attributeType ) throws IndexNotFoundException
{
if ( attributeType == null )
{
@@ -2200,9 +2193,9 @@ public abstract class AbstractBTreeParti
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public Index<ID, Entry, ID> getOneLevelIndex()
+ public Index<UUID> getOneLevelIndex()
{
- return ( Index<ID, Entry, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_ONE_LEVEL_AT_OID );
+ return ( Index<UUID> ) systemIndices.get( ApacheSchemaConstants.APACHE_ONE_LEVEL_AT_OID );
}
@@ -2210,9 +2203,9 @@ public abstract class AbstractBTreeParti
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public Index<ID, Entry, ID> getSubLevelIndex()
+ public Index<UUID> getSubLevelIndex()
{
- return ( Index<ID, Entry, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_SUB_LEVEL_AT_OID );
+ return ( Index<UUID> ) systemIndices.get( ApacheSchemaConstants.APACHE_SUB_LEVEL_AT_OID );
}
@@ -2220,9 +2213,9 @@ public abstract class AbstractBTreeParti
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public Index<String, Entry, ID> getAliasIndex()
+ public Index<String> getAliasIndex()
{
- return ( Index<String, Entry, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_ALIAS_AT_OID );
+ return ( Index<String> ) systemIndices.get( ApacheSchemaConstants.APACHE_ALIAS_AT_OID );
}
@@ -2230,9 +2223,9 @@ public abstract class AbstractBTreeParti
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public Index<ID, Entry, ID> getOneAliasIndex()
+ public Index<UUID> getOneAliasIndex()
{
- return ( Index<ID, Entry, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID );
+ return ( Index<UUID> ) systemIndices.get( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID );
}
@@ -2240,9 +2233,9 @@ public abstract class AbstractBTreeParti
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public Index<ID, Entry, ID> getSubAliasIndex()
+ public Index<UUID> getSubAliasIndex()
{
- return ( Index<ID, Entry, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID );
+ return ( Index<UUID> ) systemIndices.get( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID );
}
@@ -2250,9 +2243,9 @@ public abstract class AbstractBTreeParti
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public Index<String, Entry, ID> getObjectClassIndex()
+ public Index<String> getObjectClassIndex()
{
- return ( Index<String, Entry, ID> ) systemIndices.get( SchemaConstants.OBJECT_CLASS_AT_OID );
+ return ( Index<String> ) systemIndices.get( SchemaConstants.OBJECT_CLASS_AT_OID );
}
@@ -2260,9 +2253,9 @@ public abstract class AbstractBTreeParti
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public Index<String, Entry, ID> getEntryUuidIndex()
+ public Index<String> getEntryUuidIndex()
{
- return ( Index<String, Entry, ID> ) systemIndices.get( SchemaConstants.ENTRY_UUID_AT_OID );
+ return ( Index<String> ) systemIndices.get( SchemaConstants.ENTRY_UUID_AT_OID );
}
@@ -2270,9 +2263,9 @@ public abstract class AbstractBTreeParti
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public Index<String, Entry, ID> getEntryCsnIndex()
+ public Index<String> getEntryCsnIndex()
{
- return ( Index<String, Entry, ID> ) systemIndices.get( SchemaConstants.ENTRY_CSN_AT_OID );
+ return ( Index<String> ) systemIndices.get( SchemaConstants.ENTRY_CSN_AT_OID );
}
@@ -2280,9 +2273,9 @@ public abstract class AbstractBTreeParti
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public Index<String, Entry, ID> getPresenceIndex()
+ public Index<String> getPresenceIndex()
{
- return ( Index<String, Entry, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_PRESENCE_AT_OID );
+ return ( Index<String> ) systemIndices.get( ApacheSchemaConstants.APACHE_PRESENCE_AT_OID );
}
@@ -2290,9 +2283,9 @@ public abstract class AbstractBTreeParti
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public Index<ParentIdAndRdn<ID>, Entry, ID> getRdnIndex()
+ public Index<ParentIdAndRdn> getRdnIndex()
{
- return ( Index<ParentIdAndRdn<ID>, Entry, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_RDN_AT_OID );
+ return ( Index<ParentIdAndRdn> ) systemIndices.get( ApacheSchemaConstants.APACHE_RDN_AT_OID );
}
@@ -2337,12 +2330,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 );
@@ -2452,10 +2445,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 )
{
@@ -2467,7 +2460,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
@@ -2506,7 +2499,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 )
{
@@ -2523,10 +2516,10 @@ public abstract class AbstractBTreeParti
* @param movedBase the base where the move occured
* @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 );
/*
@@ -2534,7 +2527,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
@@ -2568,15 +2561,15 @@ public abstract class AbstractBTreeParti
//---------------------------------------------------------------------------------------------
// Debug methods
//---------------------------------------------------------------------------------------------
- private void dumpIndex( OutputStream stream, Index<?, Entry, ID> index )
+ private void dumpIndex( OutputStream stream, Index<?> index )
{
try
{
- IndexCursor<?, Entry, ID> cursor = index.forwardCursor();
+ IndexCursor<?> cursor = index.forwardCursor();
while ( cursor.next() )
{
- IndexEntry<?, ID> entry = cursor.get();
+ IndexEntry<?> entry = cursor.get();
System.out.println( entry );
}
Modified: directory/apacheds/branches/apacheds-txns/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-txns/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/EntryCursorAdaptor.java?rev=1199852&r1=1199851&r2=1199852&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/EntryCursorAdaptor.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/EntryCursorAdaptor.java Wed Nov 9 17:04:46 2011
@@ -21,6 +21,7 @@ package org.apache.directory.server.core
import java.util.Iterator;
+import java.util.UUID;
import org.apache.directory.server.core.api.partition.index.IndexCursor;
import org.apache.directory.server.core.api.partition.index.IndexEntry;
@@ -36,13 +37,13 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class EntryCursorAdaptor<ID extends Comparable<ID>> implements Cursor<Entry>
+public class EntryCursorAdaptor implements Cursor<Entry>
{
- private final AbstractBTreePartition<ID> db;
- private final IndexCursor<ID, Entry, ID> indexCursor;
+ private final AbstractBTreePartition db;
+ private final IndexCursor<UUID> indexCursor;
- public EntryCursorAdaptor( AbstractBTreePartition<ID> db, IndexCursor<ID, Entry, ID> indexCursor )
+ public EntryCursorAdaptor( AbstractBTreePartition db, IndexCursor<UUID> indexCursor )
{
this.db = db;
this.indexCursor = indexCursor;
@@ -132,7 +133,7 @@ public class EntryCursorAdaptor<ID exten
*/
public Entry get() throws Exception
{
- IndexEntry<ID, ID> indexEntry = indexCursor.get();
+ IndexEntry<UUID> indexEntry = indexCursor.get();
if ( indexEntry.getEntry() == null )
{
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexAssertion.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexAssertion.java?rev=1199852&r1=1199851&r2=1199852&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexAssertion.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexAssertion.java Wed Nov 9 17:04:46 2011
@@ -30,7 +30,7 @@ import org.apache.directory.server.core.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public interface IndexAssertion<K, E, ID>
+public interface IndexAssertion<K>
{
/**
* Tests to see if a perspective candidate should be returned based on
@@ -44,5 +44,5 @@ public interface IndexAssertion<K, E, ID
* @throws Exception if their are failures while asserting the
* condition
*/
- boolean assertCandidate( IndexEntry<K, ID> entry ) throws Exception;
+ boolean assertCandidate( IndexEntry<K> entry ) throws Exception;
}
Modified: directory/apacheds/branches/apacheds-txns/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-txns/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexCursorAdaptor.java?rev=1199852&r1=1199851&r2=1199852&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexCursorAdaptor.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexCursorAdaptor.java Wed Nov 9 17:04:46 2011
@@ -21,6 +21,7 @@ package org.apache.directory.server.core
import java.util.Iterator;
+import java.util.UUID;
import org.apache.directory.server.core.api.partition.index.ForwardIndexEntry;
import org.apache.directory.server.core.api.partition.index.IndexCursor;
@@ -40,12 +41,12 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class IndexCursorAdaptor<K, O, ID> implements IndexCursor<K, O, ID>
+public class IndexCursorAdaptor<K> implements IndexCursor<K>
{
@SuppressWarnings("unchecked")
final Cursor<Tuple> wrappedCursor;
- final ForwardIndexEntry<K, ID> forwardEntry;
- final ReverseIndexEntry<K, ID> reverseEntry;
+ final ForwardIndexEntry<K> forwardEntry;
+ final ReverseIndexEntry<K> reverseEntry;
/**
@@ -63,13 +64,13 @@ public class IndexCursorAdaptor<K, O, ID
if ( forwardIndex )
{
- forwardEntry = new ForwardIndexEntry<K, ID>();
+ forwardEntry = new ForwardIndexEntry<K>();
reverseEntry = null;
}
else
{
forwardEntry = null;
- reverseEntry = new ReverseIndexEntry<K, ID>();
+ reverseEntry = new ReverseIndexEntry<K>();
}
}
@@ -81,7 +82,7 @@ public class IndexCursorAdaptor<K, O, ID
@SuppressWarnings("unchecked")
- public void beforeValue( ID id, K key ) throws Exception
+ public void beforeValue( UUID id, K key ) throws Exception
{
if ( wrappedCursor instanceof TupleCursor )
{
@@ -91,7 +92,7 @@ public class IndexCursorAdaptor<K, O, ID
@SuppressWarnings("unchecked")
- public void afterValue( ID id, K key ) throws Exception
+ public void afterValue( UUID id, K key ) throws Exception
{
if ( wrappedCursor instanceof TupleCursor )
{
@@ -100,13 +101,13 @@ public class IndexCursorAdaptor<K, O, ID
}
- public void before( IndexEntry<K, ID> element ) throws Exception
+ public void before( IndexEntry<K> element ) throws Exception
{
wrappedCursor.before( element.getTuple() );
}
- public void after( IndexEntry<K, ID> element ) throws Exception
+ public void after( IndexEntry<K> element ) throws Exception
{
wrappedCursor.after( element.getTuple() );
}
@@ -155,17 +156,17 @@ public class IndexCursorAdaptor<K, O, ID
@SuppressWarnings("unchecked")
- public IndexEntry<K, ID> get() throws Exception
+ public IndexEntry<K> 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;
}
@@ -190,9 +191,9 @@ public class IndexCursorAdaptor<K, O, ID
}
- public Iterator<IndexEntry<K, ID>> iterator()
+ public Iterator<IndexEntry<K>> iterator()
{
- return new CursorIterator<IndexEntry<K, ID>>( this );
+ return new CursorIterator<IndexEntry<K>>( this );
}
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java?rev=1199852&r1=1199851&r2=1199852&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java Wed Nov 9 17:04:46 2011
@@ -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;
@@ -47,7 +48,7 @@ import org.apache.directory.server.core.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public interface Store<E, ID extends Comparable<ID>>
+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 ?
@@ -133,7 +134,7 @@ public interface Store<E, ID extends Com
*
* @return the root ID
*/
- ID getRootId();
+ UUID getRootId();
/**
* Sets the flag telling the server to flush on disk when some
@@ -172,7 +173,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<?> index ) throws Exception;
//------------------------------------------------------------------------
@@ -181,61 +182,61 @@ public interface Store<E, ID extends Com
/**
* @return The Presence system index
*/
- Index<String, E, ID> getPresenceIndex();
+ Index<String> getPresenceIndex();
/**
* @return The OneLevel system index
*/
- Index<ID, E, ID> getOneLevelIndex();
+ Index<UUID> getOneLevelIndex();
/**
* @return The SubLevel system index
*/
- Index<ID, E, ID> getSubLevelIndex();
+ Index<UUID> getSubLevelIndex();
/**
* @return The Alias system index
*/
- Index<String, E, ID> getAliasIndex();
+ Index<String> getAliasIndex();
/**
* @return The OneAlias system index
*/
- Index<ID, E, ID> getOneAliasIndex();
+ Index<UUID> getOneAliasIndex();
/**
* @return The SubAlias system index
*/
- Index<ID, E, ID> getSubAliasIndex();
+ Index<UUID> getSubAliasIndex();
/**
* @return The Rdn system index
*/
- Index<ParentIdAndRdn<ID>, E, ID> getRdnIndex();
+ Index<ParentIdAndRdn> getRdnIndex();
/**
* @return The ObjectClass system index
*/
- Index<String, E, ID> getObjectClassIndex();
+ Index<String> getObjectClassIndex();
/**
* @return The EntryUUID system index
*/
- Index<String, E, ID> getEntryUuidIndex();
+ Index<String> getEntryUuidIndex();
/**
* @return The EntryCSN system index
*/
- Index<String, E, ID> getEntryCsnIndex();
+ Index<String> getEntryCsnIndex();
/**
@@ -287,7 +288,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<?> getIndex( AttributeType attributeType ) throws IndexNotFoundException;
/**
@@ -296,7 +297,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<?> getUserIndex( AttributeType attributeType ) throws IndexNotFoundException;
/**
@@ -305,7 +306,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<?> getSystemIndex( AttributeType attributeType ) throws IndexNotFoundException;
/**
@@ -314,7 +315,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;
/**
@@ -323,7 +324,7 @@ 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;
/**
@@ -334,7 +335,7 @@ public interface Store<E, ID extends Com
* @return the id of the parent entry or zero if the suffix entry ID is used
* @throws Exception on failures to access the underlying store
*/
- ID getParentId( ID childId ) throws Exception;
+ UUID getParentId( UUID childId ) throws Exception;
/**
@@ -352,7 +353,7 @@ public interface Store<E, ID extends Com
* @param id The Entry ID 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;
/**
@@ -362,7 +363,7 @@ public interface Store<E, ID extends Com
* @return an IndexEntry Cursor over the child entries
* @throws Exception on failures to access the underlying store
*/
- IndexCursor<ID, E, ID> list( ID id ) throws Exception;
+ IndexCursor<UUID> list( UUID id ) throws Exception;
/**
@@ -372,7 +373,7 @@ public interface Store<E, ID extends Com
* @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;
/**
@@ -382,7 +383,7 @@ public interface Store<E, ID extends Com
* @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;
/**
@@ -457,5 +458,5 @@ public interface Store<E, ID extends Com
*
* @return the default ID.
*/
- ID getDefaultId() throws Exception;
+ UUID getDefaultId() throws Exception;
}
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlIndex.java?rev=1199852&r1=1199851&r2=1199852&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlIndex.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlIndex.java Wed Nov 9 17:04:46 2011
@@ -21,15 +21,19 @@ package org.apache.directory.server.xdbm
import java.net.URI;
+import java.util.Comparator;
+import java.util.UUID;
+import org.apache.directory.server.constants.ApacheSchemaConstants;
import org.apache.directory.server.core.partition.impl.btree.IndexCursorAdaptor;
-import org.apache.directory.server.core.partition.impl.btree.LongComparator;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.core.api.partition.index.AbstractIndex;
+import org.apache.directory.server.core.api.partition.index.Index;
import org.apache.directory.server.core.api.partition.index.IndexCursor;
import org.apache.directory.server.core.api.partition.index.ForwardIndexComparator;
import org.apache.directory.server.core.api.partition.index.ReverseIndexComparator;
import org.apache.directory.server.core.api.partition.index.Table;
+import org.apache.directory.server.core.api.partition.index.UUIDComparator;
import org.apache.directory.shared.ldap.model.cursor.Cursor;
import org.apache.directory.shared.ldap.model.cursor.Tuple;
import org.apache.directory.shared.ldap.model.entry.BinaryValue;
@@ -38,6 +42,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.schema.MatchingRule;
import org.apache.directory.shared.ldap.model.schema.Normalizer;
import org.apache.directory.shared.ldap.model.schema.SchemaManager;
+import org.apache.directory.shared.ldap.model.schema.comparators.SerializableComparator;
/**
@@ -45,17 +50,17 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class AvlIndex<K, O> extends AbstractIndex<K, O, Long>
+public class AvlIndex<K> extends AbstractIndex<K>
{
protected Normalizer normalizer;
- protected AvlTable<K, Long> forward;
- protected AvlTable<Long, K> reverse;
+ protected AvlTable<K, UUID> forward;
+ protected AvlTable<UUID, K> reverse;
/** Forward index entry comparator */
- protected ForwardIndexComparator<K,Long> fIndexEntryComparator;
+ protected ForwardIndexComparator<K> fIndexEntryComparator;
/** Reverse index entry comparator */
- protected ReverseIndexComparator<K,Long> rIndexEntryComparator;
+ protected ReverseIndexComparator<K> rIndexEntryComparator;
@@ -94,14 +99,25 @@ public class AvlIndex<K, O> extends Abst
throw new Exception( I18n.err( I18n.ERR_212, attributeType ) );
}
- LdapComparator<K> comp = ( LdapComparator<K> ) mr.getLdapComparator();
-
+ Comparator comp = ( LdapComparator<K> ) mr.getLdapComparator();
+ ( ( LdapComparator<K> )comp ).setSchemaManager( schemaManager );
+
+ String attributeOid = attributeType.getOid();
+
+ if ( attributeOid.equals( ApacheSchemaConstants.APACHE_ONE_LEVEL_AT_OID ) ||
+ attributeOid.equals( ApacheSchemaConstants.APACHE_SUB_LEVEL_AT_OID ) ||
+ attributeOid.equals( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID ) ||
+ attributeOid.equals( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID ) )
+ {
+ comp = UUIDComparator.INSTANCE;
+ }
+
/*
* The forward key/value map stores attribute values to master table
* primary keys. A value for an attribute can occur several times in
* different entries so the forward map can have more than one value.
*/
- forward = new AvlTable<K, Long>( attributeType.getName(), comp, LongComparator.INSTANCE, true );
+ forward = new AvlTable<K, UUID>( attributeType.getName(), comp, UUIDComparator.INSTANCE, true );
/*
* Now the reverse map stores the primary key into the master table as
@@ -111,19 +127,19 @@ public class AvlIndex<K, O> extends Abst
*/
if ( attributeType.isSingleValued() )
{
- reverse = new AvlTable<Long, K>( attributeType.getName(), LongComparator.INSTANCE, comp, false );
+ reverse = new AvlTable<UUID, K>( attributeType.getName(), UUIDComparator.INSTANCE, comp, false );
}
else
{
- reverse = new AvlTable<Long, K>( attributeType.getName(), LongComparator.INSTANCE, comp, true );
+ reverse = new AvlTable<UUID, K>( attributeType.getName(), UUIDComparator.INSTANCE, comp, true );
}
- fIndexEntryComparator = new ForwardIndexComparator( comp, LongComparator.INSTANCE );
- rIndexEntryComparator = new ReverseIndexComparator( comp, LongComparator.INSTANCE );
+ fIndexEntryComparator = new ForwardIndexComparator<K>( comp );
+ rIndexEntryComparator = new ReverseIndexComparator<K>( comp );
}
- public void add( K attrVal, Long id ) throws Exception
+ public void add( K attrVal, UUID id ) throws Exception
{
forward.put( getNormalized( attrVal ), id );
reverse.put( id, getNormalized( attrVal ) );
@@ -168,13 +184,13 @@ public class AvlIndex<K, O> extends Abst
/**
* {@inheritDoc}
*/
- public void drop( Long id ) throws Exception
+ public void drop( UUID id ) throws Exception
{
- Cursor<Tuple<Long, K>> cursor = reverse.cursor( id );
+ Cursor<Tuple<UUID, K>> cursor = reverse.cursor( id );
while ( cursor.next() )
{
- Tuple<Long, K> tuple = cursor.get();
+ Tuple<UUID, K> tuple = cursor.get();
forward.remove( tuple.getValue(), id );
}
@@ -185,7 +201,7 @@ public class AvlIndex<K, O> extends Abst
/**
* {@inheritDoc}
*/
- public void drop( K attrVal, Long id ) throws Exception
+ public void drop( K attrVal, UUID id ) throws Exception
{
forward.remove( getNormalized( attrVal ), id );
reverse.remove( id, getNormalized( attrVal ) );
@@ -204,7 +220,7 @@ public class AvlIndex<K, O> extends Abst
/**
* {@inheritDoc}
*/
- public boolean forward( K attrVal, Long id ) throws Exception
+ public boolean forward( K attrVal, UUID id ) throws Exception
{
return forward.has( getNormalized( attrVal ), id );
}
@@ -214,7 +230,7 @@ public class AvlIndex<K, O> extends Abst
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public IndexCursor<K, O, Long> forwardCursor() throws Exception
+ public IndexCursor<K> forwardCursor() throws Exception
{
return new IndexCursorAdaptor( forward.cursor(), true );
}
@@ -224,7 +240,7 @@ public class AvlIndex<K, O> extends Abst
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public IndexCursor<K, O, Long> forwardCursor( K key ) throws Exception
+ public IndexCursor<K> forwardCursor( K key ) throws Exception
{
return new IndexCursorAdaptor( forward.cursor( key ), true );
}
@@ -242,7 +258,7 @@ public class AvlIndex<K, O> extends Abst
/**
* {@inheritDoc}
*/
- public boolean forwardGreaterOrEq( K attrVal, Long id ) throws Exception
+ public boolean forwardGreaterOrEq( K attrVal, UUID id ) throws Exception
{
return forward.hasGreaterOrEqual( getNormalized( attrVal ), id );
}
@@ -260,7 +276,7 @@ public class AvlIndex<K, O> extends Abst
/**
* {@inheritDoc}
*/
- public boolean forwardLessOrEq( K attrVal, Long id ) throws Exception
+ public boolean forwardLessOrEq( K attrVal, UUID id ) throws Exception
{
return forward.hasLessOrEqual( getNormalized( attrVal ), id );
}
@@ -269,7 +285,7 @@ public class AvlIndex<K, O> extends Abst
/**
* {@inheritDoc}
*/
- public Long forwardLookup( K attrVal ) throws Exception
+ public UUID forwardLookup( K attrVal ) throws Exception
{
return forward.get( getNormalized( attrVal ) );
}
@@ -278,7 +294,7 @@ public class AvlIndex<K, O> extends Abst
/**
* {@inheritDoc}
*/
- public Cursor<Long> forwardValueCursor( K key ) throws Exception
+ public Cursor<UUID> forwardValueCursor( K key ) throws Exception
{
return forward.valueCursor( key );
}
@@ -290,7 +306,7 @@ public class AvlIndex<K, O> extends Abst
@SuppressWarnings("unchecked")
public K getNormalized( K attrVal ) throws Exception
{
- if ( attrVal instanceof Long )
+ if ( attrVal instanceof UUID )
{
return attrVal;
}
@@ -327,7 +343,7 @@ public class AvlIndex<K, O> extends Abst
/**
* {@inheritDoc}
*/
- public boolean reverse( Long id ) throws Exception
+ public boolean reverse( UUID id ) throws Exception
{
return reverse.has( id );
}
@@ -336,7 +352,7 @@ public class AvlIndex<K, O> extends Abst
/**
* {@inheritDoc}
*/
- public boolean reverse( Long id, K attrVal ) throws Exception
+ public boolean reverse( UUID id, K attrVal ) throws Exception
{
return reverse.has( id, getNormalized( attrVal ) );
}
@@ -346,7 +362,7 @@ public class AvlIndex<K, O> extends Abst
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public IndexCursor<K, O, Long> reverseCursor() throws Exception
+ public IndexCursor<K> reverseCursor() throws Exception
{
return new IndexCursorAdaptor( reverse.cursor(), false );
}
@@ -356,7 +372,7 @@ public class AvlIndex<K, O> extends Abst
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public IndexCursor<K, O, Long> reverseCursor( Long id ) throws Exception
+ public IndexCursor<K> reverseCursor( UUID id ) throws Exception
{
return new IndexCursorAdaptor( reverse.cursor( id ), false );
}
@@ -365,7 +381,7 @@ public class AvlIndex<K, O> extends Abst
/**
* {@inheritDoc}
*/
- public boolean reverseGreaterOrEq( Long id ) throws Exception
+ public boolean reverseGreaterOrEq( UUID id ) throws Exception
{
return reverse.hasGreaterOrEqual( id );
}
@@ -374,7 +390,7 @@ public class AvlIndex<K, O> extends Abst
/**
* {@inheritDoc}
*/
- public boolean reverseGreaterOrEq( Long id, K attrVal ) throws Exception
+ public boolean reverseGreaterOrEq( UUID id, K attrVal ) throws Exception
{
return reverse.hasGreaterOrEqual( id, getNormalized( attrVal ) );
}
@@ -383,7 +399,7 @@ public class AvlIndex<K, O> extends Abst
/**
* {@inheritDoc}
*/
- public boolean reverseLessOrEq( Long id ) throws Exception
+ public boolean reverseLessOrEq( UUID id ) throws Exception
{
return reverse.hasLessOrEqual( id );
}
@@ -392,7 +408,7 @@ public class AvlIndex<K, O> extends Abst
/**
* {@inheritDoc}
*/
- public boolean reverseLessOrEq( Long id, K attrVal ) throws Exception
+ public boolean reverseLessOrEq( UUID id, K attrVal ) throws Exception
{
return reverse.hasLessOrEqual( id, getNormalized( attrVal ) );
}
@@ -401,7 +417,7 @@ public class AvlIndex<K, O> extends Abst
/**
* {@inheritDoc}
*/
- public K reverseLookup( Long id ) throws Exception
+ public K reverseLookup( UUID id ) throws Exception
{
return reverse.get( id );
}
@@ -410,7 +426,7 @@ public class AvlIndex<K, O> extends Abst
/**
* {@inheritDoc}
*/
- public Cursor<K> reverseValueCursor( Long id ) throws Exception
+ public Cursor<K> reverseValueCursor( UUID id ) throws Exception
{
return reverse.valueCursor( id );
}
@@ -442,12 +458,12 @@ public class AvlIndex<K, O> extends Abst
return reverse.isDupsEnabled();
}
- public ForwardIndexComparator<K,Long> getForwardIndexEntryComparator()
+ public ForwardIndexComparator<K> getForwardIndexEntryComparator()
{
return this.fIndexEntryComparator;
}
- public ReverseIndexComparator<K,Long> getReverseIndexEntryComparator()
+ public ReverseIndexComparator<K> getReverseIndexEntryComparator()
{
return this.rIndexEntryComparator;
}
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlMasterTable.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlMasterTable.java?rev=1199852&r1=1199851&r2=1199852&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlMasterTable.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlMasterTable.java Wed Nov 9 17:04:46 2011
@@ -21,9 +21,12 @@ package org.apache.directory.server.xdbm
import java.util.Comparator;
+import java.util.UUID;
import java.util.concurrent.atomic.AtomicLong;
import org.apache.directory.server.core.api.partition.index.MasterTable;
+import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.model.entry.Entry;
/**
@@ -32,12 +35,12 @@ import org.apache.directory.server.core.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class AvlMasterTable<E> extends AvlTable<Long, E> implements MasterTable<Long, E>
+public class AvlMasterTable extends AvlTable<UUID, Entry> implements MasterTable
{
private AtomicLong counter = new AtomicLong( 0 );
- public AvlMasterTable( String name, Comparator<Long> keyComparator, Comparator<E> valComparator,
+ public AvlMasterTable( String name, Comparator<UUID> keyComparator, Comparator<Entry> valComparator,
boolean dupsEnabled )
{
super( name, keyComparator, valComparator, dupsEnabled );
@@ -47,9 +50,11 @@ public class AvlMasterTable<E> extends A
/**
* {@inheritDoc}
*/
- public Long getNextId( E entry ) throws Exception
+ public UUID getNextId( Entry entry ) throws Exception
{
- return counter.incrementAndGet();
+ String name = entry.get( SchemaConstants.ENTRY_UUID_AT ).getString();
+ UUID uuid = UUID.fromString( name );
+ return uuid;
}
@@ -58,6 +63,6 @@ public class AvlMasterTable<E> extends A
*/
public void resetCounter() throws Exception
{
- counter.set( 0L );
+
}
}
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndex.java?rev=1199852&r1=1199851&r2=1199852&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndex.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndex.java Wed Nov 9 17:04:46 2011
@@ -21,10 +21,13 @@
package org.apache.directory.server.xdbm.impl.avl;
+import java.util.UUID;
+
import org.apache.directory.server.core.partition.impl.btree.LongComparator;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.core.api.partition.index.ParentIdAndRdn;
import org.apache.directory.server.core.api.partition.index.ParentIdAndRdnComparator;
+import org.apache.directory.server.core.api.partition.index.UUIDComparator;
import org.apache.directory.shared.ldap.model.schema.AttributeType;
import org.apache.directory.shared.ldap.model.schema.MatchingRule;
import org.apache.directory.shared.ldap.model.schema.SchemaManager;
@@ -35,7 +38,7 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class AvlRdnIndex<E> extends AvlIndex<ParentIdAndRdn<Long>, E>
+public class AvlRdnIndex extends AvlIndex<ParentIdAndRdn>
{
public AvlRdnIndex()
@@ -72,41 +75,41 @@ public class AvlRdnIndex<E> extends AvlI
throw new Exception( I18n.err( I18n.ERR_212, attributeType ) );
}
- ParentIdAndRdnComparator<Long> comp = new ParentIdAndRdnComparator<Long>( mr.getOid() );
+ ParentIdAndRdnComparator comp = new ParentIdAndRdnComparator( mr.getOid() );
- LongComparator.INSTANCE.setSchemaManager( schemaManager );
+ //UUIDComparator.INSTANCE.setSchemaManager( schemaManager );
/*
* The forward key/value map stores attribute values to master table
* primary keys. A value for an attribute can occur several times in
* different entries so the forward map can have more than one value.
*/
- forward = new AvlTable<ParentIdAndRdn<Long>, Long>( attributeType.getName(), comp, LongComparator.INSTANCE,
+ forward = new AvlTable<ParentIdAndRdn, UUID>( attributeType.getName(), comp, UUIDComparator.INSTANCE,
false );
- reverse = new AvlTable<Long, ParentIdAndRdn<Long>>( attributeType.getName(), LongComparator.INSTANCE, comp,
+ reverse = new AvlTable<UUID, ParentIdAndRdn>( attributeType.getName(), UUIDComparator.INSTANCE, comp,
false );
}
- public void add( ParentIdAndRdn<Long> rdn, Long entryId ) throws Exception
+ public void add( ParentIdAndRdn rdn, UUID entryId ) throws Exception
{
forward.put( rdn, entryId );
reverse.put( entryId, rdn );
}
- public void drop( Long entryId ) throws Exception
+ public void drop( UUID entryId ) throws Exception
{
- ParentIdAndRdn<Long> rdn = reverse.get( entryId );
+ ParentIdAndRdn rdn = reverse.get( entryId );
forward.remove( rdn );
reverse.remove( entryId );
}
- public void drop( ParentIdAndRdn<Long> rdn, Long id ) throws Exception
+ public void drop( ParentIdAndRdn rdn, UUID id ) throws Exception
{
- long val = forward.get( rdn );
- if ( val == id )
+ UUID val = forward.get( rdn );
+ if ( val.compareTo( id ) == 0 )
{
forward.remove( rdn );
reverse.remove( val );
@@ -114,7 +117,7 @@ public class AvlRdnIndex<E> extends AvlI
}
- public ParentIdAndRdn<Long> getNormalized( ParentIdAndRdn<Long> rdn ) throws Exception
+ public ParentIdAndRdn getNormalized( ParentIdAndRdn rdn ) throws Exception
{
return rdn;
}