directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1199849 [2/2] - in /directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search: ./ impl/
Date Wed, 09 Nov 2011 17:02:10 GMT
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeEvaluator.java?rev=1199849&r1=1199848&r2=1199849&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeEvaluator.java
(original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeEvaluator.java
Wed Nov  9 17:02:09 2011
@@ -20,10 +20,13 @@
 package org.apache.directory.server.xdbm.search.impl;
 
 
+import java.util.UUID;
+
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.server.core.api.partition.index.IndexEntry;
 import org.apache.directory.server.xdbm.Store;
 import org.apache.directory.server.xdbm.search.Evaluator;
+import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.filter.ScopeNode;
 import org.apache.directory.shared.ldap.model.message.SearchScope;
 
@@ -33,19 +36,19 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class OneLevelScopeEvaluator<E, ID extends Comparable<ID>> implements
Evaluator<ScopeNode, E, ID>
+public class OneLevelScopeEvaluator implements Evaluator<ScopeNode>
 {
     /** The ScopeNode containing initial search scope constraints */
     private final ScopeNode node;
 
     /** The entry identifier of the scope base */
-    private final ID baseId;
+    private final UUID baseId;
 
     /** True if the scope requires alias dereferencing while searching */
     private final boolean dereferencing;
 
     /** the entry db storing entries */
-    private final Store<E, ID> db;
+    private final Store db;
 
 
     /**
@@ -55,7 +58,7 @@ public class OneLevelScopeEvaluator<E, I
      * @param db the database used to evaluate scope node
      * @throws Exception on db access failure
      */
-    public OneLevelScopeEvaluator( Store<E, ID> db, ScopeNode node ) throws Exception
+    public OneLevelScopeEvaluator( Store db, ScopeNode node ) throws Exception
     {
         this.node = node;
 
@@ -79,7 +82,7 @@ public class OneLevelScopeEvaluator<E, I
      * @throws Exception if db lookups fail
      * @see org.apache.directory.server.xdbm.search.Evaluator#evaluate(IndexEntry)
      */
-    public boolean evaluateId( ID candidate ) throws Exception
+    public boolean evaluateId( UUID candidate ) throws Exception
     {
         boolean isChild = db.getOneLevelIndex().forward( baseId, candidate );
 
@@ -135,7 +138,7 @@ public class OneLevelScopeEvaluator<E, I
      *
      * {@inheritDoc}
      */
-    public boolean evaluateEntry( E candidate ) throws Exception
+    public boolean evaluateEntry( Entry candidate ) throws Exception
     {
         throw new UnsupportedOperationException( I18n.err( I18n.ERR_721 ) );
     }
@@ -150,7 +153,7 @@ public class OneLevelScopeEvaluator<E, I
      * @throws Exception if db lookups fail
      * @see org.apache.directory.server.xdbm.search.Evaluator#evaluate(IndexEntry)
      */
-    public boolean evaluate( IndexEntry<?, ID> candidate ) throws Exception
+    public boolean evaluate( IndexEntry<?> candidate ) throws Exception
     {
         boolean isChild = db.getOneLevelIndex().forward( baseId, candidate.getId() );
 
@@ -208,7 +211,7 @@ public class OneLevelScopeEvaluator<E, I
      *
      * @return identifier of the search base
      */
-    public ID getBaseId()
+    public UUID getBaseId()
     {
         return baseId;
     }

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OrCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OrCursor.java?rev=1199849&r1=1199848&r2=1199849&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OrCursor.java
(original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OrCursor.java
Wed Nov  9 17:02:09 2011
@@ -24,6 +24,7 @@ import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
+import java.util.UUID;
 
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.server.core.api.partition.index.AbstractIndexCursor;
@@ -41,18 +42,18 @@ import org.apache.directory.shared.ldap.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class OrCursor<V, ID> extends AbstractIndexCursor<V, Entry, ID>
+public class OrCursor<V> extends AbstractIndexCursor<V>
 {
     private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_722 );
-    private final List<IndexCursor<V, Entry, ID>> cursors;
-    private final List<Evaluator<? extends ExprNode, Entry, ID>> evaluators;
-    private final List<Set<ID>> blacklists;
+    private final List<IndexCursor<V>> cursors;
+    private final List<Evaluator<? extends ExprNode>> evaluators;
+    private final List<Set<UUID>> blacklists;
     private int cursorIndex = -1;
 
 
     // TODO - do same evaluator fail fast optimization that we do in AndCursor
-    public OrCursor( List<IndexCursor<V, Entry, ID>> cursors,
-        List<Evaluator<? extends ExprNode, Entry, ID>> evaluators )
+    public OrCursor( List<IndexCursor<V>> cursors,
+        List<Evaluator<? extends ExprNode>> evaluators )
     {
         if ( cursors.size() <= 1 )
         {
@@ -61,11 +62,11 @@ public class OrCursor<V, ID> extends Abs
 
         this.cursors = cursors;
         this.evaluators = evaluators;
-        this.blacklists = new ArrayList<Set<ID>>();
+        this.blacklists = new ArrayList<Set<UUID>>();
 
         for ( int ii = 0; ii < cursors.size(); ii++ )
         {
-            this.blacklists.add( new HashSet<ID>() );
+            this.blacklists.add( new HashSet<UUID>() );
         }
         this.cursorIndex = 0;
     }
@@ -114,7 +115,7 @@ public class OrCursor<V, ID> extends Abs
     }
 
 
-    private boolean isBlackListed( ID id )
+    private boolean isBlackListed( UUID id )
     {
         return blacklists.get( cursorIndex ).contains( id );
     }
@@ -127,7 +128,7 @@ public class OrCursor<V, ID> extends Abs
      * @param indexEntry the index entry to blacklist
      * @throws Exception if there are problems accessing underlying db
      */
-    private void blackListIfDuplicate( IndexEntry<?, ID> indexEntry ) throws Exception
+    private void blackListIfDuplicate( IndexEntry<?> indexEntry ) throws Exception
     {
         for ( int ii = 0; ii < evaluators.size(); ii++ )
         {
@@ -149,7 +150,7 @@ public class OrCursor<V, ID> extends Abs
         while ( cursors.get( cursorIndex ).previous() )
         {
             checkNotClosed( "previous()" );
-            IndexEntry<?, ID> candidate = cursors.get( cursorIndex ).get();
+            IndexEntry<?> candidate = cursors.get( cursorIndex ).get();
             
             if ( !isBlackListed( candidate.getId() ) )
             {
@@ -168,7 +169,7 @@ public class OrCursor<V, ID> extends Abs
             while ( cursors.get( cursorIndex ).previous() )
             {
                 checkNotClosed( "previous()" );
-                IndexEntry<?, ID> candidate = cursors.get( cursorIndex ).get();
+                IndexEntry<?> candidate = cursors.get( cursorIndex ).get();
                 
                 if ( !isBlackListed( candidate.getId() ) )
                 {
@@ -188,7 +189,7 @@ public class OrCursor<V, ID> extends Abs
         while ( cursors.get( cursorIndex ).next() )
         {
             checkNotClosed( "next()" );
-            IndexEntry<?, ID> candidate = cursors.get( cursorIndex ).get();
+            IndexEntry<?> candidate = cursors.get( cursorIndex ).get();
             if ( !isBlackListed( candidate.getId() ) )
             {
                 blackListIfDuplicate( candidate );
@@ -206,7 +207,7 @@ public class OrCursor<V, ID> extends Abs
             while ( cursors.get( cursorIndex ).next() )
             {
                 checkNotClosed( "previous()" );
-                IndexEntry<?, ID> candidate = cursors.get( cursorIndex ).get();
+                IndexEntry<?> candidate = cursors.get( cursorIndex ).get();
                 if ( !isBlackListed( candidate.getId() ) )
                 {
                     blackListIfDuplicate( candidate );
@@ -220,7 +221,7 @@ public class OrCursor<V, ID> extends Abs
     }
 
 
-    public IndexEntry<V, ID> get() throws Exception
+    public IndexEntry<V> get() throws Exception
     {
         checkNotClosed( "get()" );
         

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OrEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OrEvaluator.java?rev=1199849&r1=1199848&r2=1199849&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OrEvaluator.java
(original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OrEvaluator.java
Wed Nov  9 17:02:09 2011
@@ -37,16 +37,16 @@ import org.apache.directory.shared.ldap.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class OrEvaluator<ID> implements Evaluator<OrNode, Entry, ID>
+public class OrEvaluator implements Evaluator<OrNode>
 {
     /** The list of evaluators associated with each of the children */
-    private final List<Evaluator<? extends ExprNode, Entry, ID>> evaluators;
+    private final List<Evaluator<? extends ExprNode>> evaluators;
 
     /** The OrNode */
     private final OrNode node;
 
 
-    public OrEvaluator( OrNode node, List<Evaluator<? extends ExprNode, Entry, ID>>
evaluators )
+    public OrEvaluator( OrNode node, List<Evaluator<? extends ExprNode>> evaluators
)
     {
         this.node = node;
         this.evaluators = optimize( evaluators );
@@ -64,16 +64,16 @@ public class OrEvaluator<ID> implements 
      * @param unoptimized the unoptimized list of Evaluators
      * @return optimized Evaluator list with decreasing scan count ordering
      */
-    private List<Evaluator<? extends ExprNode, Entry, ID>> optimize(
-        List<Evaluator<? extends ExprNode, Entry, ID>> unoptimized )
+    private List<Evaluator<? extends ExprNode>> optimize(
+        List<Evaluator<? extends ExprNode>> unoptimized )
     {
-        List<Evaluator<? extends ExprNode, Entry, ID>> optimized = new ArrayList<Evaluator<?
extends ExprNode, Entry, ID>>(
+        List<Evaluator<? extends ExprNode>> optimized = new ArrayList<Evaluator<?
extends ExprNode>>(
             unoptimized.size() );
         optimized.addAll( unoptimized );
-        Collections.sort( optimized, new Comparator<Evaluator<? extends ExprNode, Entry,
ID>>()
+        Collections.sort( optimized, new Comparator<Evaluator<? extends ExprNode>>()
         {
-            public int compare( Evaluator<? extends ExprNode, Entry, ID> e1,
-                Evaluator<? extends ExprNode, Entry, ID> e2 )
+            public int compare( Evaluator<? extends ExprNode> e1,
+                Evaluator<? extends ExprNode> e2 )
             {
                 long scanCount1 = ( Long ) e1.getExpression().get( "count" );
                 long scanCount2 = ( Long ) e2.getExpression().get( "count" );
@@ -102,9 +102,9 @@ public class OrEvaluator<ID> implements 
     }
 
 
-    public boolean evaluate( IndexEntry<?, ID> indexEntry ) throws Exception
+    public boolean evaluate( IndexEntry<?> indexEntry ) throws Exception
     {
-        for ( Evaluator<?, Entry, ID> evaluator : evaluators )
+        for ( Evaluator<?> evaluator : evaluators )
         {
             if ( evaluator.evaluate( indexEntry ) )
             {
@@ -118,7 +118,7 @@ public class OrEvaluator<ID> implements 
 
     public boolean evaluateEntry( Entry entry ) throws Exception
     {
-        for ( Evaluator<?, Entry, ID> evaluator : evaluators )
+        for ( Evaluator<?> evaluator : evaluators )
         {
             if ( evaluator.evaluateEntry( entry ) )
             {

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java?rev=1199849&r1=1199848&r2=1199849&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java
(original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java
Wed Nov  9 17:02:09 2011
@@ -20,6 +20,8 @@
 package org.apache.directory.server.xdbm.search.impl;
 
 
+import java.util.UUID;
+
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.server.core.api.partition.index.AbstractIndexCursor;
 import org.apache.directory.server.core.api.partition.index.IndexCursor;
@@ -35,15 +37,15 @@ import org.apache.directory.shared.ldap.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class PresenceCursor<ID extends Comparable<ID>> extends AbstractIndexCursor<String,
Entry, ID>
+public class PresenceCursor extends AbstractIndexCursor<String>
 {
     private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_724 );
-    private final IndexCursor<String, Entry, ID> uuidCursor;
-    private final IndexCursor<String, Entry, ID> presenceCursor;
-    private final PresenceEvaluator<ID> presenceEvaluator;
+    private final IndexCursor<String> uuidCursor;
+    private final IndexCursor<String> presenceCursor;
+    private final PresenceEvaluator presenceEvaluator;
 
 
-    public PresenceCursor( Store<Entry, ID> store, PresenceEvaluator<ID> presenceEvaluator
) throws Exception
+    public PresenceCursor( Store store, PresenceEvaluator presenceEvaluator ) throws Exception
     {
         this.presenceEvaluator = presenceEvaluator;
         AttributeType type = presenceEvaluator.getAttributeType();
@@ -87,7 +89,7 @@ public class PresenceCursor<ID extends C
     /**
      * {@inheritDoc}
      */
-    public void beforeValue( ID id, String value ) throws Exception
+    public void beforeValue( UUID id, String value ) throws Exception
     {
         checkNotClosed( "beforeValue()" );
         
@@ -105,7 +107,7 @@ public class PresenceCursor<ID extends C
     /**
      * {@inheritDoc}
      */
-    public void before( IndexEntry<String, ID> element ) throws Exception
+    public void before( IndexEntry<String> element ) throws Exception
     {
         checkNotClosed( "before()" );
         
@@ -123,7 +125,7 @@ public class PresenceCursor<ID extends C
     /**
      * {@inheritDoc}
      */
-    public void afterValue( ID id, String value ) throws Exception
+    public void afterValue( UUID id, String value ) throws Exception
     {
         checkNotClosed( "afterValue()" );
         
@@ -141,7 +143,7 @@ public class PresenceCursor<ID extends C
     /**
      * {@inheritDoc}
      */
-    public void after( IndexEntry<String, ID> element ) throws Exception
+    public void after( IndexEntry<String> element ) throws Exception
     {
         checkNotClosed( "after()" );
         
@@ -227,7 +229,7 @@ public class PresenceCursor<ID extends C
         while ( uuidCursor.previous() )
         {
             checkNotClosed( "previous()" );
-            IndexEntry<?, ID> candidate = uuidCursor.get();
+            IndexEntry<?> candidate = uuidCursor.get();
             
             if ( presenceEvaluator.evaluate( candidate ) )
             {
@@ -250,7 +252,7 @@ public class PresenceCursor<ID extends C
         while ( uuidCursor.next() )
         {
             checkNotClosed( "next()" );
-            IndexEntry<?, ID> candidate = uuidCursor.get();
+            IndexEntry<?> candidate = uuidCursor.get();
             
             if ( presenceEvaluator.evaluate( candidate ) )
             {
@@ -262,7 +264,7 @@ public class PresenceCursor<ID extends C
     }
 
 
-    public IndexEntry<String, ID> get() throws Exception
+    public IndexEntry<String> get() throws Exception
     {
         checkNotClosed( "get()" );
         
@@ -283,7 +285,7 @@ public class PresenceCursor<ID extends C
              * value to be the value of the attribute in question.  So we will
              * set that accordingly here.
              */
-            IndexEntry<String, ID> indexEntry = uuidCursor.get();
+            IndexEntry<String> indexEntry = uuidCursor.get();
             indexEntry.setValue( presenceEvaluator.getAttributeType().getOid() );
             
             return indexEntry;

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java?rev=1199849&r1=1199848&r2=1199849&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java
(original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java
Wed Nov  9 17:02:09 2011
@@ -21,6 +21,7 @@ package org.apache.directory.server.xdbm
 
 
 import java.util.Iterator;
+import java.util.UUID;
 
 import org.apache.directory.server.core.api.partition.index.Index;
 import org.apache.directory.server.core.api.partition.index.IndexEntry;
@@ -39,13 +40,13 @@ import org.apache.directory.shared.ldap.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class PresenceEvaluator<ID extends Comparable<ID>> implements Evaluator<PresenceNode,
Entry, ID>
+public class PresenceEvaluator implements Evaluator<PresenceNode>
 {
     /** The ExprNode to evaluate */
     private final PresenceNode node;
 
     /** The backend */
-    private final Store<Entry, ID> db;
+    private final Store db;
 
     /** The AttributeType we will use for the evaluation */
     private final AttributeType attributeType;
@@ -54,10 +55,10 @@ public class PresenceEvaluator<ID extend
     private final SchemaManager schemaManager;
 
     /** The index to use if any */
-    private final Index<String, Entry, ID> idx;
+    private final Index<String> idx;
 
 
-    public PresenceEvaluator( PresenceNode node, Store<Entry, ID> db, SchemaManager
schemaManager )
+    public PresenceEvaluator( PresenceNode node, Store db, SchemaManager schemaManager )
         throws Exception
     {
         this.db = db;
@@ -90,7 +91,7 @@ public class PresenceEvaluator<ID extend
 
     // TODO - determine if comaparator and index entry should have the Value
     // wrapper or the raw normalized value
-    public boolean evaluate( IndexEntry<?, ID> indexEntry ) throws Exception
+    public boolean evaluate( IndexEntry<?> indexEntry ) throws Exception
     {
         if ( idx != null )
         {
@@ -112,7 +113,7 @@ public class PresenceEvaluator<ID extend
 
     // TODO - determine if comaparator and index entry should have the Value
     // wrapper or the raw normalized value
-    public boolean evaluateId( ID id ) throws Exception
+    public boolean evaluateId( UUID id ) throws Exception
     {
         if ( idx != null )
         {

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ScanCountComparator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ScanCountComparator.java?rev=1199849&r1=1199848&r2=1199849&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ScanCountComparator.java
(original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ScanCountComparator.java
Wed Nov  9 17:02:09 2011
@@ -31,12 +31,12 @@ import org.apache.directory.shared.ldap.
  *
  * @param <ID> The type of element
  */
-public class ScanCountComparator<ID> implements Comparator<Evaluator<?, Entry,
ID>>
+public class ScanCountComparator implements Comparator<Evaluator<?>>
 {
     /**
      * Compare two scan counts frpm two evaluators 
      */
-    public int compare( Evaluator<?, Entry, ID> e1, Evaluator<?, Entry, ID> e2
)
+    public int compare( Evaluator<?> e1, Evaluator<?> e2 )
     {
         long scanCount1 = ( Long ) e1.getExpression().get( "count" );
         long scanCount2 = ( Long ) e2.getExpression().get( "count" );

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java?rev=1199849&r1=1199848&r2=1199849&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java
(original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java
Wed Nov  9 17:02:09 2011
@@ -36,17 +36,17 @@ import org.apache.directory.shared.ldap.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class SubstringCursor<ID extends Comparable<ID>> extends AbstractIndexCursor<String,
Entry, ID>
+public class SubstringCursor extends AbstractIndexCursor<String>
 {
     private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_725 );
     private final boolean hasIndex;
-    private final IndexCursor<String, Entry, ID> wrapped;
-    private final SubstringEvaluator<ID> evaluator;
-    private final ForwardIndexEntry<String, ID> indexEntry = new ForwardIndexEntry<String,
ID>();
+    private final IndexCursor<String> wrapped;
+    private final SubstringEvaluator evaluator;
+    private final ForwardIndexEntry<String> indexEntry = new ForwardIndexEntry<String>();
 
 
     @SuppressWarnings("unchecked")
-    public SubstringCursor( Store<Entry, ID> store, final SubstringEvaluator<ID>
substringEvaluator )
+    public SubstringCursor( Store store, final SubstringEvaluator substringEvaluator )
         throws Exception
     {
         evaluator = substringEvaluator;
@@ -54,7 +54,7 @@ public class SubstringCursor<ID extends 
 
         if ( hasIndex )
         {
-            wrapped = ( ( Index<String, Entry, ID> ) store.getIndex( evaluator.getExpression().getAttributeType()
) )
+            wrapped = ( ( Index<String> ) store.getIndex( evaluator.getExpression().getAttributeType()
) )
                 .forwardCursor();
         }
         else
@@ -89,7 +89,7 @@ public class SubstringCursor<ID extends 
         checkNotClosed( "beforeFirst()" );
         if ( evaluator.getExpression().getInitial() != null && hasIndex )
         {
-            ForwardIndexEntry<String, ID> indexEntry = new ForwardIndexEntry<String,
ID>();
+            ForwardIndexEntry<String> indexEntry = new ForwardIndexEntry<String>();
             indexEntry.setValue( evaluator.getExpression().getInitial() );
             wrapped.before( indexEntry );
         }
@@ -130,7 +130,7 @@ public class SubstringCursor<ID extends 
     }
 
 
-    private boolean evaluateCandidate( IndexEntry<String, ID> indexEntry ) throws Exception
+    private boolean evaluateCandidate( IndexEntry<String> indexEntry ) throws Exception
     {
         if ( hasIndex )
         {
@@ -155,7 +155,7 @@ public class SubstringCursor<ID extends 
         while ( wrapped.previous() )
         {
             checkNotClosed( "previous()" );
-            IndexEntry<String, ID> entry = wrapped.get();
+            IndexEntry<String> entry = wrapped.get();
             
             if ( evaluateCandidate( entry ) )
             {
@@ -177,7 +177,7 @@ public class SubstringCursor<ID extends 
         while ( wrapped.next() )
         {
             checkNotClosed( "next()" );
-            IndexEntry<String, ID> entry = wrapped.get();
+            IndexEntry<String> entry = wrapped.get();
             
             if ( evaluateCandidate( entry ) )
             {
@@ -194,7 +194,7 @@ public class SubstringCursor<ID extends 
     }
 
 
-    public IndexEntry<String, ID> get() throws Exception
+    public IndexEntry<String> get() throws Exception
     {
         checkNotClosed( "get()" );
         

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java?rev=1199849&r1=1199848&r2=1199849&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java
(original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java
Wed Nov  9 17:02:09 2011
@@ -21,6 +21,7 @@ package org.apache.directory.server.xdbm
 
 
 import java.util.Iterator;
+import java.util.UUID;
 import java.util.regex.Pattern;
 
 import org.apache.directory.server.i18n.I18n;
@@ -45,10 +46,10 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class SubstringEvaluator<ID extends Comparable<ID>> implements Evaluator<SubstringNode,
Entry, ID>
+public class SubstringEvaluator implements Evaluator<SubstringNode>
 {
     /** Database used while evaluating candidates */
-    private final Store<Entry, ID> db;
+    private final Store db;
 
     /** Reference to the SchemaManager */
     private final SchemaManager schemaManager;
@@ -66,7 +67,7 @@ public class SubstringEvaluator<ID exten
     private final Normalizer normalizer;
 
     /** The index to use if any */
-    private final Index<String, Entry, ID> idx;
+    private final Index<String> idx;
 
 
     /**
@@ -78,7 +79,7 @@ public class SubstringEvaluator<ID exten
      * @throws Exception if there are failures accessing resources and the db
      */
     @SuppressWarnings("unchecked")
-    public SubstringEvaluator( SubstringNode node, Store<Entry, ID> db, SchemaManager
schemaManager )
+    public SubstringEvaluator( SubstringNode node, Store db, SchemaManager schemaManager
)
         throws Exception
     {
         this.db = db;
@@ -115,7 +116,7 @@ public class SubstringEvaluator<ID exten
 
         if ( db.hasIndexOn( attributeType ) )
         {
-            idx = ( Index<String, Entry, ID> ) db.getIndex( attributeType );
+            idx = ( Index<String> ) db.getIndex( attributeType );
         }
         else
         {
@@ -125,12 +126,12 @@ public class SubstringEvaluator<ID exten
 
 
     @SuppressWarnings("unchecked")
-    public boolean evaluate( IndexEntry<?, ID> indexEntry ) throws Exception
+    public boolean evaluate( IndexEntry<?> indexEntry ) throws Exception
     {
 
         if ( idx == null )
         {
-            return evaluateWithoutIndex( ( IndexEntry<String, ID> ) indexEntry );
+            return evaluateWithoutIndex( ( IndexEntry<String> ) indexEntry );
         }
         else
         {
@@ -139,7 +140,7 @@ public class SubstringEvaluator<ID exten
     }
 
 
-    public boolean evaluateId( ID id ) throws Exception
+    public boolean evaluateId( UUID id ) throws Exception
     {
 
         if ( idx == null )
@@ -180,7 +181,7 @@ public class SubstringEvaluator<ID exten
     }
 
 
-    private boolean evaluateWithIndex( IndexEntry<?, ID> indexEntry ) throws Exception
+    private boolean evaluateWithIndex( IndexEntry<?> indexEntry ) throws Exception
     {
         /*
          * Note that this is using the reverse half of the index giving a
@@ -188,12 +189,12 @@ public class SubstringEvaluator<ID exten
          * Otherwise we would have to scan the entire index if there were
          * no reverse lookups.
          */
-        Cursor<IndexEntry<String, ID>> entries = idx.reverseCursor( indexEntry.getId()
);
+        Cursor<IndexEntry<String>> entries = idx.reverseCursor( indexEntry.getId()
);
 
         // cycle through the attribute values testing for a match
         while ( entries.next() )
         {
-            IndexEntry<String, ID> rec = entries.get();
+            IndexEntry<String> rec = entries.get();
 
             // once match is found cleanup and return true
             if ( regex.matcher( ( String ) rec.getValue() ).matches() )
@@ -216,7 +217,7 @@ public class SubstringEvaluator<ID exten
     }
 
 
-    private boolean evaluateWithIndex( ID id ) throws Exception
+    private boolean evaluateWithIndex( UUID id ) throws Exception
     {
         /*
          * Note that this is using the reverse half of the index giving a
@@ -224,12 +225,12 @@ public class SubstringEvaluator<ID exten
          * Otherwise we would have to scan the entire index if there were
          * no reverse lookups.
          */
-        Cursor<IndexEntry<String, ID>> entries = idx.reverseCursor( id );
+        Cursor<IndexEntry<String>> entries = idx.reverseCursor( id );
 
         // cycle through the attribute values testing for a match
         while ( entries.next() )
         {
-            IndexEntry<String, ID> rec = entries.get();
+            IndexEntry<String> rec = entries.get();
 
             // once match is found cleanup and return true
             if ( regex.matcher( ( String ) rec.getValue() ).matches() )
@@ -248,7 +249,7 @@ public class SubstringEvaluator<ID exten
 
     // TODO - determine if comaparator and index entry should have the Value
     // wrapper or the raw normalized value
-    private boolean evaluateWithoutIndex( ID id ) throws Exception
+    private boolean evaluateWithoutIndex( UUID id ) throws Exception
     {
         return evaluateWithoutIndex( db.lookup( id ) );
     }
@@ -330,7 +331,7 @@ public class SubstringEvaluator<ID exten
 
     // TODO - determine if comaparator and index entry should have the Value
     // wrapper or the raw normalized value
-    private boolean evaluateWithoutIndex( IndexEntry<String, ID> indexEntry ) throws
Exception
+    private boolean evaluateWithoutIndex( IndexEntry<String> indexEntry ) throws Exception
     {
         Entry entry = indexEntry.getEntry();
 

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java?rev=1199849&r1=1199848&r2=1199849&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java
(original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java
Wed Nov  9 17:02:09 2011
@@ -20,6 +20,8 @@
 package org.apache.directory.server.xdbm.search.impl;
 
 
+import java.util.UUID;
+
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.server.core.api.partition.index.AbstractIndexCursor;
@@ -36,26 +38,26 @@ import org.apache.directory.shared.ldap.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class SubtreeScopeCursor<ID extends Comparable<ID>> extends AbstractIndexCursor<ID,
Entry, ID>
+public class SubtreeScopeCursor extends AbstractIndexCursor<UUID>
 {
     private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_719 );
 
     /** The Entry database/store */
-    private final Store<Entry, ID> db;
+    private final Store db;
 
     /** A ScopeNode Evaluator */
-    private final SubtreeScopeEvaluator<Entry, ID> evaluator;
+    private final SubtreeScopeEvaluator evaluator;
 
     /** A Cursor over the entries in the scope of the search base */
-    private final IndexCursor<ID, Entry, ID> scopeCursor;
+    private final IndexCursor<UUID> scopeCursor;
 
     /** A Cursor over entries brought into scope by alias dereferencing */
-    private final IndexCursor<ID, Entry, ID> dereferencedCursor;
+    private final IndexCursor<UUID> dereferencedCursor;
 
     /** Currently active Cursor: we switch between two cursors */
-    private IndexCursor<ID, Entry, ID> cursor;
+    private IndexCursor<UUID> cursor;
 
-    private ID contextEntryId;
+    private UUID contextEntryId;
 
 
     /**
@@ -65,15 +67,15 @@ public class SubtreeScopeCursor<ID exten
      * @param evaluator an IndexEntry (candidate) evaluator
      * @throws Exception on db access failures
      */
-    public SubtreeScopeCursor( Store<Entry, ID> db, SubtreeScopeEvaluator<Entry,
ID> evaluator )
+    public SubtreeScopeCursor( Store db, SubtreeScopeEvaluator evaluator )
         throws Exception
     {
         this.db = db;
         this.evaluator = evaluator;
 
-        if ( evaluator.getBaseId() == getContextEntryId() )
+        if ( evaluator.getBaseId().compareTo( getContextEntryId() ) == 0 )
         {
-            scopeCursor = new AllEntriesCursor<ID>( db );
+            scopeCursor = new AllEntriesCursor( db );
         }
         else
         {
@@ -101,7 +103,7 @@ public class SubtreeScopeCursor<ID exten
 
     
     // This will suppress PMD.EmptyCatchBlock warnings in this method
-    private ID getContextEntryId() throws Exception
+    private UUID getContextEntryId() throws Exception
     {
         if ( contextEntryId == null )
         {
@@ -299,7 +301,7 @@ public class SubtreeScopeCursor<ID exten
     }
 
 
-    public IndexEntry<ID, ID> get() throws Exception
+    public IndexEntry<UUID> get() throws Exception
     {
         checkNotClosed( "get()" );
         

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java?rev=1199849&r1=1199848&r2=1199849&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java
(original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java
Wed Nov  9 17:02:09 2011
@@ -20,11 +20,14 @@
 package org.apache.directory.server.xdbm.search.impl;
 
 
+import java.util.UUID;
+
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.server.core.api.partition.index.IndexEntry;
 import org.apache.directory.server.xdbm.Store;
 import org.apache.directory.server.xdbm.search.Evaluator;
+import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.filter.ScopeNode;
 import org.apache.directory.shared.ldap.model.message.SearchScope;
 
@@ -35,13 +38,13 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class SubtreeScopeEvaluator<E, ID extends Comparable<ID>> implements Evaluator<ScopeNode,
E, ID>
+public class SubtreeScopeEvaluator implements Evaluator<ScopeNode>
 {
     /** The ScopeNode containing initial search scope constraints */
     private final ScopeNode node;
 
     /** The entry identifier of the scope base */
-    private final ID baseId;
+    private final UUID baseId;
 
     /** 
      * Whether or not to accept all candidates.  If this evaluator's baseId is
@@ -59,7 +62,7 @@ public class SubtreeScopeEvaluator<E, ID
     private final boolean dereferencing;
 
     /** The entry database/store */
-    private final Store<E, ID> db;
+    private final Store db;
 
 
     /**
@@ -69,7 +72,7 @@ public class SubtreeScopeEvaluator<E, ID
      * @param db the database used to evaluate scope node
      * @throws Exception on db access failure
      */
-    public SubtreeScopeEvaluator( Store<E, ID> db, ScopeNode node ) throws Exception
+    public SubtreeScopeEvaluator( Store db, ScopeNode node ) throws Exception
     {
         this.db = db;
         this.node = node;
@@ -80,16 +83,16 @@ public class SubtreeScopeEvaluator<E, ID
         }
 
         baseId = db.getEntryId( node.getBaseDn() );
-        baseIsContextEntry = getContextEntryId() == baseId;
+        baseIsContextEntry = ( getContextEntryId().compareTo( baseId ) == 0 );
         dereferencing = node.getDerefAliases().isDerefInSearching() || node.getDerefAliases().isDerefAlways();
     }
 
-    private ID contextEntryId;
+    private UUID contextEntryId;
 
 
     // This will suppress PMD.EmptyCatchBlock warnings in this method
     @SuppressWarnings("PMD.EmptyCatchBlock")
-    private ID getContextEntryId() throws Exception
+    private UUID getContextEntryId() throws Exception
     {
         if ( contextEntryId == null )
         {
@@ -123,9 +126,9 @@ public class SubtreeScopeEvaluator<E, ID
      * @throws Exception if the index lookups fail.
      * @see Evaluator#evaluate(org.apache.directory.server.xdbm.IndexEntry)
      */
-    public boolean evaluate( IndexEntry<?, ID> candidate ) throws Exception
+    public boolean evaluate( IndexEntry<?> candidate ) throws Exception
     {
-        ID id = candidate.getId();
+        UUID id = candidate.getId();
         
         /*
          * This condition catches situations where the candidate is equal to 
@@ -192,7 +195,7 @@ public class SubtreeScopeEvaluator<E, ID
      * @throws Exception if the index lookups fail.
      * @see Evaluator#evaluate(org.apache.directory.server.xdbm.IndexEntry)
      */
-    public boolean evaluateEntry( E candidate ) throws Exception
+    public boolean evaluateEntry( Entry candidate ) throws Exception
     {
         throw new UnsupportedOperationException( I18n.err( I18n.ERR_721 ) );
     }
@@ -204,7 +207,7 @@ public class SubtreeScopeEvaluator<E, ID
     }
 
 
-    public ID getBaseId()
+    public UUID getBaseId()
     {
         return baseId;
     }



Mime
View raw message