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 2010/07/13 12:55:40 UTC
svn commit: r963675 - in /directory/apacheds/trunk:
core/src/main/java/org/apache/directory/server/core/partition/
jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/
jdbm-partition/src/test/java/org/apache/director...
Author: elecharny
Date: Tue Jul 13 10:55:39 2010
New Revision: 963675
URL: http://svn.apache.org/viewvc?rev=963675&view=rev
Log:
o Moved some initialization from JdbmStore/AvlStore down to AbstractStore
o Created a hasUserIndexOn( AttributeType attributeType ) method to be used instead of hasUserIndexOn( String id )
o Minor refactoring
Modified:
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java
directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlStore.java
directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java
directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java
directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java
directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlStoreTest.java
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?rev=963675&r1=963674&r2=963675&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java Tue Jul 13 10:55:39 2010
@@ -848,11 +848,12 @@ public class DefaultPartitionNexus exten
else if ( isOnelevelScope )
{
List<EntryFilteringCursor> cursors = new ArrayList<EntryFilteringCursor>();
- for ( Partition p : partitions.values() )
+
+ for ( Partition partition : partitions.values() )
{
- searchContext.setDn( p.getSuffix() );
+ searchContext.setDn( partition.getSuffix() );
searchContext.setScope( SearchScope.OBJECT );
- cursors.add( p.search( searchContext ) );
+ cursors.add( partition.search( searchContext ) );
}
return new CursorList( cursors, searchContext );
@@ -860,10 +861,12 @@ public class DefaultPartitionNexus exten
else if ( isSublevelScope )
{
List<EntryFilteringCursor> cursors = new ArrayList<EntryFilteringCursor>();
- for ( Partition p : partitions.values() )
+
+ for ( Partition partition : partitions.values() )
{
- ClonedServerEntry entry = p.lookup( new LookupOperationContext( directoryService.getAdminSession(),
- p.getSuffix() ) );
+ ClonedServerEntry entry = partition.lookup( new LookupOperationContext( directoryService.getAdminSession(),
+ partition.getSuffix() ) );
+
if ( entry != null )
{
Partition backend = getPartition( entry.getDn() );
@@ -886,6 +889,7 @@ public class DefaultPartitionNexus exten
}
Partition backend = getPartition( base );
+
return backend.search( searchContext );
}
Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java?rev=963675&r1=963674&r2=963675&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java Tue Jul 13 10:55:39 2010
@@ -36,7 +36,6 @@ import org.apache.directory.server.i18n.
import org.apache.directory.server.xdbm.AbstractStore;
import org.apache.directory.server.xdbm.Index;
import org.apache.directory.shared.ldap.MultiException;
-import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.cursor.Cursor;
import org.apache.directory.shared.ldap.cursor.Tuple;
import org.apache.directory.shared.ldap.entry.Entry;
@@ -108,13 +107,7 @@ public class JdbmStore<E> extends Abstra
*/
public synchronized void init( SchemaManager schemaManager ) throws Exception
{
- this.schemaManager = schemaManager;
-
- // Initialize Attribute types used all over this method
- objectClassAT = schemaManager.getAttributeType( SchemaConstants.OBJECT_CLASS_AT );
- aliasedObjectNameAT = schemaManager.getAttributeType( SchemaConstants.ALIASED_OBJECT_NAME_AT );
- entryCsnAT = schemaManager.getAttributeType( SchemaConstants.ENTRY_CSN_AT );
- entryUuidAT = schemaManager.getAttributeType( SchemaConstants.ENTRY_UUID_AT );
+ super.init( schemaManager );
partitionDir.mkdirs();
Modified: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java?rev=963675&r1=963674&r2=963675&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java Tue Jul 13 10:55:39 2010
@@ -57,6 +57,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
import org.apache.directory.shared.ldap.name.DN;
import org.apache.directory.shared.ldap.name.RDN;
+import org.apache.directory.shared.ldap.schema.AttributeType;
import org.apache.directory.shared.ldap.schema.SchemaManager;
import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
import org.apache.directory.shared.ldap.schema.ldif.extractor.impl.DefaultSchemaLdifExtractor;
@@ -86,6 +87,9 @@ public class JdbmStoreTest
private static SchemaManager schemaManager = null;
private static LdifSchemaLoader loader;
private static DN EXAMPLE_COM;
+
+ /** The OU AttributeType instance */
+ private static AttributeType OU_AT;
@BeforeClass
@@ -115,6 +119,8 @@ public class JdbmStoreTest
EXAMPLE_COM = new DN( "dc=example,dc=com" );
EXAMPLE_COM.normalize( schemaManager.getNormalizerMapping() );
+
+ OU_AT = schemaManager.getAttributeType( SchemaConstants.OU_AT );
}
@@ -405,7 +411,7 @@ public class JdbmStoreTest
assertEquals( 2, store.getUserIndices().size() );
assertFalse( store.hasUserIndexOn( "dc" ) );
- assertTrue( store.hasUserIndexOn( SchemaConstants.OU_AT ) );
+ assertTrue( store.hasUserIndexOn( OU_AT ) );
assertTrue( store.hasSystemIndexOn( ApacheSchemaConstants.APACHE_ALIAS_AT ) );
Iterator<String> userIndices = store.userIndices();
assertTrue( userIndices.hasNext() );
@@ -674,8 +680,7 @@ public class JdbmStoreTest
dn.normalize( schemaManager.getNormalizerMapping() );
List<Modification> mods = new ArrayList<Modification>();
- EntryAttribute attrib = new DefaultEntryAttribute( SchemaConstants.OU_AT, schemaManager
- .lookupAttributeTypeRegistry( SchemaConstants.OU_AT_OID ) );
+ EntryAttribute attrib = new DefaultEntryAttribute( SchemaConstants.OU_AT, OU_AT );
attrib.add( "Engineering" );
Modification add = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, attrib );
@@ -883,8 +888,7 @@ public class JdbmStoreTest
store.add( entry );
List<Modification> mods = new ArrayList<Modification>();
- EntryAttribute attrib = new DefaultEntryAttribute( SchemaConstants.OU_AT, schemaManager
- .lookupAttributeTypeRegistry( SchemaConstants.OU_AT_OID ) );
+ EntryAttribute attrib = new DefaultEntryAttribute( SchemaConstants.OU_AT, OU_AT );
String attribVal = "Marketing";
attrib.add( attribVal );
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java?rev=963675&r1=963674&r2=963675&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java Tue Jul 13 10:55:39 2010
@@ -71,10 +71,10 @@ public abstract class AbstractStore<E, I
public static final int DEFAULT_CACHE_SIZE = 10000;
/** Cached attributes types to avoid lookup all over the code */
- protected AttributeType objectClassAT;
- protected AttributeType entryCsnAT;
- protected AttributeType entryUuidAT;
- protected AttributeType aliasedObjectNameAT;
+ protected AttributeType OBJECT_CLASS_AT;
+ protected AttributeType ENTRY_CSN_AT;
+ protected AttributeType ENTRY_UUID_AT;
+ protected AttributeType ALIASED_OBJECT_NAME_AT;
/** true if initialized */
protected boolean initialized;
@@ -136,6 +136,18 @@ public abstract class AbstractStore<E, I
/** the relative distinguished name index */
protected Index<ParentIdAndRdn<ID>, E, ID> rdnIdx;
+
+ public void init( SchemaManager schemaManager ) throws Exception
+ {
+ this.schemaManager = schemaManager;
+
+ // Initialize Attribute types used all over this method
+ OBJECT_CLASS_AT = schemaManager.getAttributeType( SchemaConstants.OBJECT_CLASS_AT );
+ ALIASED_OBJECT_NAME_AT = schemaManager.getAttributeType( SchemaConstants.ALIASED_OBJECT_NAME_AT );
+ ENTRY_CSN_AT = schemaManager.getAttributeType( SchemaConstants.ENTRY_CSN_AT );
+ ENTRY_UUID_AT = schemaManager.getAttributeType( SchemaConstants.ENTRY_UUID_AT );
+
+ }
protected void protect( String property )
{
@@ -422,6 +434,15 @@ public abstract class AbstractStore<E, I
/**
* {@inheritDoc}
*/
+ public boolean hasUserIndexOn( AttributeType attributeType ) throws LdapException
+ {
+ return userIndices.containsKey( attributeType.getOid() );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
public boolean hasSystemIndexOn( String id ) throws LdapException
{
return systemIndices.containsKey( schemaManager.getAttributeTypeRegistry().getOidByName( id ) );
@@ -812,7 +833,7 @@ public abstract class AbstractStore<E, I
rdnIdx.add( key, id );
- EntryAttribute objectClass = entry.get( objectClassAT );
+ EntryAttribute objectClass = entry.get( OBJECT_CLASS_AT );
if ( objectClass == null )
{
@@ -833,7 +854,7 @@ public abstract class AbstractStore<E, I
if ( objectClass.contains( SchemaConstants.ALIAS_OC ) )
{
- EntryAttribute aliasAttr = entry.get( aliasedObjectNameAT );
+ EntryAttribute aliasAttr = entry.get( ALIASED_OBJECT_NAME_AT );
addAliasIndices( id, entryDn, aliasAttr.getString() );
}
@@ -845,7 +866,7 @@ public abstract class AbstractStore<E, I
oneLevelIdx.add( parentId, id );
// Update the EntryCsn index
- EntryAttribute entryCsn = entry.get( entryCsnAT );
+ EntryAttribute entryCsn = entry.get( ENTRY_CSN_AT );
if ( entryCsn == null )
{
@@ -856,7 +877,7 @@ public abstract class AbstractStore<E, I
entryCsnIdx.add( entryCsn.getString(), id );
// Update the EntryUuid index
- EntryAttribute entryUuid = entry.get( entryUuidAT );
+ EntryAttribute entryUuid = entry.get( ENTRY_UUID_AT );
if ( entryUuid == null )
{
@@ -882,7 +903,7 @@ public abstract class AbstractStore<E, I
{
String attributeOid = attribute.getAttributeType().getOid();
- if ( hasUserIndexOn( attributeOid ) )
+ if ( hasUserIndexOn( attribute.getAttributeType() ) )
{
Index<Object, E, ID> idx = ( Index<Object, E, ID> ) getUserIndex( attributeOid );
@@ -1006,7 +1027,7 @@ public abstract class AbstractStore<E, I
{
Entry entry = master.get( id );
- EntryAttribute objectClass = entry.get( objectClassAT );
+ EntryAttribute objectClass = entry.get( OBJECT_CLASS_AT );
if ( objectClass.contains( SchemaConstants.ALIAS_OC ) )
{
@@ -1028,7 +1049,7 @@ public abstract class AbstractStore<E, I
{
String attributeOid = attribute.getAttributeType().getOid();
- if ( hasUserIndexOn( attributeOid ) )
+ if ( hasUserIndexOn( attribute.getAttributeType() ) )
{
Index<?, E, ID> index = getUserIndex( attributeOid );
@@ -1411,7 +1432,7 @@ public abstract class AbstractStore<E, I
objectClassIdx.add( value.getString(), id );
}
}
- else if ( hasUserIndexOn( modsOid ) )
+ else if ( hasUserIndexOn( mods.getAttributeType() ) )
{
Index<?, E, ID> index = getUserIndex( modsOid );
@@ -1428,11 +1449,10 @@ public abstract class AbstractStore<E, I
}
// add all the values in mods to the same attribute in the entry
- AttributeType type = schemaManager.lookupAttributeTypeRegistry( modsOid );
for ( Value<?> value : mods )
{
- entry.add( type, value );
+ entry.add( mods.getAttributeType(), value );
}
if ( modsOid.equals( SchemaConstants.ALIASED_OBJECT_NAME_AT_OID ) )
@@ -1466,7 +1486,7 @@ public abstract class AbstractStore<E, I
String modsOid = schemaManager.getAttributeTypeRegistry().getOidByName( mods.getId() );
// Special case for the ObjectClass index
- if ( modsOid.equals( SchemaConstants.OBJECT_CLASS_AT_OID ) )
+ if ( mods.getAttributeType().equals( OBJECT_CLASS_AT ) )
{
// if the id exists in the index drop all existing attribute
// value index entries and add new ones
@@ -1480,7 +1500,7 @@ public abstract class AbstractStore<E, I
objectClassIdx.add( value.getString(), id );
}
}
- else if ( hasUserIndexOn( modsOid ) )
+ else if ( hasUserIndexOn( mods.getAttributeType() ) )
{
Index<?, E, ID> index = getUserIndex( modsOid );
@@ -1509,7 +1529,7 @@ public abstract class AbstractStore<E, I
String aliasAttributeOid = schemaManager.getAttributeTypeRegistry().getOidByName(
SchemaConstants.ALIASED_OBJECT_NAME_AT );
- if ( modsOid.equals( aliasAttributeOid ) )
+ if ( mods.getAttributeType().equals( ALIASED_OBJECT_NAME_AT ) )
{
dropAliasIndices( id );
}
@@ -1557,7 +1577,7 @@ public abstract class AbstractStore<E, I
String modsOid = schemaManager.getAttributeTypeRegistry().getOidByName( mods.getId() );
// Special case for the ObjectClass index
- if ( modsOid.equals( SchemaConstants.OBJECT_CLASS_AT_OID ) )
+ if ( mods.getAttributeType().equals( OBJECT_CLASS_AT ) )
{
/*
* If there are no attribute values in the modifications then this
@@ -1576,7 +1596,7 @@ public abstract class AbstractStore<E, I
}
}
}
- else if ( hasUserIndexOn( modsOid ) )
+ else if ( hasUserIndexOn( mods.getAttributeType() ) )
{
Index<?, E, ID> index = getUserIndex( modsOid );
@@ -1608,19 +1628,20 @@ public abstract class AbstractStore<E, I
}
AttributeType attrType = schemaManager.lookupAttributeTypeRegistry( modsOid );
+
/*
* If there are no attribute values in the modifications then this
- * implies the compelete removal of the attribute from the entry. Else
+ * implies the complete removal of the attribute from the entry. Else
* we remove individual attribute values from the entry in mods one
* at a time.
*/
if ( mods.size() == 0 )
{
- entry.removeAttributes( attrType );
+ entry.removeAttributes( mods.getAttributeType() );
}
else
{
- EntryAttribute entryAttr = entry.get( attrType );
+ EntryAttribute entryAttr = entry.get( mods.getAttributeType() );
for ( Value<?> value : mods )
{
@@ -1635,7 +1656,7 @@ public abstract class AbstractStore<E, I
}
// Aliases->single valued comp/partial attr removal is not relevant here
- if ( modsOid.equals( SchemaConstants.ALIASED_OBJECT_NAME_AT_OID ) )
+ if ( mods.getAttributeType().equals( ALIASED_OBJECT_NAME_AT ) )
{
dropAliasIndices( id );
}
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java?rev=963675&r1=963674&r2=963675&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java Tue Jul 13 10:55:39 2010
@@ -35,6 +35,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.entry.ModificationOperation;
import org.apache.directory.shared.ldap.name.DN;
import org.apache.directory.shared.ldap.name.RDN;
+import org.apache.directory.shared.ldap.schema.AttributeType;
import org.apache.directory.shared.ldap.schema.SchemaManager;
@@ -350,6 +351,16 @@ public interface Store<E, ID extends Com
/**
+ * Tells if an index is already present in the User's index list
+ * @param attributeType The attributeType index we are looking for
+ * @return <code>true</code> if the index is already present in the
+ * User's index list
+ * @throws Exception If something went wrong
+ */
+ boolean hasUserIndexOn( AttributeType attributeType ) throws Exception;
+
+
+ /**
* Tells if an index is already present in the System's index list
* @param id The index we are looking for
* @return <code>true</code> if the index is already present in the
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlStore.java?rev=963675&r1=963674&r2=963675&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlStore.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlStore.java Tue Jul 13 10:55:39 2010
@@ -26,7 +26,6 @@ import org.apache.directory.server.const
import org.apache.directory.server.core.partition.impl.btree.LongComparator;
import org.apache.directory.server.xdbm.AbstractStore;
import org.apache.directory.server.xdbm.Index;
-import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.entry.Entry;
import org.apache.directory.shared.ldap.schema.SchemaManager;
import org.slf4j.Logger;
@@ -64,12 +63,7 @@ public class AvlStore<E> extends Abstrac
*/
public void init( SchemaManager schemaManager ) throws Exception
{
- this.schemaManager = schemaManager;
-
- objectClassAT = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.OBJECT_CLASS_AT );
- aliasedObjectNameAT = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.ALIASED_OBJECT_NAME_AT );
- entryCsnAT = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.ENTRY_CSN_AT );
- entryUuidAT = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.ENTRY_UUID_AT );
+ super.init( schemaManager );
// Create the master table (the table containing all the entries)
master = new AvlMasterTable<Entry>( id, new LongComparator(), null, false );
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java?rev=963675&r1=963674&r2=963675&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java Tue Jul 13 10:55:39 2010
@@ -347,7 +347,7 @@ public class DefaultOptimizer<E, ID exte
*/
private long getPresenceScan( PresenceNode node ) throws Exception
{
- if ( db.hasUserIndexOn( node.getAttribute() ) )
+ if ( db.hasUserIndexOn( node.getAttributeType() ) )
{
Index<String, E, ID> idx = db.getPresenceIndex();
return idx.count( node.getAttribute() );
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java?rev=963675&r1=963674&r2=963675&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java Tue Jul 13 10:55:39 2010
@@ -20,11 +20,11 @@
package org.apache.directory.server.xdbm.search.impl;
-import org.apache.directory.server.xdbm.IndexEntry;
-import org.apache.directory.server.xdbm.Store;
+import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.xdbm.AbstractIndexCursor;
import org.apache.directory.server.xdbm.IndexCursor;
-import org.apache.directory.server.i18n.I18n;
+import org.apache.directory.server.xdbm.IndexEntry;
+import org.apache.directory.server.xdbm.Store;
import org.apache.directory.shared.ldap.cursor.InvalidCursorPositionException;
import org.apache.directory.shared.ldap.entry.Entry;
import org.apache.directory.shared.ldap.schema.AttributeType;
@@ -52,7 +52,7 @@ public class PresenceCursor<ID extends C
// we don't maintain a presence index for objectClass, entryUUID, and entryCSN
// as it doesn't make sense because every entry has such an attribute
// instead for those attributes and all un-indexed attributes we use the ndn index
- if ( db.hasUserIndexOn( type.getOid() ) )
+ if ( db.hasUserIndexOn( type ) )
{
presenceCursor = db.getPresenceIndex().forwardCursor( type.getOid() );
ndnCursor = null;
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java?rev=963675&r1=963674&r2=963675&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java Tue Jul 13 10:55:39 2010
@@ -56,7 +56,7 @@ public class PresenceEvaluator<ID extend
this.schemaManager = schemaManager;
this.type = node.getAttributeType();
- if ( db.hasUserIndexOn( node.getAttribute() ) )
+ if ( db.hasUserIndexOn( node.getAttributeType() ) )
{
idx = db.getPresenceIndex();
}
Modified: directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlStoreTest.java?rev=963675&r1=963674&r2=963675&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlStoreTest.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlStoreTest.java Tue Jul 13 10:55:39 2010
@@ -57,6 +57,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
import org.apache.directory.shared.ldap.name.DN;
import org.apache.directory.shared.ldap.name.RDN;
+import org.apache.directory.shared.ldap.schema.AttributeType;
import org.apache.directory.shared.ldap.schema.SchemaManager;
import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
import org.apache.directory.shared.ldap.schema.ldif.extractor.impl.DefaultSchemaLdifExtractor;
@@ -86,6 +87,12 @@ public class AvlStoreTest
private static SchemaManager schemaManager = null;
private static DN EXAMPLE_COM;
+ /** The OU AttributeType instance */
+ private static AttributeType OU_AT;
+
+ /** The DC AttributeType instance */
+ private static AttributeType DC_AT;
+
@BeforeClass
public static void setup() throws Exception
@@ -115,6 +122,9 @@ public class AvlStoreTest
EXAMPLE_COM = new DN( "dc=example,dc=com" );
EXAMPLE_COM.normalize( schemaManager.getNormalizerMapping() );
+
+ OU_AT = schemaManager.getAttributeType( SchemaConstants.OU_AT );
+ DC_AT = schemaManager.getAttributeType( SchemaConstants.DC_AT );
}
@@ -338,8 +348,8 @@ public class AvlStoreTest
assertNotNull( store.getSuffixDn() );
assertEquals( 2, store.getUserIndices().size() );
- assertFalse( store.hasUserIndexOn( "dc" ) );
- assertTrue( store.hasUserIndexOn( SchemaConstants.OU_AT_OID ) );
+ assertFalse( store.hasUserIndexOn( DC_AT ) );
+ assertTrue( store.hasUserIndexOn( OU_AT ) );
assertTrue( store.hasSystemIndexOn( ApacheSchemaConstants.APACHE_ALIAS_AT_OID ) );
Iterator<String> userIndices = store.userIndices();
assertTrue( userIndices.hasNext() );