directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r917312 [3/5] - in /directory/apacheds/trunk: avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/ avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/ core-annotations/src/main/java/org/apache/...
Date Sun, 28 Feb 2010 22:55:35 GMT
Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateCursor.java?rev=917312&r1=917311&r2=917312&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateCursor.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateCursor.java Sun Feb 28 22:55:33 2010
@@ -43,24 +43,24 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $$Rev$$
  */
-public class ApproximateCursor<V> extends AbstractIndexCursor<V, ServerEntry>
+public class ApproximateCursor<V, ID> extends AbstractIndexCursor<V, ServerEntry, ID>
 {
     private static final String UNSUPPORTED_MSG = "ApproximateCursors only support positioning by element when a user index exists on the asserted attribute.";
 
     /** An approximate evaluator for candidates */
-    private final ApproximateEvaluator approximateEvaluator;
+    private final ApproximateEvaluator<V, ID> approximateEvaluator;
 
     /** Cursor over attribute entry matching filter: set when index present */
-    private final IndexCursor<V, ServerEntry> userIdxCursor;
+    private final IndexCursor<V, ServerEntry, ID> userIdxCursor;
 
     /** NDN Cursor on all entries in  (set when no index on user attribute) */
-    private final IndexCursor<String, ServerEntry> ndnIdxCursor;
+    private final IndexCursor<String, ServerEntry, ID> ndnIdxCursor;
 
     /** used only when ndnIdxCursor is used (no index on attribute) */
     private boolean available = false;
 
 
-    public ApproximateCursor( Store<ServerEntry> db, ApproximateEvaluator approximateEvaluator ) throws Exception
+    public ApproximateCursor( Store<ServerEntry, ID> db, ApproximateEvaluator<V, ID> approximateEvaluator ) throws Exception
     {
         this.approximateEvaluator = approximateEvaluator;
 
@@ -69,7 +69,7 @@
         if ( db.hasUserIndexOn( attribute ) )
         {
             //noinspection unchecked
-            Index<V, ServerEntry> index = ( Index<V, ServerEntry> ) db.getUserIndex( attribute );
+            Index<V, ServerEntry, ID> index = ( Index<V, ServerEntry, ID> ) db.getUserIndex( attribute );
             userIdxCursor = index.forwardCursor( value.get() );
             ndnIdxCursor = null;
         }
@@ -92,7 +92,7 @@
     }
 
 
-    public void beforeValue( Long id, V value ) throws Exception
+    public void beforeValue( ID id, V value ) throws Exception
     {
         checkNotClosed( "beforeValue()" );
         if ( userIdxCursor != null )
@@ -106,7 +106,7 @@
     }
 
 
-    public void afterValue( Long id, V value ) throws Exception
+    public void afterValue( ID id, V value ) throws Exception
     {
         checkNotClosed( "afterValue()" );
         if ( userIdxCursor != null )
@@ -120,7 +120,7 @@
     }
 
 
-    public void before( IndexEntry<V, ServerEntry> element ) throws Exception
+    public void before( IndexEntry<V, ServerEntry, ID> element ) throws Exception
     {
         checkNotClosed( "before()" );
         if ( userIdxCursor != null )
@@ -134,7 +134,7 @@
     }
 
 
-    public void after( IndexEntry<V, ServerEntry> element ) throws Exception
+    public void after( IndexEntry<V, ServerEntry, ID> element ) throws Exception
     {
         checkNotClosed( "after()" );
         if ( userIdxCursor != null )
@@ -202,7 +202,7 @@
         while ( ndnIdxCursor.previous() )
         {
             checkNotClosed( "previous()" );
-            IndexEntry<?, ServerEntry> candidate = ndnIdxCursor.get();
+            IndexEntry<?, ServerEntry, ID> candidate = ndnIdxCursor.get();
             if ( approximateEvaluator.evaluate( candidate ) )
             {
                 return available = true;
@@ -223,7 +223,7 @@
         while ( ndnIdxCursor.next() )
         {
             checkNotClosed( "next()" );
-            IndexEntry<?, ServerEntry> candidate = ndnIdxCursor.get();
+            IndexEntry<?, ServerEntry, ID> candidate = ndnIdxCursor.get();
             if ( approximateEvaluator.evaluate( candidate ) )
             {
                 return available = true;
@@ -235,7 +235,7 @@
 
 
     @SuppressWarnings("unchecked")
-    public IndexEntry<V, ServerEntry> get() throws Exception
+    public IndexEntry<V, ServerEntry, ID> get() throws Exception
     {
         checkNotClosed( "get()" );
         if ( userIdxCursor != null )
@@ -245,7 +245,7 @@
 
         if ( available )
         {
-            return ( IndexEntry<V, ServerEntry> ) ndnIdxCursor.get();
+            return ( IndexEntry<V, ServerEntry, ID> ) ndnIdxCursor.get();
         }
 
         throw new InvalidCursorPositionException( I18n.err( I18n.ERR_708 ) );

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java?rev=917312&r1=917311&r2=917312&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java Sun Feb 28 22:55:33 2010
@@ -45,18 +45,18 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class ApproximateEvaluator implements Evaluator<ApproximateNode, ServerEntry>
+public class ApproximateEvaluator<T, ID> implements Evaluator<ApproximateNode<T>, ServerEntry, ID>
 {
-    private final ApproximateNode<Object> node;
-    private final Store<ServerEntry> db;
+    private final ApproximateNode<T> node;
+    private final Store<ServerEntry, ID> db;
     private final SchemaManager schemaManager;
     private final AttributeType type;
     private final Normalizer normalizer;
     private final LdapComparator<? super Object> ldapComparator;
-    private final Index<Object, ServerEntry> idx;
+    private final Index<T, ServerEntry, ID> idx;
 
 
-    public ApproximateEvaluator( ApproximateNode node, Store<ServerEntry> db, SchemaManager schemaManager )
+    public ApproximateEvaluator( ApproximateNode<T> node, Store<ServerEntry, ID> db, SchemaManager schemaManager )
         throws Exception
     {
         this.db = db;
@@ -66,7 +66,7 @@
         if ( db.hasUserIndexOn( node.getAttribute() ) )
         {
             //noinspection unchecked
-            idx = ( Index<Object, ServerEntry> ) db.getUserIndex( node.getAttribute() );
+            idx = ( Index<T, ServerEntry, ID> ) db.getUserIndex( node.getAttribute() );
             type = null;
             normalizer = null;
             ldapComparator = null;
@@ -89,13 +89,13 @@
     }
 
 
-    public ApproximateNode getExpression()
+    public ApproximateNode<T> getExpression()
     {
         return node;
     }
 
 
-    public boolean evaluate( ServerEntry entry ) throws Exception
+    public boolean evaluateEntry( ServerEntry entry ) throws Exception
     {
         // get the attribute
         ServerAttribute attr = ( ServerAttribute ) entry.get( type );
@@ -135,18 +135,18 @@
     }
 
 
-    public boolean evaluate( Long id ) throws Exception
+    public boolean evaluateId( ID id ) throws Exception
     {
         if ( idx != null )
         {
             return idx.reverse( id );
         }
 
-        return evaluate( db.lookup( id ) );
+        return evaluateEntry( db.lookup( id ) );
     }
 
 
-    public boolean evaluate( IndexEntry<?, ServerEntry> indexEntry ) throws Exception
+    public boolean evaluate( IndexEntry<?, ServerEntry, ID> indexEntry ) throws Exception
     {
         if ( idx != null )
         {
@@ -162,7 +162,7 @@
             indexEntry.setObject( entry );
         }
 
-        return evaluate( entry );
+        return evaluateEntry( entry );
     }
 
 

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/CursorBuilder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/CursorBuilder.java?rev=917312&r1=917311&r2=917312&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/CursorBuilder.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/CursorBuilder.java Sun Feb 28 22:55:33 2010
@@ -22,6 +22,7 @@
 
 import java.util.List;
 import java.util.ArrayList;
+import java.util.Set;
 
 import org.apache.directory.server.xdbm.Store;
 import org.apache.directory.server.xdbm.IndexCursor;
@@ -30,11 +31,16 @@
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.ldap.NotImplementedException;
 import org.apache.directory.shared.ldap.filter.AndNode;
+import org.apache.directory.shared.ldap.filter.ApproximateNode;
+import org.apache.directory.shared.ldap.filter.EqualityNode;
 import org.apache.directory.shared.ldap.filter.ExprNode;
+import org.apache.directory.shared.ldap.filter.GreaterEqNode;
+import org.apache.directory.shared.ldap.filter.LessEqNode;
 import org.apache.directory.shared.ldap.filter.NotNode;
 import org.apache.directory.shared.ldap.filter.OrNode;
 import org.apache.directory.shared.ldap.filter.ScopeNode;
 import org.apache.directory.shared.ldap.filter.SearchScope;
+import org.apache.directory.shared.ldap.filter.SimpleNode;
 
 
 /**
@@ -43,13 +49,13 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class CursorBuilder
+public class CursorBuilder<ID>
 {
     /** The database used by this builder */
-    private Store<ServerEntry> db = null;
+    private Store<ServerEntry, ID> db = null;
 
     /** Evaluator dependency on a EvaluatorBuilder */
-    private EvaluatorBuilder evaluatorBuilder;
+    private EvaluatorBuilder<ID> evaluatorBuilder;
 
 
     /**
@@ -58,14 +64,14 @@
      * @param db database used by this enumerator
      * @param evaluatorBuilder the evaluator builder
      */
-    public CursorBuilder( Store<ServerEntry> db, EvaluatorBuilder evaluatorBuilder )
+    public CursorBuilder( Store<ServerEntry, ID> db, EvaluatorBuilder<ID> evaluatorBuilder )
     {
         this.db = db;
         this.evaluatorBuilder = evaluatorBuilder;
     }
 
 
-    public IndexCursor<?, ServerEntry> build( ExprNode node ) throws Exception
+    public IndexCursor<?, ServerEntry, ID> build( ExprNode node ) throws Exception
     {
         switch ( node.getAssertionType() )
         {
@@ -84,7 +90,7 @@
                 return new LessEqCursor( db, ( LessEqEvaluator ) evaluatorBuilder.build( node ) );
 
             case PRESENCE:
-                return new PresenceCursor( db, ( PresenceEvaluator ) evaluatorBuilder.build( node ) );
+                return new PresenceCursor<ID>( db, ( PresenceEvaluator<ID> ) evaluatorBuilder.build( node ) );
 
             case SCOPE:
                 if ( ( ( ScopeNode ) node ).getScope() == SearchScope.ONELEVEL )
@@ -105,7 +111,7 @@
                 return buildAndCursor( ( AndNode ) node );
 
             case NOT:
-                return new NotCursor( db, evaluatorBuilder.build( ( ( NotNode ) node ).getFirstChild() ) );
+                return new NotCursor<ID, ID>( db, evaluatorBuilder.build( ( ( NotNode ) node ).getFirstChild() ) );
 
             case OR:
                 return buildOrCursor( ( OrNode ) node );
@@ -129,11 +135,12 @@
      * @return Cursor over candidates satisfying disjunction expression
      * @throws Exception on db access failures
      */
-    private IndexCursor<?, ServerEntry> buildOrCursor( OrNode node ) throws Exception
+    private IndexCursor<?, ServerEntry, ID> buildOrCursor( OrNode node ) throws Exception
     {
         List<ExprNode> children = node.getChildren();
-        List<IndexCursor<?, ServerEntry>> childCursors = new ArrayList<IndexCursor<?, ServerEntry>>( children.size() );
-        List<Evaluator<? extends ExprNode, ServerEntry>> childEvaluators = new ArrayList<Evaluator<? extends ExprNode, ServerEntry>>(
+        List<IndexCursor<? extends Object, ServerEntry, ID>> childCursors = new ArrayList<IndexCursor<?, ServerEntry, ID>>(
+            children.size() );
+        List<Evaluator<? extends ExprNode, ServerEntry, ID>> childEvaluators = new ArrayList<Evaluator<? extends ExprNode, ServerEntry, ID>>(
             children.size() );
 
         // Recursively create Cursors and Evaluators for each child expression node
@@ -143,7 +150,6 @@
             childEvaluators.add( evaluatorBuilder.build( child ) );
         }
 
-        //noinspection unchecked
         return new OrCursor( childCursors, childEvaluators );
     }
 
@@ -155,7 +161,7 @@
      * @return Cursor over the conjunction expression
      * @throws Exception on db access failures
      */
-    private IndexCursor<?, ServerEntry> buildAndCursor( AndNode node ) throws Exception
+    private IndexCursor<?, ServerEntry, ID> buildAndCursor( AndNode node ) throws Exception
     {
         int minIndex = 0;
         long minValue = Long.MAX_VALUE;
@@ -188,7 +194,7 @@
 
         // Once found we build the child Evaluators minus the one for the minChild
         ExprNode minChild = children.get( minIndex );
-        List<Evaluator<? extends ExprNode, ServerEntry>> childEvaluators = new ArrayList<Evaluator<? extends ExprNode, ServerEntry>>(
+        List<Evaluator<? extends ExprNode, ServerEntry, ID>> childEvaluators = new ArrayList<Evaluator<? extends ExprNode, ServerEntry, ID>>(
             children.size() - 1 );
         for ( ExprNode child : children )
         {
@@ -201,7 +207,7 @@
         }
 
         // Do recursive call to build min child Cursor then create AndCursor
-        IndexCursor<?, ServerEntry> childCursor = build( minChild );
+        IndexCursor<?, ServerEntry, ID> childCursor = build( minChild );
         return new AndCursor( childCursor, childEvaluators );
     }
 }

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java?rev=917312&r1=917311&r2=917312&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java Sun Feb 28 22:55:33 2010
@@ -50,11 +50,11 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class DefaultOptimizer<E> implements Optimizer
+public class DefaultOptimizer<E, ID> implements Optimizer
 {
     /** the database this optimizer operates on */
-    private final Store<E> db;
-    private Long contextEntryId;
+    private final Store<E, ID> db;
+    private ID contextEntryId;
 
 
     /**
@@ -62,13 +62,13 @@
      *
      * @param db the database this optimizer works for.
      */
-    public DefaultOptimizer( Store<E> db ) throws Exception
+    public DefaultOptimizer( Store<E, ID> db ) throws Exception
     {
         this.db = db;
     }
 
 
-    private Long getContextEntryId()
+    private ID getContextEntryId() throws Exception
     {
         if ( contextEntryId == null )
         {
@@ -84,7 +84,7 @@
 
         if ( contextEntryId == null )
         {
-            return 1L;
+            return db.getDefaultId();
         }
 
         return contextEntryId;
@@ -275,7 +275,7 @@
     {
         if ( db.hasUserIndexOn( node.getAttribute() ) )
         {
-            Index<V, E> idx = ( Index<V, E> ) db.getUserIndex( node.getAttribute() );
+            Index<V, E, ID> idx = ( Index<V, E, ID> ) db.getUserIndex( node.getAttribute() );
             return idx.count( node.getValue().get() );
         }
 
@@ -298,7 +298,7 @@
     {
         if ( db.hasUserIndexOn( node.getAttribute() ) )
         {
-            Index<V, E> idx = ( Index<V, E> ) db.getUserIndex( node.getAttribute() );
+            Index<V, E, ID> idx = ( Index<V, E, ID> ) db.getUserIndex( node.getAttribute() );
             if ( isGreaterThan )
             {
                 return idx.greaterThanCount( node.getValue().get() );
@@ -348,7 +348,7 @@
     {
         if ( db.hasUserIndexOn( node.getAttribute() ) )
         {
-            Index<String, E> idx = db.getPresenceIndex();
+            Index<String, E, ID> idx = db.getPresenceIndex();
             return idx.count( node.getAttribute() );
         }
 
@@ -365,7 +365,7 @@
      */
     private long getScopeScan( ScopeNode node ) throws Exception
     {
-        Long id = db.getEntryId( node.getBaseDn() );
+        ID id = db.getEntryId( node.getBaseDn() );
         switch ( node.getScope() )
         {
             case OBJECT:

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java?rev=917312&r1=917311&r2=917312&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java Sun Feb 28 22:55:33 2010
@@ -48,16 +48,16 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class DefaultSearchEngine implements SearchEngine<ServerEntry>
+public class DefaultSearchEngine<ID> implements SearchEngine<ServerEntry, ID>
 {
     /** the Optimizer used by this DefaultSearchEngine */
     private final Optimizer optimizer;
     /** the Database this DefaultSearchEngine operates on */
-    private final Store<ServerEntry> db;
+    private final Store<ServerEntry, ID> db;
     /** creates Cursors over entries satisfying filter expressions */
-    private final CursorBuilder cursorBuilder;
+    private final CursorBuilder<ID> cursorBuilder;
     /** creates evaluators which check to see if candidates satisfy a filter expression */
-    private final EvaluatorBuilder evaluatorBuilder;
+    private final EvaluatorBuilder<ID> evaluatorBuilder;
 
 
     // ------------------------------------------------------------------------
@@ -72,8 +72,8 @@
      * @param evaluatorBuilder an expression evaluator builder
      * @param optimizer an optimizer to use during search
      */
-    public DefaultSearchEngine( Store<ServerEntry> db, CursorBuilder cursorBuilder, EvaluatorBuilder evaluatorBuilder,
-        Optimizer optimizer )
+    public DefaultSearchEngine( Store<ServerEntry, ID> db, CursorBuilder<ID> cursorBuilder,
+        EvaluatorBuilder<ID> evaluatorBuilder, Optimizer optimizer )
     {
         this.db = db;
         this.optimizer = optimizer;
@@ -96,17 +96,17 @@
     /**
      * @see SearchEngine#cursor(LdapDN, AliasDerefMode, ExprNode, SearchControls)
      */
-    public IndexCursor<Long, ServerEntry> cursor( LdapDN base, AliasDerefMode aliasDerefMode, ExprNode filter,
+    public IndexCursor<ID, ServerEntry, ID> cursor( LdapDN base, AliasDerefMode aliasDerefMode, ExprNode filter,
         SearchControls searchCtls ) throws Exception
     {
         LdapDN effectiveBase;
-        Long baseId = db.getEntryId( base.toString() );
+        ID baseId = db.getEntryId( base.toString() );
 
         // Check that we have an entry, otherwise we can immediately get out
         if ( baseId == null )
         {
             // The entry is not found : ciao !
-            return new EmptyIndexCursor<Long, ServerEntry>();
+            return new EmptyIndexCursor<ID, ServerEntry, ID>();
         }
 
         String aliasedBase = db.getAliasIndex().reverseLookup( baseId );
@@ -141,24 +141,24 @@
 
         if ( searchCtls.getSearchScope() == SearchControls.OBJECT_SCOPE )
         {
-            Long effectiveBaseId = baseId;
+            ID effectiveBaseId = baseId;
             if ( effectiveBase != base )
             {
                 effectiveBaseId = db.getEntryId( effectiveBase.toNormName() );
             }
 
-            IndexEntry<Long, ServerEntry> indexEntry = new ForwardIndexEntry<Long, ServerEntry>();
+            IndexEntry<ID, ServerEntry, ID> indexEntry = new ForwardIndexEntry<ID, ServerEntry, ID>();
             indexEntry.setId( effectiveBaseId );
             optimizer.annotate( filter );
-            Evaluator<? extends ExprNode, ServerEntry> evaluator = evaluatorBuilder.build( filter );
+            Evaluator<? extends ExprNode, ServerEntry, ID> evaluator = evaluatorBuilder.build( filter );
 
             if ( evaluator.evaluate( indexEntry ) )
             {
-                return new SingletonIndexCursor<Long, ServerEntry>( indexEntry );
+                return new SingletonIndexCursor<ID, ServerEntry, ID>( indexEntry );
             }
             else
             {
-                return new EmptyIndexCursor<Long, ServerEntry>();
+                return new EmptyIndexCursor<ID, ServerEntry, ID>();
             }
         }
 
@@ -171,14 +171,14 @@
 
         // Annotate the node with the optimizer and return search enumeration.
         optimizer.annotate( root );
-        return ( IndexCursor<Long, ServerEntry> ) cursorBuilder.build( root );
+        return ( IndexCursor<ID, ServerEntry, ID> ) cursorBuilder.build( root );
     }
 
 
     /**
      * @see SearchEngine#evaluator(ExprNode)
      */
-    public Evaluator<? extends ExprNode, ServerEntry> evaluator( ExprNode filter ) throws Exception
+    public Evaluator<? extends ExprNode, ServerEntry, ID> evaluator( ExprNode filter ) throws Exception
     {
         return evaluatorBuilder.build( filter );
     }

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityCursor.java?rev=917312&r1=917311&r2=917312&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityCursor.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityCursor.java Sun Feb 28 22:55:33 2010
@@ -41,7 +41,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $$Rev$$
  */
-public class EqualityCursor<V> extends AbstractIndexCursor<V, ServerEntry>
+public class EqualityCursor<V, ID> extends AbstractIndexCursor<V, ServerEntry, ID>
 {
     private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_714 );
 
@@ -50,17 +50,17 @@
     private final EqualityEvaluator equalityEvaluator;
 
     /** Cursor over attribute entry matching filter: set when index present */
-    private final IndexCursor<V, ServerEntry> userIdxCursor;
+    private final IndexCursor<V, ServerEntry, ID> userIdxCursor;
 
     /** NDN Cursor on all entries in  (set when no index on user attribute) */
-    private final IndexCursor<String, ServerEntry> ndnIdxCursor;
+    private final IndexCursor<String, ServerEntry, ID> ndnIdxCursor;
 
     /** used only when ndnIdxCursor is used (no index on attribute) */
     private boolean available = false;
 
 
     @SuppressWarnings("unchecked")
-    public EqualityCursor( Store<ServerEntry> db, EqualityEvaluator equalityEvaluator ) throws Exception
+    public EqualityCursor( Store<ServerEntry, ID> db, EqualityEvaluator<V, ID> equalityEvaluator ) throws Exception
     {
         this.equalityEvaluator = equalityEvaluator;
 
@@ -68,7 +68,7 @@
         Value<V> value = equalityEvaluator.getExpression().getValue();
         if ( db.hasUserIndexOn( attribute ) )
         {
-            Index<V, ServerEntry> userIndex = ( Index<V, ServerEntry> ) db.getUserIndex( attribute );
+            Index<V, ServerEntry, ID> userIndex = ( Index<V, ServerEntry, ID> ) db.getUserIndex( attribute );
             userIdxCursor = userIndex.forwardCursor( value.get() );
             ndnIdxCursor = null;
         }
@@ -91,7 +91,7 @@
     }
 
 
-    public void beforeValue( Long id, V value ) throws Exception
+    public void beforeValue( ID id, V value ) throws Exception
     {
         checkNotClosed( "beforeValue()" );
         if ( userIdxCursor != null )
@@ -105,7 +105,7 @@
     }
 
 
-    public void before( IndexEntry<V, ServerEntry> element ) throws Exception
+    public void before( IndexEntry<V, ServerEntry, ID> element ) throws Exception
     {
         checkNotClosed( "before()" );
         if ( userIdxCursor != null )
@@ -119,7 +119,7 @@
     }
 
 
-    public void afterValue( Long id, V key ) throws Exception
+    public void afterValue( ID id, V key ) throws Exception
     {
         checkNotClosed( "afterValue()" );
         if ( userIdxCursor != null )
@@ -133,7 +133,7 @@
     }
 
 
-    public void after( IndexEntry<V, ServerEntry> element ) throws Exception
+    public void after( IndexEntry<V, ServerEntry, ID> element ) throws Exception
     {
         checkNotClosed( "after()" );
         if ( userIdxCursor != null )
@@ -202,7 +202,7 @@
         while ( ndnIdxCursor.previous() )
         {
             checkNotClosed( "previous()" );
-            IndexEntry<?, ServerEntry> candidate = ndnIdxCursor.get();
+            IndexEntry<?, ServerEntry, ID> candidate = ndnIdxCursor.get();
             if ( equalityEvaluator.evaluate( candidate ) )
             {
                 return available = true;
@@ -224,7 +224,7 @@
         while ( ndnIdxCursor.next() )
         {
             checkNotClosed( "next()" );
-            IndexEntry<?, ServerEntry> candidate = ndnIdxCursor.get();
+            IndexEntry<?, ServerEntry, ID> candidate = ndnIdxCursor.get();
             if ( equalityEvaluator.evaluate( candidate ) )
             {
                 return available = true;
@@ -236,7 +236,7 @@
 
 
     @SuppressWarnings("unchecked")
-    public IndexEntry<V, ServerEntry> get() throws Exception
+    public IndexEntry<V, ServerEntry, ID> get() throws Exception
     {
         checkNotClosed( "get()" );
         if ( userIdxCursor != null )
@@ -246,7 +246,7 @@
 
         if ( available )
         {
-            return ( IndexEntry<V, ServerEntry> ) ndnIdxCursor.get();
+            return ( IndexEntry<V, ServerEntry, ID> ) ndnIdxCursor.get();
         }
 
         throw new InvalidCursorPositionException( I18n.err( I18n.ERR_708 ) );

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java?rev=917312&r1=917311&r2=917312&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java Sun Feb 28 22:55:33 2010
@@ -49,10 +49,10 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class EqualityEvaluator<T> implements Evaluator<EqualityNode<T>, ServerEntry>
+public class EqualityEvaluator<T, ID> implements Evaluator<EqualityNode<T>, ServerEntry, ID>
 {
     private final EqualityNode<T> node;
-    private final Store<ServerEntry> db;
+    private final Store<ServerEntry, ID> db;
     private final SchemaManager schemaManager;
     private final AttributeType type;
     private final Normalizer normalizer;
@@ -66,10 +66,10 @@
     /** The default String comparator if no comparator has been defined */
     private static final Comparator<String> STRING_COMPARATOR = new StringComparator( null );
 
-    private final Index<T, ServerEntry> idx;
+    private final Index<T, ServerEntry, ID> idx;
 
 
-    public EqualityEvaluator( EqualityNode<T> node, Store<ServerEntry> db, SchemaManager schemaManager )
+    public EqualityEvaluator( EqualityNode<T> node, Store<ServerEntry, ID> db, SchemaManager schemaManager )
         throws Exception
     {
         this.db = db;
@@ -79,7 +79,7 @@
         if ( db.hasUserIndexOn( node.getAttribute() ) )
         {
             //noinspection unchecked
-            idx = ( Index<T, ServerEntry> ) db.getUserIndex( node.getAttribute() );
+            idx = ( Index<T, ServerEntry, ID> ) db.getUserIndex( node.getAttribute() );
             type = null;
             normalizer = null;
             comparator = null;
@@ -111,7 +111,7 @@
     }
 
 
-    public boolean evaluate( IndexEntry<?, ServerEntry> indexEntry ) throws Exception
+    public boolean evaluate( IndexEntry<?, ServerEntry, ID> indexEntry ) throws Exception
     {
         if ( idx != null )
         {
@@ -127,11 +127,11 @@
             indexEntry.setObject( entry );
         }
 
-        return evaluate( entry );
+        return evaluateEntry( entry );
     }
 
 
-    public boolean evaluate( ServerEntry entry ) throws Exception
+    public boolean evaluateEntry( ServerEntry entry ) throws Exception
     {
         // get the attribute
         ServerAttribute attr = ( ServerAttribute ) entry.get( type );
@@ -171,14 +171,14 @@
     }
 
 
-    public boolean evaluate( Long id ) throws Exception
+    public boolean evaluateId( ID id ) throws Exception
     {
         if ( idx != null )
         {
             return idx.reverse( id );
         }
 
-        return evaluate( db.lookup( id ) );
+        return evaluateEntry( db.lookup( id ) );
     }
 
 

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EvaluatorBuilder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EvaluatorBuilder.java?rev=917312&r1=917311&r2=917312&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EvaluatorBuilder.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EvaluatorBuilder.java Sun Feb 28 22:55:33 2010
@@ -49,9 +49,9 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class EvaluatorBuilder
+public class EvaluatorBuilder<ID>
 {
-    private final Store<ServerEntry> db;
+    private final Store<ServerEntry, ID> db;
     private final SchemaManager schemaManager;
 
 
@@ -63,14 +63,14 @@
      * @param registries the schema registries
      * @throws Exception failure to access db or lookup schema in registries
      */
-    public EvaluatorBuilder( Store<ServerEntry> db, SchemaManager schemaManager ) throws Exception
+    public EvaluatorBuilder( Store<ServerEntry, ID> db, SchemaManager schemaManager ) throws Exception
     {
         this.db = db;
         this.schemaManager = schemaManager;
     }
 
 
-    public Evaluator<? extends ExprNode, ServerEntry> build( ExprNode node ) throws Exception
+    public Evaluator<? extends ExprNode, ServerEntry, ID> build( ExprNode node ) throws Exception
     {
         switch ( node.getAssertionType() )
         {
@@ -89,20 +89,20 @@
                 return new LessEqEvaluator( ( LessEqNode ) node, db, schemaManager );
 
             case PRESENCE:
-                return new PresenceEvaluator( ( PresenceNode ) node, db, schemaManager );
+                return new PresenceEvaluator<ID>( ( PresenceNode ) node, db, schemaManager );
 
             case SCOPE:
                 if ( ( ( ScopeNode ) node ).getScope() == SearchScope.ONELEVEL )
                 {
-                    return new OneLevelScopeEvaluator<ServerEntry>( db, ( ScopeNode ) node );
+                    return new OneLevelScopeEvaluator<ServerEntry, ID>( db, ( ScopeNode ) node );
                 }
                 else
                 {
-                    return new SubtreeScopeEvaluator<ServerEntry>( db, ( ScopeNode ) node );
+                    return new SubtreeScopeEvaluator<ServerEntry, ID>( db, ( ScopeNode ) node );
                 }
 
             case SUBSTRING:
-                return new SubstringEvaluator( ( SubstringNode ) node, db, schemaManager );
+                return new SubstringEvaluator<ID>( ( SubstringNode ) node, db, schemaManager );
 
                 /* ---------- LOGICAL OPERATORS ---------- */
 
@@ -110,7 +110,7 @@
                 return buildAndEvaluator( ( AndNode ) node );
 
             case NOT:
-                return new NotEvaluator( ( NotNode ) node, build( ( ( NotNode ) node ).getFirstChild() ) );
+                return new NotEvaluator<ID>( ( NotNode ) node, build( ( ( NotNode ) node ).getFirstChild() ) );
 
             case OR:
                 return buildOrEvaluator( ( OrNode ) node );
@@ -127,28 +127,28 @@
     }
 
 
-    AndEvaluator buildAndEvaluator( AndNode node ) throws Exception
+    AndEvaluator<ID> buildAndEvaluator( AndNode node ) throws Exception
     {
         List<ExprNode> children = node.getChildren();
-        List<Evaluator<? extends ExprNode, ServerEntry>> evaluators = new ArrayList<Evaluator<? extends ExprNode, ServerEntry>>(
+        List<Evaluator<? extends ExprNode, ServerEntry, ID>> evaluators = new ArrayList<Evaluator<? extends ExprNode, ServerEntry, ID>>(
             children.size() );
         for ( ExprNode child : children )
         {
             evaluators.add( build( child ) );
         }
-        return new AndEvaluator( node, evaluators );
+        return new AndEvaluator<ID>( node, evaluators );
     }
 
 
-    OrEvaluator buildOrEvaluator( OrNode node ) throws Exception
+    OrEvaluator<ID> buildOrEvaluator( OrNode node ) throws Exception
     {
         List<ExprNode> children = node.getChildren();
-        List<Evaluator<? extends ExprNode, ServerEntry>> evaluators = new ArrayList<Evaluator<? extends ExprNode, ServerEntry>>(
+        List<Evaluator<? extends ExprNode, ServerEntry, ID>> evaluators = new ArrayList<Evaluator<? extends ExprNode, ServerEntry, ID>>(
             children.size() );
         for ( ExprNode child : children )
         {
             evaluators.add( build( child ) );
         }
-        return new OrEvaluator( node, evaluators );
+        return new OrEvaluator<ID>( node, evaluators );
     }
 }

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqCursor.java?rev=917312&r1=917311&r2=917312&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqCursor.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqCursor.java Sun Feb 28 22:55:33 2010
@@ -41,39 +41,39 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class GreaterEqCursor<V> extends AbstractIndexCursor<V, ServerEntry>
+public class GreaterEqCursor<V, ID> extends AbstractIndexCursor<V, ServerEntry, ID>
 {
     private static final String UNSUPPORTED_MSG = "GreaterEqCursors only support positioning by element when a user index exists on the asserted attribute.";
 
     /** An greater eq evaluator for candidates */
-    private final GreaterEqEvaluator greaterEqEvaluator;
+    private final GreaterEqEvaluator<V, ID> greaterEqEvaluator;
 
     /** Cursor over attribute entry matching filter: set when index present */
-    private final IndexCursor<V, ServerEntry> userIdxCursor;
+    private final IndexCursor<V, ServerEntry, ID> userIdxCursor;
 
     /** NDN Cursor on all entries in  (set when no index on user attribute) */
-    private final IndexCursor<String, ServerEntry> ndnIdxCursor;
+    private final IndexCursor<String, ServerEntry, ID> ndnIdxCursor;
 
     /**
      * Used to store indexEntry from ndnCandidate so it can be saved after
      * call to evaluate() which changes the value so it's not referring to
      * the NDN but to the value of the attribute instead.
      */
-    IndexEntry<String, ServerEntry> ndnCandidate;
+    IndexEntry<String, ServerEntry, ID> ndnCandidate;
 
     /** used in both modes */
     private boolean available = false;
 
 
     @SuppressWarnings("unchecked")
-    public GreaterEqCursor( Store<ServerEntry> db, GreaterEqEvaluator greaterEqEvaluator ) throws Exception
+    public GreaterEqCursor( Store<ServerEntry, ID> db, GreaterEqEvaluator greaterEqEvaluator ) throws Exception
     {
         this.greaterEqEvaluator = greaterEqEvaluator;
 
         String attribute = greaterEqEvaluator.getExpression().getAttribute();
         if ( db.hasUserIndexOn( attribute ) )
         {
-            userIdxCursor = ( ( Index<V, ServerEntry> ) db.getUserIndex( attribute ) ).forwardCursor();
+            userIdxCursor = ( ( Index<V, ServerEntry, ID> ) db.getUserIndex( attribute ) ).forwardCursor();
             ndnIdxCursor = null;
         }
         else
@@ -91,7 +91,7 @@
 
 
     @SuppressWarnings("unchecked")
-    public void beforeValue( Long id, V value ) throws Exception
+    public void beforeValue( ID id, V value ) throws Exception
     {
         checkNotClosed( "beforeValue()" );
         if ( userIdxCursor != null )
@@ -122,7 +122,7 @@
 
 
     @SuppressWarnings("unchecked")
-    public void afterValue( Long id, V value ) throws Exception
+    public void afterValue( ID id, V value ) throws Exception
     {
         checkNotClosed( "afterValue()" );
         if ( userIdxCursor != null )
@@ -162,7 +162,7 @@
 
 
     @SuppressWarnings("unchecked")
-    public void before( IndexEntry<V, ServerEntry> element ) throws Exception
+    public void before( IndexEntry<V, ServerEntry, ID> element ) throws Exception
     {
         checkNotClosed( "before()" );
         if ( userIdxCursor != null )
@@ -193,7 +193,7 @@
 
 
     @SuppressWarnings("unchecked")
-    public void after( IndexEntry<V, ServerEntry> element ) throws Exception
+    public void after( IndexEntry<V, ServerEntry, ID> element ) throws Exception
     {
         checkNotClosed( "after()" );
         if ( userIdxCursor != null )
@@ -238,7 +238,7 @@
         checkNotClosed( "beforeFirst()" );
         if ( userIdxCursor != null )
         {
-            IndexEntry<V, ServerEntry> advanceTo = new ForwardIndexEntry<V, ServerEntry>();
+            IndexEntry<V, ServerEntry, ID> advanceTo = new ForwardIndexEntry<V, ServerEntry, ID>();
             advanceTo.setValue( ( V ) greaterEqEvaluator.getExpression().getValue().get() );
             userIdxCursor.before( advanceTo );
         }
@@ -296,7 +296,7 @@
             while ( userIdxCursor.previous() )
             {
                 checkNotClosed( "previous()" );
-                IndexEntry<?, ServerEntry> candidate = userIdxCursor.get();
+                IndexEntry<?, ServerEntry, ID> candidate = userIdxCursor.get();
                 if ( greaterEqEvaluator.getComparator().compare( candidate.getValue(),
                     greaterEqEvaluator.getExpression().getValue().get() ) >= 0 )
                 {
@@ -348,7 +348,7 @@
 
 
     @SuppressWarnings("unchecked")
-    public IndexEntry<V, ServerEntry> get() throws Exception
+    public IndexEntry<V, ServerEntry, ID> get() throws Exception
     {
         checkNotClosed( "get()" );
         if ( userIdxCursor != null )
@@ -363,7 +363,7 @@
 
         if ( available )
         {
-            return ( IndexEntry<V, ServerEntry> ) ndnCandidate;
+            return ( IndexEntry<V, ServerEntry, ID> ) ndnCandidate;
         }
 
         throw new InvalidCursorPositionException( I18n.err( I18n.ERR_708 ) );

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java?rev=917312&r1=917311&r2=917312&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java Sun Feb 28 22:55:33 2010
@@ -45,18 +45,18 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class GreaterEqEvaluator implements Evaluator<GreaterEqNode, ServerEntry>
+public class GreaterEqEvaluator<T, ID> implements Evaluator<GreaterEqNode<T>, ServerEntry, ID>
 {
-    private final GreaterEqNode node;
-    private final Store<ServerEntry> db;
+    private final GreaterEqNode<T> node;
+    private final Store<ServerEntry, ID> db;
     private final SchemaManager schemaManager;
     private final AttributeType type;
     private final Normalizer normalizer;
     private final Comparator comparator;
-    private final Index<Object, ServerEntry> idx;
+    private final Index<Object, ServerEntry, ID> idx;
 
 
-    public GreaterEqEvaluator( GreaterEqNode node, Store<ServerEntry> db, SchemaManager schemaManager )
+    public GreaterEqEvaluator( GreaterEqNode<T> node, Store<ServerEntry, ID> db, SchemaManager schemaManager )
         throws Exception
     {
         this.db = db;
@@ -67,7 +67,7 @@
         if ( db.hasUserIndexOn( node.getAttribute() ) )
         {
             //noinspection unchecked
-            idx = ( Index<Object, ServerEntry> ) db.getUserIndex( node.getAttribute() );
+            idx = ( Index<Object, ServerEntry, ID> ) db.getUserIndex( node.getAttribute() );
         }
         else
         {
@@ -121,7 +121,7 @@
     }
 
 
-    public boolean evaluate( IndexEntry<?, ServerEntry> indexEntry ) throws Exception
+    public boolean evaluate( IndexEntry<?, ServerEntry, ID> indexEntry ) throws Exception
     {
         if ( idx != null )
         {
@@ -150,7 +150,7 @@
 
         // if the attribute exists and has a greater than or equal value return true
         //noinspection unchecked
-        if ( attr != null && evaluate( ( IndexEntry<Object, ServerEntry> ) indexEntry, attr ) )
+        if ( attr != null && evaluate( ( IndexEntry<Object, ServerEntry, ID> ) indexEntry, attr ) )
         {
             return true;
         }
@@ -173,7 +173,7 @@
                 attr = ( ServerAttribute ) entry.get( descendant );
 
                 //noinspection unchecked
-                if ( attr != null && evaluate( ( IndexEntry<Object, ServerEntry> ) indexEntry, attr ) )
+                if ( attr != null && evaluate( ( IndexEntry<Object, ServerEntry, ID> ) indexEntry, attr ) )
                 {
                     return true;
                 }
@@ -185,18 +185,18 @@
     }
 
 
-    public boolean evaluate( Long id ) throws Exception
+    public boolean evaluateId( ID id ) throws Exception
     {
         if ( idx != null )
         {
             return idx.reverseGreaterOrEq( id, node.getValue().get() );
         }
 
-        return evaluate( db.lookup( id ) );
+        return evaluateEntry( db.lookup( id ) );
     }
 
 
-    public boolean evaluate( ServerEntry entry ) throws Exception
+    public boolean evaluateEntry( ServerEntry entry ) throws Exception
     {
         // get the attribute
         ServerAttribute attr = ( ServerAttribute ) entry.get( type );
@@ -238,7 +238,8 @@
 
     // TODO - determine if comaparator and index entry should have the Value
     // wrapper or the raw normalized value 
-    private boolean evaluate( IndexEntry<Object, ServerEntry> indexEntry, ServerAttribute attribute ) throws Exception
+    private boolean evaluate( IndexEntry<Object, ServerEntry, ID> indexEntry, ServerAttribute attribute )
+        throws Exception
     {
         /*
          * Cycle through the attribute values testing normalized version

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java?rev=917312&r1=917311&r2=917312&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java Sun Feb 28 22:55:33 2010
@@ -41,44 +41,44 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $$Rev$$
  */
-public class LessEqCursor<V> extends AbstractIndexCursor<V, ServerEntry>
+public class LessEqCursor<V, ID> extends AbstractIndexCursor<V, ServerEntry, ID>
 {
     private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_716 );
 
     /** An less eq evaluator for candidates */
-    private final LessEqEvaluator lessEqEvaluator;
+    private final LessEqEvaluator<V, ID> lessEqEvaluator;
 
     /** Cursor over attribute entry matching filter: set when index present */
-    private final IndexCursor<V, ServerEntry> userIdxCursor;
+    private final IndexCursor<V, ServerEntry, ID> userIdxCursor;
 
     /** NDN Cursor on all entries in  (set when no index on user attribute) */
-    private final IndexCursor<V, ServerEntry> ndnIdxCursor;
+    private final IndexCursor<V, ServerEntry, ID> ndnIdxCursor;
 
     /**
      * Used to store indexEntry from ndnCandidate so it can be saved after
      * call to evaluate() which changes the value so it's not referring to
      * the NDN but to the value of the attribute instead.
      */
-    IndexEntry<V, ServerEntry> ndnCandidate;
+    IndexEntry<V, ServerEntry, ID> ndnCandidate;
 
     /** used in both modes */
     private boolean available = false;
 
 
     @SuppressWarnings("unchecked")
-    public LessEqCursor( Store<ServerEntry> db, LessEqEvaluator lessEqEvaluator ) throws Exception
+    public LessEqCursor( Store<ServerEntry, ID> db, LessEqEvaluator<V, ID> lessEqEvaluator ) throws Exception
     {
         this.lessEqEvaluator = lessEqEvaluator;
 
         String attribute = lessEqEvaluator.getExpression().getAttribute();
         if ( db.hasUserIndexOn( attribute ) )
         {
-            userIdxCursor = ( ( Index<V, ServerEntry> ) db.getUserIndex( attribute ) ).forwardCursor();
+            userIdxCursor = ( ( Index<V, ServerEntry, ID> ) db.getUserIndex( attribute ) ).forwardCursor();
             ndnIdxCursor = null;
         }
         else
         {
-            ndnIdxCursor = ( IndexCursor<V, ServerEntry> ) db.getNdnIndex().forwardCursor();
+            ndnIdxCursor = ( IndexCursor<V, ServerEntry, ID> ) db.getNdnIndex().forwardCursor();
             userIdxCursor = null;
         }
     }
@@ -90,7 +90,7 @@
     }
 
 
-    public void beforeValue( Long id, V value ) throws Exception
+    public void beforeValue( ID id, V value ) throws Exception
     {
         checkNotClosed( "beforeValue()" );
         if ( userIdxCursor != null )
@@ -135,7 +135,7 @@
     }
 
 
-    public void before( IndexEntry<V, ServerEntry> element ) throws Exception
+    public void before( IndexEntry<V, ServerEntry, ID> element ) throws Exception
     {
         checkNotClosed( "before()" );
         if ( userIdxCursor != null )
@@ -179,7 +179,7 @@
     }
 
 
-    public void afterValue( Long id, V value ) throws Exception
+    public void afterValue( ID id, V value ) throws Exception
     {
         checkNotClosed( "afterValue()" );
         if ( userIdxCursor != null )
@@ -215,7 +215,7 @@
     }
 
 
-    public void after( IndexEntry<V, ServerEntry> element ) throws Exception
+    public void after( IndexEntry<V, ServerEntry, ID> element ) throws Exception
     {
         checkNotClosed( "after()" );
         if ( userIdxCursor != null )
@@ -273,7 +273,7 @@
         checkNotClosed( "afterLast()" );
         if ( userIdxCursor != null )
         {
-            IndexEntry<V, ServerEntry> advanceTo = new ForwardIndexEntry<V, ServerEntry>();
+            IndexEntry<V, ServerEntry, ID> advanceTo = new ForwardIndexEntry<V, ServerEntry, ID>();
             //noinspection unchecked
             advanceTo.setValue( ( V ) lessEqEvaluator.getExpression().getValue().get() );
             userIdxCursor.after( advanceTo );
@@ -348,7 +348,7 @@
             while ( userIdxCursor.next() )
             {
                 checkNotClosed( "next()" );
-                IndexEntry<?, ServerEntry> candidate = userIdxCursor.get();
+                IndexEntry<?, ServerEntry, ID> candidate = userIdxCursor.get();
                 if ( lessEqEvaluator.getLdapComparator().compare( candidate.getValue(),
                     lessEqEvaluator.getExpression().getValue().get() ) <= 0 )
                 {
@@ -377,7 +377,7 @@
     }
 
 
-    public IndexEntry<V, ServerEntry> get() throws Exception
+    public IndexEntry<V, ServerEntry, ID> get() throws Exception
     {
         checkNotClosed( "get()" );
         if ( userIdxCursor != null )

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java?rev=917312&r1=917311&r2=917312&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java Sun Feb 28 22:55:33 2010
@@ -45,18 +45,18 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class LessEqEvaluator implements Evaluator<LessEqNode, ServerEntry>
+public class LessEqEvaluator<T, ID> implements Evaluator<LessEqNode<T>, ServerEntry, ID>
 {
-    private final LessEqNode node;
-    private final Store<ServerEntry> db;
+    private final LessEqNode<T> node;
+    private final Store<ServerEntry, ID> db;
     private final SchemaManager schemaManager;
     private final AttributeType type;
     private final Normalizer normalizer;
     private final LdapComparator<? super Object> ldapComparator;
-    private final Index<Object, ServerEntry> idx;
+    private final Index<T, ServerEntry, ID> idx;
 
 
-    public LessEqEvaluator( LessEqNode node, Store<ServerEntry> db, SchemaManager schemaManager ) throws Exception
+    public LessEqEvaluator( LessEqNode<T> node, Store<ServerEntry, ID> db, SchemaManager schemaManager ) throws Exception
     {
         this.db = db;
         this.node = node;
@@ -66,7 +66,7 @@
         if ( db.hasUserIndexOn( node.getAttribute() ) )
         {
             //noinspection unchecked
-            idx = ( Index<Object, ServerEntry> ) db.getUserIndex( node.getAttribute() );
+            idx = ( Index<T, ServerEntry, ID> ) db.getUserIndex( node.getAttribute() );
         }
         else
         {
@@ -96,7 +96,7 @@
     }
 
 
-    public LessEqNode getExpression()
+    public LessEqNode<T> getExpression()
     {
         return node;
     }
@@ -120,18 +120,18 @@
     }
 
 
-    public boolean evaluate( Long id ) throws Exception
+    public boolean evaluateId( ID id ) throws Exception
     {
         if ( idx != null )
         {
             return idx.reverseLessOrEq( id, node.getValue().get() );
         }
 
-        return evaluate( db.lookup( id ) );
+        return evaluateEntry( db.lookup( id ) );
     }
 
 
-    public boolean evaluate( IndexEntry<?, ServerEntry> indexEntry ) throws Exception
+    public boolean evaluate( IndexEntry<?, ServerEntry, ID> indexEntry ) throws Exception
     {
         if ( idx != null )
         {
@@ -157,7 +157,7 @@
 
         // if the attribute does not exist just return false
         //noinspection unchecked
-        if ( attr != null && evaluate( ( IndexEntry<Object, ServerEntry> ) indexEntry, attr ) )
+        if ( attr != null && evaluate( ( IndexEntry<Object, ServerEntry, ID> ) indexEntry, attr ) )
         {
             return true;
         }
@@ -180,7 +180,7 @@
                 attr = ( ServerAttribute ) entry.get( descendant );
 
                 //noinspection unchecked
-                if ( attr != null && evaluate( ( IndexEntry<Object, ServerEntry> ) indexEntry, attr ) )
+                if ( attr != null && evaluate( ( IndexEntry<Object, ServerEntry, ID> ) indexEntry, attr ) )
                 {
                     return true;
                 }
@@ -192,7 +192,7 @@
     }
 
 
-    public boolean evaluate( ServerEntry entry ) throws Exception
+    public boolean evaluateEntry( ServerEntry entry ) throws Exception
     {
         // get the attribute
         ServerAttribute attr = ( ServerAttribute ) entry.get( type );
@@ -234,7 +234,8 @@
 
     // TODO - determine if comaparator and index entry should have the Value
     // wrapper or the raw normalized value
-    private boolean evaluate( IndexEntry<Object, ServerEntry> indexEntry, ServerAttribute attribute ) throws Exception
+    private boolean evaluate( IndexEntry<Object, ServerEntry, ID> indexEntry, ServerAttribute attribute )
+        throws Exception
     {
         /*
          * Cycle through the attribute values testing normalized version
@@ -242,7 +243,7 @@
          * normalizer.  The test uses the comparator obtained from the
          * appropriate matching rule to perform the check.
          */
-        for ( Value value : attribute )
+        for ( Value<?> value : attribute )
         {
             value.normalize( normalizer );
 

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/NotCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/NotCursor.java?rev=917312&r1=917311&r2=917312&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/NotCursor.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/NotCursor.java Sun Feb 28 22:55:33 2010
@@ -37,20 +37,20 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $$Rev$$
  */
-public class NotCursor<V> extends AbstractIndexCursor<V, ServerEntry>
+public class NotCursor<V, ID> extends AbstractIndexCursor<V, ServerEntry, ID>
 {
     private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_718 );
-    private final IndexCursor<V, ServerEntry> ndnCursor;
-    private final Evaluator<? extends ExprNode, ServerEntry> childEvaluator;
+    private final IndexCursor<V, ServerEntry, ID> ndnCursor;
+    private final Evaluator<? extends ExprNode, ServerEntry, ID> childEvaluator;
     private boolean available = false;
 
 
     @SuppressWarnings("unchecked")
-    public NotCursor( Store<ServerEntry> db, Evaluator<? extends ExprNode, ServerEntry> childEvaluator )
+    public NotCursor( Store<ServerEntry, ID> db, Evaluator<? extends ExprNode, ServerEntry, ID> childEvaluator )
         throws Exception
     {
         this.childEvaluator = childEvaluator;
-        this.ndnCursor = ( IndexCursor<V, ServerEntry> ) db.getNdnIndex().forwardCursor();
+        this.ndnCursor = ( IndexCursor<V, ServerEntry, ID> ) db.getNdnIndex().forwardCursor();
     }
 
 
@@ -60,25 +60,25 @@
     }
 
 
-    public void beforeValue( Long id, V value ) throws Exception
+    public void beforeValue( ID id, V value ) throws Exception
     {
         throw new UnsupportedOperationException( UNSUPPORTED_MSG );
     }
 
 
-    public void before( IndexEntry<V, ServerEntry> element ) throws Exception
+    public void before( IndexEntry<V, ServerEntry, ID> element ) throws Exception
     {
         throw new UnsupportedOperationException( UNSUPPORTED_MSG );
     }
 
 
-    public void after( IndexEntry<V, ServerEntry> element ) throws Exception
+    public void after( IndexEntry<V, ServerEntry, ID> element ) throws Exception
     {
         throw new UnsupportedOperationException( UNSUPPORTED_MSG );
     }
 
 
-    public void afterValue( Long id, V value ) throws Exception
+    public void afterValue( ID id, V value ) throws Exception
     {
         throw new UnsupportedOperationException( UNSUPPORTED_MSG );
     }
@@ -119,7 +119,7 @@
         while ( ndnCursor.previous() )
         {
             checkNotClosed( "previous()" );
-            IndexEntry<?, ServerEntry> candidate = ndnCursor.get();
+            IndexEntry<?, ServerEntry, ID> candidate = ndnCursor.get();
             if ( !childEvaluator.evaluate( candidate ) )
             {
                 return available = true;
@@ -135,7 +135,7 @@
         while ( ndnCursor.next() )
         {
             checkNotClosed( "next()" );
-            IndexEntry<?, ServerEntry> candidate = ndnCursor.get();
+            IndexEntry<?, ServerEntry, ID> candidate = ndnCursor.get();
             if ( !childEvaluator.evaluate( candidate ) )
             {
                 return available = true;
@@ -146,7 +146,7 @@
     }
 
 
-    public IndexEntry<V, ServerEntry> get() throws Exception
+    public IndexEntry<V, ServerEntry, ID> get() throws Exception
     {
         checkNotClosed( "get()" );
         if ( available )

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/NotEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/NotEvaluator.java?rev=917312&r1=917311&r2=917312&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/NotEvaluator.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/NotEvaluator.java Sun Feb 28 22:55:33 2010
@@ -33,32 +33,32 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $$Rev$$
  */
-public class NotEvaluator implements Evaluator<NotNode, ServerEntry>
+public class NotEvaluator<ID> implements Evaluator<NotNode, ServerEntry, ID>
 {
     private final NotNode node;
-    private final Evaluator<? extends ExprNode, ServerEntry> childEvaluator;
+    private final Evaluator<? extends ExprNode, ServerEntry, ID> childEvaluator;
 
 
-    public NotEvaluator( NotNode node, Evaluator<? extends ExprNode, ServerEntry> childEvaluator )
+    public NotEvaluator( NotNode node, Evaluator<? extends ExprNode, ServerEntry, ID> childEvaluator )
     {
         this.node = node;
         this.childEvaluator = childEvaluator;
     }
 
 
-    public boolean evaluate( Long id ) throws Exception
+    public boolean evaluateId( ID id ) throws Exception
     {
-        return !childEvaluator.evaluate( id );
+        return !childEvaluator.evaluateId( id );
     }
 
 
-    public boolean evaluate( ServerEntry entry ) throws Exception
+    public boolean evaluateEntry( ServerEntry entry ) throws Exception
     {
-        return !childEvaluator.evaluate( entry );
+        return !childEvaluator.evaluateEntry( entry );
     }
 
 
-    public boolean evaluate( IndexEntry<?, ServerEntry> indexEntry ) throws Exception
+    public boolean evaluate( IndexEntry<?, ServerEntry, ID> indexEntry ) throws Exception
     {
         return !childEvaluator.evaluate( indexEntry );
     }

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeCursor.java?rev=917312&r1=917311&r2=917312&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeCursor.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeCursor.java Sun Feb 28 22:55:33 2010
@@ -37,26 +37,26 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class OneLevelScopeCursor extends AbstractIndexCursor<Long, ServerEntry>
+public class OneLevelScopeCursor<ID> extends AbstractIndexCursor<ID, ServerEntry, ID>
 {
     /** Error message for unsupported operations */
     private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_719 );
 
     /** The entry database/store */
-    private final Store<ServerEntry> db;
+    private final Store<ServerEntry, ID> db;
 
     /** A onelevel ScopeNode Evaluator */
     @SuppressWarnings("unchecked")
     private final OneLevelScopeEvaluator evaluator;
 
     /** A Cursor over the entries in the scope of the search base */
-    private final IndexCursor<Long, ServerEntry> scopeCursor;
+    private final IndexCursor<ID, ServerEntry, ID> scopeCursor;
 
     /** A Cursor over entries brought into scope by alias dereferencing */
-    private final Cursor<IndexEntry<Long, ServerEntry>> dereferencedCursor;
+    private final Cursor<IndexEntry<ID, ServerEntry, ID>> dereferencedCursor;
 
     /** Currently active Cursor: we switch between two cursors */
-    private Cursor<IndexEntry<Long, ServerEntry>> cursor;
+    private Cursor<IndexEntry<ID, ServerEntry, ID>> cursor;
 
     /** Whether or not this Cursor is positioned so an entry is available */
     private boolean available = false;
@@ -69,8 +69,9 @@
      * @param evaluator an IndexEntry (candidate) evaluator
      * @throws Exception on db access failures
      */
-    @SuppressWarnings("unchecked")
-    public OneLevelScopeCursor( Store<ServerEntry> db, OneLevelScopeEvaluator evaluator ) throws Exception
+    //@SuppressWarnings("unchecked")
+    public OneLevelScopeCursor( Store<ServerEntry, ID> db, OneLevelScopeEvaluator<ServerEntry, ID> evaluator )
+        throws Exception
     {
         this.db = db;
         this.evaluator = evaluator;
@@ -93,25 +94,25 @@
     }
 
 
-    public void beforeValue( Long id, Long value ) throws Exception
+    public void beforeValue( ID id, ID value ) throws Exception
     {
         throw new UnsupportedOperationException( UNSUPPORTED_MSG );
     }
 
 
-    public void afterValue( Long id, Long value ) throws Exception
+    public void afterValue( ID id, ID value ) throws Exception
     {
         throw new UnsupportedOperationException( UNSUPPORTED_MSG );
     }
 
 
-    public void before( IndexEntry<Long, ServerEntry> element ) throws Exception
+    public void before( IndexEntry<ID, ServerEntry, ID> element ) throws Exception
     {
         throw new UnsupportedOperationException( UNSUPPORTED_MSG );
     }
 
 
-    public void after( IndexEntry<Long, ServerEntry> element ) throws Exception
+    public void after( IndexEntry<ID, ServerEntry, ID> element ) throws Exception
     {
         throw new UnsupportedOperationException( UNSUPPORTED_MSG );
     }
@@ -289,7 +290,7 @@
     }
 
 
-    public IndexEntry<Long, ServerEntry> get() throws Exception
+    public IndexEntry<ID, ServerEntry, ID> get() throws Exception
     {
         checkNotClosed( "get()" );
         if ( available )

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeEvaluator.java?rev=917312&r1=917311&r2=917312&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeEvaluator.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeEvaluator.java Sun Feb 28 22:55:33 2010
@@ -34,19 +34,19 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class OneLevelScopeEvaluator<E> implements Evaluator<ScopeNode, E>
+public class OneLevelScopeEvaluator<E, ID> implements Evaluator<ScopeNode, E, ID>
 {
     /** The ScopeNode containing initial search scope constraints */
     private final ScopeNode node;
 
     /** The entry identifier of the scope base */
-    private final Long baseId;
+    private final ID baseId;
 
     /** True if the scope requires alias dereferencing while searching */
     private final boolean dereferencing;
 
     /** the entry db storing entries */
-    private final Store<E> db;
+    private final Store<E, ID> db;
 
 
     /**
@@ -56,7 +56,7 @@
      * @param db the database used to evaluate scope node
      * @throws Exception on db access failure
      */
-    public OneLevelScopeEvaluator( Store<E> db, ScopeNode node ) throws Exception
+    public OneLevelScopeEvaluator( Store<E, ID> db, ScopeNode node ) throws Exception
     {
         this.node = node;
 
@@ -80,7 +80,7 @@
      * @throws Exception if db lookups fail
      * @see org.apache.directory.server.xdbm.search.Evaluator#evaluate(IndexEntry)
      */
-    public boolean evaluate( Long candidate ) throws Exception
+    public boolean evaluateId( ID candidate ) throws Exception
     {
         boolean isChild = db.getOneLevelIndex().forward( baseId, candidate );
 
@@ -136,7 +136,7 @@
      *
      * @see Evaluator#evaluate(Object)
      */
-    public boolean evaluate( E candidate ) throws Exception
+    public boolean evaluateEntry( E candidate ) throws Exception
     {
         throw new UnsupportedOperationException( I18n.err( I18n.ERR_721 ) );
     }
@@ -151,7 +151,7 @@
      * @throws Exception if db lookups fail
      * @see org.apache.directory.server.xdbm.search.Evaluator#evaluate(IndexEntry)
      */
-    public boolean evaluate( IndexEntry<?, E> candidate ) throws Exception
+    public boolean evaluate( IndexEntry<?, E, ID> candidate ) throws Exception
     {
         boolean isChild = db.getOneLevelIndex().forward( baseId, candidate.getId() );
 
@@ -209,7 +209,7 @@
      *
      * @return identifier of the search base
      */
-    public Long getBaseId()
+    public ID getBaseId()
     {
         return baseId;
     }

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OrCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OrCursor.java?rev=917312&r1=917311&r2=917312&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OrCursor.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OrCursor.java Sun Feb 28 22:55:33 2010
@@ -42,19 +42,19 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class OrCursor<V> extends AbstractIndexCursor<V, ServerEntry>
+public class OrCursor<V, ID> extends AbstractIndexCursor<V, ServerEntry, ID>
 {
     private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_722 );
-    private final List<IndexCursor<V, ServerEntry>> cursors;
-    private final List<Evaluator<? extends ExprNode, ServerEntry>> evaluators;
-    private final List<Set<Long>> blacklists;
+    private final List<IndexCursor<V, ServerEntry, ID>> cursors;
+    private final List<Evaluator<? extends ExprNode, ServerEntry, ID>> evaluators;
+    private final List<Set<ID>> blacklists;
     private int cursorIndex = -1;
     private boolean available = false;
 
 
     // TODO - do same evaluator fail fast optimization that we do in AndCursor
-    public OrCursor( List<IndexCursor<V, ServerEntry>> cursors,
-        List<Evaluator<? extends ExprNode, ServerEntry>> evaluators )
+    public OrCursor( List<IndexCursor<V, ServerEntry, ID>> cursors,
+        List<Evaluator<? extends ExprNode, ServerEntry, ID>> evaluators )
     {
         if ( cursors.size() <= 1 )
         {
@@ -63,11 +63,11 @@
 
         this.cursors = cursors;
         this.evaluators = evaluators;
-        this.blacklists = new ArrayList<Set<Long>>();
+        this.blacklists = new ArrayList<Set<ID>>();
 
         for ( int ii = 0; ii < cursors.size(); ii++ )
         {
-            this.blacklists.add( new HashSet<Long>() );
+            this.blacklists.add( new HashSet<ID>() );
         }
         this.cursorIndex = 0;
     }
@@ -79,25 +79,25 @@
     }
 
 
-    public void before( IndexEntry<V, ServerEntry> element ) throws Exception
+    public void before( IndexEntry<V, ServerEntry, ID> element ) throws Exception
     {
         throw new UnsupportedOperationException( UNSUPPORTED_MSG );
     }
 
 
-    public void after( IndexEntry<V, ServerEntry> element ) throws Exception
+    public void after( IndexEntry<V, ServerEntry, ID> element ) throws Exception
     {
         throw new UnsupportedOperationException( UNSUPPORTED_MSG );
     }
 
 
-    public void beforeValue( Long id, V value ) throws Exception
+    public void beforeValue( ID id, V value ) throws Exception
     {
         throw new UnsupportedOperationException( UNSUPPORTED_MSG );
     }
 
 
-    public void afterValue( Long id, V value ) throws Exception
+    public void afterValue( ID id, V value ) throws Exception
     {
         throw new UnsupportedOperationException( UNSUPPORTED_MSG );
     }
@@ -135,7 +135,7 @@
     }
 
 
-    private boolean isBlackListed( Long id )
+    private boolean isBlackListed( ID id )
     {
         return blacklists.get( cursorIndex ).contains( id );
     }
@@ -148,7 +148,7 @@
      * @param indexEntry the index entry to blacklist
      * @throws Exception if there are problems accessing underlying db
      */
-    private void blackListIfDuplicate( IndexEntry<?, ServerEntry> indexEntry ) throws Exception
+    private void blackListIfDuplicate( IndexEntry<?, ServerEntry, ID> indexEntry ) throws Exception
     {
         for ( int ii = 0; ii < evaluators.size(); ii++ )
         {
@@ -170,7 +170,7 @@
         while ( cursors.get( cursorIndex ).previous() )
         {
             checkNotClosed( "previous()" );
-            IndexEntry<?, ServerEntry> candidate = cursors.get( cursorIndex ).get();
+            IndexEntry<?, ServerEntry, ID> candidate = cursors.get( cursorIndex ).get();
             if ( !isBlackListed( candidate.getId() ) )
             {
                 blackListIfDuplicate( candidate );
@@ -187,7 +187,7 @@
             while ( cursors.get( cursorIndex ).previous() )
             {
                 checkNotClosed( "previous()" );
-                IndexEntry<?, ServerEntry> candidate = cursors.get( cursorIndex ).get();
+                IndexEntry<?, ServerEntry, ID> candidate = cursors.get( cursorIndex ).get();
                 if ( !isBlackListed( candidate.getId() ) )
                 {
                     blackListIfDuplicate( candidate );
@@ -205,7 +205,7 @@
         while ( cursors.get( cursorIndex ).next() )
         {
             checkNotClosed( "next()" );
-            IndexEntry<?, ServerEntry> candidate = cursors.get( cursorIndex ).get();
+            IndexEntry<?, ServerEntry, ID> candidate = cursors.get( cursorIndex ).get();
             if ( !isBlackListed( candidate.getId() ) )
             {
                 blackListIfDuplicate( candidate );
@@ -222,7 +222,7 @@
             while ( cursors.get( cursorIndex ).next() )
             {
                 checkNotClosed( "previous()" );
-                IndexEntry<?, ServerEntry> candidate = cursors.get( cursorIndex ).get();
+                IndexEntry<?, ServerEntry, ID> candidate = cursors.get( cursorIndex ).get();
                 if ( !isBlackListed( candidate.getId() ) )
                 {
                     blackListIfDuplicate( candidate );
@@ -235,7 +235,7 @@
     }
 
 
-    public IndexEntry<V, ServerEntry> get() throws Exception
+    public IndexEntry<V, ServerEntry, ID> get() throws Exception
     {
         checkNotClosed( "get()" );
         if ( available )

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OrEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OrEvaluator.java?rev=917312&r1=917311&r2=917312&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OrEvaluator.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OrEvaluator.java Sun Feb 28 22:55:33 2010
@@ -38,14 +38,14 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $$Rev$$
  */
-public class OrEvaluator implements Evaluator<OrNode, ServerEntry>
+public class OrEvaluator<ID> implements Evaluator<OrNode, ServerEntry, ID>
 {
-    private final List<Evaluator<? extends ExprNode, ServerEntry>> evaluators;
+    private final List<Evaluator<? extends ExprNode, ServerEntry, ID>> evaluators;
 
     private final OrNode node;
 
 
-    public OrEvaluator( OrNode node, List<Evaluator<? extends ExprNode, ServerEntry>> evaluators )
+    public OrEvaluator( OrNode node, List<Evaluator<? extends ExprNode, ServerEntry, ID>> evaluators )
     {
         this.node = node;
         this.evaluators = optimize( evaluators );
@@ -63,16 +63,16 @@
      * @param unoptimized the unoptimized list of Evaluators
      * @return optimized Evaluator list with decreasing scan count ordering
      */
-    private List<Evaluator<? extends ExprNode, ServerEntry>> optimize(
-        List<Evaluator<? extends ExprNode, ServerEntry>> unoptimized )
+    private List<Evaluator<? extends ExprNode, ServerEntry, ID>> optimize(
+        List<Evaluator<? extends ExprNode, ServerEntry, ID>> unoptimized )
     {
-        List<Evaluator<? extends ExprNode, ServerEntry>> optimized = new ArrayList<Evaluator<? extends ExprNode, ServerEntry>>(
+        List<Evaluator<? extends ExprNode, ServerEntry, ID>> optimized = new ArrayList<Evaluator<? extends ExprNode, ServerEntry, ID>>(
             unoptimized.size() );
         optimized.addAll( unoptimized );
-        Collections.sort( optimized, new Comparator<Evaluator<? extends ExprNode, ServerEntry>>()
+        Collections.sort( optimized, new Comparator<Evaluator<? extends ExprNode, ServerEntry, ID>>()
         {
-            public int compare( Evaluator<? extends ExprNode, ServerEntry> e1,
-                Evaluator<? extends ExprNode, ServerEntry> e2 )
+            public int compare( Evaluator<? extends ExprNode, ServerEntry, ID> e1,
+                Evaluator<? extends ExprNode, ServerEntry, ID> e2 )
             {
                 long scanCount1 = ( Long ) e1.getExpression().get( "count" );
                 long scanCount2 = ( Long ) e2.getExpression().get( "count" );
@@ -101,9 +101,9 @@
     }
 
 
-    public boolean evaluate( IndexEntry<?, ServerEntry> indexEntry ) throws Exception
+    public boolean evaluate( IndexEntry<?, ServerEntry, ID> indexEntry ) throws Exception
     {
-        for ( Evaluator<?, ServerEntry> evaluator : evaluators )
+        for ( Evaluator<?, ServerEntry, ID> evaluator : evaluators )
         {
             if ( evaluator.evaluate( indexEntry ) )
             {
@@ -115,11 +115,11 @@
     }
 
 
-    public boolean evaluate( Long id ) throws Exception
+    public boolean evaluateId( ID id ) throws Exception
     {
-        for ( Evaluator<?, ServerEntry> evaluator : evaluators )
+        for ( Evaluator<?, ServerEntry, ID> evaluator : evaluators )
         {
-            if ( evaluator.evaluate( id ) )
+            if ( evaluator.evaluateId( id ) )
             {
                 return true;
             }
@@ -129,11 +129,11 @@
     }
 
 
-    public boolean evaluate( ServerEntry entry ) throws Exception
+    public boolean evaluateEntry( ServerEntry entry ) throws Exception
     {
-        for ( Evaluator<?, ServerEntry> evaluator : evaluators )
+        for ( Evaluator<?, ServerEntry, ID> evaluator : evaluators )
         {
-            if ( evaluator.evaluate( entry ) )
+            if ( evaluator.evaluateEntry( entry ) )
             {
                 return true;
             }

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java?rev=917312&r1=917311&r2=917312&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java Sun Feb 28 22:55:33 2010
@@ -36,16 +36,16 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $$Rev$$
  */
-public class PresenceCursor extends AbstractIndexCursor<String, ServerEntry>
+public class PresenceCursor<ID> extends AbstractIndexCursor<String, ServerEntry, ID>
 {
     private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_724 );
-    private final IndexCursor<String, ServerEntry> ndnCursor;
-    private final IndexCursor<String, ServerEntry> presenceCursor;
-    private final PresenceEvaluator presenceEvaluator;
+    private final IndexCursor<String, ServerEntry, ID> ndnCursor;
+    private final IndexCursor<String, ServerEntry, ID> presenceCursor;
+    private final PresenceEvaluator<ID> presenceEvaluator;
     private boolean available = false;
 
 
-    public PresenceCursor( Store<ServerEntry> db, PresenceEvaluator presenceEvaluator ) throws Exception
+    public PresenceCursor( Store<ServerEntry, ID> db, PresenceEvaluator<ID> presenceEvaluator ) throws Exception
     {
         this.presenceEvaluator = presenceEvaluator;
         AttributeType type = presenceEvaluator.getAttributeType();
@@ -74,7 +74,7 @@
     }
 
 
-    public void beforeValue( Long id, String value ) throws Exception
+    public void beforeValue( ID id, String value ) throws Exception
     {
         checkNotClosed( "beforeValue()" );
         if ( presenceCursor != null )
@@ -87,7 +87,7 @@
     }
 
 
-    public void before( IndexEntry<String, ServerEntry> element ) throws Exception
+    public void before( IndexEntry<String, ServerEntry, ID> element ) throws Exception
     {
         checkNotClosed( "before()" );
         if ( presenceCursor != null )
@@ -100,7 +100,7 @@
     }
 
 
-    public void afterValue( Long id, String value ) throws Exception
+    public void afterValue( ID id, String value ) throws Exception
     {
         checkNotClosed( "afterValue()" );
         if ( presenceCursor != null )
@@ -113,7 +113,7 @@
     }
 
 
-    public void after( IndexEntry<String, ServerEntry> element ) throws Exception
+    public void after( IndexEntry<String, ServerEntry, ID> element ) throws Exception
     {
         checkNotClosed( "after()" );
         if ( presenceCursor != null )
@@ -191,7 +191,7 @@
         while ( ndnCursor.previous() )
         {
             checkNotClosed( "previous()" );
-            IndexEntry<?, ServerEntry> candidate = ndnCursor.get();
+            IndexEntry<?, ServerEntry, ID> candidate = ndnCursor.get();
             if ( presenceEvaluator.evaluate( candidate ) )
             {
                 return available = true;
@@ -213,7 +213,7 @@
         while ( ndnCursor.next() )
         {
             checkNotClosed( "next()" );
-            IndexEntry<?, ServerEntry> candidate = ndnCursor.get();
+            IndexEntry<?, ServerEntry, ID> candidate = ndnCursor.get();
             if ( presenceEvaluator.evaluate( candidate ) )
             {
                 return available = true;
@@ -224,7 +224,7 @@
     }
 
 
-    public IndexEntry<String, ServerEntry> get() throws Exception
+    public IndexEntry<String, ServerEntry, ID> get() throws Exception
     {
         checkNotClosed( "get()" );
         if ( presenceCursor != null )
@@ -244,7 +244,7 @@
              * value to be the value of the attribute in question.  So we will
              * set that accordingly here.
              */
-            IndexEntry<String, ServerEntry> indexEntry = ndnCursor.get();
+            IndexEntry<String, ServerEntry, ID> indexEntry = ndnCursor.get();
             indexEntry.setValue( presenceEvaluator.getAttributeType().getOid() );
             return indexEntry;
         }

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java?rev=917312&r1=917311&r2=917312&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java Sun Feb 28 22:55:33 2010
@@ -40,16 +40,17 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class PresenceEvaluator implements Evaluator<PresenceNode, ServerEntry>
+public class PresenceEvaluator<ID> implements Evaluator<PresenceNode, ServerEntry, ID>
 {
     private final PresenceNode node;
-    private final Store<ServerEntry> db;
+    private final Store<ServerEntry, ID> db;
     private final AttributeType type;
     private final SchemaManager schemaManager;
-    private final Index<String, ServerEntry> idx;
+    private final Index<String, ServerEntry, ID> idx;
 
 
-    public PresenceEvaluator( PresenceNode node, Store<ServerEntry> db, SchemaManager schemaManager ) throws Exception
+    public PresenceEvaluator( PresenceNode node, Store<ServerEntry, ID> db, SchemaManager schemaManager )
+        throws Exception
     {
         this.db = db;
         this.node = node;
@@ -81,7 +82,7 @@
 
     // TODO - determine if comaparator and index entry should have the Value
     // wrapper or the raw normalized value
-    public boolean evaluate( IndexEntry<?, ServerEntry> indexEntry ) throws Exception
+    public boolean evaluate( IndexEntry<?, ServerEntry, ID> indexEntry ) throws Exception
     {
         if ( idx != null )
         {
@@ -97,26 +98,26 @@
             indexEntry.setObject( entry );
         }
 
-        return evaluate( entry );
+        return evaluateEntry( entry );
     }
 
 
     // TODO - determine if comaparator and index entry should have the Value
     // wrapper or the raw normalized value
-    public boolean evaluate( Long id ) throws Exception
+    public boolean evaluateId( ID id ) throws Exception
     {
         if ( idx != null )
         {
             return idx.forward( type.getOid(), id );
         }
 
-        return evaluate( db.lookup( id ) );
+        return evaluateEntry( db.lookup( id ) );
     }
 
 
     // TODO - determine if comaparator and index entry should have the Value
     // wrapper or the raw normalized value
-    public boolean evaluate( ServerEntry entry ) throws Exception
+    public boolean evaluateEntry( ServerEntry entry ) throws Exception
     {
         // get the attribute
         ServerAttribute attr = ( ServerAttribute ) entry.get( type );



Mime
View raw message