You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2012/08/29 16:23:11 UTC
svn commit: r1378574 [2/6] - in
/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src:
main/java/org/apache/directory/server/core/partition/impl/avl/
main/java/org/apache/directory/server/core/partition/impl/btree/
main/java/org/apache/director...
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlIndex.java?rev=1378574&r1=1378573&r2=1378574&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlIndex.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlIndex.java Wed Aug 29 14:23:08 2012
@@ -21,9 +21,9 @@ package org.apache.directory.server.xdbm
import java.net.URI;
+import java.util.UUID;
import org.apache.directory.server.core.partition.impl.btree.IndexCursorAdaptor;
-import org.apache.directory.server.core.partition.impl.btree.LongComparator;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.xdbm.AbstractIndex;
import org.apache.directory.server.xdbm.EmptyIndexCursor;
@@ -36,6 +36,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.schema.MatchingRule;
import org.apache.directory.shared.ldap.model.schema.Normalizer;
import org.apache.directory.shared.ldap.model.schema.SchemaManager;
+import org.apache.directory.shared.ldap.model.schema.comparators.UuidComparator;
/**
@@ -43,11 +44,11 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class AvlIndex<K, O> extends AbstractIndex<K, O, Long>
+public class AvlIndex<K, O> extends AbstractIndex<K, O, UUID>
{
protected Normalizer normalizer;
- protected AvlTable<K, Long> forward;
- protected AvlTable<Long, K> reverse;
+ protected AvlTable<K, UUID> forward;
+ protected AvlTable<UUID, K> reverse;
public AvlIndex()
@@ -98,7 +99,7 @@ public class AvlIndex<K, O> extends Abst
* primary keys. A value for an attribute can occur several times in
* different entries so the forward map can have more than one value.
*/
- forward = new AvlTable<K, Long>( attributeType.getName(), comp, LongComparator.INSTANCE, true );
+ forward = new AvlTable<K, UUID>( attributeType.getName(), comp, UuidComparator.INSTANCE, true );
/*
* Now the reverse map stores the primary key into the master table as
@@ -110,17 +111,17 @@ public class AvlIndex<K, O> extends Abst
{
if ( attributeType.isSingleValued() )
{
- reverse = new AvlTable<Long, K>( attributeType.getName(), LongComparator.INSTANCE, comp, false );
+ reverse = new AvlTable<UUID, K>( attributeType.getName(), UuidComparator.INSTANCE, comp, false );
}
else
{
- reverse = new AvlTable<Long, K>( attributeType.getName(), LongComparator.INSTANCE, comp, true );
+ reverse = new AvlTable<UUID, K>( attributeType.getName(), UuidComparator.INSTANCE, comp, true );
}
}
}
- public void add( K attrVal, Long id ) throws Exception
+ public void add( K attrVal, UUID id ) throws Exception
{
forward.put( attrVal, id );
@@ -169,17 +170,17 @@ public class AvlIndex<K, O> extends Abst
/**
* {@inheritDoc}
*/
- public void drop( Long id ) throws Exception
+ public void drop( UUID id ) throws Exception
{
if ( withReverse )
{
if ( isDupsEnabled() )
{
- Cursor<Tuple<Long, K>> cursor = reverse.cursor( id );
+ Cursor<Tuple<UUID, K>> cursor = reverse.cursor( id );
while ( cursor.next() )
{
- Tuple<Long, K> tuple = cursor.get();
+ Tuple<UUID, K> tuple = cursor.get();
forward.remove( tuple.getValue(), id );
}
@@ -200,7 +201,7 @@ public class AvlIndex<K, O> extends Abst
/**
* {@inheritDoc}
*/
- public void drop( K attrVal, Long id ) throws Exception
+ public void drop( K attrVal, UUID id ) throws Exception
{
forward.remove( attrVal, id );
@@ -223,7 +224,7 @@ public class AvlIndex<K, O> extends Abst
/**
* {@inheritDoc}
*/
- public boolean forward( K attrVal, Long id ) throws Exception
+ public boolean forward( K attrVal, UUID id ) throws Exception
{
return forward.has( attrVal, id );
}
@@ -233,7 +234,7 @@ public class AvlIndex<K, O> extends Abst
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public Cursor<IndexEntry<K, Long>> forwardCursor() throws Exception
+ public Cursor<IndexEntry<K, UUID>> forwardCursor() throws Exception
{
return new IndexCursorAdaptor( forward.cursor(), true );
}
@@ -243,7 +244,7 @@ public class AvlIndex<K, O> extends Abst
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public Cursor<IndexEntry<K, Long>> forwardCursor( K key ) throws Exception
+ public Cursor<IndexEntry<K, UUID>> forwardCursor( K key ) throws Exception
{
return new IndexCursorAdaptor( forward.cursor( key ), true );
}
@@ -261,7 +262,7 @@ public class AvlIndex<K, O> extends Abst
/**
* {@inheritDoc}
*/
- public boolean forwardGreaterOrEq( K attrVal, Long id ) throws Exception
+ public boolean forwardGreaterOrEq( K attrVal, UUID id ) throws Exception
{
return forward.hasGreaterOrEqual( attrVal, id );
}
@@ -279,7 +280,7 @@ public class AvlIndex<K, O> extends Abst
/**
* {@inheritDoc}
*/
- public boolean forwardLessOrEq( K attrVal, Long id ) throws Exception
+ public boolean forwardLessOrEq( K attrVal, UUID id ) throws Exception
{
return forward.hasLessOrEqual( attrVal, id );
}
@@ -288,7 +289,7 @@ public class AvlIndex<K, O> extends Abst
/**
* {@inheritDoc}
*/
- public Long forwardLookup( K attrVal ) throws Exception
+ public UUID forwardLookup( K attrVal ) throws Exception
{
return forward.get( attrVal );
}
@@ -297,7 +298,7 @@ public class AvlIndex<K, O> extends Abst
/**
* {@inheritDoc}
*/
- public Cursor<Long> forwardValueCursor( K key ) throws Exception
+ public Cursor<UUID> forwardValueCursor( K key ) throws Exception
{
return forward.valueCursor( key );
}
@@ -324,7 +325,7 @@ public class AvlIndex<K, O> extends Abst
/**
* {@inheritDoc}
*/
- public boolean reverse( Long id ) throws Exception
+ public boolean reverse( UUID id ) throws Exception
{
if ( withReverse )
{
@@ -340,7 +341,7 @@ public class AvlIndex<K, O> extends Abst
/**
* {@inheritDoc}
*/
- public boolean reverse( Long id, K attrVal ) throws Exception
+ public boolean reverse( UUID id, K attrVal ) throws Exception
{
if ( withReverse )
{
@@ -357,7 +358,7 @@ public class AvlIndex<K, O> extends Abst
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public Cursor<IndexEntry<K, Long>> reverseCursor() throws Exception
+ public Cursor<IndexEntry<K, UUID>> reverseCursor() throws Exception
{
if ( withReverse )
{
@@ -365,7 +366,7 @@ public class AvlIndex<K, O> extends Abst
}
else
{
- return new EmptyIndexCursor<K, Long>();
+ return new EmptyIndexCursor<K>();
}
}
@@ -374,7 +375,7 @@ public class AvlIndex<K, O> extends Abst
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public Cursor<IndexEntry<K, Long>> reverseCursor( Long id ) throws Exception
+ public Cursor<IndexEntry<K, UUID>> reverseCursor( UUID id ) throws Exception
{
if ( withReverse )
{
@@ -382,7 +383,7 @@ public class AvlIndex<K, O> extends Abst
}
else
{
- return new EmptyIndexCursor<K, Long>();
+ return new EmptyIndexCursor<K>();
}
}
@@ -390,7 +391,7 @@ public class AvlIndex<K, O> extends Abst
/**
* {@inheritDoc}
*/
- public boolean reverseGreaterOrEq( Long id ) throws Exception
+ public boolean reverseGreaterOrEq( UUID id ) throws Exception
{
if ( withReverse )
{
@@ -406,7 +407,7 @@ public class AvlIndex<K, O> extends Abst
/**
* {@inheritDoc}
*/
- public boolean reverseGreaterOrEq( Long id, K attrVal ) throws Exception
+ public boolean reverseGreaterOrEq( UUID id, K attrVal ) throws Exception
{
if ( withReverse )
{
@@ -422,7 +423,7 @@ public class AvlIndex<K, O> extends Abst
/**
* {@inheritDoc}
*/
- public boolean reverseLessOrEq( Long id ) throws Exception
+ public boolean reverseLessOrEq( UUID id ) throws Exception
{
if ( withReverse )
{
@@ -438,7 +439,7 @@ public class AvlIndex<K, O> extends Abst
/**
* {@inheritDoc}
*/
- public boolean reverseLessOrEq( Long id, K attrVal ) throws Exception
+ public boolean reverseLessOrEq( UUID id, K attrVal ) throws Exception
{
if ( withReverse )
{
@@ -454,7 +455,7 @@ public class AvlIndex<K, O> extends Abst
/**
* {@inheritDoc}
*/
- public K reverseLookup( Long id ) throws Exception
+ public K reverseLookup( UUID id ) throws Exception
{
if ( withReverse )
{
@@ -470,7 +471,7 @@ public class AvlIndex<K, O> extends Abst
/**
* {@inheritDoc}
*/
- public Cursor<K> reverseValueCursor( Long id ) throws Exception
+ public Cursor<K> reverseValueCursor( UUID id ) throws Exception
{
if ( withReverse )
{
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlMasterTable.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlMasterTable.java?rev=1378574&r1=1378573&r2=1378574&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlMasterTable.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlMasterTable.java Wed Aug 29 14:23:08 2012
@@ -21,7 +21,7 @@ package org.apache.directory.server.xdbm
import java.util.Comparator;
-import java.util.concurrent.atomic.AtomicLong;
+import java.util.UUID;
import org.apache.directory.server.xdbm.MasterTable;
@@ -32,12 +32,9 @@ import org.apache.directory.server.xdbm.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class AvlMasterTable<E> extends AvlTable<Long, E> implements MasterTable<Long, E>
+public class AvlMasterTable<E> extends AvlTable<UUID, E> implements MasterTable<E>
{
- private AtomicLong counter = new AtomicLong( 0 );
-
-
- public AvlMasterTable( String name, Comparator<Long> keyComparator, Comparator<E> valComparator,
+ public AvlMasterTable( String name, Comparator<UUID> keyComparator, Comparator<E> valComparator,
boolean dupsEnabled )
{
super( name, keyComparator, valComparator, dupsEnabled );
@@ -47,17 +44,8 @@ public class AvlMasterTable<E> extends A
/**
* {@inheritDoc}
*/
- public Long getNextId( E entry ) throws Exception
- {
- return counter.incrementAndGet();
- }
-
-
- /**
- * {@inheritDoc}
- */
- public void resetCounter() throws Exception
+ public UUID getNextId( E entry ) throws Exception
{
- counter.set( 0L );
+ return UUID.randomUUID();
}
}
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndex.java?rev=1378574&r1=1378573&r2=1378574&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndex.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndex.java Wed Aug 29 14:23:08 2012
@@ -21,7 +21,8 @@
package org.apache.directory.server.xdbm.impl.avl;
-import org.apache.directory.server.core.partition.impl.btree.LongComparator;
+import java.util.UUID;
+
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.xdbm.ParentIdAndRdn;
import org.apache.directory.server.xdbm.ParentIdAndRdnComparator;
@@ -29,6 +30,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.schema.AttributeType;
import org.apache.directory.shared.ldap.model.schema.MatchingRule;
import org.apache.directory.shared.ldap.model.schema.SchemaManager;
+import org.apache.directory.shared.ldap.model.schema.comparators.UuidComparator;
/**
@@ -36,7 +38,7 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class AvlRdnIndex extends AvlIndex<ParentIdAndRdn<Long>, Entry>
+public class AvlRdnIndex extends AvlIndex<ParentIdAndRdn<UUID>, Entry>
{
public AvlRdnIndex()
{
@@ -73,18 +75,18 @@ public class AvlRdnIndex extends AvlInde
throw new Exception( I18n.err( I18n.ERR_212, attributeType ) );
}
- ParentIdAndRdnComparator<Long> comp = new ParentIdAndRdnComparator<Long>( mr.getOid() );
+ ParentIdAndRdnComparator<UUID> comp = new ParentIdAndRdnComparator<UUID>( mr.getOid() );
- LongComparator.INSTANCE.setSchemaManager( schemaManager );
+ UuidComparator.INSTANCE.setSchemaManager( schemaManager );
/*
* The forward key/value map stores attribute values to master table
* primary keys. A value for an attribute can occur several times in
* different entries so the forward map can have more than one value.
*/
- forward = new AvlTable<ParentIdAndRdn<Long>, Long>( attributeType.getName(), comp, LongComparator.INSTANCE,
+ forward = new AvlTable<ParentIdAndRdn<UUID>, UUID>( attributeType.getName(), comp, UuidComparator.INSTANCE,
false );
- reverse = new AvlTable<Long, ParentIdAndRdn<Long>>( attributeType.getName(), LongComparator.INSTANCE, comp,
+ reverse = new AvlTable<UUID, ParentIdAndRdn<UUID>>( attributeType.getName(), UuidComparator.INSTANCE, comp,
false );
}
}
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/Evaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/Evaluator.java?rev=1378574&r1=1378573&r2=1378574&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/Evaluator.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/Evaluator.java Wed Aug 29 14:23:08 2012
@@ -20,6 +20,8 @@
package org.apache.directory.server.xdbm.search;
+import java.util.UUID;
+
import org.apache.directory.server.xdbm.IndexEntry;
import org.apache.directory.shared.ldap.model.entry.Entry;
import org.apache.directory.shared.ldap.model.filter.ExprNode;
@@ -49,7 +51,7 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public interface Evaluator<N extends ExprNode, ID>
+public interface Evaluator<N extends ExprNode>
{
/**
* Evaluates a candidate to determine if a filter expression selects it.
@@ -63,7 +65,7 @@ public interface Evaluator<N extends Exp
* @return true if filter selects the candidate false otherwise
* @throws Exception if there are faults during evaluation
*/
- boolean evaluate( IndexEntry<?, ID> entry ) throws Exception;
+ boolean evaluate( IndexEntry<?, UUID> entry ) throws Exception;
/**
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/SearchEngine.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/SearchEngine.java?rev=1378574&r1=1378573&r2=1378574&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/SearchEngine.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/SearchEngine.java Wed Aug 29 14:23:08 2012
@@ -20,6 +20,8 @@
package org.apache.directory.server.xdbm.search;
+import java.util.UUID;
+
import org.apache.directory.server.xdbm.IndexEntry;
import org.apache.directory.shared.ldap.model.constants.JndiPropertyConstants;
import org.apache.directory.shared.ldap.model.cursor.Cursor;
@@ -35,7 +37,7 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public interface SearchEngine<E, ID>
+public interface SearchEngine<E>
{
/**
* @todo put this in the right place
@@ -82,7 +84,7 @@ public interface SearchEngine<E, ID>
* @return enumeration over SearchResults
* @throws Exception if the search fails
*/
- Cursor<IndexEntry<ID, ID>> cursor( Dn base, AliasDerefMode aliasDerefMode, ExprNode filter,
+ Cursor<IndexEntry<UUID, UUID>> cursor( Dn base, AliasDerefMode aliasDerefMode, ExprNode filter,
SearchScope scope ) throws Exception;
@@ -93,5 +95,5 @@ public interface SearchEngine<E, ID>
* @return true if the filter passes the entry, false otherwise
* @throws Exception if something goes wrong while accessing the db
*/
- Evaluator<? extends ExprNode, ID> evaluator( ExprNode filter ) throws Exception;
+ Evaluator<? extends ExprNode> evaluator( ExprNode filter ) throws Exception;
}
\ No newline at end of file
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/AllEntriesCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/AllEntriesCursor.java?rev=1378574&r1=1378573&r2=1378574&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/AllEntriesCursor.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/AllEntriesCursor.java Wed Aug 29 14:23:08 2012
@@ -20,6 +20,8 @@
package org.apache.directory.server.xdbm.search.cursor;
+import java.util.UUID;
+
import org.apache.directory.server.core.partition.impl.btree.IndexCursorAdaptor;
import org.apache.directory.server.xdbm.AbstractIndexCursor;
import org.apache.directory.server.xdbm.ForwardIndexEntry;
@@ -36,16 +38,16 @@ import org.slf4j.LoggerFactory;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class AllEntriesCursor<ID extends Comparable<ID>> extends AbstractIndexCursor<ID, ID>
+public class AllEntriesCursor extends AbstractIndexCursor<UUID>
{
/** A dedicated log for cursors */
private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" );
/** The index entry we use to return entries one by one. */
- private IndexEntry<ID, ID> indexEntry = new ForwardIndexEntry<ID, ID>();
+ private IndexEntry<UUID, UUID> indexEntry = new ForwardIndexEntry<UUID, UUID>();
/** The cursor on the EntryUUID index */
- private final Cursor<IndexEntry<String, ID>> wrapped;
+ private final Cursor<IndexEntry<String, UUID>> wrapped;
/**
@@ -62,7 +64,7 @@ public class AllEntriesCursor<ID extends
* @param db
* @throws Exception
*/
- public AllEntriesCursor( Store<Entry, ID> db ) throws Exception
+ public AllEntriesCursor( Store<Entry> db ) throws Exception
{
LOG_CURSOR.debug( "Creating AllEntriesCursor {}", this );
// Uses the MasterTable
@@ -73,7 +75,7 @@ public class AllEntriesCursor<ID extends
/**
* {@inheritDoc}
*/
- public void after( IndexEntry<ID, ID> indexEntry ) throws Exception
+ public void after( IndexEntry<UUID, UUID> indexEntry ) throws Exception
{
checkNotClosed( "after()" );
}
@@ -102,7 +104,7 @@ public class AllEntriesCursor<ID extends
/**
* {@inheritDoc}
*/
- public void before( IndexEntry<ID, ID> indexEntry ) throws Exception
+ public void before( IndexEntry<UUID, UUID> indexEntry ) throws Exception
{
checkNotClosed( "before()" );
}
@@ -133,15 +135,15 @@ public class AllEntriesCursor<ID extends
/**
* {@inheritDoc}
*/
- public IndexEntry<ID, ID> get() throws Exception
+ public IndexEntry<UUID, UUID> get() throws Exception
{
checkNotClosed( "get()" );
// Create the returned IndexEntry, copying what we get from the wrapped cursor
- IndexEntry<?, ID> wrappedEntry = wrapped.get();
- indexEntry.setId( ( ID ) wrappedEntry.getKey() );
- indexEntry.setKey( ( ID ) wrappedEntry.getKey() );
- indexEntry.setEntry( ( Entry ) wrappedEntry.getId() );
+ IndexEntry<?, UUID> wrappedEntry = wrapped.get();
+ indexEntry.setId( ( UUID ) wrappedEntry.getKey() );
+ indexEntry.setKey( ( UUID ) wrappedEntry.getKey() );
+ indexEntry.setEntry( ( Entry ) wrappedEntry.getTuple().getValue() );
return indexEntry;
}
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/AndCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/AndCursor.java?rev=1378574&r1=1378573&r2=1378574&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/AndCursor.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/AndCursor.java Wed Aug 29 14:23:08 2012
@@ -23,6 +23,7 @@ package org.apache.directory.server.xdbm
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.UUID;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.xdbm.AbstractIndexCursor;
@@ -41,7 +42,7 @@ import org.slf4j.LoggerFactory;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class AndCursor<V, ID> extends AbstractIndexCursor<V, ID>
+public class AndCursor<V> extends AbstractIndexCursor<V>
{
/** A dedicated log for cursors */
private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" );
@@ -50,10 +51,10 @@ public class AndCursor<V, ID> extends Ab
private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_707 );
/** */
- private final Cursor<IndexEntry<V, ID>> wrapped;
+ private final Cursor<IndexEntry<V, UUID>> wrapped;
/** The evaluators used for the members of the And filter */
- private final List<Evaluator<? extends ExprNode, ID>> evaluators;
+ private final List<Evaluator<? extends ExprNode>> evaluators;
/**
@@ -63,8 +64,8 @@ public class AndCursor<V, ID> extends Ab
* @param wrapped The encapsulated IndexCursor
* @param evaluators The list of evaluators associated wth the elements
*/
- public AndCursor( Cursor<IndexEntry<V, ID>> wrapped,
- List<Evaluator<? extends ExprNode, ID>> evaluators )
+ public AndCursor( Cursor<IndexEntry<V, UUID>> wrapped,
+ List<Evaluator<? extends ExprNode>> evaluators )
{
LOG_CURSOR.debug( "Creating AndCursor {}", this );
this.wrapped = wrapped;
@@ -134,7 +135,7 @@ public class AndCursor<V, ID> extends Ab
{
checkNotClosed( "previous()" );
- IndexEntry<V, ID> candidate = wrapped.get();
+ IndexEntry<V, UUID> candidate = wrapped.get();
if ( matches( candidate ) )
{
@@ -154,7 +155,7 @@ public class AndCursor<V, ID> extends Ab
while ( wrapped.next() )
{
checkNotClosed( "next()" );
- IndexEntry<V, ID> candidate = wrapped.get();
+ IndexEntry<V, UUID> candidate = wrapped.get();
if ( matches( candidate ) )
{
@@ -169,7 +170,7 @@ public class AndCursor<V, ID> extends Ab
/**
* {@inheritDoc}
*/
- public IndexEntry<V, ID> get() throws Exception
+ public IndexEntry<V, UUID> get() throws Exception
{
checkNotClosed( "get()" );
@@ -215,14 +216,14 @@ public class AndCursor<V, ID> extends Ab
* @param unoptimized the unoptimized list of Evaluators
* @return optimized Evaluator list with increasing scan count ordering
*/
- private List<Evaluator<? extends ExprNode, ID>> optimize(
- List<Evaluator<? extends ExprNode, ID>> unoptimized )
+ private List<Evaluator<? extends ExprNode>> optimize(
+ List<Evaluator<? extends ExprNode>> unoptimized )
{
- List<Evaluator<? extends ExprNode, ID>> optimized = new ArrayList<Evaluator<? extends ExprNode, ID>>(
+ List<Evaluator<? extends ExprNode>> optimized = new ArrayList<Evaluator<? extends ExprNode>>(
unoptimized.size() );
optimized.addAll( unoptimized );
- Collections.sort( optimized, new ScanCountComparator<ID>() );
+ Collections.sort( optimized, new ScanCountComparator() );
return optimized;
}
@@ -231,9 +232,9 @@ public class AndCursor<V, ID> extends Ab
/**
* Checks if the entry is a valid candidate by using the evaluators.
*/
- private boolean matches( IndexEntry<V, ID> indexEntry ) throws Exception
+ private boolean matches( IndexEntry<V, UUID> indexEntry ) throws Exception
{
- for ( Evaluator<?, ID> evaluator : evaluators )
+ for ( Evaluator<?> evaluator : evaluators )
{
if ( !evaluator.evaluate( indexEntry ) )
{
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/ApproximateCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/ApproximateCursor.java?rev=1378574&r1=1378573&r2=1378574&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/ApproximateCursor.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/ApproximateCursor.java Wed Aug 29 14:23:08 2012
@@ -20,6 +20,8 @@
package org.apache.directory.server.xdbm.search.cursor;
+import java.util.UUID;
+
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.xdbm.AbstractIndexCursor;
import org.apache.directory.server.xdbm.Index;
@@ -46,7 +48,7 @@ import org.slf4j.LoggerFactory;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class ApproximateCursor<V, ID extends Comparable<ID>> extends AbstractIndexCursor<V, ID>
+public class ApproximateCursor<V> extends AbstractIndexCursor<V>
{
/** A dedicated log for cursors */
private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" );
@@ -55,13 +57,13 @@ public class ApproximateCursor<V, ID ext
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<V, ID> approximateEvaluator;
+ private final ApproximateEvaluator<V> approximateEvaluator;
/** Cursor over attribute entry matching filter: set when index present */
- private final Cursor<IndexEntry<V, ID>> userIdxCursor;
+ private final Cursor<IndexEntry<V, UUID>> userIdxCursor;
/** NDN Cursor on all entries in (set when no index on user attribute) */
- private final Cursor<IndexEntry<String, ID>> uuidIdxCursor;
+ private final Cursor<IndexEntry<String, UUID>> uuidIdxCursor;
/**
@@ -71,7 +73,7 @@ public class ApproximateCursor<V, ID ext
* @throws Exception If the creation failed
*/
@SuppressWarnings("unchecked")
- public ApproximateCursor( Store<Entry, ID> db, ApproximateEvaluator<V, ID> approximateEvaluator ) throws Exception
+ public ApproximateCursor( Store<Entry> db, ApproximateEvaluator<V> approximateEvaluator ) throws Exception
{
LOG_CURSOR.debug( "Creating ApproximateCursor {}", this );
this.approximateEvaluator = approximateEvaluator;
@@ -81,7 +83,7 @@ public class ApproximateCursor<V, ID ext
if ( db.hasIndexOn( attributeType ) )
{
- Index<V, Entry, ID> index = ( Index<V, Entry, ID> ) db.getIndex( attributeType );
+ Index<V, Entry, UUID> index = ( Index<V, Entry, UUID> ) db.getIndex( attributeType );
userIdxCursor = index.forwardCursor( value.getValue() );
uuidIdxCursor = null;
}
@@ -119,7 +121,7 @@ public class ApproximateCursor<V, ID ext
/**
* {@inheritDoc}
*/
- public void before( IndexEntry<V, ID> element ) throws Exception
+ public void before( IndexEntry<V, UUID> element ) throws Exception
{
checkNotClosed( "before()" );
@@ -138,7 +140,7 @@ public class ApproximateCursor<V, ID ext
* {@inheritDoc}
*/
@Override
- public void after( IndexEntry<V, ID> element ) throws Exception
+ public void after( IndexEntry<V, UUID> element ) throws Exception
{
checkNotClosed( "after()" );
@@ -225,7 +227,7 @@ public class ApproximateCursor<V, ID ext
while ( uuidIdxCursor.previous() )
{
checkNotClosed( "previous()" );
- IndexEntry<?, ID> candidate = uuidIdxCursor.get();
+ IndexEntry<?, UUID> candidate = uuidIdxCursor.get();
if ( approximateEvaluator.evaluate( candidate ) )
{
@@ -250,7 +252,7 @@ public class ApproximateCursor<V, ID ext
while ( uuidIdxCursor.next() )
{
checkNotClosed( "next()" );
- IndexEntry<?, ID> candidate = uuidIdxCursor.get();
+ IndexEntry<?, UUID> candidate = uuidIdxCursor.get();
if ( approximateEvaluator.evaluate( candidate ) )
{
@@ -266,7 +268,7 @@ public class ApproximateCursor<V, ID ext
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public IndexEntry<V, ID> get() throws Exception
+ public IndexEntry<V, UUID> get() throws Exception
{
checkNotClosed( "get()" );
@@ -277,7 +279,7 @@ public class ApproximateCursor<V, ID ext
if ( available() )
{
- return ( IndexEntry<V, ID> ) uuidIdxCursor.get();
+ return ( IndexEntry<V, UUID> ) uuidIdxCursor.get();
}
throw new InvalidCursorPositionException( I18n.err( I18n.ERR_708 ) );
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/ChildrenCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/ChildrenCursor.java?rev=1378574&r1=1378573&r2=1378574&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/ChildrenCursor.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/ChildrenCursor.java Wed Aug 29 14:23:08 2012
@@ -20,6 +20,8 @@
package org.apache.directory.server.xdbm.search.cursor;
+import java.util.UUID;
+
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.xdbm.AbstractIndexCursor;
import org.apache.directory.server.xdbm.ForwardIndexEntry;
@@ -38,7 +40,7 @@ import org.slf4j.LoggerFactory;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class ChildrenCursor<ID extends Comparable<ID>> extends AbstractIndexCursor<ID, ID>
+public class ChildrenCursor extends AbstractIndexCursor<UUID>
{
/** A dedicated log for cursors */
private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" );
@@ -47,13 +49,13 @@ public class ChildrenCursor<ID extends C
private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_719 );
/** A Cursor over the entries in the scope of the search base */
- private final Cursor<IndexEntry<ParentIdAndRdn<ID>, ID>> cursor;
+ private final Cursor<IndexEntry<ParentIdAndRdn<UUID>, UUID>> cursor;
/** The Parent ID */
- private ID parentId;
+ private UUID parentId;
/** The prefetched element */
- private IndexEntry<ID, ID> prefetched;
+ private IndexEntry<UUID, UUID> prefetched;
/**
@@ -63,7 +65,7 @@ public class ChildrenCursor<ID extends C
* @param evaluator an IndexEntry (candidate) evaluator
* @throws Exception on db access failures
*/
- public ChildrenCursor( Store<Entry, ID> db, ID parentId, Cursor<IndexEntry<ParentIdAndRdn<ID>, ID>> cursor )
+ public ChildrenCursor( Store<Entry> db, UUID parentId, Cursor<IndexEntry<ParentIdAndRdn<UUID>, UUID>> cursor )
throws Exception
{
LOG_CURSOR.debug( "Creating ChildrenCursor {}", this );
@@ -118,7 +120,7 @@ public class ChildrenCursor<ID extends C
{
IndexEntry entry = cursor.get();
- if ( ( ( ParentIdAndRdn<ID> ) entry.getTuple().getKey() ).getParentId().equals( parentId ) )
+ if ( ( ( ParentIdAndRdn<UUID> ) entry.getTuple().getKey() ).getParentId().equals( parentId ) )
{
prefetched = entry;
return true;
@@ -141,9 +143,9 @@ public class ChildrenCursor<ID extends C
if ( hasNext )
{
IndexEntry cursorEntry = cursor.get();
- IndexEntry<ID, ID> entry = new ForwardIndexEntry();
- entry.setId( ( ID ) cursorEntry.getId() );
- entry.setKey( ( ( ParentIdAndRdn<ID> ) cursorEntry.getTuple().getKey() ).getParentId() );
+ IndexEntry<UUID, UUID> entry = new ForwardIndexEntry();
+ entry.setId( ( UUID ) cursorEntry.getId() );
+ entry.setKey( ( ( ParentIdAndRdn<UUID> ) cursorEntry.getTuple().getKey() ).getParentId() );
if ( entry.getKey().equals( parentId ) )
{
@@ -156,7 +158,7 @@ public class ChildrenCursor<ID extends C
}
- public IndexEntry<ID, ID> get() throws Exception
+ public IndexEntry<UUID, UUID> get() throws Exception
{
checkNotClosed( "get()" );
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/DescendantCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/DescendantCursor.java?rev=1378574&r1=1378573&r2=1378574&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/DescendantCursor.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/DescendantCursor.java Wed Aug 29 14:23:08 2012
@@ -20,6 +20,8 @@
package org.apache.directory.server.xdbm.search.cursor;
+import java.util.UUID;
+
import org.apache.commons.collections.ArrayStack;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.xdbm.AbstractIndexCursor;
@@ -41,7 +43,7 @@ import org.slf4j.LoggerFactory;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class DescendantCursor<ID extends Comparable<ID>> extends AbstractIndexCursor<ID, ID>
+public class DescendantCursor extends AbstractIndexCursor<UUID>
{
/** A dedicated log for cursors */
private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" );
@@ -50,16 +52,16 @@ public class DescendantCursor<ID extends
private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_719 );
/** The entry database/store */
- private final Store<Entry, ID> db;
+ private final Store<Entry> db;
/** The prefetched element */
private IndexEntry prefetched;
/** The current Cursor over the entries in the scope of the search base */
- private Cursor<IndexEntry<ParentIdAndRdn<ID>, ID>> currentCursor;
+ private Cursor<IndexEntry<ParentIdAndRdn<UUID>, UUID>> currentCursor;
/** The current Parent ID */
- private ID currentParentId;
+ private UUID currentParentId;
/** The stack of cursors used to process the depth-first traversal */
private ArrayStack cursorStack;
@@ -68,7 +70,7 @@ public class DescendantCursor<ID extends
private ArrayStack parentIdStack;
/** The initial entry ID we are looking descendants for */
- private ID baseId;
+ private UUID baseId;
/** A flag to tell that we are in the top level cursor or not */
private boolean topLevel;
@@ -84,8 +86,8 @@ public class DescendantCursor<ID extends
* @param evaluator an IndexEntry (candidate) evaluator
* @throws Exception on db access failures
*/
- public DescendantCursor( Store<Entry, ID> db, ID baseId, ID parentId,
- Cursor<IndexEntry<ParentIdAndRdn<ID>, ID>> cursor )
+ public DescendantCursor( Store<Entry> db, UUID baseId, UUID parentId,
+ Cursor<IndexEntry<ParentIdAndRdn<UUID>, UUID>> cursor )
throws Exception
{
this( db, baseId, parentId, cursor, TOP_LEVEL );
@@ -99,8 +101,8 @@ public class DescendantCursor<ID extends
* @param evaluator an IndexEntry (candidate) evaluator
* @throws Exception on db access failures
*/
- public DescendantCursor( Store<Entry, ID> db, ID baseId, ID parentId,
- Cursor<IndexEntry<ParentIdAndRdn<ID>, ID>> cursor,
+ public DescendantCursor( Store<Entry> db, UUID baseId, UUID parentId,
+ Cursor<IndexEntry<ParentIdAndRdn<UUID>, UUID>> cursor,
boolean topLevel )
throws Exception
{
@@ -161,7 +163,7 @@ public class DescendantCursor<ID extends
{
IndexEntry entry = currentCursor.get();
- if ( ( ( ParentIdAndRdn<ID> ) entry.getTuple().getKey() ).getParentId().equals( currentParentId ) )
+ if ( ( ( ParentIdAndRdn<UUID> ) entry.getTuple().getKey() ).getParentId().equals( currentParentId ) )
{
prefetched = entry;
return true;
@@ -191,7 +193,7 @@ public class DescendantCursor<ID extends
if ( hasNext )
{
IndexEntry cursorEntry = currentCursor.get();
- ParentIdAndRdn<ID> parentIdAndRdn = ( ( ParentIdAndRdn<ID> ) ( cursorEntry.getKey() ) );
+ ParentIdAndRdn<UUID> parentIdAndRdn = ( ( ParentIdAndRdn<UUID> ) ( cursorEntry.getKey() ) );
// Check that we aren't out of the cursor's limit
if ( !parentIdAndRdn.getParentId().equals( currentParentId ) )
@@ -202,8 +204,8 @@ public class DescendantCursor<ID extends
if ( !finished )
{
currentCursor.close();
- currentCursor = ( Cursor<IndexEntry<ParentIdAndRdn<ID>, ID>> ) cursorStack.pop();
- currentParentId = ( ID ) parentIdStack.pop();
+ currentCursor = ( Cursor<IndexEntry<ParentIdAndRdn<UUID>, UUID>> ) cursorStack.pop();
+ currentParentId = ( UUID ) parentIdStack.pop();
}
// And continue...
@@ -225,12 +227,12 @@ public class DescendantCursor<ID extends
// Check if the current entry has children or not.
if ( parentIdAndRdn.getNbDescendants() > 0 )
{
- ID newParentId = ( ID ) cursorEntry.getId();
+ UUID newParentId = ( UUID ) cursorEntry.getId();
// Yes, then create a new cursor and go down one level
- Cursor<IndexEntry<ParentIdAndRdn<ID>, ID>> cursor = db.getRdnIndex().forwardCursor();
+ Cursor<IndexEntry<ParentIdAndRdn<UUID>, UUID>> cursor = db.getRdnIndex().forwardCursor();
- IndexEntry<ParentIdAndRdn<ID>, ID> startingPos = new ForwardIndexEntry<ParentIdAndRdn<ID>, ID>();
+ IndexEntry<ParentIdAndRdn<UUID>, UUID> startingPos = new ForwardIndexEntry<ParentIdAndRdn<UUID>, UUID>();
startingPos.setKey( new ParentIdAndRdn( newParentId, ( Rdn[] ) null ) );
cursor.before( startingPos );
@@ -252,8 +254,8 @@ public class DescendantCursor<ID extends
if ( !finished )
{
currentCursor.close();
- currentCursor = ( Cursor<IndexEntry<ParentIdAndRdn<ID>, ID>> ) cursorStack.pop();
- currentParentId = ( ID ) parentIdStack.pop();
+ currentCursor = ( Cursor<IndexEntry<ParentIdAndRdn<UUID>, UUID>> ) cursorStack.pop();
+ currentParentId = ( UUID ) parentIdStack.pop();
}
// and continue...
}
@@ -263,7 +265,7 @@ public class DescendantCursor<ID extends
}
- public IndexEntry<ID, ID> get() throws Exception
+ public IndexEntry<UUID, UUID> get() throws Exception
{
checkNotClosed( "get()" );
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/EqualityCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/EqualityCursor.java?rev=1378574&r1=1378573&r2=1378574&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/EqualityCursor.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/EqualityCursor.java Wed Aug 29 14:23:08 2012
@@ -20,6 +20,8 @@
package org.apache.directory.server.xdbm.search.cursor;
+import java.util.UUID;
+
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.xdbm.AbstractIndexCursor;
import org.apache.directory.server.xdbm.Index;
@@ -44,7 +46,7 @@ import org.slf4j.LoggerFactory;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class EqualityCursor<V, ID extends Comparable<ID>> extends AbstractIndexCursor<V, ID>
+public class EqualityCursor<V> extends AbstractIndexCursor<V>
{
/** A dedicated log for cursors */
private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" );
@@ -53,13 +55,13 @@ public class EqualityCursor<V, ID extend
private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_714 );
/** An equality evaluator for candidates */
- private final EqualityEvaluator<V, ID> equalityEvaluator;
+ private final EqualityEvaluator<V> equalityEvaluator;
/** Cursor over attribute entry matching filter: set when index present */
- private final Cursor<IndexEntry<V, ID>> userIdxCursor;
+ private final Cursor<IndexEntry<V, UUID>> userIdxCursor;
/** NDN Cursor on all entries in (set when no index on user attribute) */
- private final Cursor<IndexEntry<String, ID>> uuidIdxCursor;
+ private final Cursor<IndexEntry<String, UUID>> uuidIdxCursor;
/**
@@ -69,7 +71,7 @@ public class EqualityCursor<V, ID extend
* @throws Exception If the creation failed
*/
@SuppressWarnings("unchecked")
- public EqualityCursor( Store<Entry, ID> db, EqualityEvaluator<V, ID> equalityEvaluator ) throws Exception
+ public EqualityCursor( Store<Entry> db, EqualityEvaluator<V> equalityEvaluator ) throws Exception
{
LOG_CURSOR.debug( "Creating EqualityCursor {}", this );
this.equalityEvaluator = equalityEvaluator;
@@ -79,7 +81,7 @@ public class EqualityCursor<V, ID extend
if ( db.hasIndexOn( attributeType ) )
{
- Index<V, Entry, ID> userIndex = ( Index<V, Entry, ID> ) db.getIndex( attributeType );
+ Index<V, Entry, UUID> userIndex = ( Index<V, Entry, UUID> ) db.getIndex( attributeType );
userIdxCursor = userIndex.forwardCursor( value.getValue() );
uuidIdxCursor = null;
}
@@ -117,7 +119,7 @@ public class EqualityCursor<V, ID extend
/**
* {@inheritDoc}
*/
- public void before( IndexEntry<V, ID> element ) throws Exception
+ public void before( IndexEntry<V, UUID> element ) throws Exception
{
checkNotClosed( "before()" );
@@ -135,7 +137,7 @@ public class EqualityCursor<V, ID extend
/**
* {@inheritDoc}
*/
- public void after( IndexEntry<V, ID> element ) throws Exception
+ public void after( IndexEntry<V, UUID> element ) throws Exception
{
checkNotClosed( "after()" );
@@ -225,7 +227,7 @@ public class EqualityCursor<V, ID extend
while ( uuidIdxCursor.previous() )
{
checkNotClosed( "previous()" );
- IndexEntry<?, ID> candidate = uuidIdxCursor.get();
+ IndexEntry<?, UUID> candidate = uuidIdxCursor.get();
if ( equalityEvaluator.evaluate( candidate ) )
{
@@ -250,7 +252,7 @@ public class EqualityCursor<V, ID extend
while ( uuidIdxCursor.next() )
{
checkNotClosed( "next()" );
- IndexEntry<?, ID> candidate = uuidIdxCursor.get();
+ IndexEntry<?, UUID> candidate = uuidIdxCursor.get();
if ( equalityEvaluator.evaluate( candidate ) )
{
@@ -266,7 +268,7 @@ public class EqualityCursor<V, ID extend
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public IndexEntry<V, ID> get() throws Exception
+ public IndexEntry<V, UUID> get() throws Exception
{
checkNotClosed( "get()" );
@@ -277,7 +279,7 @@ public class EqualityCursor<V, ID extend
if ( available() )
{
- return ( IndexEntry<V, ID> ) uuidIdxCursor.get();
+ return ( IndexEntry<V, UUID> ) uuidIdxCursor.get();
}
throw new InvalidCursorPositionException( I18n.err( I18n.ERR_708 ) );
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/GreaterEqCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/GreaterEqCursor.java?rev=1378574&r1=1378573&r2=1378574&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/GreaterEqCursor.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/GreaterEqCursor.java Wed Aug 29 14:23:08 2012
@@ -20,6 +20,8 @@
package org.apache.directory.server.xdbm.search.cursor;
+import java.util.UUID;
+
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.xdbm.AbstractIndexCursor;
import org.apache.directory.server.xdbm.ForwardIndexEntry;
@@ -44,7 +46,7 @@ import org.slf4j.LoggerFactory;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class GreaterEqCursor<V, ID extends Comparable<ID>> extends AbstractIndexCursor<V, ID>
+public class GreaterEqCursor<V> extends AbstractIndexCursor<V>
{
/** A dedicated log for cursors */
private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" );
@@ -52,20 +54,20 @@ public class GreaterEqCursor<V, ID exten
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<V, ID> greaterEqEvaluator;
+ private final GreaterEqEvaluator<V> greaterEqEvaluator;
/** Cursor over attribute entry matching filter: set when index present */
- private final Cursor<IndexEntry<V, ID>> userIdxCursor;
+ private final Cursor<IndexEntry<V, UUID>> userIdxCursor;
/** NDN Cursor on all entries in (set when no index on user attribute) */
- private final Cursor<IndexEntry<String, ID>> uuidIdxCursor;
+ private final Cursor<IndexEntry<String, UUID>> uuidIdxCursor;
/**
* Used to store indexEntry from uuidCandidate 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.
*/
- private IndexEntry<String, ID> uuidCandidate;
+ private IndexEntry<String, UUID> uuidCandidate;
/**
@@ -75,7 +77,7 @@ public class GreaterEqCursor<V, ID exten
* @throws Exception If the creation failed
*/
@SuppressWarnings("unchecked")
- public GreaterEqCursor( Store<Entry, ID> db, GreaterEqEvaluator<V, ID> greaterEqEvaluator ) throws Exception
+ public GreaterEqCursor( Store<Entry> db, GreaterEqEvaluator<V> greaterEqEvaluator ) throws Exception
{
LOG_CURSOR.debug( "Creating GreaterEqCursor {}", this );
this.greaterEqEvaluator = greaterEqEvaluator;
@@ -84,7 +86,7 @@ public class GreaterEqCursor<V, ID exten
if ( db.hasIndexOn( attributeType ) )
{
- userIdxCursor = ( ( Index<V, Entry, ID> ) db.getIndex( attributeType ) ).forwardCursor();
+ userIdxCursor = ( ( Index<V, Entry, UUID> ) db.getIndex( attributeType ) ).forwardCursor();
uuidIdxCursor = null;
}
else
@@ -107,7 +109,7 @@ public class GreaterEqCursor<V, ID exten
/**
* {@inheritDoc}
*/
- public void before( IndexEntry<V, ID> element ) throws Exception
+ public void before( IndexEntry<V, UUID> element ) throws Exception
{
checkNotClosed( "before()" );
@@ -141,7 +143,7 @@ public class GreaterEqCursor<V, ID exten
/**
* {@inheritDoc}
*/
- public void after( IndexEntry<V, ID> element ) throws Exception
+ public void after( IndexEntry<V, UUID> element ) throws Exception
{
checkNotClosed( "after()" );
@@ -194,7 +196,7 @@ public class GreaterEqCursor<V, ID exten
if ( userIdxCursor != null )
{
- IndexEntry<V, ID> advanceTo = new ForwardIndexEntry<V, ID>();
+ IndexEntry<V, UUID> advanceTo = new ForwardIndexEntry<V, UUID>();
advanceTo.setKey( ( V ) greaterEqEvaluator.getExpression().getValue().getValue() );
userIdxCursor.before( advanceTo );
}
@@ -267,7 +269,7 @@ public class GreaterEqCursor<V, ID exten
while ( userIdxCursor.previous() )
{
checkNotClosed( "previous()" );
- IndexEntry<?, ID> candidate = userIdxCursor.get();
+ IndexEntry<?, UUID> candidate = userIdxCursor.get();
if ( greaterEqEvaluator.getComparator().compare( candidate.getKey(),
greaterEqEvaluator.getExpression().getValue().getValue() ) >= 0 )
@@ -329,7 +331,7 @@ public class GreaterEqCursor<V, ID exten
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public IndexEntry<V, ID> get() throws Exception
+ public IndexEntry<V, UUID> get() throws Exception
{
checkNotClosed( "get()" );
@@ -345,7 +347,7 @@ public class GreaterEqCursor<V, ID exten
if ( available() )
{
- return ( IndexEntry<V, ID> ) uuidCandidate;
+ return ( IndexEntry<V, UUID> ) uuidCandidate;
}
throw new InvalidCursorPositionException( I18n.err( I18n.ERR_708 ) );
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/LessEqCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/LessEqCursor.java?rev=1378574&r1=1378573&r2=1378574&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/LessEqCursor.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/LessEqCursor.java Wed Aug 29 14:23:08 2012
@@ -20,6 +20,8 @@
package org.apache.directory.server.xdbm.search.cursor;
+import java.util.UUID;
+
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.xdbm.AbstractIndexCursor;
import org.apache.directory.server.xdbm.ForwardIndexEntry;
@@ -44,7 +46,7 @@ import org.slf4j.LoggerFactory;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class LessEqCursor<V, ID extends Comparable<ID>> extends AbstractIndexCursor<V, ID>
+public class LessEqCursor<V> extends AbstractIndexCursor<V>
{
/** A dedicated log for cursors */
private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" );
@@ -52,24 +54,24 @@ public class LessEqCursor<V, ID extends
private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_716 );
/** An less eq evaluator for candidates */
- private final LessEqEvaluator<V, ID> lessEqEvaluator;
+ private final LessEqEvaluator<V> lessEqEvaluator;
/** Cursor over attribute entry matching filter: set when index present */
- private final Cursor<IndexEntry<V, ID>> userIdxCursor;
+ private final Cursor<IndexEntry<V, UUID>> userIdxCursor;
/** NDN Cursor on all entries in (set when no index on user attribute) */
- private final Cursor<IndexEntry<V, ID>> uuidIdxCursor;
+ private final Cursor<IndexEntry<V, UUID>> uuidIdxCursor;
/**
* Used to store indexEntry from uudCandidate so it can be saved after
* call to evaluate() which changes the value so it's not referring to
* the UUID but to the value of the attribute instead.
*/
- private IndexEntry<V, ID> uuidCandidate;
+ private IndexEntry<V, UUID> uuidCandidate;
@SuppressWarnings("unchecked")
- public LessEqCursor( Store<Entry, ID> db, LessEqEvaluator<V, ID> lessEqEvaluator ) throws Exception
+ public LessEqCursor( Store<Entry> db, LessEqEvaluator<V> lessEqEvaluator ) throws Exception
{
LOG_CURSOR.debug( "Creating LessEqCursor {}", this );
this.lessEqEvaluator = lessEqEvaluator;
@@ -78,7 +80,7 @@ public class LessEqCursor<V, ID extends
if ( db.hasIndexOn( attributeType ) )
{
- userIdxCursor = ( ( Index<V, Entry, ID> ) db.getIndex( attributeType ) ).forwardCursor();
+ userIdxCursor = ( ( Index<V, Entry, UUID> ) db.getIndex( attributeType ) ).forwardCursor();
uuidIdxCursor = null;
}
else
@@ -101,7 +103,7 @@ public class LessEqCursor<V, ID extends
/**
* {@inheritDoc}
*/
- public void before( IndexEntry<V, ID> element ) throws Exception
+ public void before( IndexEntry<V, UUID> element ) throws Exception
{
checkNotClosed( "before()" );
@@ -149,7 +151,7 @@ public class LessEqCursor<V, ID extends
/**
* {@inheritDoc}
*/
- public void after( IndexEntry<V, ID> element ) throws Exception
+ public void after( IndexEntry<V, UUID> element ) throws Exception
{
checkNotClosed( "after()" );
@@ -208,7 +210,7 @@ public class LessEqCursor<V, ID extends
checkNotClosed( "afterLast()" );
if ( userIdxCursor != null )
{
- IndexEntry<V, ID> advanceTo = new ForwardIndexEntry<V, ID>();
+ IndexEntry<V, UUID> advanceTo = new ForwardIndexEntry<V, UUID>();
//noinspection unchecked
advanceTo.setKey( lessEqEvaluator.getExpression().getValue().getValue() );
userIdxCursor.after( advanceTo );
@@ -284,7 +286,7 @@ public class LessEqCursor<V, ID extends
while ( userIdxCursor.next() )
{
checkNotClosed( "next()" );
- IndexEntry<?, ID> candidate = userIdxCursor.get();
+ IndexEntry<?, UUID> candidate = userIdxCursor.get();
if ( lessEqEvaluator.getComparator().compare( candidate.getKey(),
lessEqEvaluator.getExpression().getValue().getValue() ) <= 0 )
@@ -315,7 +317,7 @@ public class LessEqCursor<V, ID extends
}
- public IndexEntry<V, ID> get() throws Exception
+ public IndexEntry<V, UUID> get() throws Exception
{
checkNotClosed( "get()" );
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/NotCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/NotCursor.java?rev=1378574&r1=1378573&r2=1378574&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/NotCursor.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/NotCursor.java Wed Aug 29 14:23:08 2012
@@ -20,6 +20,8 @@
package org.apache.directory.server.xdbm.search.cursor;
+import java.util.UUID;
+
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.xdbm.AbstractIndexCursor;
import org.apache.directory.server.xdbm.IndexEntry;
@@ -38,18 +40,18 @@ import org.slf4j.LoggerFactory;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class NotCursor<V, ID extends Comparable<ID>> extends AbstractIndexCursor<V, ID>
+public class NotCursor<V> extends AbstractIndexCursor<V>
{
/** A dedicated log for cursors */
private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" );
private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_718 );
- private final Cursor<IndexEntry<V, ID>> uuidCursor;
- private final Evaluator<? extends ExprNode, ID> childEvaluator;
+ private final Cursor<IndexEntry<V, UUID>> uuidCursor;
+ private final Evaluator<? extends ExprNode> childEvaluator;
@SuppressWarnings("unchecked")
- public NotCursor( Store<Entry, ID> store, Evaluator<? extends ExprNode, ID> childEvaluator )
+ public NotCursor( Store<Entry> store, Evaluator<? extends ExprNode> childEvaluator )
throws Exception
{
LOG_CURSOR.debug( "Creating NotCursor {}", this );
@@ -104,7 +106,7 @@ public class NotCursor<V, ID extends Com
while ( uuidCursor.previous() )
{
checkNotClosed( "previous()" );
- IndexEntry<?, ID> candidate = uuidCursor.get();
+ IndexEntry<?, UUID> candidate = uuidCursor.get();
if ( !childEvaluator.evaluate( candidate ) )
{
@@ -121,7 +123,7 @@ public class NotCursor<V, ID extends Com
while ( uuidCursor.next() )
{
checkNotClosed( "next()" );
- IndexEntry<?, ID> candidate = uuidCursor.get();
+ IndexEntry<?, UUID> candidate = uuidCursor.get();
if ( !childEvaluator.evaluate( candidate ) )
{
@@ -133,7 +135,7 @@ public class NotCursor<V, ID extends Com
}
- public IndexEntry<V, ID> get() throws Exception
+ public IndexEntry<V, UUID> get() throws Exception
{
checkNotClosed( "get()" );
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/OneLevelScopeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/OneLevelScopeCursor.java?rev=1378574&r1=1378573&r2=1378574&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/OneLevelScopeCursor.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/OneLevelScopeCursor.java Wed Aug 29 14:23:08 2012
@@ -20,6 +20,8 @@
package org.apache.directory.server.xdbm.search.cursor;
+import java.util.UUID;
+
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.xdbm.AbstractIndexCursor;
import org.apache.directory.server.xdbm.ForwardIndexEntry;
@@ -41,7 +43,7 @@ import org.slf4j.LoggerFactory;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class OneLevelScopeCursor<ID extends Comparable<ID>> extends AbstractIndexCursor<ID, ID>
+public class OneLevelScopeCursor extends AbstractIndexCursor<UUID>
{
/** A dedicated log for cursors */
private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" );
@@ -50,20 +52,20 @@ public class OneLevelScopeCursor<ID exte
private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_719 );
/** The entry database/store */
- private final Store<Entry, ID> db;
+ private final Store<Entry> 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 Cursor<IndexEntry<ID, ID>> scopeCursor;
+ private final Cursor<IndexEntry<UUID, UUID>> scopeCursor;
/** A Cursor over entries brought into scope by alias dereferencing */
- private final Cursor<IndexEntry<ID, ID>> dereferencedCursor;
+ private final Cursor<IndexEntry<UUID, UUID>> dereferencedCursor;
/** Currently active Cursor: we switch between two cursors */
- private Cursor<IndexEntry<ID, ID>> cursor;
+ private Cursor<IndexEntry<UUID, UUID>> cursor;
/**
@@ -74,7 +76,7 @@ public class OneLevelScopeCursor<ID exte
* @throws Exception on db access failures
*/
//@SuppressWarnings("unchecked")
- public OneLevelScopeCursor( Store<Entry, ID> db, OneLevelScopeEvaluator<Entry, ID> evaluator )
+ public OneLevelScopeCursor( Store<Entry> db, OneLevelScopeEvaluator<Entry> evaluator )
throws Exception
{
LOG_CURSOR.debug( "Creating OneLevelScopeCursor {}", this );
@@ -83,9 +85,9 @@ public class OneLevelScopeCursor<ID exte
// We use the RdnIndex to get all the entries from a starting point
// and below up to the number of children
- Cursor<IndexEntry<ParentIdAndRdn<ID>, ID>> cursor = db.getRdnIndex().forwardCursor();
+ Cursor<IndexEntry<ParentIdAndRdn<UUID>, UUID>> cursor = db.getRdnIndex().forwardCursor();
- IndexEntry<ParentIdAndRdn<ID>, ID> startingPos = new ForwardIndexEntry<ParentIdAndRdn<ID>, ID>();
+ IndexEntry<ParentIdAndRdn<UUID>, UUID> startingPos = new ForwardIndexEntry<ParentIdAndRdn<UUID>, UUID>();
startingPos.setKey( new ParentIdAndRdn( evaluator.getBaseId(), ( Rdn[] ) null ) );
cursor.before( startingPos );
@@ -284,7 +286,7 @@ public class OneLevelScopeCursor<ID exte
}
- public IndexEntry<ID, ID> get() throws Exception
+ public IndexEntry<UUID, UUID> get() throws Exception
{
checkNotClosed( "get()" );
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/OrCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/OrCursor.java?rev=1378574&r1=1378573&r2=1378574&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/OrCursor.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/OrCursor.java Wed Aug 29 14:23:08 2012
@@ -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.xdbm.AbstractIndexCursor;
@@ -41,21 +42,21 @@ import org.slf4j.LoggerFactory;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class OrCursor<V, ID> extends AbstractIndexCursor<V, ID>
+public class OrCursor<V> extends AbstractIndexCursor<V>
{
/** A dedicated log for cursors */
private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" );
private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_722 );
- private final List<Cursor<IndexEntry<V, ID>>> cursors;
- private final List<Evaluator<? extends ExprNode, ID>> evaluators;
- private final List<Set<ID>> blacklists;
+ private final List<Cursor<IndexEntry<V, UUID>>> 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<Cursor<IndexEntry<V, ID>>> cursors,
- List<Evaluator<? extends ExprNode, ID>> evaluators )
+ public OrCursor( List<Cursor<IndexEntry<V, UUID>>> cursors,
+ List<Evaluator<? extends ExprNode>> evaluators )
{
LOG_CURSOR.debug( "Creating OrCursor {}", this );
@@ -66,11 +67,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 i = 0; i < cursors.size(); i++ )
{
- this.blacklists.add( new HashSet<ID>() );
+ this.blacklists.add( new HashSet<UUID>() );
}
this.cursorIndex = 0;
@@ -120,7 +121,7 @@ public class OrCursor<V, ID> extends Abs
}
- private boolean isBlackListed( ID id )
+ private boolean isBlackListed( UUID id )
{
return blacklists.get( cursorIndex ).contains( id );
}
@@ -133,7 +134,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<?, UUID> indexEntry ) throws Exception
{
for ( int ii = 0; ii < evaluators.size(); ii++ )
{
@@ -155,7 +156,7 @@ public class OrCursor<V, ID> extends Abs
while ( cursors.get( cursorIndex ).previous() )
{
checkNotClosed( "previous()" );
- IndexEntry<?, ID> candidate = cursors.get( cursorIndex ).get();
+ IndexEntry<?, UUID> candidate = cursors.get( cursorIndex ).get();
if ( !isBlackListed( candidate.getId() ) )
{
@@ -174,7 +175,7 @@ public class OrCursor<V, ID> extends Abs
while ( cursors.get( cursorIndex ).previous() )
{
checkNotClosed( "previous()" );
- IndexEntry<?, ID> candidate = cursors.get( cursorIndex ).get();
+ IndexEntry<?, UUID> candidate = cursors.get( cursorIndex ).get();
if ( !isBlackListed( candidate.getId() ) )
{
@@ -194,7 +195,7 @@ public class OrCursor<V, ID> extends Abs
while ( cursors.get( cursorIndex ).next() )
{
checkNotClosed( "next()" );
- IndexEntry<?, ID> candidate = cursors.get( cursorIndex ).get();
+ IndexEntry<?, UUID> candidate = cursors.get( cursorIndex ).get();
if ( !isBlackListed( candidate.getId() ) )
{
@@ -213,7 +214,7 @@ public class OrCursor<V, ID> extends Abs
while ( cursors.get( cursorIndex ).next() )
{
checkNotClosed( "previous()" );
- IndexEntry<?, ID> candidate = cursors.get( cursorIndex ).get();
+ IndexEntry<?, UUID> candidate = cursors.get( cursorIndex ).get();
if ( !isBlackListed( candidate.getId() ) )
{
blackListIfDuplicate( candidate );
@@ -227,7 +228,7 @@ public class OrCursor<V, ID> extends Abs
}
- public IndexEntry<V, ID> get() throws Exception
+ public IndexEntry<V, UUID> get() throws Exception
{
checkNotClosed( "get()" );
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/PresenceCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/PresenceCursor.java?rev=1378574&r1=1378573&r2=1378574&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/PresenceCursor.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/PresenceCursor.java Wed Aug 29 14:23:08 2012
@@ -20,6 +20,8 @@
package org.apache.directory.server.xdbm.search.cursor;
+import java.util.UUID;
+
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.xdbm.AbstractIndexCursor;
import org.apache.directory.server.xdbm.IndexEntry;
@@ -38,21 +40,21 @@ import org.slf4j.LoggerFactory;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class PresenceCursor<ID extends Comparable<ID>> extends AbstractIndexCursor<String, ID>
+public class PresenceCursor extends AbstractIndexCursor<String>
{
/** A dedicated log for cursors */
private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" );
private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_724 );
- private final Cursor<IndexEntry<String, ID>> uuidCursor;
- private final Cursor<IndexEntry<String, ID>> presenceCursor;
- private final PresenceEvaluator<ID> presenceEvaluator;
+ private final Cursor<IndexEntry<String, UUID>> uuidCursor;
+ private final Cursor<IndexEntry<String, UUID>> presenceCursor;
+ private final PresenceEvaluator presenceEvaluator;
/** The prefetched entry, if it's a valid one */
- private IndexEntry<String, ID> prefetched;
+ private IndexEntry<String, UUID> prefetched;
- public PresenceCursor( Store<Entry, ID> store, PresenceEvaluator<ID> presenceEvaluator ) throws Exception
+ public PresenceCursor( Store<Entry> store, PresenceEvaluator presenceEvaluator ) throws Exception
{
LOG_CURSOR.debug( "Creating PresenceCursor {}", this );
this.presenceEvaluator = presenceEvaluator;
@@ -97,7 +99,7 @@ public class PresenceCursor<ID extends C
/**
* {@inheritDoc}
*/
- public void before( IndexEntry<String, ID> element ) throws Exception
+ public void before( IndexEntry<String, UUID> element ) throws Exception
{
checkNotClosed( "before()" );
@@ -115,7 +117,7 @@ public class PresenceCursor<ID extends C
/**
* {@inheritDoc}
*/
- public void after( IndexEntry<String, ID> element ) throws Exception
+ public void after( IndexEntry<String, UUID> element ) throws Exception
{
checkNotClosed( "after()" );
@@ -201,7 +203,7 @@ public class PresenceCursor<ID extends C
while ( uuidCursor.previous() )
{
checkNotClosed( "previous()" );
- IndexEntry<?, ID> candidate = uuidCursor.get();
+ IndexEntry<?, UUID> candidate = uuidCursor.get();
if ( presenceEvaluator.evaluate( candidate ) )
{
@@ -225,7 +227,7 @@ public class PresenceCursor<ID extends C
while ( uuidCursor.next() )
{
checkNotClosed( "next()" );
- IndexEntry<String, ID> candidate = uuidCursor.get();
+ IndexEntry<String, UUID> candidate = uuidCursor.get();
if ( presenceEvaluator.evaluate( candidate ) )
{
@@ -239,7 +241,7 @@ public class PresenceCursor<ID extends C
}
- public IndexEntry<String, ID> get() throws Exception
+ public IndexEntry<String, UUID> get() throws Exception
{
checkNotClosed( "get()" );
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/SubstringCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/SubstringCursor.java?rev=1378574&r1=1378573&r2=1378574&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/SubstringCursor.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/SubstringCursor.java Wed Aug 29 14:23:08 2012
@@ -20,6 +20,8 @@
package org.apache.directory.server.xdbm.search.cursor;
+import java.util.UUID;
+
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.xdbm.AbstractIndexCursor;
import org.apache.directory.server.xdbm.ForwardIndexEntry;
@@ -39,20 +41,20 @@ import org.slf4j.LoggerFactory;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class SubstringCursor<ID extends Comparable<ID>> extends AbstractIndexCursor<String, ID>
+public class SubstringCursor extends AbstractIndexCursor<String>
{
/** A dedicated log for cursors */
private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" );
private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_725 );
private final boolean hasIndex;
- private final Cursor<IndexEntry<String, ID>> wrapped;
- private final SubstringEvaluator<ID> evaluator;
- private final ForwardIndexEntry<String, ID> indexEntry = new ForwardIndexEntry<String, ID>();
+ private final Cursor<IndexEntry<String, UUID>> wrapped;
+ private final SubstringEvaluator evaluator;
+ private final ForwardIndexEntry<String, UUID> indexEntry = new ForwardIndexEntry<String, UUID>();
@SuppressWarnings("unchecked")
- public SubstringCursor( Store<Entry, ID> store, final SubstringEvaluator<ID> substringEvaluator )
+ public SubstringCursor( Store<Entry> store, final SubstringEvaluator substringEvaluator )
throws Exception
{
LOG_CURSOR.debug( "Creating SubstringCursor {}", this );
@@ -61,7 +63,7 @@ public class SubstringCursor<ID extends
if ( hasIndex )
{
- wrapped = ( ( Index<String, Entry, ID> ) store.getIndex( evaluator.getExpression().getAttributeType() ) )
+ wrapped = ( ( Index<String, Entry, UUID> ) store.getIndex( evaluator.getExpression().getAttributeType() ) )
.forwardCursor();
}
else
@@ -96,7 +98,7 @@ public class SubstringCursor<ID extends
checkNotClosed( "beforeFirst()" );
if ( evaluator.getExpression().getInitial() != null && hasIndex )
{
- ForwardIndexEntry<String, ID> indexEntry = new ForwardIndexEntry<String, ID>();
+ ForwardIndexEntry<String, UUID> indexEntry = new ForwardIndexEntry<String, UUID>();
indexEntry.setKey( evaluator.getExpression().getInitial() );
wrapped.before( indexEntry );
}
@@ -137,7 +139,7 @@ public class SubstringCursor<ID extends
}
- private boolean evaluateCandidate( IndexEntry<String, ID> indexEntry ) throws Exception
+ private boolean evaluateCandidate( IndexEntry<String, UUID> indexEntry ) throws Exception
{
if ( hasIndex )
{
@@ -163,7 +165,7 @@ public class SubstringCursor<ID extends
while ( wrapped.previous() )
{
checkNotClosed( "previous()" );
- IndexEntry<String, ID> entry = wrapped.get();
+ IndexEntry<String, UUID> entry = wrapped.get();
if ( evaluateCandidate( entry ) )
{
@@ -185,7 +187,7 @@ public class SubstringCursor<ID extends
while ( wrapped.next() )
{
checkNotClosed( "next()" );
- IndexEntry<String, ID> entry = wrapped.get();
+ IndexEntry<String, UUID> entry = wrapped.get();
if ( evaluateCandidate( entry ) )
{
@@ -203,7 +205,7 @@ public class SubstringCursor<ID extends
}
- public IndexEntry<String, ID> get() throws Exception
+ public IndexEntry<String, UUID> get() throws Exception
{
checkNotClosed( "get()" );
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/SubtreeScopeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/SubtreeScopeCursor.java?rev=1378574&r1=1378573&r2=1378574&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/SubtreeScopeCursor.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/SubtreeScopeCursor.java Wed Aug 29 14:23:08 2012
@@ -20,6 +20,8 @@
package org.apache.directory.server.xdbm.search.cursor;
+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.xdbm.AbstractIndexCursor;
@@ -42,7 +44,7 @@ import org.slf4j.LoggerFactory;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class SubtreeScopeCursor<ID extends Comparable<ID>> extends AbstractIndexCursor<ID, ID>
+public class SubtreeScopeCursor extends AbstractIndexCursor<UUID>
{
/** A dedicated log for cursors */
private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" );
@@ -50,21 +52,21 @@ public class SubtreeScopeCursor<ID exten
private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_719 );
/** The Entry database/store */
- private final Store<Entry, ID> db;
+ private final Store<Entry> db;
/** A ScopeNode Evaluator */
- private final SubtreeScopeEvaluator<Entry, ID> evaluator;
+ private final SubtreeScopeEvaluator<Entry> evaluator;
/** A Cursor over the entries in the scope of the search base */
- private final Cursor<IndexEntry<ID, ID>> scopeCursor;
+ private final Cursor<IndexEntry<UUID, UUID>> scopeCursor;
/** A Cursor over entries brought into scope by alias dereferencing */
- private final Cursor<IndexEntry<ID, ID>> dereferencedCursor;
+ private final Cursor<IndexEntry<UUID, UUID>> dereferencedCursor;
/** Currently active Cursor: we switch between two cursors */
- private Cursor<IndexEntry<ID, ID>> cursor;
+ private Cursor<IndexEntry<UUID, UUID>> cursor;
- private ID contextEntryId;
+ private UUID contextEntryId;
/**
@@ -74,7 +76,7 @@ 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<Entry> db, SubtreeScopeEvaluator<Entry> evaluator )
throws Exception
{
LOG_CURSOR.debug( "Creating SubtreeScopeCursor {}", this );
@@ -83,22 +85,22 @@ public class SubtreeScopeCursor<ID exten
if ( evaluator.getBaseId() == getContextEntryId() )
{
- scopeCursor = new AllEntriesCursor<ID>( db );
+ scopeCursor = new AllEntriesCursor( db );
}
else
{
// We use the RdnIndex to get all the entries from a starting point
// and below up to the number of children
- ID baseId = evaluator.getBaseId();
- ParentIdAndRdn<ID> parentIdAndRdn = db.getRdnIndex().reverseLookup( baseId );
+ UUID baseId = evaluator.getBaseId();
+ ParentIdAndRdn<UUID> parentIdAndRdn = db.getRdnIndex().reverseLookup( baseId );
IndexEntry indexEntry = new ForwardIndexEntry();
indexEntry.setId( baseId );
indexEntry.setKey( parentIdAndRdn );
- Cursor<IndexEntry<ParentIdAndRdn<ID>, ID>> cursor = new SingletonIndexCursor<ParentIdAndRdn<ID>, ID>(
+ Cursor<IndexEntry<ParentIdAndRdn<UUID>, UUID>> cursor = new SingletonIndexCursor<ParentIdAndRdn<UUID>>(
indexEntry );
- ID parentId = parentIdAndRdn.getParentId();
+ UUID parentId = parentIdAndRdn.getParentId();
scopeCursor = new DescendantCursor( db, baseId, parentId, cursor );
}
@@ -124,24 +126,23 @@ 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 )
{
try
{
- this.contextEntryId = db.getEntryId( ( ( Partition ) db ).getSuffixDn() );
+ contextEntryId = db.getEntryId( ( ( Partition ) db ).getSuffixDn() );
}
catch ( Exception e )
{
// might not have been created
- // might not have been created
}
}
if ( contextEntryId == null )
{
- return db.getDefaultId();
+ return Partition.DEFAULT_ID;
}
return contextEntryId;
@@ -323,7 +324,7 @@ public class SubtreeScopeCursor<ID exten
}
- public IndexEntry<ID, ID> get() throws Exception
+ public IndexEntry<UUID, UUID> get() throws Exception
{
checkNotClosed( "get()" );
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/AndEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/AndEvaluator.java?rev=1378574&r1=1378573&r2=1378574&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/AndEvaluator.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/AndEvaluator.java Wed Aug 29 14:23:08 2012
@@ -23,6 +23,7 @@ package org.apache.directory.server.xdbm
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.UUID;
import org.apache.directory.server.xdbm.IndexEntry;
import org.apache.directory.server.xdbm.search.Evaluator;
@@ -37,10 +38,10 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class AndEvaluator<ID> implements Evaluator<AndNode, ID>
+public class AndEvaluator implements Evaluator<AndNode>
{
/** The list of evaluators associated with each of the children */
- private final List<Evaluator<? extends ExprNode, ID>> evaluators;
+ private final List<Evaluator<? extends ExprNode>> evaluators;
/** The AndNode */
private final AndNode node;
@@ -51,7 +52,7 @@ public class AndEvaluator<ID> implements
* @param node The And Node
* @param evaluators The list of evaluators for all the contaned nodes
*/
- public AndEvaluator( AndNode node, List<Evaluator<? extends ExprNode, ID>> evaluators )
+ public AndEvaluator( AndNode node, List<Evaluator<? extends ExprNode>> evaluators )
{
this.node = node;
this.evaluators = optimize( evaluators );
@@ -69,14 +70,14 @@ public class AndEvaluator<ID> implements
* @param unoptimized the unoptimized list of Evaluators
* @return optimized Evaluator list with increasing scan count ordering
*/
- private List<Evaluator<? extends ExprNode, ID>> optimize(
- List<Evaluator<? extends ExprNode, ID>> unoptimized )
+ private List<Evaluator<? extends ExprNode>> optimize(
+ List<Evaluator<? extends ExprNode>> unoptimized )
{
- List<Evaluator<? extends ExprNode, ID>> optimized = new ArrayList<Evaluator<? extends ExprNode, ID>>(
+ List<Evaluator<? extends ExprNode>> optimized = new ArrayList<Evaluator<? extends ExprNode>>(
unoptimized.size() );
optimized.addAll( unoptimized );
- Collections.sort( optimized, new ScanCountComparator<ID>() );
+ Collections.sort( optimized, new ScanCountComparator() );
return optimized;
}
@@ -87,7 +88,7 @@ public class AndEvaluator<ID> implements
*/
public boolean evaluate( Entry entry ) throws Exception
{
- for ( Evaluator<?, ID> evaluator : evaluators )
+ for ( Evaluator<?> evaluator : evaluators )
{
if ( !evaluator.evaluate( entry ) )
{
@@ -102,9 +103,9 @@ public class AndEvaluator<ID> implements
/**
* {@inheritDoc}
*/
- public boolean evaluate( IndexEntry<?, ID> indexEntry ) throws Exception
+ public boolean evaluate( IndexEntry<?, UUID> indexEntry ) throws Exception
{
- for ( Evaluator<?, ID> evaluator : evaluators )
+ for ( Evaluator<?> evaluator : evaluators )
{
if ( !evaluator.evaluate( indexEntry ) )
{