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 [3/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/search/evaluator/ApproximateEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/ApproximateEvaluator.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/ApproximateEvaluator.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/ApproximateEvaluator.java Wed Aug 29 14:23:08 2012
@@ -21,6 +21,7 @@ package org.apache.directory.server.xdbm
import java.util.Iterator;
+import java.util.UUID;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.xdbm.Index;
@@ -41,7 +42,7 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class ApproximateEvaluator<T, ID extends Comparable<ID>> extends LeafEvaluator<T, ID>
+public class ApproximateEvaluator<T> extends LeafEvaluator<T>
{
/**
* Creates a new ApproximateEvaluator
@@ -50,14 +51,14 @@ public class ApproximateEvaluator<T, ID
* @param schemaManager The SchemaManager
* @throws Exception If the creation failed
*/
- public ApproximateEvaluator( ApproximateNode<T> node, Store<Entry, ID> db, SchemaManager schemaManager )
+ public ApproximateEvaluator( ApproximateNode<T> node, Store<Entry> db, SchemaManager schemaManager )
throws Exception
{
super( node, db, schemaManager );
if ( db.hasIndexOn( attributeType ) )
{
- idx = ( Index<T, Entry, ID> ) db.getIndex( attributeType );
+ idx = ( Index<T, Entry, UUID> ) db.getIndex( attributeType );
normalizer = null;
ldapComparator = null;
}
@@ -132,7 +133,7 @@ public class ApproximateEvaluator<T, ID
/**
* {@inheritDoc}
*/
- public boolean evaluate( IndexEntry<?, ID> indexEntry ) throws Exception
+ public boolean evaluate( IndexEntry<?, UUID> indexEntry ) throws Exception
{
Entry entry = indexEntry.getEntry();
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/EqualityEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/EqualityEvaluator.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/EqualityEvaluator.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/EqualityEvaluator.java Wed Aug 29 14:23:08 2012
@@ -22,6 +22,7 @@ package org.apache.directory.server.xdbm
import java.util.Comparator;
import java.util.Iterator;
+import java.util.UUID;
import org.apache.directory.server.xdbm.Index;
import org.apache.directory.server.xdbm.IndexEntry;
@@ -45,7 +46,7 @@ import org.apache.directory.shared.util.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class EqualityEvaluator<T, ID extends Comparable<ID>> extends LeafEvaluator<T, ID>
+public class EqualityEvaluator<T> extends LeafEvaluator<T>
{
/** The default byte[] comparator if no comparator has been defined */
private static final Comparator<byte[]> BINARY_COMPARATOR = new ByteArrayComparator( null );
@@ -55,14 +56,14 @@ public class EqualityEvaluator<T, ID ext
@SuppressWarnings("unchecked")
- public EqualityEvaluator( EqualityNode<T> node, Store<Entry, ID> db, SchemaManager schemaManager )
+ public EqualityEvaluator( EqualityNode<T> node, Store<Entry> db, SchemaManager schemaManager )
throws Exception
{
super( node, db, schemaManager );
if ( db.hasIndexOn( attributeType ) )
{
- idx = ( Index<T, Entry, ID> ) db.getIndex( attributeType );
+ idx = ( Index<T, Entry, UUID> ) db.getIndex( attributeType );
normalizer = null;
ldapComparator = null;
}
@@ -92,7 +93,7 @@ public class EqualityEvaluator<T, ID ext
}
- public boolean evaluate( IndexEntry<?, ID> indexEntry ) throws Exception
+ public boolean evaluate( IndexEntry<?, UUID> indexEntry ) throws Exception
{
Entry entry = indexEntry.getEntry();
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/GreaterEqEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/GreaterEqEvaluator.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/GreaterEqEvaluator.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/GreaterEqEvaluator.java Wed Aug 29 14:23:08 2012
@@ -21,6 +21,7 @@ package org.apache.directory.server.xdbm
import java.util.Iterator;
+import java.util.UUID;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.xdbm.Index;
@@ -41,17 +42,17 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class GreaterEqEvaluator<T, ID extends Comparable<ID>> extends LeafEvaluator<T, ID>
+public class GreaterEqEvaluator<T> extends LeafEvaluator<T>
{
@SuppressWarnings("unchecked")
- public GreaterEqEvaluator( GreaterEqNode<T> node, Store<Entry, ID> db, SchemaManager schemaManager )
+ public GreaterEqEvaluator( GreaterEqNode<T> node, Store<Entry> db, SchemaManager schemaManager )
throws Exception
{
super( node, db, schemaManager );
if ( db.hasIndexOn( node.getAttributeType() ) )
{
- idx = ( Index<T, Entry, ID> ) db.getIndex( attributeType );
+ idx = ( Index<T, Entry, UUID> ) db.getIndex( attributeType );
}
else
{
@@ -87,7 +88,7 @@ public class GreaterEqEvaluator<T, ID ex
}
- public boolean evaluate( IndexEntry<?, ID> indexEntry ) throws Exception
+ public boolean evaluate( IndexEntry<?, UUID> indexEntry ) throws Exception
{
if ( idx != null && idx.isDupsEnabled() )
{
@@ -116,7 +117,7 @@ public class GreaterEqEvaluator<T, ID ex
// if the attribute exists and has a greater than or equal value return true
//noinspection unchecked
- if ( attr != null && evaluate( ( IndexEntry<Object, ID> ) indexEntry, attr ) )
+ if ( attr != null && evaluate( ( IndexEntry<Object, UUID> ) indexEntry, attr ) )
{
return true;
}
@@ -138,7 +139,7 @@ public class GreaterEqEvaluator<T, ID ex
attr = entry.get( descendant );
//noinspection unchecked
- if ( attr != null && evaluate( ( IndexEntry<Object, ID> ) indexEntry, attr ) )
+ if ( attr != null && evaluate( ( IndexEntry<Object, UUID> ) indexEntry, attr ) )
{
return true;
}
@@ -191,7 +192,7 @@ public class GreaterEqEvaluator<T, ID ex
// TODO - determine if comaparator and index entry should have the Value
// wrapper or the raw normalized value
- private boolean evaluate( IndexEntry<Object, ID> indexEntry, Attribute attribute )
+ private boolean evaluate( IndexEntry<Object, UUID> indexEntry, Attribute attribute )
throws Exception
{
/*
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/LeafEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/LeafEvaluator.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/LeafEvaluator.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/LeafEvaluator.java Wed Aug 29 14:23:08 2012
@@ -20,6 +20,8 @@
package org.apache.directory.server.xdbm.search.evaluator;
+import java.util.UUID;
+
import org.apache.directory.server.xdbm.Index;
import org.apache.directory.server.xdbm.Store;
import org.apache.directory.server.xdbm.search.Evaluator;
@@ -38,13 +40,13 @@ import org.apache.directory.shared.ldap.
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-public abstract class LeafEvaluator<T, ID extends Comparable<ID>> implements Evaluator<SimpleNode<T>, ID>
+public abstract class LeafEvaluator<T> implements Evaluator<SimpleNode<T>>
{
/** The ExprNode to evaluate */
protected final SimpleNode<T> node;
/** The backend */
- protected final Store<Entry, ID> db;
+ protected final Store<Entry> db;
/** The SchemaManager instance */
protected final SchemaManager schemaManager;
@@ -59,11 +61,11 @@ public abstract class LeafEvaluator<T, I
protected LdapComparator<? super Object> ldapComparator;
/** The index to use if any */
- protected Index<T, Entry, ID> idx;
+ protected Index<T, Entry, UUID> idx;
@SuppressWarnings("unchecked")
- public LeafEvaluator( SimpleNode<T> node, Store<Entry, ID> db, SchemaManager schemaManager )
+ public LeafEvaluator( SimpleNode<T> node, Store<Entry> db, SchemaManager schemaManager )
throws Exception
{
this.db = db;
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/LessEqEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/LessEqEvaluator.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/LessEqEvaluator.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/LessEqEvaluator.java Wed Aug 29 14:23:08 2012
@@ -21,6 +21,7 @@ package org.apache.directory.server.xdbm
import java.util.Iterator;
+import java.util.UUID;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.xdbm.Index;
@@ -41,17 +42,17 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class LessEqEvaluator<T, ID extends Comparable<ID>> extends LeafEvaluator<T, ID>
+public class LessEqEvaluator<T> extends LeafEvaluator<T>
{
@SuppressWarnings("unchecked")
- public LessEqEvaluator( LessEqNode<T> node, Store<Entry, ID> db, SchemaManager schemaManager )
+ public LessEqEvaluator( LessEqNode<T> node, Store<Entry> db, SchemaManager schemaManager )
throws Exception
{
super( node, db, schemaManager );
if ( db.hasIndexOn( attributeType ) )
{
- idx = ( Index<T, Entry, ID> ) db.getIndex( attributeType );
+ idx = ( Index<T, Entry, UUID> ) db.getIndex( attributeType );
}
else
{
@@ -87,7 +88,7 @@ public class LessEqEvaluator<T, ID exten
}
- public boolean evaluate( IndexEntry<?, ID> indexEntry ) throws Exception
+ public boolean evaluate( IndexEntry<?, UUID> indexEntry ) throws Exception
{
Entry entry = indexEntry.getEntry();
@@ -108,7 +109,7 @@ public class LessEqEvaluator<T, ID exten
// if the attribute does not exist just return false
//noinspection unchecked
- if ( attr != null && evaluate( ( IndexEntry<Object, ID> ) indexEntry, attr ) )
+ if ( attr != null && evaluate( ( IndexEntry<Object, UUID> ) indexEntry, attr ) )
{
return true;
}
@@ -130,7 +131,7 @@ public class LessEqEvaluator<T, ID exten
attr = entry.get( descendant );
//noinspection unchecked
- if ( attr != null && evaluate( ( IndexEntry<Object, ID> ) indexEntry, attr ) )
+ if ( attr != null && evaluate( ( IndexEntry<Object, UUID> ) indexEntry, attr ) )
{
return true;
}
@@ -183,7 +184,7 @@ public class LessEqEvaluator<T, ID exten
// TODO - determine if comaparator and index entry should have the Value
// wrapper or the raw normalized value
- private boolean evaluate( IndexEntry<Object, ID> indexEntry, Attribute attribute )
+ private boolean evaluate( IndexEntry<Object, UUID> indexEntry, Attribute attribute )
throws Exception
{
/*
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/NotEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/NotEvaluator.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/NotEvaluator.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/NotEvaluator.java Wed Aug 29 14:23:08 2012
@@ -20,6 +20,8 @@
package org.apache.directory.server.xdbm.search.evaluator;
+import java.util.UUID;
+
import org.apache.directory.server.xdbm.IndexEntry;
import org.apache.directory.server.xdbm.search.Evaluator;
import org.apache.directory.shared.ldap.model.entry.Entry;
@@ -32,16 +34,16 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class NotEvaluator<ID> implements Evaluator<NotNode, ID>
+public class NotEvaluator implements Evaluator<NotNode>
{
/** The ExprNode to evaluate */
private final NotNode node;
/** The Evaluator to use for the inner Node */
- private final Evaluator<? extends ExprNode, ID> childEvaluator;
+ private final Evaluator<? extends ExprNode> childEvaluator;
- public NotEvaluator( NotNode node, Evaluator<? extends ExprNode, ID> childEvaluator )
+ public NotEvaluator( NotNode node, Evaluator<? extends ExprNode> childEvaluator )
{
this.node = node;
this.childEvaluator = childEvaluator;
@@ -54,7 +56,7 @@ public class NotEvaluator<ID> implements
}
- public boolean evaluate( IndexEntry<?, ID> indexEntry ) throws Exception
+ public boolean evaluate( IndexEntry<?, UUID> indexEntry ) throws Exception
{
return !childEvaluator.evaluate( indexEntry );
}
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/OneLevelScopeEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/OneLevelScopeEvaluator.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/OneLevelScopeEvaluator.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/OneLevelScopeEvaluator.java Wed Aug 29 14:23:08 2012
@@ -20,6 +20,8 @@
package org.apache.directory.server.xdbm.search.evaluator;
+import java.util.UUID;
+
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.xdbm.IndexEntry;
import org.apache.directory.server.xdbm.ParentIdAndRdn;
@@ -35,19 +37,19 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class OneLevelScopeEvaluator<E, ID extends Comparable<ID>> implements Evaluator<ScopeNode, ID>
+public class OneLevelScopeEvaluator<E> implements Evaluator<ScopeNode<UUID>>
{
/** The ScopeNode containing initial search scope constraints */
- private final ScopeNode node;
+ private final ScopeNode<UUID> node;
/** The entry identifier of the scope base */
- private final ID baseId;
+ private final UUID baseId;
/** True if the scope requires alias dereferencing while searching */
private final boolean dereferencing;
/** the entry db storing entries */
- private final Store<E, ID> db;
+ private final Store<E> db;
/**
@@ -57,7 +59,7 @@ public class OneLevelScopeEvaluator<E, I
* @param db the database used to evaluate scope node
* @throws Exception on db access failure
*/
- public OneLevelScopeEvaluator( Store<E, ID> db, ScopeNode<ID> node ) throws Exception
+ public OneLevelScopeEvaluator( Store<E> db, ScopeNode<UUID> node ) throws Exception
{
this.node = node;
@@ -96,9 +98,9 @@ public class OneLevelScopeEvaluator<E, I
* @throws Exception if db lookups fail
* @see org.apache.directory.server.xdbm.search.Evaluator#evaluate(IndexEntry)
*/
- public boolean evaluate( IndexEntry<?, ID> candidate ) throws Exception
+ public boolean evaluate( IndexEntry<?, UUID> candidate ) throws Exception
{
- ParentIdAndRdn<ID> parent = db.getRdnIndex().reverseLookup( candidate.getId() );
+ ParentIdAndRdn<UUID> parent = db.getRdnIndex().reverseLookup( candidate.getId() );
boolean isChild = parent.getParentId().equals( baseId );
/*
@@ -144,7 +146,7 @@ public class OneLevelScopeEvaluator<E, I
}
- public ScopeNode getExpression()
+ public ScopeNode<UUID> getExpression()
{
return node;
}
@@ -155,7 +157,7 @@ public class OneLevelScopeEvaluator<E, I
*
* @return identifier of the search base
*/
- public ID getBaseId()
+ public UUID getBaseId()
{
return baseId;
}
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/OrEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/OrEvaluator.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/OrEvaluator.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/OrEvaluator.java Wed Aug 29 14:23:08 2012
@@ -24,6 +24,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
+import java.util.UUID;
import org.apache.directory.server.xdbm.IndexEntry;
import org.apache.directory.server.xdbm.search.Evaluator;
@@ -37,16 +38,16 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class OrEvaluator<ID> implements Evaluator<OrNode, ID>
+public class OrEvaluator implements Evaluator<OrNode>
{
/** 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 OrNode */
private final OrNode node;
- public OrEvaluator( OrNode node, List<Evaluator<? extends ExprNode, ID>> evaluators )
+ public OrEvaluator( OrNode node, List<Evaluator<? extends ExprNode>> evaluators )
{
this.node = node;
this.evaluators = optimize( evaluators );
@@ -64,16 +65,16 @@ public class OrEvaluator<ID> implements
* @param unoptimized the unoptimized list of Evaluators
* @return optimized Evaluator list with decreasing scan count ordering
*/
- private List<Evaluator<? extends ExprNode, 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 Comparator<Evaluator<? extends ExprNode, ID>>()
+ Collections.sort( optimized, new Comparator<Evaluator<? extends ExprNode>>()
{
- public int compare( Evaluator<? extends ExprNode, ID> e1,
- Evaluator<? extends ExprNode, ID> e2 )
+ public int compare( Evaluator<? extends ExprNode> e1,
+ Evaluator<? extends ExprNode> e2 )
{
long scanCount1 = ( Long ) e1.getExpression().get( "count" );
long scanCount2 = ( Long ) e2.getExpression().get( "count" );
@@ -102,9 +103,9 @@ public class OrEvaluator<ID> implements
}
- 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 ) )
{
@@ -118,7 +119,7 @@ public class OrEvaluator<ID> implements
public boolean evaluate( Entry entry ) throws Exception
{
- for ( Evaluator<?, ID> evaluator : evaluators )
+ for ( Evaluator<?> evaluator : evaluators )
{
if ( evaluator.evaluate( entry ) )
{
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/PresenceEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/PresenceEvaluator.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/PresenceEvaluator.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/PresenceEvaluator.java Wed Aug 29 14:23:08 2012
@@ -21,6 +21,7 @@ package org.apache.directory.server.xdbm
import java.util.Iterator;
+import java.util.UUID;
import org.apache.directory.server.xdbm.Index;
import org.apache.directory.server.xdbm.IndexEntry;
@@ -39,13 +40,13 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class PresenceEvaluator<ID extends Comparable<ID>> implements Evaluator<PresenceNode, ID>
+public class PresenceEvaluator implements Evaluator<PresenceNode>
{
/** The ExprNode to evaluate */
private final PresenceNode node;
/** The backend */
- private final Store<Entry, ID> db;
+ private final Store<Entry> db;
/** The AttributeType we will use for the evaluation */
private final AttributeType attributeType;
@@ -54,10 +55,10 @@ public class PresenceEvaluator<ID extend
private final SchemaManager schemaManager;
/** The index to use if any */
- private final Index<String, Entry, ID> idx;
+ private final Index<String, Entry, UUID> idx;
- public PresenceEvaluator( PresenceNode node, Store<Entry, ID> db, SchemaManager schemaManager )
+ public PresenceEvaluator( PresenceNode node, Store<Entry> db, SchemaManager schemaManager )
throws Exception
{
this.db = db;
@@ -90,7 +91,7 @@ public class PresenceEvaluator<ID extend
// TODO - determine if comparator and index entry should have the Value
// wrapper or the raw normalized value
- public boolean evaluate( IndexEntry<?, ID> indexEntry ) throws Exception
+ public boolean evaluate( IndexEntry<?, UUID> indexEntry ) throws Exception
{
Entry entry = indexEntry.getEntry();
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/SubstringEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/SubstringEvaluator.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/SubstringEvaluator.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/SubstringEvaluator.java Wed Aug 29 14:23:08 2012
@@ -21,6 +21,7 @@ package org.apache.directory.server.xdbm
import java.util.Iterator;
+import java.util.UUID;
import java.util.regex.Pattern;
import org.apache.directory.server.xdbm.Index;
@@ -44,10 +45,10 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class SubstringEvaluator<ID extends Comparable<ID>> implements Evaluator<SubstringNode, ID>
+public class SubstringEvaluator implements Evaluator<SubstringNode>
{
/** Database used while evaluating candidates */
- private final Store<Entry, ID> db;
+ private final Store<Entry> db;
/** Reference to the SchemaManager */
private final SchemaManager schemaManager;
@@ -65,7 +66,7 @@ public class SubstringEvaluator<ID exten
private final Normalizer normalizer;
/** The index to use if any */
- private final Index<String, Entry, ID> idx;
+ private final Index<String, Entry, UUID> idx;
/**
@@ -77,7 +78,7 @@ public class SubstringEvaluator<ID exten
* @throws Exception if there are failures accessing resources and the db
*/
@SuppressWarnings("unchecked")
- public SubstringEvaluator( SubstringNode node, Store<Entry, ID> db, SchemaManager schemaManager )
+ public SubstringEvaluator( SubstringNode node, Store<Entry> db, SchemaManager schemaManager )
throws Exception
{
this.db = db;
@@ -114,7 +115,7 @@ public class SubstringEvaluator<ID exten
if ( db.hasIndexOn( attributeType ) )
{
- idx = ( Index<String, Entry, ID> ) db.getIndex( attributeType );
+ idx = ( Index<String, Entry, UUID> ) db.getIndex( attributeType );
}
else
{
@@ -124,11 +125,11 @@ public class SubstringEvaluator<ID exten
@SuppressWarnings("unchecked")
- public boolean evaluate( IndexEntry<?, ID> indexEntry ) throws Exception
+ public boolean evaluate( IndexEntry<?, UUID> indexEntry ) throws Exception
{
if ( ( idx == null ) || ( !idx.hasReverse() ) )
{
- return evaluateWithoutIndex( ( IndexEntry<String, ID> ) indexEntry );
+ return evaluateWithoutIndex( ( IndexEntry<String, UUID> ) indexEntry );
}
else
{
@@ -155,7 +156,7 @@ public class SubstringEvaluator<ID exten
}
- private boolean evaluateWithIndex( IndexEntry<?, ID> indexEntry ) throws Exception
+ private boolean evaluateWithIndex( IndexEntry<?, UUID> indexEntry ) throws Exception
{
/*
* Note that this is using the reverse half of the index giving a
@@ -163,12 +164,12 @@ public class SubstringEvaluator<ID exten
* Otherwise we would have to scan the entire index if there were
* no reverse lookups.
*/
- Cursor<IndexEntry<String, ID>> entries = idx.reverseCursor( indexEntry.getId() );
+ Cursor<IndexEntry<String, UUID>> entries = idx.reverseCursor( indexEntry.getId() );
// cycle through the attribute values testing for a match
while ( entries.next() )
{
- IndexEntry<String, ID> rec = entries.get();
+ IndexEntry<String, UUID> rec = entries.get();
// once match is found cleanup and return true
if ( regex.matcher( rec.getKey() ).matches() )
@@ -261,7 +262,7 @@ public class SubstringEvaluator<ID exten
// TODO - determine if comaparator and index entry should have the Value
// wrapper or the raw normalized value
- private boolean evaluateWithoutIndex( IndexEntry<String, ID> indexEntry ) throws Exception
+ private boolean evaluateWithoutIndex( IndexEntry<String, UUID> indexEntry ) throws Exception
{
Entry entry = indexEntry.getEntry();
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/SubtreeScopeEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/SubtreeScopeEvaluator.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/SubtreeScopeEvaluator.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/SubtreeScopeEvaluator.java Wed Aug 29 14:23:08 2012
@@ -20,6 +20,8 @@
package org.apache.directory.server.xdbm.search.evaluator;
+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.IndexEntry;
@@ -37,13 +39,13 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class SubtreeScopeEvaluator<E, ID extends Comparable<ID>> implements Evaluator<ScopeNode, ID>
+public class SubtreeScopeEvaluator<E> implements Evaluator<ScopeNode<UUID>>
{
/** The ScopeNode containing initial search scope constraints */
- private final ScopeNode node;
+ private final ScopeNode<UUID> node;
/** The entry identifier of the scope base */
- private final ID baseId;
+ private final UUID baseId;
/**
* Whether or not to accept all candidates. If this evaluator's baseId is
@@ -61,7 +63,7 @@ public class SubtreeScopeEvaluator<E, ID
private final boolean dereferencing;
/** The entry database/store */
- private final Store<E, ID> db;
+ private final Store<E> db;
/**
@@ -71,7 +73,7 @@ public class SubtreeScopeEvaluator<E, ID
* @param db the database used to evaluate scope node
* @throws Exception on db access failure
*/
- public SubtreeScopeEvaluator( Store<E, ID> db, ScopeNode<ID> node ) throws Exception
+ public SubtreeScopeEvaluator( Store<E> db, ScopeNode<UUID> node ) throws Exception
{
this.db = db;
this.node = node;
@@ -86,12 +88,12 @@ public class SubtreeScopeEvaluator<E, ID
dereferencing = node.getDerefAliases().isDerefInSearching() || node.getDerefAliases().isDerefAlways();
}
- private ID contextEntryId;
+ private UUID contextEntryId;
// This will suppress PMD.EmptyCatchBlock warnings in this method
@SuppressWarnings("PMD.EmptyCatchBlock")
- private ID getContextEntryId() throws Exception
+ private UUID getContextEntryId() throws Exception
{
if ( contextEntryId == null )
{
@@ -102,13 +104,12 @@ public class SubtreeScopeEvaluator<E, ID
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;
@@ -120,13 +121,13 @@ public class SubtreeScopeEvaluator<E, ID
* the parentIdAndRdn up to the baseId. If we terminate on the context entry without
* having found the baseId, then the candidate is not a descendant.
*/
- private boolean isDescendant( ID candidateId ) throws Exception
+ private boolean isDescendant( UUID candidateId ) throws Exception
{
- ID tmp = candidateId;
+ UUID tmp = candidateId;
while ( true )
{
- ParentIdAndRdn<ID> parentIdAndRdn = db.getRdnIndex().reverseLookup( tmp );
+ ParentIdAndRdn<UUID> parentIdAndRdn = db.getRdnIndex().reverseLookup( tmp );
if ( parentIdAndRdn == null )
{
@@ -135,7 +136,7 @@ public class SubtreeScopeEvaluator<E, ID
tmp = parentIdAndRdn.getParentId();
- if ( tmp.equals( db.getRootId() ) )
+ if ( tmp.equals( Partition.ROOT_ID ) )
{
return false;
}
@@ -158,9 +159,9 @@ public class SubtreeScopeEvaluator<E, ID
* @throws Exception if the index lookups fail.
* @see Evaluator#evaluate(org.apache.directory.server.xdbm.IndexEntry)
*/
- public boolean evaluate( IndexEntry<?, ID> candidate ) throws Exception
+ public boolean evaluate( IndexEntry<?, UUID> candidate ) throws Exception
{
- ID id = candidate.getId();
+ UUID id = candidate.getId();
/*
* This condition catches situations where the candidate is equal to
@@ -233,13 +234,13 @@ public class SubtreeScopeEvaluator<E, ID
}
- public ScopeNode getExpression()
+ public ScopeNode<UUID> getExpression()
{
return node;
}
- public ID getBaseId()
+ public UUID getBaseId()
{
return baseId;
}
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/CursorBuilder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/CursorBuilder.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/impl/CursorBuilder.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/CursorBuilder.java Wed Aug 29 14:23:08 2012
@@ -22,6 +22,7 @@ package org.apache.directory.server.xdbm
import java.util.ArrayList;
import java.util.List;
+import java.util.UUID;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.xdbm.IndexEntry;
@@ -54,13 +55,13 @@ import org.apache.directory.shared.util.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class CursorBuilder<ID extends Comparable<ID>>
+public class CursorBuilder
{
/** The database used by this builder */
- private Store<Entry, ID> db = null;
+ private Store<Entry> db = null;
/** Evaluator dependency on a EvaluatorBuilder */
- private EvaluatorBuilder<ID> evaluatorBuilder;
+ private EvaluatorBuilder evaluatorBuilder;
/**
@@ -69,63 +70,63 @@ public class CursorBuilder<ID extends Co
* @param db database used by this enumerator
* @param evaluatorBuilder the evaluator builder
*/
- public CursorBuilder( Store<Entry, ID> db, EvaluatorBuilder<ID> evaluatorBuilder )
+ public CursorBuilder( Store<Entry> db, EvaluatorBuilder evaluatorBuilder )
{
this.db = db;
this.evaluatorBuilder = evaluatorBuilder;
}
- public <T> Cursor<IndexEntry<?, ID>> build( ExprNode node ) throws Exception
+ public <T> Cursor<IndexEntry<?, UUID>> build( ExprNode node ) throws Exception
{
switch ( node.getAssertionType() )
{
/* ---------- LEAF NODE HANDLING ---------- */
case APPROXIMATE:
- return ( Cursor ) new ApproximateCursor<T, ID>( db,
- ( org.apache.directory.server.xdbm.search.evaluator.ApproximateEvaluator<T, ID> ) evaluatorBuilder
+ return ( Cursor ) new ApproximateCursor<T>( db,
+ ( org.apache.directory.server.xdbm.search.evaluator.ApproximateEvaluator<T> ) evaluatorBuilder
.build( node ) );
case EQUALITY:
- return ( Cursor ) new EqualityCursor<T, ID>( db,
- ( org.apache.directory.server.xdbm.search.evaluator.EqualityEvaluator<T, ID> ) evaluatorBuilder
+ return ( Cursor ) new EqualityCursor<T>( db,
+ ( org.apache.directory.server.xdbm.search.evaluator.EqualityEvaluator<T> ) evaluatorBuilder
.build( node ) );
case GREATEREQ:
- return ( Cursor ) new GreaterEqCursor<T, ID>( db,
- ( org.apache.directory.server.xdbm.search.evaluator.GreaterEqEvaluator<T, ID> ) evaluatorBuilder
+ return ( Cursor ) new GreaterEqCursor<T>( db,
+ ( org.apache.directory.server.xdbm.search.evaluator.GreaterEqEvaluator<T> ) evaluatorBuilder
.build( node ) );
case LESSEQ:
- return ( Cursor ) new LessEqCursor<T, ID>( db,
- ( org.apache.directory.server.xdbm.search.evaluator.LessEqEvaluator<T, ID> ) evaluatorBuilder
+ return ( Cursor ) new LessEqCursor<T>( db,
+ ( org.apache.directory.server.xdbm.search.evaluator.LessEqEvaluator<T> ) evaluatorBuilder
.build( node ) );
case PRESENCE:
- return ( Cursor ) new PresenceCursor<ID>( db,
- ( org.apache.directory.server.xdbm.search.evaluator.PresenceEvaluator<ID> ) evaluatorBuilder
+ return ( Cursor ) new PresenceCursor( db,
+ ( org.apache.directory.server.xdbm.search.evaluator.PresenceEvaluator ) evaluatorBuilder
.build( node ) );
case SCOPE:
if ( ( ( ScopeNode ) node ).getScope() == SearchScope.ONELEVEL )
{
- return ( Cursor ) new OneLevelScopeCursor<ID>(
+ return ( Cursor ) new OneLevelScopeCursor(
db,
- ( org.apache.directory.server.xdbm.search.evaluator.OneLevelScopeEvaluator<Entry, ID> ) evaluatorBuilder
+ ( org.apache.directory.server.xdbm.search.evaluator.OneLevelScopeEvaluator<Entry> ) evaluatorBuilder
.build( node ) );
}
else
{
- return ( Cursor ) new SubtreeScopeCursor<ID>(
+ return ( Cursor ) new SubtreeScopeCursor(
db,
- ( org.apache.directory.server.xdbm.search.evaluator.SubtreeScopeEvaluator<Entry, ID> ) evaluatorBuilder
+ ( org.apache.directory.server.xdbm.search.evaluator.SubtreeScopeEvaluator<Entry> ) evaluatorBuilder
.build( node ) );
}
case SUBSTRING:
- return ( Cursor ) new SubstringCursor<ID>( db,
- ( org.apache.directory.server.xdbm.search.evaluator.SubstringEvaluator<ID> ) evaluatorBuilder
+ return ( Cursor ) new SubstringCursor( db,
+ ( org.apache.directory.server.xdbm.search.evaluator.SubstringEvaluator ) evaluatorBuilder
.build( node ) );
/* ---------- LOGICAL OPERATORS ---------- */
@@ -134,7 +135,7 @@ public class CursorBuilder<ID extends Co
return buildAndCursor( ( AndNode ) node );
case NOT:
- return ( Cursor ) new NotCursor<ID, ID>( db, evaluatorBuilder.build( ( ( NotNode ) node )
+ return ( Cursor ) new NotCursor<UUID>( db, evaluatorBuilder.build( ( ( NotNode ) node )
.getFirstChild() ) );
case OR:
@@ -159,12 +160,12 @@ public class CursorBuilder<ID extends Co
* @return Cursor over candidates satisfying disjunction expression
* @throws Exception on db access failures
*/
- private Cursor<IndexEntry<?, ID>> buildOrCursor( OrNode node ) throws Exception
+ private Cursor<IndexEntry<?, UUID>> buildOrCursor( OrNode node ) throws Exception
{
List<ExprNode> children = node.getChildren();
- List<Cursor<IndexEntry<?, ID>>> childCursors = new ArrayList<Cursor<IndexEntry<?, ID>>>(
+ List<Cursor<IndexEntry<?, UUID>>> childCursors = new ArrayList<Cursor<IndexEntry<?, UUID>>>(
children.size() );
- List<Evaluator<? extends ExprNode, ID>> childEvaluators = new ArrayList<Evaluator<? extends ExprNode, ID>>(
+ List<Evaluator<? extends ExprNode>> childEvaluators = new ArrayList<Evaluator<? extends ExprNode>>(
children.size() );
// Recursively create Cursors and Evaluators for each child expression node
@@ -185,7 +186,7 @@ public class CursorBuilder<ID extends Co
* @return Cursor over the conjunction expression
* @throws Exception on db access failures
*/
- private Cursor<IndexEntry<?, ID>> buildAndCursor( AndNode node ) throws Exception
+ private Cursor<IndexEntry<?, UUID>> buildAndCursor( AndNode node ) throws Exception
{
int minIndex = 0;
long minValue = Long.MAX_VALUE;
@@ -219,7 +220,7 @@ public class CursorBuilder<ID extends Co
// Once found we build the child Evaluators minus the one for the minChild
ExprNode minChild = children.get( minIndex );
- List<Evaluator<? extends ExprNode, ID>> childEvaluators = new ArrayList<Evaluator<? extends ExprNode, ID>>(
+ List<Evaluator<? extends ExprNode>> childEvaluators = new ArrayList<Evaluator<? extends ExprNode>>(
children.size() - 1 );
for ( ExprNode child : children )
@@ -233,7 +234,7 @@ public class CursorBuilder<ID extends Co
}
// Do recursive call to build min child Cursor then create AndCursor
- Cursor<IndexEntry<?, ID>> childCursor = build( minChild );
+ Cursor<IndexEntry<?, UUID>> childCursor = build( minChild );
return new AndCursor( childCursor, childEvaluators );
}
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.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/impl/DefaultOptimizer.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java Wed Aug 29 14:23:08 2012
@@ -21,6 +21,7 @@ package org.apache.directory.server.xdbm
import java.util.List;
+import java.util.UUID;
import org.apache.directory.server.core.api.partition.Partition;
import org.apache.directory.server.i18n.I18n;
@@ -50,11 +51,11 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class DefaultOptimizer<E, ID extends Comparable<ID>> implements Optimizer
+public class DefaultOptimizer<E> implements Optimizer
{
/** the database this optimizer operates on */
- private final Store<E, ID> db;
- private ID contextEntryId;
+ private final Store<E> db;
+ private UUID contextEntryId;
/**
@@ -62,7 +63,7 @@ public class DefaultOptimizer<E, ID exte
*
* @param db the database this optimizer works for.
*/
- public DefaultOptimizer( Store<E, ID> db ) throws Exception
+ public DefaultOptimizer( Store<E> db ) throws Exception
{
this.db = db;
}
@@ -70,7 +71,7 @@ public class DefaultOptimizer<E, ID exte
// This will suppress PMD.EmptyCatchBlock warnings in this method
@SuppressWarnings("PMD.EmptyCatchBlock")
- private ID getContextEntryId() throws Exception
+ private UUID getContextEntryId() throws Exception
{
if ( contextEntryId == null )
{
@@ -86,7 +87,7 @@ public class DefaultOptimizer<E, ID exte
if ( contextEntryId == null )
{
- return db.getDefaultId();
+ return Partition.DEFAULT_ID;
}
return contextEntryId;
@@ -122,7 +123,7 @@ public class DefaultOptimizer<E, ID exte
if ( node instanceof ScopeNode )
{
- count = getScopeScan( ( ScopeNode<ID> ) node );
+ count = getScopeScan( ( ScopeNode<UUID> ) node );
}
else if ( node instanceof AssertionNode )
{
@@ -210,7 +211,7 @@ public class DefaultOptimizer<E, ID exte
}
node.set( "count", count );
-
+
return count;
}
@@ -278,7 +279,8 @@ public class DefaultOptimizer<E, ID exte
{
if ( db.hasIndexOn( node.getAttributeType() ) )
{
- Index<V, E, ID> idx = ( Index<V, E, ID> ) db.getIndex( node.getAttributeType() );
+ Index<V, E, UUID> idx = ( Index<V, E, UUID> ) db.getIndex( node.getAttributeType() );
+
return idx.count( node.getValue().getValue() );
}
@@ -301,7 +303,7 @@ public class DefaultOptimizer<E, ID exte
{
if ( db.hasIndexOn( node.getAttributeType() ) )
{
- Index<V, E, ID> idx = ( Index<V, E, ID> ) db.getIndex( node.getAttributeType() );
+ Index<V, E, UUID> idx = ( Index<V, E, UUID> ) db.getIndex( node.getAttributeType() );
if ( isGreaterThan )
{
return idx.greaterThanCount( node.getValue().getValue() );
@@ -350,7 +352,7 @@ public class DefaultOptimizer<E, ID exte
{
if ( db.hasUserIndexOn( node.getAttributeType() ) )
{
- Index<String, E, ID> idx = db.getPresenceIndex();
+ Index<String, E, UUID> idx = db.getPresenceIndex();
return idx.count( node.getAttributeType().getOid() );
}
else if ( db.hasSystemIndexOn( node.getAttributeType() ) )
@@ -371,10 +373,10 @@ public class DefaultOptimizer<E, ID exte
* @return the scan count for scope
* @throws Exception if any errors result
*/
- private long getScopeScan( ScopeNode<ID> node ) throws Exception
+ private long getScopeScan( ScopeNode<UUID> node ) throws Exception
{
- ID id = node.getBaseId();
-
+ UUID id = node.getBaseId();
+
switch ( node.getScope() )
{
case OBJECT:
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.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/impl/DefaultSearchEngine.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java Wed Aug 29 14:23:08 2012
@@ -20,6 +20,8 @@
package org.apache.directory.server.xdbm.search.impl;
+import java.util.UUID;
+
import org.apache.directory.server.core.api.partition.Partition;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.xdbm.EmptyIndexCursor;
@@ -48,19 +50,19 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class DefaultSearchEngine<ID extends Comparable<ID>> implements SearchEngine<Entry, ID>
+public class DefaultSearchEngine implements SearchEngine<Entry>
{
/** the Optimizer used by this DefaultSearchEngine */
private final Optimizer optimizer;
/** the Database this DefaultSearchEngine operates on */
- private final Store<Entry, ID> db;
+ private final Store<Entry> db;
/** creates Cursors over entries satisfying filter expressions */
- private final CursorBuilder<ID> cursorBuilder;
+ private final CursorBuilder cursorBuilder;
/** creates evaluators which check to see if candidates satisfy a filter expression */
- private final EvaluatorBuilder<ID> evaluatorBuilder;
+ private final EvaluatorBuilder evaluatorBuilder;
// ------------------------------------------------------------------------
@@ -75,8 +77,8 @@ public class DefaultSearchEngine<ID exte
* @param evaluatorBuilder an expression evaluator builder
* @param optimizer an optimizer to use during search
*/
- public DefaultSearchEngine( Store<Entry, ID> db, CursorBuilder<ID> cursorBuilder,
- EvaluatorBuilder<ID> evaluatorBuilder, Optimizer optimizer )
+ public DefaultSearchEngine( Store<Entry> db, CursorBuilder cursorBuilder,
+ EvaluatorBuilder evaluatorBuilder, Optimizer optimizer )
{
this.db = db;
this.optimizer = optimizer;
@@ -99,11 +101,11 @@ public class DefaultSearchEngine<ID exte
/**
* {@inheritDoc}
*/
- public Cursor<IndexEntry<ID, ID>> cursor( Dn base, AliasDerefMode aliasDerefMode, ExprNode filter,
+ public Cursor<IndexEntry<UUID, UUID>> cursor( Dn base, AliasDerefMode aliasDerefMode, ExprNode filter,
SearchScope scope ) throws Exception
{
Dn effectiveBase;
- ID baseId = db.getEntryId( base );
+ UUID baseId = db.getEntryId( base );
// Check that we have an entry, otherwise we can immediately get out
if ( baseId == null )
@@ -111,7 +113,7 @@ public class DefaultSearchEngine<ID exte
if ( ( ( Partition ) db ).getSuffixDn().equals( base ) )
{
// The context entry is not created yet, return an empty cursor
- return new EmptyIndexCursor<ID, ID>();
+ return new EmptyIndexCursor<UUID>();
}
else
{
@@ -148,7 +150,7 @@ public class DefaultSearchEngine<ID exte
// --------------------------------------------------------------------
// Specifically Handle Object Level Scope
// --------------------------------------------------------------------
- ID effectiveBaseId = baseId;
+ UUID effectiveBaseId = baseId;
if ( effectiveBase != base )
{
@@ -157,10 +159,10 @@ public class DefaultSearchEngine<ID exte
if ( scope == SearchScope.OBJECT )
{
- IndexEntry<ID, ID> indexEntry = new ForwardIndexEntry<ID, ID>();
+ IndexEntry<UUID, UUID> indexEntry = new ForwardIndexEntry<UUID, UUID>();
indexEntry.setId( effectiveBaseId );
optimizer.annotate( filter );
- Evaluator<? extends ExprNode, ID> evaluator = evaluatorBuilder.build( filter );
+ Evaluator<? extends ExprNode> evaluator = evaluatorBuilder.build( filter );
// Fetch the entry, as we have only one
Entry entry = null;
@@ -178,17 +180,17 @@ public class DefaultSearchEngine<ID exte
if ( evaluator.evaluate( indexEntry ) )
{
- return new SingletonIndexCursor<ID, ID>( indexEntry );
+ return new SingletonIndexCursor<UUID>( indexEntry );
}
else
{
- return new EmptyIndexCursor<ID, ID>();
+ return new EmptyIndexCursor<UUID>();
}
}
// Add the scope node using the effective base to the filter
BranchNode root = new AndNode();
- ExprNode node = new ScopeNode<ID>( aliasDerefMode, effectiveBase, effectiveBaseId, scope );
+ ExprNode node = new ScopeNode( aliasDerefMode, effectiveBase, effectiveBaseId, scope );
root.getChildren().add( node );
root.getChildren().add( filter );
@@ -202,7 +204,7 @@ public class DefaultSearchEngine<ID exte
/**
* @see SearchEngine#evaluator(ExprNode)
*/
- public Evaluator<? extends ExprNode, ID> evaluator( ExprNode filter ) throws Exception
+ public Evaluator<? extends ExprNode> evaluator( ExprNode filter ) throws Exception
{
return evaluatorBuilder.build( filter );
}
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EvaluatorBuilder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EvaluatorBuilder.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/impl/EvaluatorBuilder.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EvaluatorBuilder.java Wed Aug 29 14:23:08 2012
@@ -22,6 +22,7 @@ package org.apache.directory.server.xdbm
import java.util.ArrayList;
import java.util.List;
+import java.util.UUID;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.xdbm.Store;
@@ -59,9 +60,9 @@ import org.apache.directory.shared.util.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class EvaluatorBuilder<ID extends Comparable<ID>>
+public class EvaluatorBuilder
{
- private final Store<Entry, ID> db;
+ private final Store<Entry> db;
private final SchemaManager schemaManager;
@@ -73,46 +74,46 @@ public class EvaluatorBuilder<ID extends
* @param schemaManager the schema manager
* @throws Exception failure to access db or lookup schema in registries
*/
- public EvaluatorBuilder( Store<Entry, ID> db, SchemaManager schemaManager ) throws Exception
+ public EvaluatorBuilder( Store<Entry> db, SchemaManager schemaManager ) throws Exception
{
this.db = db;
this.schemaManager = schemaManager;
}
- public <T> Evaluator<? extends ExprNode, ID> build( ExprNode node ) throws Exception
+ public <T> Evaluator<? extends ExprNode> build( ExprNode node ) throws Exception
{
switch ( node.getAssertionType() )
{
/* ---------- LEAF NODE HANDLING ---------- */
case APPROXIMATE:
- return new ApproximateEvaluator<T, ID>( ( ApproximateNode<T> ) node, db, schemaManager );
+ return new ApproximateEvaluator<T>( ( ApproximateNode<T> ) node, db, schemaManager );
case EQUALITY:
- return new EqualityEvaluator<T, ID>( ( EqualityNode<T> ) node, db, schemaManager );
+ return new EqualityEvaluator<T>( ( EqualityNode<T> ) node, db, schemaManager );
case GREATEREQ:
- return new GreaterEqEvaluator<T, ID>( ( GreaterEqNode<T> ) node, db, schemaManager );
+ return new GreaterEqEvaluator<T>( ( GreaterEqNode<T> ) node, db, schemaManager );
case LESSEQ:
- return new LessEqEvaluator<T, ID>( ( LessEqNode<T> ) node, db, schemaManager );
+ return new LessEqEvaluator<T>( ( LessEqNode<T> ) node, db, schemaManager );
case PRESENCE:
- return new PresenceEvaluator<ID>( ( PresenceNode ) node, db, schemaManager );
+ return new PresenceEvaluator( ( PresenceNode ) node, db, schemaManager );
case SCOPE:
- if ( ( ( ScopeNode<ID> ) node ).getScope() == SearchScope.ONELEVEL )
+ if ( ( ( ScopeNode<UUID> ) node ).getScope() == SearchScope.ONELEVEL )
{
- return new OneLevelScopeEvaluator<Entry, ID>( db, ( ScopeNode<ID> ) node );
+ return new OneLevelScopeEvaluator<Entry>( db, ( ScopeNode<UUID> ) node );
}
else
{
- return new SubtreeScopeEvaluator<Entry, ID>( db, ( ScopeNode<ID> ) node );
+ return new SubtreeScopeEvaluator<Entry>( db, ( ScopeNode<UUID> ) node );
}
case SUBSTRING:
- return new SubstringEvaluator<ID>( ( SubstringNode ) node, db, schemaManager );
+ return new SubstringEvaluator( ( SubstringNode ) node, db, schemaManager );
/* ---------- LOGICAL OPERATORS ---------- */
@@ -120,7 +121,7 @@ public class EvaluatorBuilder<ID extends
return buildAndEvaluator( ( AndNode ) node );
case NOT:
- return new NotEvaluator<ID>( ( NotNode ) node, build( ( ( NotNode ) node ).getFirstChild() ) );
+ return new NotEvaluator( ( NotNode ) node, build( ( ( NotNode ) node ).getFirstChild() ) );
case OR:
return buildOrEvaluator( ( OrNode ) node );
@@ -137,28 +138,28 @@ public class EvaluatorBuilder<ID extends
}
- AndEvaluator<ID> buildAndEvaluator( AndNode node ) throws Exception
+ AndEvaluator buildAndEvaluator( AndNode node ) throws Exception
{
List<ExprNode> children = node.getChildren();
- List<Evaluator<? extends ExprNode, ID>> evaluators = new ArrayList<Evaluator<? extends ExprNode, ID>>(
+ List<Evaluator<? extends ExprNode>> evaluators = new ArrayList<Evaluator<? extends ExprNode>>(
children.size() );
for ( ExprNode child : children )
{
evaluators.add( build( child ) );
}
- return new AndEvaluator<ID>( node, evaluators );
+ return new AndEvaluator( node, evaluators );
}
- OrEvaluator<ID> buildOrEvaluator( OrNode node ) throws Exception
+ OrEvaluator buildOrEvaluator( OrNode node ) throws Exception
{
List<ExprNode> children = node.getChildren();
- List<Evaluator<? extends ExprNode, ID>> evaluators = new ArrayList<Evaluator<? extends ExprNode, ID>>(
+ List<Evaluator<? extends ExprNode>> evaluators = new ArrayList<Evaluator<? extends ExprNode>>(
children.size() );
for ( ExprNode child : children )
{
evaluators.add( build( child ) );
}
- return new OrEvaluator<ID>( node, evaluators );
+ return new OrEvaluator( node, evaluators );
}
}
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ScanCountComparator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ScanCountComparator.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/impl/ScanCountComparator.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ScanCountComparator.java Wed Aug 29 14:23:08 2012
@@ -32,12 +32,12 @@ import org.apache.directory.server.xdbm.
*
* @param <ID> The type of element
*/
-public class ScanCountComparator<ID> implements Comparator<Evaluator<?, ID>>
+public class ScanCountComparator implements Comparator<Evaluator<?>>
{
/**
* Compare two scan counts frpm two evaluators
*/
- public int compare( Evaluator<?, ID> e1, Evaluator<?, ID> e2 )
+ public int compare( Evaluator<?> e1, Evaluator<?> e2 )
{
long scanCount1 = ( Long ) e1.getExpression().get( "count" );
long scanCount2 = ( Long ) e2.getExpression().get( "count" );
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/AbstractIndexCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/AbstractIndexCursorTest.java?rev=1378574&r1=1378573&r2=1378574&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/AbstractIndexCursorTest.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/AbstractIndexCursorTest.java Wed Aug 29 14:23:08 2012
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertFal
import static org.junit.Assert.assertTrue;
import java.util.Iterator;
+import java.util.UUID;
import org.apache.directory.shared.ldap.model.cursor.CursorClosedException;
import org.apache.directory.shared.ldap.model.cursor.DefaultClosureMonitor;
@@ -41,13 +42,13 @@ import org.junit.Test;
public class AbstractIndexCursorTest
{
- private AbstractIndexCursor<String, Long> indexCursor;
+ private AbstractIndexCursor<String> indexCursor;
@Before
public void setUp()
{
- indexCursor = new EmptyIndexCursor<String, Long>();
+ indexCursor = new EmptyIndexCursor<String>();
}
@@ -124,7 +125,7 @@ public class AbstractIndexCursorTest
@Test
public void testIterator()
{
- Iterator<IndexEntry<String, Long>> iterator = indexCursor.iterator();
+ Iterator<IndexEntry<String, UUID>> iterator = indexCursor.iterator();
assertNotNull( iterator );
}
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/EmptyIndexCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/EmptyIndexCursorTest.java?rev=1378574&r1=1378573&r2=1378574&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/EmptyIndexCursorTest.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/EmptyIndexCursorTest.java Wed Aug 29 14:23:08 2012
@@ -22,6 +22,7 @@ package org.apache.directory.server.xdbm
import static junit.framework.Assert.assertFalse;
+import org.apache.directory.server.core.api.partition.Partition;
import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
import org.junit.After;
import org.junit.Before;
@@ -36,13 +37,13 @@ import org.junit.Test;
public class EmptyIndexCursorTest
{
- private EmptyIndexCursor<String, Long> indexCursor;
+ private EmptyIndexCursor<String> indexCursor;
@Before
public void setUp()
{
- indexCursor = new EmptyIndexCursor<String, Long>();
+ indexCursor = new EmptyIndexCursor<String>();
}
@@ -59,7 +60,7 @@ public class EmptyIndexCursorTest
@Test
public void testConstructor() throws Exception
{
- EmptyIndexCursor<String, Long> cursor = new EmptyIndexCursor<String, Long>();
+ EmptyIndexCursor<String> cursor = new EmptyIndexCursor<String>();
cursor.close();
}
@@ -181,7 +182,7 @@ public class EmptyIndexCursorTest
@Test
public void testBeforeValue() throws Exception
{
- indexCursor.beforeValue( 1L, "test" );
+ indexCursor.beforeValue( Partition.DEFAULT_ID, "test" );
}
@@ -195,7 +196,7 @@ public class EmptyIndexCursorTest
@Test
public void testAfterValue() throws Exception
{
- indexCursor.afterValue( 1L, "test" );
+ indexCursor.afterValue( Partition.DEFAULT_ID, "test" );
}
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java?rev=1378574&r1=1378573&r2=1378574&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java Wed Aug 29 14:23:08 2012
@@ -30,6 +30,7 @@ import static org.junit.Assert.fail;
import java.io.File;
import java.util.Iterator;
+import java.util.UUID;
import net.sf.ehcache.store.AbstractStore;
@@ -188,7 +189,7 @@ public class PartitionTest
Modification add = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, attrib );
- Long entryId = partition.getEntryId( dn );
+ UUID entryId = partition.getEntryId( dn );
Entry lookedup = partition.lookup( entryId );
// before modification: no "uidObject" tuple in objectClass index
@@ -218,11 +219,11 @@ public class PartitionTest
Modification add = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE, attrib );
- Long entryId = partition.getEntryId( dn );
+ UUID entryId = partition.getEntryId( dn );
Entry lookedup = partition.lookup( entryId );
// before modification: expect "sales" tuple in ou index
- Index<String, Entry, Long> ouIndex = ( Index<String, Entry, Long> ) partition.getUserIndex( OU_AT );
+ Index<String, Entry, UUID> ouIndex = ( Index<String, Entry, UUID> ) partition.getUserIndex( OU_AT );
assertTrue( ouIndex.forward( "sales", entryId ) );
assertTrue( lookedup.get( "ou" ).contains( "sales" ) );
@@ -247,11 +248,11 @@ public class PartitionTest
Modification add = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE, attrib );
- Long entryId = partition.getEntryId( dn );
+ UUID entryId = partition.getEntryId( dn );
Entry lookedup = partition.lookup( entryId );
// before modification: expect "sales" tuple in ou index
- Index<String, Entry, Long> ouIndex = ( Index<String, Entry, Long> ) partition.getUserIndex( OU_AT );
+ Index<String, Entry, UUID> ouIndex = ( Index<String, Entry, UUID> ) partition.getUserIndex( OU_AT );
assertTrue( partition.getPresenceIndex().forward( SchemaConstants.OU_AT_OID, entryId ) );
assertTrue( ouIndex.forward( "sales", entryId ) );
assertTrue( lookedup.get( "ou" ).contains( "sales" ) );
@@ -282,7 +283,7 @@ public class PartitionTest
Modification add = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE, attrib );
- Long entryId = partition.getEntryId( dn );
+ UUID entryId = partition.getEntryId( dn );
Entry lookedup = partition.lookup( entryId );
// before modification: expect "person" tuple in objectClass index
@@ -310,7 +311,7 @@ public class PartitionTest
Modification add = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE, attrib );
- Long entryId = partition.getEntryId( dn );
+ UUID entryId = partition.getEntryId( dn );
Entry lookedup = partition.lookup( entryId );
// before modification: expect "person" tuple in objectClass index
@@ -339,7 +340,7 @@ public class PartitionTest
Modification add = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, attrib );
- Long entryId = partition.getEntryId( dn );
+ UUID entryId = partition.getEntryId( dn );
Entry lookedup = partition.lookup( entryId );
assertNotSame( csn, lookedup.get( csnAt ).getString() );
@@ -369,13 +370,13 @@ public class PartitionTest
Dn dn = new Dn( schemaManager, "cn=user,ou=Sales,o=Good Times Co." );
Entry entry = new DefaultEntry( schemaManager, dn,
- "objectClass: top",
+ "objectClass: top",
"objectClass: person",
"cn: user",
"sn: user sn" );
// add
- StoreUtils.injectEntryInStore( partition, entry );
+ StoreUtils.injectEntryInStore( partition, entry, 12 );
verifyParentId( dn );
// move
@@ -396,9 +397,9 @@ public class PartitionTest
private Entry verifyParentId( Dn dn ) throws Exception
{
- Long entryId = partition.getEntryId( dn );
+ UUID entryId = partition.getEntryId( dn );
Entry entry = partition.lookup( entryId );
- Long parentId = partition.getParentId( entryId );
+ UUID parentId = partition.getParentId( entryId );
Attribute parentIdAt = entry.get( SchemaConstants.ENTRY_PARENT_ID_AT );
assertNotNull( parentIdAt );
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/SingletonIndexCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/SingletonIndexCursorTest.java?rev=1378574&r1=1378573&r2=1378574&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/SingletonIndexCursorTest.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/SingletonIndexCursorTest.java Wed Aug 29 14:23:08 2012
@@ -24,6 +24,9 @@ import static junit.framework.Assert.ass
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertTrue;
+import java.util.UUID;
+
+import org.apache.directory.server.core.api.partition.Partition;
import org.apache.directory.shared.ldap.model.cursor.Cursor;
import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
@@ -40,18 +43,18 @@ import org.junit.Test;
public class SingletonIndexCursorTest
{
- private ForwardIndexEntry<String, Long> indexEntry;
- private SingletonIndexCursor<String, Long> indexCursor;
+ private ForwardIndexEntry<String, UUID> indexEntry;
+ private SingletonIndexCursor<String> indexCursor;
@Before
public void setUp()
{
- indexEntry = new ForwardIndexEntry<String, Long>();
- indexEntry.setId( 1L );
+ indexEntry = new ForwardIndexEntry<String, UUID>();
+ indexEntry.setId( Partition.DEFAULT_ID );
indexEntry.setEntry( new DefaultEntry() );
indexEntry.setKey( "test" );
- indexCursor = new SingletonIndexCursor<String, Long>( indexEntry );
+ indexCursor = new SingletonIndexCursor<String>( indexEntry );
}
@@ -65,7 +68,7 @@ public class SingletonIndexCursorTest
@Test
public void testConstructor() throws Exception
{
- Cursor cursor = new SingletonIndexCursor<String, Long>( indexEntry );
+ Cursor cursor = new SingletonIndexCursor<String>( indexEntry );
cursor.close();
}
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/StoreUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/StoreUtils.java?rev=1378574&r1=1378573&r2=1378574&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/StoreUtils.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/StoreUtils.java Wed Aug 29 14:23:08 2012
@@ -20,8 +20,6 @@
package org.apache.directory.server.xdbm;
-import java.util.UUID;
-
import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
import org.apache.directory.server.core.api.partition.Partition;
import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
@@ -30,6 +28,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.entry.Entry;
import org.apache.directory.shared.ldap.model.name.Dn;
import org.apache.directory.shared.ldap.model.schema.SchemaManager;
+import org.apache.directory.shared.util.Strings;
/**
@@ -55,11 +54,10 @@ public class StoreUtils
* @param registries oid registries
* @throws Exception on access exceptions
*/
- //This will suppress PMD.AvoidUsingHardCodedIP warnings in this class
- @SuppressWarnings("PMD.AvoidUsingHardCodedIP")
- public static void loadExampleData( Store<Entry, Long> store, SchemaManager schemaManager ) throws Exception
+ public static void loadExampleData( Store<Entry> store, SchemaManager schemaManager ) throws Exception
{
Dn suffixDn = new Dn( schemaManager, "o=Good Times Co." );
+ long index = 1L;
// Entry #1
Entry entry = new DefaultEntry( schemaManager, suffixDn,
@@ -67,7 +65,7 @@ public class StoreUtils
"o: Good Times Co.",
"postalCode: 1",
"postOfficeBox: 1" );
- injectEntryInStore( store, entry );
+ injectEntryInStore( store, entry, index++ );
// Entry #2
Dn dn = new Dn( schemaManager, "ou=Sales,o=Good Times Co." );
@@ -77,7 +75,7 @@ public class StoreUtils
"ou: Sales",
"postalCode: 1",
"postOfficeBox: 1" );
- injectEntryInStore( store, entry );
+ injectEntryInStore( store, entry, index++ );
// Entry #3
dn = new Dn( schemaManager, "ou=Board of Directors,o=Good Times Co." );
@@ -87,7 +85,7 @@ public class StoreUtils
"ou: Board of Directors",
"postalCode: 1",
"postOfficeBox: 1" );
- injectEntryInStore( store, entry );
+ injectEntryInStore( store, entry, index++ );
// Entry #4
dn = new Dn( schemaManager, "ou=Engineering,o=Good Times Co." );
@@ -97,7 +95,7 @@ public class StoreUtils
"ou: Engineering",
"postalCode: 2",
"postOfficeBox: 2" );
- injectEntryInStore( store, entry );
+ injectEntryInStore( store, entry, index++ );
// Entry #5
dn = new Dn( schemaManager, "cn=JOhnny WAlkeR,ou=Sales,o=Good Times Co." );
@@ -110,7 +108,7 @@ public class StoreUtils
"sn: WAlkeR",
"postalCode: 3",
"postOfficeBox: 3" );
- injectEntryInStore( store, entry );
+ injectEntryInStore( store, entry, index++ );
// Entry #6
dn = new Dn( schemaManager, "cn=JIM BEAN,ou=Sales,o=Good Times Co." );
@@ -123,7 +121,7 @@ public class StoreUtils
"surName: BEAN",
"postalCode: 4",
"postOfficeBox: 4" );
- injectEntryInStore( store, entry );
+ injectEntryInStore( store, entry, index++ );
// Entry #7
dn = new Dn( schemaManager, "ou=Apache,ou=Board of Directors,o=Good Times Co." );
@@ -133,7 +131,7 @@ public class StoreUtils
"ou: Apache",
"postalCode: 5",
"postOfficeBox: 5" );
- injectEntryInStore( store, entry );
+ injectEntryInStore( store, entry, index++ );
// Entry #8
dn = new Dn( schemaManager, "cn=Jack Daniels,ou=Engineering,o=Good Times Co." );
@@ -146,7 +144,7 @@ public class StoreUtils
"SN: Daniels",
"postalCode: 6",
"postOfficeBox: 6" );
- injectEntryInStore( store, entry );
+ injectEntryInStore( store, entry, index++ );
// aliases -------------
@@ -159,7 +157,7 @@ public class StoreUtils
"ou: Apache",
"commonName: Jim Bean",
"aliasedObjectName: cn=Jim Bean,ou=Sales,o=Good Times Co." );
- injectEntryInStore( store, entry );
+ injectEntryInStore( store, entry, index++ );
// Entry #10
dn = new Dn( schemaManager, "commonName=Jim Bean,ou=Board of Directors,o=Good Times Co." );
@@ -169,7 +167,7 @@ public class StoreUtils
"objectClass: extensibleObject",
"commonName: Jim Bean",
"aliasedObjectName: cn=Jim Bean,ou=Sales,o=Good Times Co." );
- injectEntryInStore( store, entry );
+ injectEntryInStore( store, entry, index++ );
// Entry #11
dn = new Dn( schemaManager, "2.5.4.3=Johnny Walker,ou=Engineering,o=Good Times Co." );
@@ -180,7 +178,7 @@ public class StoreUtils
"ou: Engineering",
"2.5.4.3: Johnny Walker",
"aliasedObjectName: cn=Johnny Walker,ou=Sales,o=Good Times Co." );
- injectEntryInStore( store, entry );
+ injectEntryInStore( store, entry, index++ );
}
@@ -192,12 +190,13 @@ public class StoreUtils
* @param store the store
* @param dn the normalized Dn
* @param entry the server entry
+ * @param index the UUID number
* @throws Exception in case of any problems in adding the entry to the store
*/
- public static void injectEntryInStore( Store<Entry, Long> store, Entry entry ) throws Exception
+ public static void injectEntryInStore( Store<Entry> store, Entry entry, long index ) throws Exception
{
entry.add( SchemaConstants.ENTRY_CSN_AT, CSN_FACTORY.newInstance().toString() );
- entry.add( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString() );
+ entry.add( SchemaConstants.ENTRY_UUID_AT, Strings.getUUID( index ).toString() );
AddOperationContext addContext = new AddOperationContext( null, entry );
( ( Partition ) store ).add( addContext );
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java?rev=1378574&r1=1378573&r2=1378574&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java Wed Aug 29 14:23:08 2012
@@ -35,7 +35,6 @@ import org.apache.directory.server.const
import org.apache.directory.server.core.api.entry.ClonedServerEntry;
import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
import org.apache.directory.server.core.partition.impl.avl.AvlPartition;
-import org.apache.directory.server.xdbm.Index;
import org.apache.directory.server.xdbm.IndexEntry;
import org.apache.directory.server.xdbm.IndexNotFoundException;
import org.apache.directory.server.xdbm.StoreUtils;
@@ -59,6 +58,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.schemaextractor.impl.DefaultSchemaLdifExtractor;
import org.apache.directory.shared.ldap.schemaloader.LdifSchemaLoader;
import org.apache.directory.shared.ldap.schemamanager.impl.DefaultSchemaManager;
+import org.apache.directory.shared.util.Strings;
import org.apache.directory.shared.util.exception.Exceptions;
import org.junit.After;
import org.junit.Before;
@@ -367,55 +367,55 @@ public class AvlPartitionTest
public void testFreshStore() throws Exception
{
Dn dn = new Dn( schemaManager, "o=Good Times Co." );
- assertEquals( 1L, ( long ) partition.getEntryId( dn ) );
+ assertEquals( Strings.getUUID( 1L ), partition.getEntryId( dn ) );
assertEquals( 11, partition.count() );
// note that the suffix entry returns 0 for it's parent which does not exist
- assertEquals( 0L, ( long ) partition.getParentId( partition.getEntryId( dn ) ) );
- assertNull( partition.getParentId( 0L ) );
+ assertEquals( Strings.getUUID( 0L ), partition.getParentId( partition.getEntryId( dn ) ) );
+ assertNull( partition.getParentId( Strings.getUUID( 0L ) ) );
// should be allowed
- partition.delete( 1L );
+ partition.delete( Strings.getUUID( 1L ) );
}
@Test
public void testEntryOperations() throws Exception
{
- assertEquals( 3, partition.getChildCount( 1L ) );
+ assertEquals( 3, partition.getChildCount( Strings.getUUID( 1L ) ) );
- Cursor<IndexEntry<Long, Long>> cursor = partition.list( 2L );
+ Cursor<IndexEntry<UUID, UUID>> cursor = partition.list( Strings.getUUID( 2L ) );
assertNotNull( cursor );
cursor.beforeFirst();
assertTrue( cursor.next() );
- assertEquals( 6L, ( long ) cursor.get().getId() );
+ assertEquals( Strings.getUUID( 6L ), cursor.get().getId() );
assertTrue( cursor.next() );
- assertEquals( 5L, ( long ) cursor.get().getId() );
+ assertEquals( Strings.getUUID( 5L ), cursor.get().getId() );
assertFalse( cursor.next() );
-
- assertEquals( 3, partition.getChildCount( 1L ) );
- partition.delete( 2L );
+ assertEquals( 3, partition.getChildCount( Strings.getUUID( 1L ) ) );
- assertEquals( 2, partition.getChildCount( 1L ) );
+ partition.delete( Strings.getUUID( 2L ) );
+
+ assertEquals( 2, partition.getChildCount( Strings.getUUID( 1L ) ) );
assertEquals( 10, partition.count() );
// add an alias and delete to test dropAliasIndices method
Dn dn = new Dn( schemaManager, "commonName=Jack Daniels,ou=Apache,ou=Board of Directors,o=Good Times Co." );
DefaultEntry entry = new DefaultEntry( schemaManager, dn,
- "objectClass: top",
- "objectClass: alias",
+ "objectClass: top",
+ "objectClass: alias",
"objectClass: extensibleObject",
"ou: Apache",
"commonName: Jack Daniels",
"aliasedObjectName: cn=Jack Daniels,ou=Engineering,o=Good Times Co.",
"entryCSN", new CsnFactory( 1 ).newInstance().toString(),
- "entryUUID", UUID.randomUUID().toString() );
+ "entryUUID", Strings.getUUID( 12 ).toString() );
AddOperationContext addContext = new AddOperationContext( null, entry );
partition.add( addContext );
- partition.delete( 12L );
+ partition.delete( Strings.getUUID( 12L ) );
cursor.close();
}
@@ -500,7 +500,7 @@ public class AvlPartitionTest
partition.rename( dn, rdn, true, null );
Dn dn2 = new Dn( schemaManager, "sn=Ja\\+es,ou=Engineering,o=Good Times Co." );
- Long id = partition.getEntryId( dn2 );
+ UUID id = partition.getEntryId( dn2 );
assertNotNull( id );
Entry entry2 = partition.lookup( id );
assertEquals( "Ja+es", entry2.get( "sn" ).getString() );
@@ -513,8 +513,8 @@ public class AvlPartitionTest
{
Dn childDn = new Dn( schemaManager, "cn=Private Ryan,ou=Engineering,o=Good Times Co." );
DefaultEntry childEntry = new DefaultEntry( schemaManager, childDn,
- "objectClass: top",
- "objectClass: person",
+ "objectClass: top",
+ "objectClass: person",
"objectClass: organizationalPerson",
"ou: Engineering",
"cn", "Private Ryan",