Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 96060 invoked from network); 1 Mar 2010 07:56:04 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 1 Mar 2010 07:56:04 -0000 Received: (qmail 94540 invoked by uid 500); 28 Feb 2010 22:56:05 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 94481 invoked by uid 500); 28 Feb 2010 22:56:05 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 94474 invoked by uid 99); 28 Feb 2010 22:56:05 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 28 Feb 2010 22:56:05 +0000 X-ASF-Spam-Status: No, hits=-1999.6 required=10.0 tests=ALL_TRUSTED,SUBJECT_FUZZY_TION X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 28 Feb 2010 22:55:58 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 42A972388A3F; Sun, 28 Feb 2010 22:55:37 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@directory.apache.org From: seelmann@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100228225537.42A972388A3F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 Apache Directory Project * @version $$Rev$$ */ -public class ApproximateCursor extends AbstractIndexCursor +public class ApproximateCursor extends AbstractIndexCursor { 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 approximateEvaluator; /** Cursor over attribute entry matching filter: set when index present */ - private final IndexCursor userIdxCursor; + private final IndexCursor userIdxCursor; /** NDN Cursor on all entries in (set when no index on user attribute) */ - private final IndexCursor ndnIdxCursor; + private final IndexCursor ndnIdxCursor; /** used only when ndnIdxCursor is used (no index on attribute) */ private boolean available = false; - public ApproximateCursor( Store db, ApproximateEvaluator approximateEvaluator ) throws Exception + public ApproximateCursor( Store db, ApproximateEvaluator approximateEvaluator ) throws Exception { this.approximateEvaluator = approximateEvaluator; @@ -69,7 +69,7 @@ if ( db.hasUserIndexOn( attribute ) ) { //noinspection unchecked - Index index = ( Index ) db.getUserIndex( attribute ); + Index index = ( Index ) 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 element ) throws Exception + public void before( IndexEntry element ) throws Exception { checkNotClosed( "before()" ); if ( userIdxCursor != null ) @@ -134,7 +134,7 @@ } - public void after( IndexEntry element ) throws Exception + public void after( IndexEntry element ) throws Exception { checkNotClosed( "after()" ); if ( userIdxCursor != null ) @@ -202,7 +202,7 @@ while ( ndnIdxCursor.previous() ) { checkNotClosed( "previous()" ); - IndexEntry candidate = ndnIdxCursor.get(); + IndexEntry candidate = ndnIdxCursor.get(); if ( approximateEvaluator.evaluate( candidate ) ) { return available = true; @@ -223,7 +223,7 @@ while ( ndnIdxCursor.next() ) { checkNotClosed( "next()" ); - IndexEntry candidate = ndnIdxCursor.get(); + IndexEntry candidate = ndnIdxCursor.get(); if ( approximateEvaluator.evaluate( candidate ) ) { return available = true; @@ -235,7 +235,7 @@ @SuppressWarnings("unchecked") - public IndexEntry get() throws Exception + public IndexEntry get() throws Exception { checkNotClosed( "get()" ); if ( userIdxCursor != null ) @@ -245,7 +245,7 @@ if ( available ) { - return ( IndexEntry ) ndnIdxCursor.get(); + return ( IndexEntry ) 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 Apache Directory Project * @version $Rev$ */ -public class ApproximateEvaluator implements Evaluator +public class ApproximateEvaluator implements Evaluator, ServerEntry, ID> { - private final ApproximateNode node; - private final Store db; + private final ApproximateNode node; + private final Store db; private final SchemaManager schemaManager; private final AttributeType type; private final Normalizer normalizer; private final LdapComparator ldapComparator; - private final Index idx; + private final Index idx; - public ApproximateEvaluator( ApproximateNode node, Store db, SchemaManager schemaManager ) + public ApproximateEvaluator( ApproximateNode node, Store db, SchemaManager schemaManager ) throws Exception { this.db = db; @@ -66,7 +66,7 @@ if ( db.hasUserIndexOn( node.getAttribute() ) ) { //noinspection unchecked - idx = ( Index ) db.getUserIndex( node.getAttribute() ); + idx = ( Index ) db.getUserIndex( node.getAttribute() ); type = null; normalizer = null; ldapComparator = null; @@ -89,13 +89,13 @@ } - public ApproximateNode getExpression() + public ApproximateNode 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 indexEntry ) throws Exception + public boolean evaluate( IndexEntry 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 Apache Directory Project * @version $Rev$ */ -public class CursorBuilder +public class CursorBuilder { /** The database used by this builder */ - private Store db = null; + private Store db = null; /** Evaluator dependency on a EvaluatorBuilder */ - private EvaluatorBuilder evaluatorBuilder; + private EvaluatorBuilder evaluatorBuilder; /** @@ -58,14 +64,14 @@ * @param db database used by this enumerator * @param evaluatorBuilder the evaluator builder */ - public CursorBuilder( Store db, EvaluatorBuilder evaluatorBuilder ) + public CursorBuilder( Store db, EvaluatorBuilder evaluatorBuilder ) { this.db = db; this.evaluatorBuilder = evaluatorBuilder; } - public IndexCursor build( ExprNode node ) throws Exception + public IndexCursor 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( db, ( PresenceEvaluator ) 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( 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 buildOrCursor( OrNode node ) throws Exception + private IndexCursor buildOrCursor( OrNode node ) throws Exception { List children = node.getChildren(); - List> childCursors = new ArrayList>( children.size() ); - List> childEvaluators = new ArrayList>( + List> childCursors = new ArrayList>( + children.size() ); + List> childEvaluators = new ArrayList>( 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 buildAndCursor( AndNode node ) throws Exception + private IndexCursor 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> childEvaluators = new ArrayList>( + List> childEvaluators = new ArrayList>( children.size() - 1 ); for ( ExprNode child : children ) { @@ -201,7 +207,7 @@ } // Do recursive call to build min child Cursor then create AndCursor - IndexCursor childCursor = build( minChild ); + IndexCursor 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 Apache Directory Project * @version $Rev$ */ -public class DefaultOptimizer implements Optimizer +public class DefaultOptimizer implements Optimizer { /** the database this optimizer operates on */ - private final Store db; - private Long contextEntryId; + private final Store db; + private ID contextEntryId; /** @@ -62,13 +62,13 @@ * * @param db the database this optimizer works for. */ - public DefaultOptimizer( Store db ) throws Exception + public DefaultOptimizer( Store 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 idx = ( Index ) db.getUserIndex( node.getAttribute() ); + Index idx = ( Index ) db.getUserIndex( node.getAttribute() ); return idx.count( node.getValue().get() ); } @@ -298,7 +298,7 @@ { if ( db.hasUserIndexOn( node.getAttribute() ) ) { - Index idx = ( Index ) db.getUserIndex( node.getAttribute() ); + Index idx = ( Index ) db.getUserIndex( node.getAttribute() ); if ( isGreaterThan ) { return idx.greaterThanCount( node.getValue().get() ); @@ -348,7 +348,7 @@ { if ( db.hasUserIndexOn( node.getAttribute() ) ) { - Index idx = db.getPresenceIndex(); + Index 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 Apache Directory Project * @version $Rev$ */ -public class DefaultSearchEngine implements SearchEngine +public class DefaultSearchEngine implements SearchEngine { /** the Optimizer used by this DefaultSearchEngine */ private final Optimizer optimizer; /** the Database this DefaultSearchEngine operates on */ - private final Store db; + private final Store db; /** creates Cursors over entries satisfying filter expressions */ - private final CursorBuilder cursorBuilder; + private final CursorBuilder cursorBuilder; /** creates evaluators which check to see if candidates satisfy a filter expression */ - private final EvaluatorBuilder evaluatorBuilder; + private final EvaluatorBuilder evaluatorBuilder; // ------------------------------------------------------------------------ @@ -72,8 +72,8 @@ * @param evaluatorBuilder an expression evaluator builder * @param optimizer an optimizer to use during search */ - public DefaultSearchEngine( Store db, CursorBuilder cursorBuilder, EvaluatorBuilder evaluatorBuilder, - Optimizer optimizer ) + public DefaultSearchEngine( Store db, CursorBuilder cursorBuilder, + EvaluatorBuilder evaluatorBuilder, Optimizer optimizer ) { this.db = db; this.optimizer = optimizer; @@ -96,17 +96,17 @@ /** * @see SearchEngine#cursor(LdapDN, AliasDerefMode, ExprNode, SearchControls) */ - public IndexCursor cursor( LdapDN base, AliasDerefMode aliasDerefMode, ExprNode filter, + public IndexCursor 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(); + return new EmptyIndexCursor(); } 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 indexEntry = new ForwardIndexEntry(); + IndexEntry indexEntry = new ForwardIndexEntry(); indexEntry.setId( effectiveBaseId ); optimizer.annotate( filter ); - Evaluator evaluator = evaluatorBuilder.build( filter ); + Evaluator evaluator = evaluatorBuilder.build( filter ); if ( evaluator.evaluate( indexEntry ) ) { - return new SingletonIndexCursor( indexEntry ); + return new SingletonIndexCursor( indexEntry ); } else { - return new EmptyIndexCursor(); + return new EmptyIndexCursor(); } } @@ -171,14 +171,14 @@ // Annotate the node with the optimizer and return search enumeration. optimizer.annotate( root ); - return ( IndexCursor ) cursorBuilder.build( root ); + return ( IndexCursor ) cursorBuilder.build( root ); } /** * @see SearchEngine#evaluator(ExprNode) */ - public Evaluator evaluator( ExprNode filter ) throws Exception + public Evaluator 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 Apache Directory Project * @version $$Rev$$ */ -public class EqualityCursor extends AbstractIndexCursor +public class EqualityCursor extends AbstractIndexCursor { 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 userIdxCursor; + private final IndexCursor userIdxCursor; /** NDN Cursor on all entries in (set when no index on user attribute) */ - private final IndexCursor ndnIdxCursor; + private final IndexCursor ndnIdxCursor; /** used only when ndnIdxCursor is used (no index on attribute) */ private boolean available = false; @SuppressWarnings("unchecked") - public EqualityCursor( Store db, EqualityEvaluator equalityEvaluator ) throws Exception + public EqualityCursor( Store db, EqualityEvaluator equalityEvaluator ) throws Exception { this.equalityEvaluator = equalityEvaluator; @@ -68,7 +68,7 @@ Value value = equalityEvaluator.getExpression().getValue(); if ( db.hasUserIndexOn( attribute ) ) { - Index userIndex = ( Index ) db.getUserIndex( attribute ); + Index userIndex = ( Index ) 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 element ) throws Exception + public void before( IndexEntry 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 element ) throws Exception + public void after( IndexEntry element ) throws Exception { checkNotClosed( "after()" ); if ( userIdxCursor != null ) @@ -202,7 +202,7 @@ while ( ndnIdxCursor.previous() ) { checkNotClosed( "previous()" ); - IndexEntry candidate = ndnIdxCursor.get(); + IndexEntry candidate = ndnIdxCursor.get(); if ( equalityEvaluator.evaluate( candidate ) ) { return available = true; @@ -224,7 +224,7 @@ while ( ndnIdxCursor.next() ) { checkNotClosed( "next()" ); - IndexEntry candidate = ndnIdxCursor.get(); + IndexEntry candidate = ndnIdxCursor.get(); if ( equalityEvaluator.evaluate( candidate ) ) { return available = true; @@ -236,7 +236,7 @@ @SuppressWarnings("unchecked") - public IndexEntry get() throws Exception + public IndexEntry get() throws Exception { checkNotClosed( "get()" ); if ( userIdxCursor != null ) @@ -246,7 +246,7 @@ if ( available ) { - return ( IndexEntry ) ndnIdxCursor.get(); + return ( IndexEntry ) 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 Apache Directory Project * @version $Rev$ */ -public class EqualityEvaluator implements Evaluator, ServerEntry> +public class EqualityEvaluator implements Evaluator, ServerEntry, ID> { private final EqualityNode node; - private final Store db; + private final Store 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_COMPARATOR = new StringComparator( null ); - private final Index idx; + private final Index idx; - public EqualityEvaluator( EqualityNode node, Store db, SchemaManager schemaManager ) + public EqualityEvaluator( EqualityNode node, Store db, SchemaManager schemaManager ) throws Exception { this.db = db; @@ -79,7 +79,7 @@ if ( db.hasUserIndexOn( node.getAttribute() ) ) { //noinspection unchecked - idx = ( Index ) db.getUserIndex( node.getAttribute() ); + idx = ( Index ) db.getUserIndex( node.getAttribute() ); type = null; normalizer = null; comparator = null; @@ -111,7 +111,7 @@ } - public boolean evaluate( IndexEntry indexEntry ) throws Exception + public boolean evaluate( IndexEntry 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 Apache Directory Project * @version $Rev$ */ -public class EvaluatorBuilder +public class EvaluatorBuilder { - private final Store db; + private final Store 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 db, SchemaManager schemaManager ) throws Exception + public EvaluatorBuilder( Store db, SchemaManager schemaManager ) throws Exception { this.db = db; this.schemaManager = schemaManager; } - public Evaluator build( ExprNode node ) throws Exception + public Evaluator 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( ( PresenceNode ) node, db, schemaManager ); case SCOPE: if ( ( ( ScopeNode ) node ).getScope() == SearchScope.ONELEVEL ) { - return new OneLevelScopeEvaluator( db, ( ScopeNode ) node ); + return new OneLevelScopeEvaluator( db, ( ScopeNode ) node ); } else { - return new SubtreeScopeEvaluator( db, ( ScopeNode ) node ); + return new SubtreeScopeEvaluator( db, ( ScopeNode ) node ); } case SUBSTRING: - return new SubstringEvaluator( ( SubstringNode ) node, db, schemaManager ); + return new SubstringEvaluator( ( 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( ( NotNode ) node, build( ( ( NotNode ) node ).getFirstChild() ) ); case OR: return buildOrEvaluator( ( OrNode ) node ); @@ -127,28 +127,28 @@ } - AndEvaluator buildAndEvaluator( AndNode node ) throws Exception + AndEvaluator buildAndEvaluator( AndNode node ) throws Exception { List children = node.getChildren(); - List> evaluators = new ArrayList>( + List> evaluators = new ArrayList>( children.size() ); for ( ExprNode child : children ) { evaluators.add( build( child ) ); } - return new AndEvaluator( node, evaluators ); + return new AndEvaluator( node, evaluators ); } - OrEvaluator buildOrEvaluator( OrNode node ) throws Exception + OrEvaluator buildOrEvaluator( OrNode node ) throws Exception { List children = node.getChildren(); - List> evaluators = new ArrayList>( + List> evaluators = new ArrayList>( children.size() ); for ( ExprNode child : children ) { evaluators.add( build( child ) ); } - return new OrEvaluator( node, evaluators ); + return new OrEvaluator( 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 Apache Directory Project * @version $Rev$ */ -public class GreaterEqCursor extends AbstractIndexCursor +public class GreaterEqCursor extends AbstractIndexCursor { 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 greaterEqEvaluator; /** Cursor over attribute entry matching filter: set when index present */ - private final IndexCursor userIdxCursor; + private final IndexCursor userIdxCursor; /** NDN Cursor on all entries in (set when no index on user attribute) */ - private final IndexCursor ndnIdxCursor; + private final IndexCursor 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 ndnCandidate; + IndexEntry ndnCandidate; /** used in both modes */ private boolean available = false; @SuppressWarnings("unchecked") - public GreaterEqCursor( Store db, GreaterEqEvaluator greaterEqEvaluator ) throws Exception + public GreaterEqCursor( Store db, GreaterEqEvaluator greaterEqEvaluator ) throws Exception { this.greaterEqEvaluator = greaterEqEvaluator; String attribute = greaterEqEvaluator.getExpression().getAttribute(); if ( db.hasUserIndexOn( attribute ) ) { - userIdxCursor = ( ( Index ) db.getUserIndex( attribute ) ).forwardCursor(); + userIdxCursor = ( ( Index ) 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 element ) throws Exception + public void before( IndexEntry element ) throws Exception { checkNotClosed( "before()" ); if ( userIdxCursor != null ) @@ -193,7 +193,7 @@ @SuppressWarnings("unchecked") - public void after( IndexEntry element ) throws Exception + public void after( IndexEntry element ) throws Exception { checkNotClosed( "after()" ); if ( userIdxCursor != null ) @@ -238,7 +238,7 @@ checkNotClosed( "beforeFirst()" ); if ( userIdxCursor != null ) { - IndexEntry advanceTo = new ForwardIndexEntry(); + IndexEntry advanceTo = new ForwardIndexEntry(); advanceTo.setValue( ( V ) greaterEqEvaluator.getExpression().getValue().get() ); userIdxCursor.before( advanceTo ); } @@ -296,7 +296,7 @@ while ( userIdxCursor.previous() ) { checkNotClosed( "previous()" ); - IndexEntry candidate = userIdxCursor.get(); + IndexEntry candidate = userIdxCursor.get(); if ( greaterEqEvaluator.getComparator().compare( candidate.getValue(), greaterEqEvaluator.getExpression().getValue().get() ) >= 0 ) { @@ -348,7 +348,7 @@ @SuppressWarnings("unchecked") - public IndexEntry get() throws Exception + public IndexEntry get() throws Exception { checkNotClosed( "get()" ); if ( userIdxCursor != null ) @@ -363,7 +363,7 @@ if ( available ) { - return ( IndexEntry ) ndnCandidate; + return ( IndexEntry ) 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 Apache Directory Project * @version $Rev$ */ -public class GreaterEqEvaluator implements Evaluator +public class GreaterEqEvaluator implements Evaluator, ServerEntry, ID> { - private final GreaterEqNode node; - private final Store db; + private final GreaterEqNode node; + private final Store db; private final SchemaManager schemaManager; private final AttributeType type; private final Normalizer normalizer; private final Comparator comparator; - private final Index idx; + private final Index idx; - public GreaterEqEvaluator( GreaterEqNode node, Store db, SchemaManager schemaManager ) + public GreaterEqEvaluator( GreaterEqNode node, Store db, SchemaManager schemaManager ) throws Exception { this.db = db; @@ -67,7 +67,7 @@ if ( db.hasUserIndexOn( node.getAttribute() ) ) { //noinspection unchecked - idx = ( Index ) db.getUserIndex( node.getAttribute() ); + idx = ( Index ) db.getUserIndex( node.getAttribute() ); } else { @@ -121,7 +121,7 @@ } - public boolean evaluate( IndexEntry indexEntry ) throws Exception + public boolean evaluate( IndexEntry 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 ) indexEntry, attr ) ) + if ( attr != null && evaluate( ( IndexEntry ) indexEntry, attr ) ) { return true; } @@ -173,7 +173,7 @@ attr = ( ServerAttribute ) entry.get( descendant ); //noinspection unchecked - if ( attr != null && evaluate( ( IndexEntry ) indexEntry, attr ) ) + if ( attr != null && evaluate( ( IndexEntry ) 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 indexEntry, ServerAttribute attribute ) throws Exception + private boolean evaluate( IndexEntry 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 Apache Directory Project * @version $$Rev$$ */ -public class LessEqCursor extends AbstractIndexCursor +public class LessEqCursor extends AbstractIndexCursor { private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_716 ); /** An less eq evaluator for candidates */ - private final LessEqEvaluator lessEqEvaluator; + private final LessEqEvaluator lessEqEvaluator; /** Cursor over attribute entry matching filter: set when index present */ - private final IndexCursor userIdxCursor; + private final IndexCursor userIdxCursor; /** NDN Cursor on all entries in (set when no index on user attribute) */ - private final IndexCursor ndnIdxCursor; + private final IndexCursor 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 ndnCandidate; + IndexEntry ndnCandidate; /** used in both modes */ private boolean available = false; @SuppressWarnings("unchecked") - public LessEqCursor( Store db, LessEqEvaluator lessEqEvaluator ) throws Exception + public LessEqCursor( Store db, LessEqEvaluator lessEqEvaluator ) throws Exception { this.lessEqEvaluator = lessEqEvaluator; String attribute = lessEqEvaluator.getExpression().getAttribute(); if ( db.hasUserIndexOn( attribute ) ) { - userIdxCursor = ( ( Index ) db.getUserIndex( attribute ) ).forwardCursor(); + userIdxCursor = ( ( Index ) db.getUserIndex( attribute ) ).forwardCursor(); ndnIdxCursor = null; } else { - ndnIdxCursor = ( IndexCursor ) db.getNdnIndex().forwardCursor(); + ndnIdxCursor = ( IndexCursor ) 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 element ) throws Exception + public void before( IndexEntry 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 element ) throws Exception + public void after( IndexEntry element ) throws Exception { checkNotClosed( "after()" ); if ( userIdxCursor != null ) @@ -273,7 +273,7 @@ checkNotClosed( "afterLast()" ); if ( userIdxCursor != null ) { - IndexEntry advanceTo = new ForwardIndexEntry(); + IndexEntry advanceTo = new ForwardIndexEntry(); //noinspection unchecked advanceTo.setValue( ( V ) lessEqEvaluator.getExpression().getValue().get() ); userIdxCursor.after( advanceTo ); @@ -348,7 +348,7 @@ while ( userIdxCursor.next() ) { checkNotClosed( "next()" ); - IndexEntry candidate = userIdxCursor.get(); + IndexEntry candidate = userIdxCursor.get(); if ( lessEqEvaluator.getLdapComparator().compare( candidate.getValue(), lessEqEvaluator.getExpression().getValue().get() ) <= 0 ) { @@ -377,7 +377,7 @@ } - public IndexEntry get() throws Exception + public IndexEntry 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 Apache Directory Project * @version $Rev$ */ -public class LessEqEvaluator implements Evaluator +public class LessEqEvaluator implements Evaluator, ServerEntry, ID> { - private final LessEqNode node; - private final Store db; + private final LessEqNode node; + private final Store db; private final SchemaManager schemaManager; private final AttributeType type; private final Normalizer normalizer; private final LdapComparator ldapComparator; - private final Index idx; + private final Index idx; - public LessEqEvaluator( LessEqNode node, Store db, SchemaManager schemaManager ) throws Exception + public LessEqEvaluator( LessEqNode node, Store db, SchemaManager schemaManager ) throws Exception { this.db = db; this.node = node; @@ -66,7 +66,7 @@ if ( db.hasUserIndexOn( node.getAttribute() ) ) { //noinspection unchecked - idx = ( Index ) db.getUserIndex( node.getAttribute() ); + idx = ( Index ) db.getUserIndex( node.getAttribute() ); } else { @@ -96,7 +96,7 @@ } - public LessEqNode getExpression() + public LessEqNode 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 indexEntry ) throws Exception + public boolean evaluate( IndexEntry 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 ) indexEntry, attr ) ) + if ( attr != null && evaluate( ( IndexEntry ) indexEntry, attr ) ) { return true; } @@ -180,7 +180,7 @@ attr = ( ServerAttribute ) entry.get( descendant ); //noinspection unchecked - if ( attr != null && evaluate( ( IndexEntry ) indexEntry, attr ) ) + if ( attr != null && evaluate( ( IndexEntry ) 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 indexEntry, ServerAttribute attribute ) throws Exception + private boolean evaluate( IndexEntry 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 Apache Directory Project * @version $$Rev$$ */ -public class NotCursor extends AbstractIndexCursor +public class NotCursor extends AbstractIndexCursor { private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_718 ); - private final IndexCursor ndnCursor; - private final Evaluator childEvaluator; + private final IndexCursor ndnCursor; + private final Evaluator childEvaluator; private boolean available = false; @SuppressWarnings("unchecked") - public NotCursor( Store db, Evaluator childEvaluator ) + public NotCursor( Store db, Evaluator childEvaluator ) throws Exception { this.childEvaluator = childEvaluator; - this.ndnCursor = ( IndexCursor ) db.getNdnIndex().forwardCursor(); + this.ndnCursor = ( IndexCursor ) 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 element ) throws Exception + public void before( IndexEntry element ) throws Exception { throw new UnsupportedOperationException( UNSUPPORTED_MSG ); } - public void after( IndexEntry element ) throws Exception + public void after( IndexEntry 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 candidate = ndnCursor.get(); + IndexEntry candidate = ndnCursor.get(); if ( !childEvaluator.evaluate( candidate ) ) { return available = true; @@ -135,7 +135,7 @@ while ( ndnCursor.next() ) { checkNotClosed( "next()" ); - IndexEntry candidate = ndnCursor.get(); + IndexEntry candidate = ndnCursor.get(); if ( !childEvaluator.evaluate( candidate ) ) { return available = true; @@ -146,7 +146,7 @@ } - public IndexEntry get() throws Exception + public IndexEntry 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 Apache Directory Project * @version $$Rev$$ */ -public class NotEvaluator implements Evaluator +public class NotEvaluator implements Evaluator { private final NotNode node; - private final Evaluator childEvaluator; + private final Evaluator childEvaluator; - public NotEvaluator( NotNode node, Evaluator childEvaluator ) + public NotEvaluator( NotNode node, Evaluator 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 indexEntry ) throws Exception + public boolean evaluate( IndexEntry 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 Apache Directory Project * @version $Rev$ */ -public class OneLevelScopeCursor extends AbstractIndexCursor +public class OneLevelScopeCursor extends AbstractIndexCursor { /** Error message for unsupported operations */ private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_719 ); /** The entry database/store */ - private final Store db; + private final Store 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 scopeCursor; + private final IndexCursor scopeCursor; /** A Cursor over entries brought into scope by alias dereferencing */ - private final Cursor> dereferencedCursor; + private final Cursor> dereferencedCursor; /** Currently active Cursor: we switch between two cursors */ - private Cursor> cursor; + private Cursor> 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 db, OneLevelScopeEvaluator evaluator ) throws Exception + //@SuppressWarnings("unchecked") + public OneLevelScopeCursor( Store db, OneLevelScopeEvaluator 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 element ) throws Exception + public void before( IndexEntry element ) throws Exception { throw new UnsupportedOperationException( UNSUPPORTED_MSG ); } - public void after( IndexEntry element ) throws Exception + public void after( IndexEntry element ) throws Exception { throw new UnsupportedOperationException( UNSUPPORTED_MSG ); } @@ -289,7 +290,7 @@ } - public IndexEntry get() throws Exception + public IndexEntry 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 Apache Directory Project * @version $Rev$ */ -public class OneLevelScopeEvaluator implements Evaluator +public class OneLevelScopeEvaluator implements Evaluator { /** 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 db; + private final Store db; /** @@ -56,7 +56,7 @@ * @param db the database used to evaluate scope node * @throws Exception on db access failure */ - public OneLevelScopeEvaluator( Store db, ScopeNode node ) throws Exception + public OneLevelScopeEvaluator( Store 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 candidate ) throws Exception + public boolean evaluate( IndexEntry 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 Apache Directory Project * @version $Rev$ */ -public class OrCursor extends AbstractIndexCursor +public class OrCursor extends AbstractIndexCursor { private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_722 ); - private final List> cursors; - private final List> evaluators; - private final List> blacklists; + private final List> cursors; + private final List> evaluators; + private final List> blacklists; private int cursorIndex = -1; private boolean available = false; // TODO - do same evaluator fail fast optimization that we do in AndCursor - public OrCursor( List> cursors, - List> evaluators ) + public OrCursor( List> cursors, + List> evaluators ) { if ( cursors.size() <= 1 ) { @@ -63,11 +63,11 @@ this.cursors = cursors; this.evaluators = evaluators; - this.blacklists = new ArrayList>(); + this.blacklists = new ArrayList>(); for ( int ii = 0; ii < cursors.size(); ii++ ) { - this.blacklists.add( new HashSet() ); + this.blacklists.add( new HashSet() ); } this.cursorIndex = 0; } @@ -79,25 +79,25 @@ } - public void before( IndexEntry element ) throws Exception + public void before( IndexEntry element ) throws Exception { throw new UnsupportedOperationException( UNSUPPORTED_MSG ); } - public void after( IndexEntry element ) throws Exception + public void after( IndexEntry 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 indexEntry ) throws Exception + private void blackListIfDuplicate( IndexEntry indexEntry ) throws Exception { for ( int ii = 0; ii < evaluators.size(); ii++ ) { @@ -170,7 +170,7 @@ while ( cursors.get( cursorIndex ).previous() ) { checkNotClosed( "previous()" ); - IndexEntry candidate = cursors.get( cursorIndex ).get(); + IndexEntry candidate = cursors.get( cursorIndex ).get(); if ( !isBlackListed( candidate.getId() ) ) { blackListIfDuplicate( candidate ); @@ -187,7 +187,7 @@ while ( cursors.get( cursorIndex ).previous() ) { checkNotClosed( "previous()" ); - IndexEntry candidate = cursors.get( cursorIndex ).get(); + IndexEntry candidate = cursors.get( cursorIndex ).get(); if ( !isBlackListed( candidate.getId() ) ) { blackListIfDuplicate( candidate ); @@ -205,7 +205,7 @@ while ( cursors.get( cursorIndex ).next() ) { checkNotClosed( "next()" ); - IndexEntry candidate = cursors.get( cursorIndex ).get(); + IndexEntry candidate = cursors.get( cursorIndex ).get(); if ( !isBlackListed( candidate.getId() ) ) { blackListIfDuplicate( candidate ); @@ -222,7 +222,7 @@ while ( cursors.get( cursorIndex ).next() ) { checkNotClosed( "previous()" ); - IndexEntry candidate = cursors.get( cursorIndex ).get(); + IndexEntry candidate = cursors.get( cursorIndex ).get(); if ( !isBlackListed( candidate.getId() ) ) { blackListIfDuplicate( candidate ); @@ -235,7 +235,7 @@ } - public IndexEntry get() throws Exception + public IndexEntry 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 Apache Directory Project * @version $$Rev$$ */ -public class OrEvaluator implements Evaluator +public class OrEvaluator implements Evaluator { - private final List> evaluators; + private final List> evaluators; private final OrNode node; - public OrEvaluator( OrNode node, List> evaluators ) + public OrEvaluator( OrNode node, List> 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> optimize( - List> unoptimized ) + private List> optimize( + List> unoptimized ) { - List> optimized = new ArrayList>( + List> optimized = new ArrayList>( unoptimized.size() ); optimized.addAll( unoptimized ); - Collections.sort( optimized, new Comparator>() + Collections.sort( optimized, new Comparator>() { - public int compare( Evaluator e1, - Evaluator e2 ) + public int compare( Evaluator e1, + Evaluator e2 ) { long scanCount1 = ( Long ) e1.getExpression().get( "count" ); long scanCount2 = ( Long ) e2.getExpression().get( "count" ); @@ -101,9 +101,9 @@ } - public boolean evaluate( IndexEntry indexEntry ) throws Exception + public boolean evaluate( IndexEntry indexEntry ) throws Exception { - for ( Evaluator evaluator : evaluators ) + for ( Evaluator 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 evaluator : evaluators ) + for ( Evaluator 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 evaluator : evaluators ) + for ( Evaluator 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 Apache Directory Project * @version $$Rev$$ */ -public class PresenceCursor extends AbstractIndexCursor +public class PresenceCursor extends AbstractIndexCursor { private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_724 ); - private final IndexCursor ndnCursor; - private final IndexCursor presenceCursor; - private final PresenceEvaluator presenceEvaluator; + private final IndexCursor ndnCursor; + private final IndexCursor presenceCursor; + private final PresenceEvaluator presenceEvaluator; private boolean available = false; - public PresenceCursor( Store db, PresenceEvaluator presenceEvaluator ) throws Exception + public PresenceCursor( Store db, PresenceEvaluator 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 element ) throws Exception + public void before( IndexEntry 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 element ) throws Exception + public void after( IndexEntry element ) throws Exception { checkNotClosed( "after()" ); if ( presenceCursor != null ) @@ -191,7 +191,7 @@ while ( ndnCursor.previous() ) { checkNotClosed( "previous()" ); - IndexEntry candidate = ndnCursor.get(); + IndexEntry candidate = ndnCursor.get(); if ( presenceEvaluator.evaluate( candidate ) ) { return available = true; @@ -213,7 +213,7 @@ while ( ndnCursor.next() ) { checkNotClosed( "next()" ); - IndexEntry candidate = ndnCursor.get(); + IndexEntry candidate = ndnCursor.get(); if ( presenceEvaluator.evaluate( candidate ) ) { return available = true; @@ -224,7 +224,7 @@ } - public IndexEntry get() throws Exception + public IndexEntry 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 indexEntry = ndnCursor.get(); + IndexEntry 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 Apache Directory Project * @version $Rev$ */ -public class PresenceEvaluator implements Evaluator +public class PresenceEvaluator implements Evaluator { private final PresenceNode node; - private final Store db; + private final Store db; private final AttributeType type; private final SchemaManager schemaManager; - private final Index idx; + private final Index idx; - public PresenceEvaluator( PresenceNode node, Store db, SchemaManager schemaManager ) throws Exception + public PresenceEvaluator( PresenceNode node, Store 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 indexEntry ) throws Exception + public boolean evaluate( IndexEntry 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 );