directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r963683 - in /directory/apacheds/trunk/xdbm-partition/src: main/java/org/apache/directory/server/xdbm/ main/java/org/apache/directory/server/xdbm/search/impl/ test/java/org/apache/directory/server/xdbm/
Date Tue, 13 Jul 2010 11:42:01 GMT
Author: elecharny
Date: Tue Jul 13 11:42:01 2010
New Revision: 963683

URL: http://svn.apache.org/viewvc?rev=963683&view=rev
Log:
Added the methods getIndex/getSystemIndex/hasIndexOn/hasUserIndexOn/hasSystemIndexOn taking
an AttributeType parameter

Modified:
    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/search/impl/ApproximateCursor.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.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/EqualityCursor.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqCursor.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java
    directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/AbstractStoreTest.java

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=963683&r1=963682&r2=963683&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 11:42:01 2010
@@ -425,6 +425,15 @@ public abstract class AbstractStore<E, I
     /**
      * {@inheritDoc}
      */
+    public boolean hasIndexOn( AttributeType attributeType ) throws LdapException
+    {
+        return hasUserIndexOn( attributeType ) || hasSystemIndexOn( attributeType );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
     public boolean hasUserIndexOn( String id ) throws LdapException
     {
         return userIndices.containsKey( schemaManager.getAttributeTypeRegistry().getOidByName(
id ) );
@@ -452,6 +461,15 @@ public abstract class AbstractStore<E, I
     /**
      * {@inheritDoc}
      */
+    public boolean hasSystemIndexOn( AttributeType attributeType ) throws LdapException
+    {
+        return systemIndices.containsKey( attributeType.getOid() );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
     public Set<Index<?, E, ID>> getUserIndices()
     {
         return new HashSet<Index<?, E, ID>>( userIndices.values() );
@@ -465,7 +483,7 @@ public abstract class AbstractStore<E, I
     {
         try
         {
-            id = schemaManager.getAttributeTypeRegistry().getOidByName( id );
+            return getIndex( schemaManager.lookupAttributeTypeRegistry( id) );
         }
         catch ( LdapException e )
         {
@@ -473,6 +491,15 @@ public abstract class AbstractStore<E, I
             LOG.error( msg, e );
             throw new IndexNotFoundException( msg, id, e );
         }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Index<?, E, ID> getIndex( AttributeType attributeType ) throws IndexNotFoundException
+    {
+        String id = attributeType.getOid();
 
         if ( userIndices.containsKey( id ) )
         {
@@ -495,7 +522,7 @@ public abstract class AbstractStore<E, I
     {
         try
         {
-            id = schemaManager.getAttributeTypeRegistry().getOidByName( id );
+            return getUserIndex( schemaManager.lookupAttributeTypeRegistry( id ) );
         }
         catch ( LdapException e )
         {
@@ -503,6 +530,15 @@ public abstract class AbstractStore<E, I
             LOG.error( msg, e );
             throw new IndexNotFoundException( msg, id, e );
         }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Index<?, E, ID> getUserIndex( AttributeType attributeType ) throws IndexNotFoundException
+    {
+        String id = attributeType.getOid();
 
         if ( userIndices.containsKey( id ) )
         {
@@ -520,7 +556,7 @@ public abstract class AbstractStore<E, I
     {
         try
         {
-            id = schemaManager.getAttributeTypeRegistry().getOidByName( id );
+            return getSystemIndex( schemaManager.lookupAttributeTypeRegistry( id ) );
         }
         catch ( LdapException e )
         {
@@ -528,6 +564,15 @@ public abstract class AbstractStore<E, I
             LOG.error( msg, e );
             throw new IndexNotFoundException( msg, id, e );
         }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Index<?, E, ID> getSystemIndex( AttributeType attributeType ) throws IndexNotFoundException
+    {
+        String id = attributeType.getOid();
 
         if ( systemIndices.containsKey( 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=963683&r1=963682&r2=963683&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 11:42:01 2010
@@ -341,6 +341,16 @@ public interface Store<E, ID extends Com
 
 
     /**
+     * Tells if an index is already present in the User's <strong>or</strong>
System's index list
+     * @param ttributeType The index we are looking for
+     * @return <code>true</code> if the index is already present in the
+     * User's <strong>or</strong> System's index list 
+     * @throws Exception If something went wrong
+     */
+    boolean hasIndexOn( AttributeType attributeType ) throws Exception;
+
+
+    /**
      * Tells if an index is already present in the User's index list
      * @param id The index we are looking for
      * @return <code>true</code> if the index is already present in the
@@ -371,6 +381,16 @@ public interface Store<E, ID extends Com
 
 
     /**
+     * Tells if an index is already present in the System's index list
+     * @param attributeType The index we are looking for
+     * @return <code>true</code> if the index is already present in the
+     * System's index list 
+     * @throws Exception If something went wrong
+     */
+    boolean hasSystemIndexOn( AttributeType attributeType ) throws Exception;
+
+
+    /**
      * Get the user <strong>or</strong> system index associated with the given
name
      * @param id The index name we are looking for
      * @return The associated user <strong>or</strong> system index
@@ -380,6 +400,15 @@ public interface Store<E, ID extends Com
 
 
     /**
+     * Get the user <strong>or</strong> system index associated with the given
attributeType
+     * @param attributeType The index attributeType we are looking for
+     * @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;
+
+
+    /**
      * Get the user index associated with the given name
      * @param id The index name we are looking for
      * @return The associated user index
@@ -389,6 +418,15 @@ public interface Store<E, ID extends Com
 
 
     /**
+     * Get the user index associated with the given attributeType
+     * @param attributeType The index attributeType we are looking for
+     * @return The associated user index
+     * @throws IndexNotFoundException If the index does not exist
+     */
+    Index<?, E, ID> getUserIndex( AttributeType attributeType ) throws IndexNotFoundException;
+
+
+    /**
      * Get the system index associated with the given name
      * @param id The index name we are looking for
      * @return The associated system index
@@ -398,6 +436,15 @@ public interface Store<E, ID extends Com
 
 
     /**
+     * Get the system index associated with the given attributeType
+     * @param attributeType The index attributeType we are looking for
+     * @return The associated system index
+     * @throws IndexNotFoundException If the index does not exist
+     */
+    Index<?, E, ID> getSystemIndex( AttributeType attributeType ) throws IndexNotFoundException;
+
+
+    /**
      * Gets the entry's id. Returns <code>null</code> if the DN doesn't exist
in this store.
      * Note that the DN must be normalized!
      * @param dn the normalized entry DN

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateCursor.java?rev=963683&r1=963682&r2=963683&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateCursor.java
(original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateCursor.java
Tue Jul 13 11:42:01 2010
@@ -29,6 +29,7 @@ import org.apache.directory.server.xdbm.
 import org.apache.directory.shared.ldap.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.Value;
+import org.apache.directory.shared.ldap.schema.AttributeType;
 
 
 /**
@@ -64,11 +65,12 @@ public class ApproximateCursor<V, ID ext
     {
         this.approximateEvaluator = approximateEvaluator;
 
-        String attribute = approximateEvaluator.getExpression().getAttribute();
+        AttributeType attributeType = approximateEvaluator.getExpression().getAttributeType();
         Value<V> value = approximateEvaluator.getExpression().getValue();
-        if ( db.hasIndexOn( attribute ) )
+        
+        if ( db.hasIndexOn( attributeType ) )
         {
-            Index<V, Entry, ID> index = ( Index<V, Entry, ID> ) db.getIndex(
attribute );
+            Index<V, Entry, ID> index = ( Index<V, Entry, ID> ) db.getIndex(
attributeType );
             userIdxCursor = index.forwardCursor( value.get() );
             ndnIdxCursor = null;
         }

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java?rev=963683&r1=963682&r2=963683&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java
(original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java
Tue Jul 13 11:42:01 2010
@@ -63,9 +63,9 @@ public class ApproximateEvaluator<T, ID 
         this.node = node;
         this.schemaManager = schemaManager;
 
-        if ( db.hasIndexOn( node.getAttribute() ) )
+        if ( db.hasIndexOn( node.getAttributeType() ) )
         {
-            idx = ( Index<T, Entry, ID> ) db.getIndex( node.getAttribute() );
+            idx = ( Index<T, Entry, ID> ) db.getIndex( node.getAttributeType() );
             type = null;
             normalizer = null;
             ldapComparator = null;

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=963683&r1=963682&r2=963683&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 11:42:01 2010
@@ -274,9 +274,9 @@ public class DefaultOptimizer<E, ID exte
     @SuppressWarnings("unchecked")
     private <V> long getEqualityScan( SimpleNode<V> node ) throws Exception
     {
-        if ( db.hasIndexOn( node.getAttribute() ) )
+        if ( db.hasIndexOn( node.getAttributeType() ) )
         {
-            Index<V, E, ID> idx = ( Index<V, E, ID> ) db.getIndex( node.getAttribute()
);
+            Index<V, E, ID> idx = ( Index<V, E, ID> ) db.getIndex( node.getAttributeType()
);
             return idx.count( node.getValue().get() );
         }
 
@@ -297,9 +297,9 @@ public class DefaultOptimizer<E, ID exte
     @SuppressWarnings("unchecked")
     private <V> long getGreaterLessScan( SimpleNode<V> node, boolean isGreaterThan
) throws Exception
     {
-        if ( db.hasIndexOn( node.getAttribute() ) )
+        if ( db.hasIndexOn( node.getAttributeType() ) )
         {
-            Index<V, E, ID> idx = ( Index<V, E, ID> ) db.getIndex( node.getAttribute()
);
+            Index<V, E, ID> idx = ( Index<V, E, ID> ) db.getIndex( node.getAttributeType()
);
             if ( isGreaterThan )
             {
                 return idx.greaterThanCount( node.getValue().get() );
@@ -327,9 +327,9 @@ public class DefaultOptimizer<E, ID exte
     @SuppressWarnings("unchecked")
     private long getFullScan( LeafNode node ) throws Exception
     {
-        if ( db.hasIndexOn( node.getAttribute() ) )
+        if ( db.hasIndexOn( node.getAttributeType() ) )
         {
-            Index idx = db.getIndex( node.getAttribute() );
+            Index idx = db.getIndex( node.getAttributeType() );
             return idx.count();
         }
 
@@ -352,7 +352,7 @@ public class DefaultOptimizer<E, ID exte
             Index<String, E, ID> idx = db.getPresenceIndex();
             return idx.count( node.getAttribute() );
         }
-        else if ( db.hasSystemIndexOn( node.getAttribute() ) )
+        else if ( db.hasSystemIndexOn( node.getAttributeType() ) )
         {
             // the system indices (objectClass, entryUUID, entryCSN) are maintained for
             // each entry, so we could just return the database count

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityCursor.java?rev=963683&r1=963682&r2=963683&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityCursor.java
(original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityCursor.java
Tue Jul 13 11:42:01 2010
@@ -29,6 +29,7 @@ import org.apache.directory.server.xdbm.
 import org.apache.directory.shared.ldap.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.Value;
+import org.apache.directory.shared.ldap.schema.AttributeType;
 
 
 /**
@@ -63,12 +64,12 @@ public class EqualityCursor<V, ID extend
     {
         this.equalityEvaluator = equalityEvaluator;
 
-        String attribute = equalityEvaluator.getExpression().getAttribute();
+        AttributeType attributeType = equalityEvaluator.getExpression().getAttributeType();
         Value<V> value = equalityEvaluator.getExpression().getValue();
         
-        if ( db.hasIndexOn( attribute ) )
+        if ( db.hasIndexOn( attributeType ) )
         {
-            Index<V, Entry, ID> userIndex = ( Index<V, Entry, ID> ) db.getIndex(
attribute );
+            Index<V, Entry, ID> userIndex = ( Index<V, Entry, ID> ) db.getIndex(
attributeType );
             userIdxCursor = userIndex.forwardCursor( value.get() );
             ndnIdxCursor = null;
         }

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java?rev=963683&r1=963682&r2=963683&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java
(original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java
Tue Jul 13 11:42:01 2010
@@ -76,9 +76,9 @@ public class EqualityEvaluator<T, ID ext
         this.node = node;
         this.schemaManager = schemaManager;
 
-        if ( db.hasIndexOn( node.getAttribute() ) )
+        if ( db.hasIndexOn( node.getAttributeType() ) )
         {
-            idx = ( Index<T, Entry, ID> ) db.getIndex( node.getAttribute() );
+            idx = ( Index<T, Entry, ID> ) db.getIndex( node.getAttributeType() );
             type = null;
             normalizer = null;
             comparator = null;

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqCursor.java?rev=963683&r1=963682&r2=963683&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqCursor.java
(original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqCursor.java
Tue Jul 13 11:42:01 2010
@@ -29,6 +29,7 @@ import org.apache.directory.server.xdbm.
 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;
 
 
 /**
@@ -69,11 +70,11 @@ public class GreaterEqCursor<V, ID exten
     {
         this.greaterEqEvaluator = greaterEqEvaluator;
 
-        String attribute = greaterEqEvaluator.getExpression().getAttribute();
+        AttributeType attributeType = greaterEqEvaluator.getExpression().getAttributeType();
         
-        if ( db.hasIndexOn( attribute ) )
+        if ( db.hasIndexOn( attributeType ) )
         {
-            userIdxCursor = ( ( Index<V, Entry, ID> ) db.getIndex( attribute ) ).forwardCursor();
+            userIdxCursor = ( ( Index<V, Entry, ID> ) db.getIndex( attributeType )
).forwardCursor();
             ndnIdxCursor = null;
         }
         else

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java?rev=963683&r1=963682&r2=963683&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java
(original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java
Tue Jul 13 11:42:01 2010
@@ -64,9 +64,9 @@ public class GreaterEqEvaluator<T, ID ex
         this.schemaManager = schemaManager;
         this.type = node.getAttributeType();
 
-        if ( db.hasIndexOn( node.getAttribute() ) )
+        if ( db.hasIndexOn( node.getAttributeType() ) )
         {
-            idx = ( Index<Object, Entry, ID> ) db.getIndex( node.getAttribute() );
+            idx = ( Index<Object, Entry, ID> ) db.getIndex( node.getAttributeType()
);
         }
         else
         {

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java?rev=963683&r1=963682&r2=963683&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java
(original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java
Tue Jul 13 11:42:01 2010
@@ -29,6 +29,7 @@ import org.apache.directory.server.xdbm.
 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;
 
 
 /**
@@ -69,11 +70,11 @@ public class LessEqCursor<V, ID extends 
     {
         this.lessEqEvaluator = lessEqEvaluator;
 
-        String attribute = lessEqEvaluator.getExpression().getAttribute();
+        AttributeType attributeType = lessEqEvaluator.getExpression().getAttributeType();
         
-        if ( db.hasIndexOn( attribute ) )
+        if ( db.hasIndexOn( attributeType ) )
         {
-            userIdxCursor = ( ( Index<V, Entry, ID> ) db.getIndex( attribute ) ).forwardCursor();
+            userIdxCursor = ( ( Index<V, Entry, ID> ) db.getIndex( attributeType )
).forwardCursor();
             ndnIdxCursor = null;
         }
         else

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java?rev=963683&r1=963682&r2=963683&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java
(original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java
Tue Jul 13 11:42:01 2010
@@ -64,9 +64,9 @@ public class LessEqEvaluator<T, ID exten
         this.schemaManager = schemaManager;
         this.type = node.getAttributeType();
 
-        if ( db.hasIndexOn( node.getAttribute() ) )
+        if ( db.hasIndexOn( node.getAttributeType() ) )
         {
-            idx = ( Index<T, Entry, ID> ) db.getIndex( node.getAttribute() );
+            idx = ( Index<T, Entry, ID> ) db.getIndex( node.getAttributeType() );
         }
         else
         {

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=963683&r1=963682&r2=963683&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 11:42:01 2010
@@ -118,7 +118,7 @@ public class PresenceEvaluator<ID extend
     // wrapper or the raw normalized value
     public boolean evaluateEntry( Entry entry ) throws Exception
     {
-        if ( db.hasSystemIndexOn( node.getAttribute() ) )
+        if ( db.hasSystemIndexOn( node.getAttributeType() ) )
         {
             // we don't maintain a presence index for objectClass, entryUUID, and entryCSN
             // however as every entry has such an attribute this evaluator always evaluates
to true

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java?rev=963683&r1=963682&r2=963683&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java
(original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java
Tue Jul 13 11:42:01 2010
@@ -51,11 +51,11 @@ public class SubstringCursor<ID extends 
         throws Exception
     {
         evaluator = substringEvaluator;
-        hasIndex = db.hasIndexOn( evaluator.getExpression().getAttribute() );
+        hasIndex = db.hasIndexOn( evaluator.getExpression().getAttributeType() );
 
         if ( hasIndex )
         {
-            wrapped = ( ( Index<String, Entry, ID> ) db.getIndex( evaluator.getExpression().getAttribute()
) )
+            wrapped = ( ( Index<String, Entry, ID> ) db.getIndex( evaluator.getExpression().getAttributeType()
) )
                 .forwardCursor();
         }
         else

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java?rev=963683&r1=963682&r2=963683&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java
(original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java
Tue Jul 13 11:42:01 2010
@@ -111,9 +111,9 @@ public class SubstringEvaluator<ID exten
             regex = null;
         }
 
-        if ( db.hasIndexOn( node.getAttribute() ) )
+        if ( db.hasIndexOn( node.getAttributeType() ) )
         {
-            idx = ( Index<String, Entry, ID> ) db.getIndex( node.getAttribute() );
+            idx = ( Index<String, Entry, ID> ) db.getIndex( node.getAttributeType()
);
         }
         else
         {

Modified: directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/AbstractStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/AbstractStoreTest.java?rev=963683&r1=963682&r2=963683&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/AbstractStoreTest.java
(original)
+++ directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/AbstractStoreTest.java
Tue Jul 13 11:42:01 2010
@@ -72,6 +72,15 @@ public class AbstractStoreTest
     private static Store<Entry, Long> store;
     private static SchemaManager schemaManager = null;
     private static DN EXAMPLE_COM;
+    
+    /** The OU AttributType instance */
+    private static AttributeType OU_AT;
+
+    /** The CN AttributType instance */
+    private static AttributeType CN_AT;
+
+    /** The UID AttributType instance */
+    private static AttributeType UID_AT;
 
 
     @BeforeClass
@@ -102,6 +111,10 @@ public class AbstractStoreTest
 
         EXAMPLE_COM = new DN( "dc=example,dc=com" );
         EXAMPLE_COM.normalize( schemaManager.getNormalizerMapping() );
+        
+        OU_AT = schemaManager.getAttributeType( SchemaConstants.OU_AT );
+        CN_AT = schemaManager.getAttributeType( SchemaConstants.CN_AT );
+        UID_AT = schemaManager.getAttributeType( SchemaConstants.UID_AT );
     }
 
 
@@ -149,9 +162,9 @@ public class AbstractStoreTest
         assertEquals( 11, store.getEntryCsnIndex().count() );
         assertEquals( 11, store.getEntryUuidIndex().count() );
         assertEquals( 3, store.getUserIndices().size() );
-        assertEquals( 9, store.getUserIndex( SchemaConstants.OU_AT_OID ).count() );
-        assertEquals( 0, store.getUserIndex( SchemaConstants.UID_AT_OID ).count() );
-        assertEquals( 6, store.getUserIndex( SchemaConstants.CN_AT_OID ).count() );
+        assertEquals( 9, store.getUserIndex( OU_AT ).count() );
+        assertEquals( 0, store.getUserIndex( UID_AT ).count() );
+        assertEquals( 6, store.getUserIndex( CN_AT ).count() );
     }
 
 
@@ -199,8 +212,7 @@ public class AbstractStoreTest
         dn.normalize( schemaManager.getNormalizerMapping() );
 
         List<Modification> mods = new ArrayList<Modification>();
-        EntryAttribute attrib = new DefaultEntryAttribute( SchemaConstants.OU_AT, schemaManager
-            .lookupAttributeTypeRegistry( SchemaConstants.OU_AT ) );
+        EntryAttribute attrib = new DefaultEntryAttribute( SchemaConstants.OU_AT, OU_AT );
 
         String attribVal = "sales";
         attrib.add( attribVal );
@@ -212,7 +224,7 @@ public class AbstractStoreTest
         Entry lookedup = store.lookup( entryId );
 
         // before modification: expect "sales" tuple in ou index
-        Index<String, Entry, Long> ouIndex = ( Index<String, Entry, Long> ) store.getUserIndex(
SchemaConstants.OU_AT );
+        Index<String, Entry, Long> ouIndex = ( Index<String, Entry, Long> ) store.getUserIndex(
OU_AT );
         assertTrue( ouIndex.forward( "sales", entryId ) );
         assertTrue( lookedup.get( "ou" ).contains( "sales" ) );
 
@@ -235,8 +247,7 @@ public class AbstractStoreTest
         dn.normalize( schemaManager.getNormalizerMapping() );
 
         List<Modification> mods = new ArrayList<Modification>();
-        EntryAttribute attrib = new DefaultEntryAttribute( SchemaConstants.OU_AT, schemaManager
-            .lookupAttributeTypeRegistry( SchemaConstants.OU_AT ) );
+        EntryAttribute attrib = new DefaultEntryAttribute( SchemaConstants.OU_AT, OU_AT );
 
         Modification add = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE,
attrib );
         mods.add( add );
@@ -245,7 +256,7 @@ public class AbstractStoreTest
         Entry lookedup = store.lookup( entryId );
 
         // before modification: expect "sales" tuple in ou index
-        Index<String, Entry, Long> ouIndex = ( Index<String, Entry, Long> ) store.getUserIndex(
SchemaConstants.OU_AT );
+        Index<String, Entry, Long> ouIndex = ( Index<String, Entry, Long> ) store.getUserIndex(
OU_AT );
         assertTrue( store.getPresenceIndex().forward( SchemaConstants.OU_AT_OID, entryId
) );
         assertTrue( ouIndex.forward( "sales", entryId ) );
         assertTrue( lookedup.get( "ou" ).contains( "sales" ) );



Mime
View raw message