directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r896599 [28/30] - in /directory/apacheds/trunk: ./ avl-partition/ avl-partition/src/ avl-partition/src/main/ avl-partition/src/main/java/ avl-partition/src/main/java/org/ avl-partition/src/main/java/org/apache/ avl-partition/src/main/java/o...
Date Wed, 06 Jan 2010 18:27:19 GMT
Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java Wed Jan  6 18:26:43 2010
@@ -20,21 +20,21 @@
 package org.apache.directory.server.xdbm.search.impl;
 
 
+import java.util.Iterator;
+
+import org.apache.directory.server.core.entry.ServerAttribute;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.xdbm.Index;
+import org.apache.directory.server.xdbm.IndexEntry;
+import org.apache.directory.server.xdbm.Store;
+import org.apache.directory.server.xdbm.search.Evaluator;
+import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.filter.ApproximateNode;
 import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.LdapComparator;
 import org.apache.directory.shared.ldap.schema.MatchingRule;
 import org.apache.directory.shared.ldap.schema.Normalizer;
-import org.apache.directory.shared.ldap.entry.Value;
-import org.apache.directory.server.xdbm.IndexEntry;
-import org.apache.directory.server.xdbm.Store;
-import org.apache.directory.server.xdbm.Index;
-import org.apache.directory.server.xdbm.search.Evaluator;
-import org.apache.directory.server.schema.registries.Registries;
-import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.entry.ServerAttribute;
-
-import java.util.Iterator;
-import java.util.Comparator;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
 
 
 /**
@@ -48,19 +48,19 @@
 {
     private final ApproximateNode<Object> node;
     private final Store<ServerEntry> db;
-    private final Registries registries;
+    private final SchemaManager schemaManager;
     private final AttributeType type;
     private final Normalizer normalizer;
-    private final Comparator comparator;
+    private final LdapComparator<? super Object> ldapComparator;
     private final Index<Object,ServerEntry> idx;
 
 
-    public ApproximateEvaluator( ApproximateNode node, Store<ServerEntry> db, Registries registries )
+    public ApproximateEvaluator( ApproximateNode node, Store<ServerEntry> db, SchemaManager schemaManager )
         throws Exception
     {
         this.db = db;
         this.node = node;
-        this.registries = registries;
+        this.schemaManager = schemaManager;
 
         if ( db.hasUserIndexOn( node.getAttribute() ) )
         {
@@ -68,12 +68,12 @@
             idx = ( Index<Object,ServerEntry> ) db.getUserIndex( node.getAttribute() );
             type = null;
             normalizer = null;
-            comparator = null;
+            ldapComparator = null;
         }
         else
         {
             idx = null;
-            type = registries.getAttributeTypeRegistry().lookup( node.getAttribute() );
+            type = schemaManager.lookupAttributeTypeRegistry( node.getAttribute() );
 
             MatchingRule mr = type.getEquality();
 
@@ -84,7 +84,7 @@
             }
 
             normalizer = mr.getNormalizer();
-            comparator = mr.getComparator();
+            ldapComparator = mr.getLdapComparator();
         }
     }
 
@@ -109,13 +109,13 @@
         // If we do not have the attribute, loop through the sub classes of
         // the attributeType.  Perhaps the entry has an attribute value of a
         // subtype (descendant) that will produce a match
-        if ( registries.getAttributeTypeRegistry().hasDescendants( node.getAttribute() ) )
+        if ( schemaManager.getAttributeTypeRegistry().hasDescendants( node.getAttribute() ) )
         {
             // TODO check to see if descendant handling is necessary for the
             // index so we can match properly even when for example a name
             // attribute is used instead of more specific commonName
             Iterator<AttributeType> descendants =
-                registries.getAttributeTypeRegistry().descendants( node.getAttribute() );
+                schemaManager.getAttributeTypeRegistry().descendants( node.getAttribute() );
 
             while ( descendants.hasNext() )
             {
@@ -182,7 +182,7 @@
             value.normalize( normalizer );
 
             //noinspection unchecked
-            if ( comparator.compare( value.getNormalizedValue(), node.getValue().getNormalizedValue() ) == 0 )
+            if ( ldapComparator.compare( value.getNormalizedValue(), node.getValue().getNormalizedValue() ) == 0 )
             {
                 return true;
             }

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/CursorBuilder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/CursorBuilder.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/CursorBuilder.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/CursorBuilder.java Wed Jan  6 18:26:43 2010
@@ -28,7 +28,12 @@
 import org.apache.directory.server.xdbm.search.Evaluator;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.shared.ldap.NotImplementedException;
-import org.apache.directory.shared.ldap.filter.*;
+import org.apache.directory.shared.ldap.filter.AndNode;
+import org.apache.directory.shared.ldap.filter.ExprNode;
+import org.apache.directory.shared.ldap.filter.NotNode;
+import org.apache.directory.shared.ldap.filter.OrNode;
+import org.apache.directory.shared.ldap.filter.ScopeNode;
+import org.apache.directory.shared.ldap.filter.SearchScope;
 
 
 /**
@@ -67,14 +72,19 @@
 
             case APPROXIMATE:
                 return new ApproximateCursor( db, ( ApproximateEvaluator ) evaluatorBuilder.build( node ) );
+            
             case EQUALITY:
                 return new EqualityCursor( db, ( EqualityEvaluator ) evaluatorBuilder.build( node ) );
+            
             case GREATEREQ:
                 return new GreaterEqCursor( db, ( GreaterEqEvaluator ) evaluatorBuilder.build( node ) );
+            
             case LESSEQ:
                 return new LessEqCursor( db, ( LessEqEvaluator ) evaluatorBuilder.build( node ) );
+            
             case PRESENCE:
                 return new PresenceCursor( db, ( PresenceEvaluator ) evaluatorBuilder.build( node ) );
+            
             case SCOPE:
                 if ( ( ( ScopeNode ) node ).getScope() == SearchScope.ONELEVEL )
                 {
@@ -84,6 +94,7 @@
                 {
                     return new SubtreeScopeCursor( db, ( SubtreeScopeEvaluator ) evaluatorBuilder.build( node ) );
                 }
+                
             case SUBSTRING:
                 return new SubstringCursor( db, ( SubstringEvaluator ) evaluatorBuilder.build( node ) );
 
@@ -91,8 +102,10 @@
 
             case AND:
                 return buildAndCursor( ( AndNode ) node );
+                
             case NOT:
                 return new NotCursor( db, evaluatorBuilder.build( ( ( NotNode ) node).getFirstChild() ) );
+            
             case OR:
                 return buildOrCursor( ( OrNode ) node );
 

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java Wed Jan  6 18:26:43 2010
@@ -29,7 +29,12 @@
 import org.apache.directory.shared.ldap.filter.SearchScope;
 import org.apache.directory.shared.ldap.message.AliasDerefMode;
 import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.server.xdbm.*;
+import org.apache.directory.server.xdbm.EmptyIndexCursor;
+import org.apache.directory.server.xdbm.ForwardIndexEntry;
+import org.apache.directory.server.xdbm.IndexCursor;
+import org.apache.directory.server.xdbm.IndexEntry;
+import org.apache.directory.server.xdbm.SingletonIndexCursor;
+import org.apache.directory.server.xdbm.Store;
 import org.apache.directory.server.xdbm.search.Optimizer;
 import org.apache.directory.server.xdbm.search.SearchEngine;
 import org.apache.directory.server.xdbm.search.Evaluator;

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java Wed Jan  6 18:26:43 2010
@@ -20,28 +20,26 @@
 package org.apache.directory.server.xdbm.search.impl;
 
 
+import java.util.Comparator;
+import java.util.Iterator;
+
+import org.apache.directory.server.core.entry.ServerAttribute;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.xdbm.Index;
+import org.apache.directory.server.xdbm.IndexEntry;
+import org.apache.directory.server.xdbm.Store;
+import org.apache.directory.server.xdbm.search.Evaluator;
+import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.filter.EqualityNode;
 import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.LdapComparator;
 import org.apache.directory.shared.ldap.schema.MatchingRule;
 import org.apache.directory.shared.ldap.schema.Normalizer;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.apache.directory.shared.ldap.schema.comparators.ByteArrayComparator;
 import org.apache.directory.shared.ldap.schema.comparators.StringComparator;
 import org.apache.directory.shared.ldap.schema.normalizers.NoOpNormalizer;
 import org.apache.directory.shared.ldap.util.StringTools;
-import org.apache.directory.shared.ldap.entry.Value;
-import org.apache.directory.shared.ldap.entry.client.ClientBinaryValue;
-import org.apache.directory.server.xdbm.IndexEntry;
-import org.apache.directory.server.xdbm.Store;
-import org.apache.directory.server.xdbm.Index;
-import org.apache.directory.server.xdbm.search.Evaluator;
-import org.apache.directory.server.schema.registries.Registries;
-import org.apache.directory.server.core.entry.ServerBinaryValue;
-import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.entry.ServerAttribute;
-import org.apache.directory.server.core.entry.ServerStringValue;
-
-import java.util.Iterator;
-import java.util.Comparator;
 
 
 /**
@@ -55,28 +53,28 @@
 {
     private final EqualityNode<T> node;
     private final Store<ServerEntry> db;
-    private final Registries registries;
+    private final SchemaManager schemaManager;
     private final AttributeType type;
     private final Normalizer normalizer;
     
     /** The comparator to use */
-    private final Comparator comparator;
+    private final LdapComparator<?> comparator;
     
     /** The default byte[] comparator if no comparator has been defined */
-    private static final Comparator<byte[]> BINARY_COMPARATOR = ByteArrayComparator.INSTANCE;
+    private static final Comparator<byte[]> BINARY_COMPARATOR = new ByteArrayComparator( null );
     
     /** The default String comparator if no comparator has been defined */
-    private static final Comparator<String> STRING_COMPARATOR = StringComparator.INSTANCE;
+    private static final Comparator<String> STRING_COMPARATOR = new StringComparator( null );
     
     private final Index<T,ServerEntry> idx;
 
 
-    public EqualityEvaluator( EqualityNode<T> node, Store<ServerEntry> db, Registries registries )
+    public EqualityEvaluator( EqualityNode<T> node, Store<ServerEntry> db, SchemaManager schemaManager )
         throws Exception
     {
         this.db = db;
         this.node = node;
-        this.registries = registries;
+        this.schemaManager = schemaManager;
 
         if ( db.hasUserIndexOn( node.getAttribute() ) )
         {
@@ -89,19 +87,19 @@
         else
         {
             idx = null;
-            type = registries.getAttributeTypeRegistry().lookup( node.getAttribute() );
+            type = schemaManager.lookupAttributeTypeRegistry( node.getAttribute() );
 
             MatchingRule mr = type.getEquality();
 
             if ( mr == null )
             {
-                normalizer = NoOpNormalizer.INSTANCE;
+                normalizer = new NoOpNormalizer( type.getOid() );
                 comparator = null;
             }
             else
             {
                 normalizer = mr.getNormalizer();
-                comparator = mr.getComparator();
+                comparator = mr.getLdapComparator();
             }
         }
     }
@@ -147,13 +145,13 @@
         // If we do not have the attribute, loop through the sub classes of
         // the attributeType.  Perhaps the entry has an attribute value of a
         // subtype (descendant) that will produce a match
-        if ( registries.getAttributeTypeRegistry().hasDescendants( node.getAttribute() ) )
+        if ( schemaManager.getAttributeTypeRegistry().hasDescendants( node.getAttribute() ) )
         {
             // TODO check to see if descendant handling is necessary for the
             // index so we can match properly even when for example a name
             // attribute is used instead of more specific commonName
             Iterator<AttributeType> descendants =
-                registries.getAttributeTypeRegistry().descendants( node.getAttribute() );
+                schemaManager.getAttributeTypeRegistry().descendants( node.getAttribute() );
 
             while ( descendants.hasNext() )
             {
@@ -207,7 +205,7 @@
                 
                 if ( comparator != null )
                 {
-                    if ( ( comparator.compare( serverValue, nodeValue ) == 0 ) )
+                    if ( ( ((LdapComparator<byte[]>)comparator).compare( serverValue, nodeValue ) == 0 ) )
                     {
                         return true;
                     }
@@ -237,7 +235,7 @@
                 
                 if ( comparator != null )
                 {
-                    if ( comparator.compare( serverValue, nodeValue ) == 0 )
+                    if ( ((LdapComparator<String>)comparator).compare( serverValue, nodeValue ) == 0 )
                     {
                         return true;
                     }

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EvaluatorBuilder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EvaluatorBuilder.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EvaluatorBuilder.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EvaluatorBuilder.java Wed Jan  6 18:26:43 2010
@@ -20,15 +20,26 @@
 package org.apache.directory.server.xdbm.search.impl;
 
 
-import org.apache.directory.server.schema.registries.Registries;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.xdbm.Store;
 import org.apache.directory.server.xdbm.search.Evaluator;
-import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.shared.ldap.filter.*;
 import org.apache.directory.shared.ldap.NotImplementedException;
-
-import java.util.List;
-import java.util.ArrayList;
+import org.apache.directory.shared.ldap.filter.AndNode;
+import org.apache.directory.shared.ldap.filter.ApproximateNode;
+import org.apache.directory.shared.ldap.filter.EqualityNode;
+import org.apache.directory.shared.ldap.filter.ExprNode;
+import org.apache.directory.shared.ldap.filter.GreaterEqNode;
+import org.apache.directory.shared.ldap.filter.LessEqNode;
+import org.apache.directory.shared.ldap.filter.NotNode;
+import org.apache.directory.shared.ldap.filter.OrNode;
+import org.apache.directory.shared.ldap.filter.PresenceNode;
+import org.apache.directory.shared.ldap.filter.ScopeNode;
+import org.apache.directory.shared.ldap.filter.SearchScope;
+import org.apache.directory.shared.ldap.filter.SubstringNode;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
 
 
 /**
@@ -40,7 +51,7 @@
 public class EvaluatorBuilder
 {
     private final Store<ServerEntry> db;
-    private final Registries registries;
+    private final SchemaManager schemaManager;
 
 
     /**
@@ -51,10 +62,10 @@
      * @param registries the schema registries
      * @throws Exception failure to access db or lookup schema in registries
      */
-    public EvaluatorBuilder( Store<ServerEntry> db, Registries registries ) throws Exception
+    public EvaluatorBuilder( Store<ServerEntry> db, SchemaManager schemaManager ) throws Exception
     {
         this.db = db;
-        this.registries = registries;
+        this.schemaManager = schemaManager;
     }
 
 
@@ -65,15 +76,20 @@
             /* ---------- LEAF NODE HANDLING ---------- */
 
             case APPROXIMATE:
-                return new ApproximateEvaluator( ( ApproximateNode ) node, db, registries );
+                return new ApproximateEvaluator( ( ApproximateNode ) node, db, schemaManager );
+                
             case EQUALITY:
-                return new EqualityEvaluator( ( EqualityNode ) node, db, registries );
+                return new EqualityEvaluator( ( EqualityNode ) node, db, schemaManager );
+                
             case GREATEREQ:
-                return new GreaterEqEvaluator( ( GreaterEqNode ) node, db, registries );
+                return new GreaterEqEvaluator( ( GreaterEqNode ) node, db, schemaManager );
+                
             case LESSEQ:
-                return new LessEqEvaluator( ( LessEqNode ) node, db, registries );
+                return new LessEqEvaluator( ( LessEqNode ) node, db, schemaManager );
+                
             case PRESENCE:
-                return new PresenceEvaluator( ( PresenceNode ) node, db, registries );
+                return new PresenceEvaluator( ( PresenceNode ) node, db, schemaManager );
+                
             case SCOPE:
                 if ( ( ( ScopeNode ) node ).getScope() == SearchScope.ONELEVEL )
                 {
@@ -83,15 +99,18 @@
                 {
                     return new SubtreeScopeEvaluator<ServerEntry>( db, ( ScopeNode ) node );
                 }
+                
             case SUBSTRING:
-                return new SubstringEvaluator( ( SubstringNode ) node, db, registries );
+                return new SubstringEvaluator( ( SubstringNode ) node, db, schemaManager );
 
             /* ---------- LOGICAL OPERATORS ---------- */
 
             case AND:
                 return buildAndEvaluator( ( AndNode ) node );
+                
             case NOT:
                 return new NotEvaluator( ( NotNode ) node, build( ( ( NotNode ) node).getFirstChild() ) );
+                
             case OR:
                 return buildOrEvaluator( ( OrNode ) node );
 

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java Wed Jan  6 18:26:43 2010
@@ -20,21 +20,21 @@
 package org.apache.directory.server.xdbm.search.impl;
 
 
+import java.util.Comparator;
+import java.util.Iterator;
+
+import org.apache.directory.server.core.entry.ServerAttribute;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.xdbm.Index;
+import org.apache.directory.server.xdbm.IndexEntry;
+import org.apache.directory.server.xdbm.Store;
+import org.apache.directory.server.xdbm.search.Evaluator;
+import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.filter.GreaterEqNode;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.MatchingRule;
 import org.apache.directory.shared.ldap.schema.Normalizer;
-import org.apache.directory.shared.ldap.entry.Value;
-import org.apache.directory.server.xdbm.IndexEntry;
-import org.apache.directory.server.xdbm.Store;
-import org.apache.directory.server.xdbm.Index;
-import org.apache.directory.server.xdbm.search.Evaluator;
-import org.apache.directory.server.schema.registries.Registries;
-import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.entry.ServerAttribute;
-
-import java.util.Iterator;
-import java.util.Comparator;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
 
 
 /**
@@ -48,20 +48,20 @@
 {
     private final GreaterEqNode node;
     private final Store<ServerEntry> db;
-    private final Registries registries;
+    private final SchemaManager schemaManager;
     private final AttributeType type;
     private final Normalizer normalizer;
     private final Comparator comparator;
     private final Index<Object,ServerEntry> idx;
 
 
-    public GreaterEqEvaluator( GreaterEqNode node, Store<ServerEntry> db, Registries registries )
+    public GreaterEqEvaluator( GreaterEqNode node, Store<ServerEntry> db, SchemaManager schemaManager )
         throws Exception
     {
         this.db = db;
         this.node = node;
-        this.registries = registries;
-        this.type = registries.getAttributeTypeRegistry().lookup( node.getAttribute() );
+        this.schemaManager = schemaManager;
+        this.type = schemaManager.lookupAttributeTypeRegistry( node.getAttribute() );
 
         if ( db.hasUserIndexOn( node.getAttribute() ) )
         {
@@ -93,7 +93,7 @@
         }
 
         normalizer = mr.getNormalizer();
-        comparator = mr.getComparator();
+        comparator = mr.getLdapComparator();
     }
 
 
@@ -158,13 +158,13 @@
         // If we do not have the attribute, loop through the sub classes of
         // the attributeType.  Perhaps the entry has an attribute value of a
         // subtype (descendant) that will produce a match
-        if ( registries.getAttributeTypeRegistry().hasDescendants( node.getAttribute() ) )
+        if ( schemaManager.getAttributeTypeRegistry().hasDescendants( node.getAttribute() ) )
         {
             // TODO check to see if descendant handling is necessary for the
             // index so we can match properly even when for example a name
             // attribute is used instead of more specific commonName
             Iterator<AttributeType> descendants =
-                registries.getAttributeTypeRegistry().descendants( node.getAttribute() );
+                schemaManager.getAttributeTypeRegistry().descendants( node.getAttribute() );
 
             while ( descendants.hasNext() )
             {
@@ -210,13 +210,13 @@
         // If we do not have the attribute, loop through the sub classes of
         // the attributeType.  Perhaps the entry has an attribute value of a
         // subtype (descendant) that will produce a match
-        if ( registries.getAttributeTypeRegistry().hasDescendants( node.getAttribute() ) )
+        if ( schemaManager.getAttributeTypeRegistry().hasDescendants( node.getAttribute() ) )
         {
             // TODO check to see if descendant handling is necessary for the
             // index so we can match properly even when for example a name
             // attribute is used instead of more specific commonName
             Iterator<AttributeType> descendants =
-                registries.getAttributeTypeRegistry().descendants( node.getAttribute() );
+                schemaManager.getAttributeTypeRegistry().descendants( node.getAttribute() );
 
             while ( descendants.hasNext() )
             {

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java Wed Jan  6 18:26:43 2010
@@ -109,7 +109,7 @@
              * before() method of the userIdxCursor.
              */
             //noinspection unchecked
-            int compareValue = lessEqEvaluator.getComparator().compare( value,
+            int compareValue = lessEqEvaluator.getLdapComparator().compare( value,
                  lessEqEvaluator.getExpression().getValue().get() );
 
             if ( compareValue > 0 )
@@ -135,7 +135,6 @@
     }
 
 
-    @SuppressWarnings("unchecked")
     public void before( IndexEntry<V, ServerEntry> element ) throws Exception
     {
         checkNotClosed( "before()" );
@@ -154,7 +153,7 @@
              * If the element's value is smaller, then we delegate to the
              * before() method of the userIdxCursor.
              */
-            int compareValue = lessEqEvaluator.getComparator().compare( element.getValue(),
+            int compareValue = lessEqEvaluator.getLdapComparator().compare( element.getValue(),
                  lessEqEvaluator.getExpression().getValue().get() );
 
             if ( compareValue > 0 )
@@ -180,13 +179,12 @@
     }
 
 
-    @SuppressWarnings("unchecked")
     public void afterValue( Long id, V value ) throws Exception
     {
         checkNotClosed( "afterValue()" );
         if ( userIdxCursor != null )
         {
-            int comparedValue = lessEqEvaluator.getComparator().compare( value,
+            int comparedValue = lessEqEvaluator.getLdapComparator().compare( value,
                  lessEqEvaluator.getExpression().getValue().get() );
 
             /*
@@ -217,13 +215,12 @@
     }
 
 
-    @SuppressWarnings("unchecked")
     public void after( IndexEntry<V, ServerEntry> element ) throws Exception
     {
         checkNotClosed( "after()" );
         if ( userIdxCursor != null )
         {
-            int comparedValue = lessEqEvaluator.getComparator().compare( element.getValue(),
+            int comparedValue = lessEqEvaluator.getLdapComparator().compare( element.getValue(),
                  lessEqEvaluator.getExpression().getValue().get() );
 
             /*
@@ -337,7 +334,6 @@
     }
 
 
-    @SuppressWarnings("unchecked")
     public boolean next() throws Exception
     {
         checkNotClosed( "next()" );
@@ -353,7 +349,7 @@
             {
                 checkNotClosed( "next()" );
                 IndexEntry<?,ServerEntry> candidate = userIdxCursor.get();
-                if ( lessEqEvaluator.getComparator().compare( candidate.getValue(),
+                if ( lessEqEvaluator.getLdapComparator().compare( candidate.getValue(),
                      lessEqEvaluator.getExpression().getValue().get() ) <= 0 )
                 {
                     return available = true;

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java Wed Jan  6 18:26:43 2010
@@ -20,21 +20,21 @@
 package org.apache.directory.server.xdbm.search.impl;
 
 
+import java.util.Iterator;
+
+import org.apache.directory.server.core.entry.ServerAttribute;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.xdbm.Index;
+import org.apache.directory.server.xdbm.IndexEntry;
+import org.apache.directory.server.xdbm.Store;
+import org.apache.directory.server.xdbm.search.Evaluator;
+import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.filter.LessEqNode;
 import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.LdapComparator;
 import org.apache.directory.shared.ldap.schema.MatchingRule;
 import org.apache.directory.shared.ldap.schema.Normalizer;
-import org.apache.directory.shared.ldap.entry.Value;
-import org.apache.directory.server.xdbm.IndexEntry;
-import org.apache.directory.server.xdbm.Store;
-import org.apache.directory.server.xdbm.Index;
-import org.apache.directory.server.xdbm.search.Evaluator;
-import org.apache.directory.server.schema.registries.Registries;
-import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.entry.ServerAttribute;
-
-import java.util.Iterator;
-import java.util.Comparator;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
 
 
 /**
@@ -48,20 +48,20 @@
 {
     private final LessEqNode node;
     private final Store<ServerEntry> db;
-    private final Registries registries;
+    private final SchemaManager schemaManager;
     private final AttributeType type;
     private final Normalizer normalizer;
-    private final Comparator comparator;
+    private final LdapComparator<? super Object> ldapComparator;
     private final Index<Object,ServerEntry> idx;
 
 
-    public LessEqEvaluator( LessEqNode node, Store<ServerEntry> db, Registries registries )
+    public LessEqEvaluator( LessEqNode node, Store<ServerEntry> db, SchemaManager schemaManager )
         throws Exception
     {
         this.db = db;
         this.node = node;
-        this.registries = registries;
-        this.type = registries.getAttributeTypeRegistry().lookup( node.getAttribute() );
+        this.schemaManager = schemaManager;
+        this.type = schemaManager.lookupAttributeTypeRegistry( node.getAttribute() );
 
         if ( db.hasUserIndexOn( node.getAttribute() ) )
         {
@@ -93,7 +93,7 @@
         }
 
         normalizer = mr.getNormalizer();
-        comparator = mr.getComparator();
+        ldapComparator = mr.getLdapComparator();
     }
 
 
@@ -115,9 +115,9 @@
     }
 
 
-    public Comparator getComparator()
+    public LdapComparator<? super Object> getLdapComparator()
     {
-        return comparator;
+        return ldapComparator;
     }
 
 
@@ -166,13 +166,13 @@
         // If we do not have the attribute, loop through the sub classes of
         // the attributeType.  Perhaps the entry has an attribute value of a
         // subtype (descendant) that will produce a match
-        if ( registries.getAttributeTypeRegistry().hasDescendants( node.getAttribute() ) )
+        if ( schemaManager.getAttributeTypeRegistry().hasDescendants( node.getAttribute() ) )
         {
             // TODO check to see if descendant handling is necessary for the
             // index so we can match properly even when for example a name
             // attribute is used instead of more specific commonName
             Iterator<AttributeType> descendants =
-                registries.getAttributeTypeRegistry().descendants( node.getAttribute() );
+                schemaManager.getAttributeTypeRegistry().descendants( node.getAttribute() );
 
             while ( descendants.hasNext() )
             {
@@ -207,13 +207,13 @@
         // If we do not have the attribute, loop through the sub classes of
         // the attributeType.  Perhaps the entry has an attribute value of a
         // subtype (descendant) that will produce a match
-        if ( registries.getAttributeTypeRegistry().hasDescendants( node.getAttribute() ) )
+        if ( schemaManager.getAttributeTypeRegistry().hasDescendants( node.getAttribute() ) )
         {
             // TODO check to see if descendant handling is necessary for the
             // index so we can match properly even when for example a name
             // attribute is used instead of more specific commonName
             Iterator<AttributeType> descendants =
-                registries.getAttributeTypeRegistry().descendants( node.getAttribute() );
+                schemaManager.getAttributeTypeRegistry().descendants( node.getAttribute() );
 
             while ( descendants.hasNext() )
             {
@@ -248,7 +248,7 @@
             value.normalize( normalizer );
 
             //noinspection unchecked
-            if ( comparator.compare( value.getNormalizedValue(), node.getValue().getNormalizedValue() ) <= 0 )
+            if ( ldapComparator.compare( value.getNormalizedValue(), node.getValue().getNormalizedValue() ) <= 0 )
             {
                 if ( indexEntry != null )
                 {

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java Wed Jan  6 18:26:43 2010
@@ -20,17 +20,17 @@
 package org.apache.directory.server.xdbm.search.impl;
 
 
-import org.apache.directory.shared.ldap.filter.PresenceNode;
-import org.apache.directory.shared.ldap.schema.AttributeType;
+import java.util.Iterator;
+
+import org.apache.directory.server.core.entry.ServerAttribute;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.xdbm.Index;
 import org.apache.directory.server.xdbm.IndexEntry;
 import org.apache.directory.server.xdbm.Store;
-import org.apache.directory.server.xdbm.Index;
 import org.apache.directory.server.xdbm.search.Evaluator;
-import org.apache.directory.server.schema.registries.Registries;
-import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.entry.ServerAttribute;
-
-import java.util.Iterator;
+import org.apache.directory.shared.ldap.filter.PresenceNode;
+import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
 
 
 /**
@@ -44,18 +44,18 @@
 {
     private final PresenceNode node;
     private final Store<ServerEntry> db;
-    private final Registries registries;
     private final AttributeType type;
+    private final SchemaManager schemaManager;
     private final Index<String,ServerEntry> idx;
 
 
-    public PresenceEvaluator( PresenceNode node, Store<ServerEntry> db, Registries registries )
+    public PresenceEvaluator( PresenceNode node, Store<ServerEntry> db, SchemaManager schemaManager )
         throws Exception
     {
         this.db = db;
         this.node = node;
-        this.registries = registries;
-        this.type = registries.getAttributeTypeRegistry().lookup( node.getAttribute() );
+        this.schemaManager = schemaManager;
+        this.type = schemaManager.lookupAttributeTypeRegistry( node.getAttribute() );
 
         if ( db.hasUserIndexOn( node.getAttribute() ) )
         {
@@ -131,13 +131,13 @@
         // If we do not have the attribute, loop through the sub classes of
         // the attributeType.  Perhaps the entry has an attribute value of a
         // subtype (descendant) that will produce a match
-        if ( registries.getAttributeTypeRegistry().hasDescendants( node.getAttribute() ) )
+        if ( schemaManager.getAttributeTypeRegistry().hasDescendants( node.getAttribute() ) )
         {
             // TODO check to see if descendant handling is necessary for the
             // index so we can match properly even when for example a name
             // attribute is used instead of more specific commonName
             Iterator<AttributeType> descendants =
-                registries.getAttributeTypeRegistry().descendants( node.getAttribute() );
+                schemaManager.getAttributeTypeRegistry().descendants( node.getAttribute() );
 
             do
             {

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java Wed Jan  6 18:26:43 2010
@@ -23,20 +23,20 @@
 import java.util.Iterator;
 import java.util.regex.Pattern;
 
-import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.server.core.entry.ServerAttribute;
+import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.xdbm.Index;
 import org.apache.directory.server.xdbm.IndexEntry;
 import org.apache.directory.server.xdbm.Store;
 import org.apache.directory.server.xdbm.search.Evaluator;
-import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.entry.ServerAttribute;
+import org.apache.directory.shared.ldap.cursor.Cursor;
+import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.filter.SubstringNode;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.MatchingRule;
 import org.apache.directory.shared.ldap.schema.Normalizer;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.apache.directory.shared.ldap.schema.normalizers.NoOpNormalizer;
-import org.apache.directory.shared.ldap.cursor.Cursor;
-import org.apache.directory.shared.ldap.entry.Value;
 
 
 /**
@@ -50,8 +50,8 @@
     /** Database used while evaluating candidates */
     private final Store<ServerEntry> db;
     
-    /** Oid Registry used to translate attributeIds to OIDs */
-    private final Registries registries;
+    /** Reference to the SchemaManager */
+    private final SchemaManager schemaManager;
 
     /** The Substring expression */
     private final SubstringNode node;
@@ -74,16 +74,16 @@
      * @param registries the set of registries
      * @throws Exception if there are failures accessing resources and the db
      */
-    public SubstringEvaluator( SubstringNode node, Store<ServerEntry> db, Registries registries ) throws Exception
+    public SubstringEvaluator( SubstringNode node, Store<ServerEntry> db, SchemaManager schemaManager ) throws Exception
     {
         this.db = db;
         this.node = node;
-        this.registries = registries;
+        this.schemaManager = schemaManager;
 
-        String oid = registries.getOidRegistry().getOid( node.getAttribute() );
-        type = registries.getAttributeTypeRegistry().lookup( oid );
+        String oid = schemaManager.getAttributeTypeRegistry().getOidByName( node.getAttribute() );
+        type = schemaManager.lookupAttributeTypeRegistry( oid );
 
-        MatchingRule rule = type.getSubstr();
+        MatchingRule rule = type.getSubstring();
 
         if ( rule == null )
         {
@@ -96,7 +96,7 @@
         }
         else
         {
-            normalizer = new NoOpNormalizer();
+            normalizer = new NoOpNormalizer( type.getSyntaxOid() );
         }
         
         // compile the regular expression to search for a matching attribute
@@ -199,7 +199,6 @@
     }
 
 
-    @SuppressWarnings( { "UnusedDeclaration" } )
     private boolean evaluateWithIndex( ServerEntry entry ) throws Exception
     {
         throw new UnsupportedOperationException( "This is too inefficient without getId() on ServerEntry" );
@@ -276,13 +275,13 @@
 
         // If we do not have the attribute, loop through the descendant
         // May be the node Attribute has descendant ?
-        if ( registries.getAttributeTypeRegistry().hasDescendants( node.getAttribute() ) )
+        if ( schemaManager.getAttributeTypeRegistry().hasDescendants( node.getAttribute() ) )
         {
             // TODO check to see if descendant handling is necessary for the
             // index so we can match properly even when for example a name
             // attribute is used instead of more specific commonName
             Iterator<AttributeType> descendants =
-                registries.getAttributeTypeRegistry().descendants( node.getAttribute() );
+                schemaManager.getAttributeTypeRegistry().descendants( node.getAttribute() );
 
             while ( descendants.hasNext() )
             {
@@ -371,13 +370,13 @@
 
         // If we do not have the attribute, loop through the descendant
         // May be the node Attribute has descendant ?
-        if ( registries.getAttributeTypeRegistry().hasDescendants( node.getAttribute() ) )
+        if ( schemaManager.getAttributeTypeRegistry().hasDescendants( node.getAttribute() ) )
         {
             // TODO check to see if descendant handling is necessary for the
             // index so we can match properly even when for example a name
             // attribute is used instead of more specific commonName
             Iterator<AttributeType> descendants =
-                registries.getAttributeTypeRegistry().descendants( node.getAttribute() );
+                schemaManager.getAttributeTypeRegistry().descendants( node.getAttribute() );
 
             while ( descendants.hasNext() )
             {

Modified: directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java Wed Jan  6 18:26:43 2010
@@ -20,32 +20,22 @@
 package org.apache.directory.server.xdbm.search.impl;
 
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.io.File;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.List;
 import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.commons.io.FileUtils;
+import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmStore;
-import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.schema.SerializableComparator;
-import org.apache.directory.server.schema.bootstrap.ApacheSchema;
-import org.apache.directory.server.schema.bootstrap.ApachemetaSchema;
-import org.apache.directory.server.schema.bootstrap.BootstrapSchemaLoader;
-import org.apache.directory.server.schema.bootstrap.CollectiveSchema;
-import org.apache.directory.server.schema.bootstrap.CoreSchema;
-import org.apache.directory.server.schema.bootstrap.Schema;
-import org.apache.directory.server.schema.bootstrap.SystemSchema;
-import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
-import org.apache.directory.server.schema.registries.DefaultOidRegistry;
-import org.apache.directory.server.schema.registries.DefaultRegistries;
-import org.apache.directory.server.schema.registries.OidRegistry;
-import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.server.xdbm.ForwardIndexEntry;
-import org.apache.directory.server.xdbm.Store;
 import org.apache.directory.server.xdbm.IndexCursor;
+import org.apache.directory.server.xdbm.Store;
 import org.apache.directory.server.xdbm.search.Evaluator;
 import org.apache.directory.server.xdbm.tools.StoreUtils;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
@@ -55,16 +45,19 @@
 import org.apache.directory.shared.ldap.filter.FilterParser;
 import org.apache.directory.shared.ldap.filter.PresenceNode;
 import org.apache.directory.shared.ldap.filter.SubstringNode;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
+import org.apache.directory.shared.ldap.schema.SchemaManager;
+import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
+import org.apache.directory.shared.ldap.schema.ldif.extractor.impl.DefaultSchemaLdifExtractor;
+import org.apache.directory.shared.ldap.schema.loader.ldif.LdifSchemaLoader;
+import org.apache.directory.shared.ldap.schema.manager.impl.DefaultSchemaManager;
+import org.apache.directory.shared.ldap.util.ExceptionUtils;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.fail;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 
 /**
  * 
@@ -79,35 +72,53 @@
 
     File wkdir;
     Store<ServerEntry> store;
-    Registries registries = null;
-    AttributeTypeRegistry attributeRegistry;
     EvaluatorBuilder evaluatorBuilder;
     CursorBuilder cursorBuilder;
+    private static SchemaManager schemaManager;
+    
+    @BeforeClass
+    public static void setup() throws Exception
+    {
+        // setup the standard registries
+        String workingDirectory = System.getProperty( "workingDirectory" );
+
+        if ( workingDirectory == null )
+        {
+            String path = AndCursorTest.class.getResource( "" ).getPath();
+            int targetPos = path.indexOf( "target" );
+            workingDirectory = path.substring( 0, targetPos + 6 );
+        }
+
+        File schemaRepository = new File( workingDirectory, "schema" );
+        SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory ) );
+        extractor.extractOrCopy( true );
+        LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository );
+        schemaManager = new DefaultSchemaManager( loader );
+
+        boolean loaded = schemaManager.loadAllEnabled();
+        
+        if ( !loaded )
+        {
+            fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
+        }
+
+        loaded = schemaManager.loadWithDeps( "collective" );
+        
+        if ( !loaded )
+        {
+            fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
+        }
+    }
 
     public AndCursorTest() throws Exception
     {
-        // setup the standard registries
-        BootstrapSchemaLoader loader = new BootstrapSchemaLoader();
-        OidRegistry oidRegistry = new DefaultOidRegistry();
-        registries = new DefaultRegistries( "bootstrap", loader, oidRegistry );
-        SerializableComparator.setRegistry( registries.getComparatorRegistry() );
-
-        // load essential bootstrap schemas
-        Set<Schema> bootstrapSchemas = new HashSet<Schema>();
-        bootstrapSchemas.add( new ApachemetaSchema() );
-        bootstrapSchemas.add( new ApacheSchema() );
-        bootstrapSchemas.add( new CoreSchema() );
-        bootstrapSchemas.add( new SystemSchema() );
-        bootstrapSchemas.add( new CollectiveSchema() );
-        loader.loadWithDependencies( bootstrapSchemas, registries );
-        attributeRegistry = registries.getAttributeTypeRegistry();
     }
 
 
     @Before
     public void createStore() throws Exception
     {
-        destryStore();
+        destroyStore();
 
         // setup the working directory for the store
         wkdir = File.createTempFile( getClass().getSimpleName(), "db" );
@@ -121,12 +132,12 @@
         store.setCacheSize( 10 );
         store.setWorkingDirectory( wkdir );
         store.setSyncOnWrite( false );
-
+        
         store.addIndex( new JdbmIndex( SchemaConstants.OU_AT_OID ) );
         store.addIndex( new JdbmIndex( SchemaConstants.CN_AT_OID ) );
-        StoreUtils.loadExampleData( store, registries );
+        StoreUtils.loadExampleData( store, schemaManager );
         
-        evaluatorBuilder = new EvaluatorBuilder( store, registries );
+        evaluatorBuilder = new EvaluatorBuilder( store, schemaManager );
         cursorBuilder = new CursorBuilder( store, evaluatorBuilder );
         
         LOG.debug( "Created new store" );
@@ -134,7 +145,7 @@
 
     
     @After
-    public void destryStore() throws Exception
+    public void destroyStore() throws Exception
     {
         if ( store != null )
         {
@@ -194,7 +205,7 @@
         Evaluator<? extends ExprNode, ServerEntry> eval;
         
         ExprNode exprNode = new SubstringNode( "cn", "J", null );
-        eval = new SubstringEvaluator( ( SubstringNode ) exprNode, store, registries );
+        eval = new SubstringEvaluator( ( SubstringNode ) exprNode, store, schemaManager );
         IndexCursor<?,ServerEntry> wrapped = new SubstringCursor( store, ( SubstringEvaluator ) eval );
         
         /* adding this results in NPE  adding Presence evaluator not 
@@ -204,7 +215,7 @@
         andNode.addNode( exprNode );
         
         exprNode = new PresenceNode( "sn" );
-        eval = new PresenceEvaluator( ( PresenceNode ) exprNode, store, registries );
+        eval = new PresenceEvaluator( ( PresenceNode ) exprNode, store, schemaManager );
         evaluators.add( eval );
         
         andNode.addNode( exprNode );

Modified: directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/BogusSyntax.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/BogusSyntax.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/BogusSyntax.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/BogusSyntax.java Wed Jan  6 18:26:43 2010
@@ -20,11 +20,9 @@
 package org.apache.directory.server.xdbm.search.impl;
 
 
-import org.apache.directory.shared.ldap.schema.Syntax;
+import org.apache.directory.shared.ldap.schema.LdapSyntax;
 import org.apache.directory.shared.ldap.schema.SyntaxChecker;
-import org.apache.directory.shared.ldap.schema.syntaxes.AcceptAllSyntaxChecker;
-
-import javax.naming.NamingException;
+import org.apache.directory.shared.ldap.schema.syntaxCheckers.OctetStringSyntaxChecker;
 
 
 /**
@@ -33,66 +31,23 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class BogusSyntax implements Syntax
+public class BogusSyntax extends LdapSyntax
 {
     private static final long serialVersionUID = 1L;
 
-
-    public boolean isHumanReadable()
-    {
-        return false;
-    }
-
-
-    public SyntaxChecker getSyntaxChecker() throws NamingException
-    {
-        return new AcceptAllSyntaxChecker( getOid() );
-    }
-
-
-    public boolean isObsolete()
-    {
-        return false;
-    }
-
-
-    public String getOid()
-    {
-        return "1.3.6.1.4.1.18060.0.4.1.1.100000";
-    }
-
-
-    public String[] getNames()
-    {
-        return new String[] { "bogus" };
-    }
-
-
-    public String getName()
-    {
-        return "bogus";
-    }
-
-
-    public String getDescription()
-    {
-        return "bogus";
-    }
-
-
-    public String getSchema()
-    {
-        return "bogus";
-    }
-
-
-    public void setSchema( String schemaName )
+    protected BogusSyntax( int oidVal )
     {
+        super( "1.3.6.1.4.1.18060.0.4.1.1.100000." + oidVal );
+        setHumanReadable( false );
+        setObsolete( false );
+        addName( "bogus" );
+        setDescription( "bogus" );
+        setSchemaName( "other" );
     }
 
 
-    public String[] getNamesRef()
+    public SyntaxChecker getSyntaxChecker()
     {
-        return new String[] { "bogus" };
+        return new OctetStringSyntaxChecker();
     }
 }

Modified: directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/FilterNormalizingVisitor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/FilterNormalizingVisitor.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/FilterNormalizingVisitor.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/FilterNormalizingVisitor.java Wed Jan  6 18:26:43 2010
@@ -25,7 +25,6 @@
 
 import javax.naming.NamingException;
 
-import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.entry.client.ClientBinaryValue;
 import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
@@ -41,6 +40,7 @@
 import org.apache.directory.shared.ldap.filter.SubstringNode;
 import org.apache.directory.shared.ldap.name.NameComponentNormalizer;
 import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -70,8 +70,8 @@
     /** the name component normalizer used by this visitor */
     private final NameComponentNormalizer ncn;
 
-    /** the global registries used to resolve OIDs for attributeType ids */
-    private final Registries registries;
+    /** the global schemaManager used to resolve OIDs for attributeType ids */
+    private final SchemaManager schemaManager;
 
 
     /**
@@ -118,10 +118,10 @@
      * @param ncn The name component normalizer to use
      * @param registries The global registries
      */
-    public FilterNormalizingVisitor( NameComponentNormalizer ncn, Registries registries )
+    public FilterNormalizingVisitor( NameComponentNormalizer ncn, SchemaManager schemaManager )
     {
         this.ncn = ncn;
-        this.registries = registries;
+        this.schemaManager = schemaManager;
     }
 
 
@@ -141,7 +141,7 @@
         {
             Value<?> normalized = null;
 
-            AttributeType attributeType = registries.getAttributeTypeRegistry().lookup( attribute );
+            AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( attribute );
 
             if ( attributeType.getSyntax().isHumanReadable() )
             {
@@ -175,7 +175,7 @@
     {
         try
         {
-            node.setAttribute( registries.getOidRegistry().getOid( node.getAttribute() ) );
+            node.setAttribute( schemaManager.getAttributeTypeRegistry().getOidByName( node.getAttribute() ) );
             return node;
         }
         catch ( NamingException ne )
@@ -215,7 +215,7 @@
 
         try
         {
-            node.setAttribute( registries.getOidRegistry().getOid( node.getAttribute() ) );
+            node.setAttribute( schemaManager.getAttributeTypeRegistry().getOidByName( node.getAttribute() ) );
             node.setValue( normalized );
             return node;
         }
@@ -293,7 +293,7 @@
 
         try
         {
-            node.setAttribute( registries.getOidRegistry().getOid( node.getAttribute() ) );
+            node.setAttribute( schemaManager.getAttributeTypeRegistry().getOidByName( node.getAttribute() ) );
 
             if ( normInitial != null )
             {
@@ -338,7 +338,7 @@
     {
         try
         {
-            node.setAttribute( registries.getOidRegistry().getOid( node.getAttribute() ) );
+            node.setAttribute( schemaManager.getAttributeTypeRegistry().getOidByName( node.getAttribute() ) );
             return node;
         }
         catch ( NamingException ne )

Modified: directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java Wed Jan  6 18:26:43 2010
@@ -20,41 +20,49 @@
 package org.apache.directory.server.xdbm.search.impl;
 
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.directory.server.xdbm.Store;
-import org.apache.directory.server.xdbm.ForwardIndexEntry;
-import org.apache.directory.server.xdbm.tools.StoreUtils;
-import org.apache.directory.server.schema.registries.*;
-import org.apache.directory.server.schema.bootstrap.*;
-import org.apache.directory.server.schema.SerializableComparator;
-import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmStore;
-import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
-import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.entry.ServerStringValue;
-import org.apache.directory.server.core.entry.DefaultServerEntry;
-import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.csn.CsnFactory;
-import org.apache.directory.shared.ldap.cursor.InvalidCursorPositionException;
-import org.apache.directory.shared.ldap.filter.GreaterEqNode;
-import org.apache.directory.shared.ldap.schema.*;
-import org.apache.directory.shared.ldap.schema.parsers.SyntaxCheckerDescription;
-import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.commons.io.FileUtils;
-import org.junit.Before;
-import org.junit.After;
-import org.junit.Test;import static org.junit.Assert.assertTrue;import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.io.File;
 import java.util.ArrayList;
-import java.util.HashSet;
 import java.util.List;
-import java.util.Set;
 import java.util.UUID;
 
+import org.apache.commons.io.FileUtils;
+import org.apache.directory.server.core.entry.DefaultServerEntry;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerStringValue;
+import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
+import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmStore;
+import org.apache.directory.server.xdbm.ForwardIndexEntry;
+import org.apache.directory.server.xdbm.Store;
+import org.apache.directory.server.xdbm.tools.StoreUtils;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.csn.CsnFactory;
+import org.apache.directory.shared.ldap.cursor.InvalidCursorPositionException;
+import org.apache.directory.shared.ldap.filter.GreaterEqNode;
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.LdapSyntax;
+import org.apache.directory.shared.ldap.schema.MatchingRule;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
+import org.apache.directory.shared.ldap.schema.SchemaUtils;
+import org.apache.directory.shared.ldap.schema.comparators.StringComparator;
+import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
+import org.apache.directory.shared.ldap.schema.ldif.extractor.impl.DefaultSchemaLdifExtractor;
+import org.apache.directory.shared.ldap.schema.loader.ldif.LdifSchemaLoader;
+import org.apache.directory.shared.ldap.schema.manager.impl.DefaultSchemaManager;
+import org.apache.directory.shared.ldap.schema.parsers.SyntaxCheckerDescription;
+import org.apache.directory.shared.ldap.util.ExceptionUtils;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -67,30 +75,43 @@
 {
     public static final Logger LOG = LoggerFactory.getLogger( GreaterEqTest.class );
 
-
     File wkdir;
     Store<ServerEntry> store;
-    Registries registries = null;
-    AttributeTypeRegistry attributeRegistry;
+    static SchemaManager schemaManager = null;
 
 
-    public GreaterEqTest() throws Exception
+    @BeforeClass
+    public static void setup() throws Exception
     {
         // setup the standard registries
-        BootstrapSchemaLoader loader = new BootstrapSchemaLoader();
-        OidRegistry oidRegistry = new DefaultOidRegistry();
-        registries = new DefaultRegistries( "bootstrap", loader, oidRegistry );
-        SerializableComparator.setRegistry( registries.getComparatorRegistry() );
-
-        // load essential bootstrap schemas
-        Set<Schema> bootstrapSchemas = new HashSet<Schema>();
-        bootstrapSchemas.add( new ApachemetaSchema() );
-        bootstrapSchemas.add( new ApacheSchema() );
-        bootstrapSchemas.add( new CoreSchema() );
-        bootstrapSchemas.add( new SystemSchema() );
-        bootstrapSchemas.add( new CollectiveSchema() );
-        loader.loadWithDependencies( bootstrapSchemas, registries );
-        attributeRegistry = registries.getAttributeTypeRegistry();
+        String workingDirectory = System.getProperty( "workingDirectory" );
+
+        if ( workingDirectory == null )
+        {
+            String path = GreaterEqTest.class.getResource( "" ).getPath();
+            int targetPos = path.indexOf( "target" );
+            workingDirectory = path.substring( 0, targetPos + 6 );
+        }
+
+        File schemaRepository = new File( workingDirectory, "schema" );
+        SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory ) );
+        extractor.extractOrCopy( true );
+        LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository );
+        schemaManager = new DefaultSchemaManager( loader );
+
+        boolean loaded = schemaManager.loadAllEnabled();
+
+        if ( !loaded )
+        {
+            fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
+        }
+
+        loaded = schemaManager.loadWithDeps( loader.getSchema( "collective" ) );
+
+        if ( !loaded )
+        {
+            fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
+        }
     }
 
 
@@ -116,7 +137,7 @@
         store.addIndex( new JdbmIndex( SchemaConstants.CN_AT_OID ) );
         store.addIndex( new JdbmIndex( SchemaConstants.POSTALCODE_AT_OID ) );
 
-        StoreUtils.loadExampleData( store, registries );
+        StoreUtils.loadExampleData( store, schemaManager );
         LOG.debug( "Created new store" );
     }
 
@@ -142,9 +163,9 @@
     @Test
     public void testCursorIndexed() throws Exception
     {
-        AttributeType at = attributeRegistry.lookup( SchemaConstants.POSTALCODE_AT_OID );
+        AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.POSTALCODE_AT_OID );
         GreaterEqNode node = new GreaterEqNode( SchemaConstants.POSTALCODE_AT_OID, new ServerStringValue( at, "3" ) );
-        GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, registries );
+        GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, schemaManager );
         GreaterEqCursor cursor = new GreaterEqCursor( store, evaluator );
         assertNotNull( cursor );
         assertFalse( cursor.available() );
@@ -153,8 +174,14 @@
 
         // ---------- test bad get() ----------
 
-        try { cursor.get(); fail(); }
-        catch( InvalidCursorPositionException e ) {}
+        try
+        {
+            cursor.get();
+            fail();
+        }
+        catch ( InvalidCursorPositionException e )
+        {
+        }
 
         // ---------- test beforeFirst() ----------
 
@@ -281,7 +308,7 @@
         // ---------- test before() ----------
 
         cursor = new GreaterEqCursor( store, evaluator );
-        ForwardIndexEntry<String,ServerEntry> indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+        ForwardIndexEntry<String, ServerEntry> indexEntry = new ForwardIndexEntry<String, ServerEntry>();
         indexEntry.setValue( "5" );
 
         assertFalse( cursor.available() );
@@ -304,7 +331,7 @@
         assertTrue( cursor.isClosed() );
 
         cursor = new GreaterEqCursor( store, evaluator );
-        indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+        indexEntry = new ForwardIndexEntry<String, ServerEntry>();
         indexEntry.setValue( "7" );
         cursor.before( indexEntry );
         assertFalse( cursor.available() );
@@ -314,7 +341,7 @@
         cursor.close();
 
         cursor = new GreaterEqCursor( store, evaluator );
-        indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+        indexEntry = new ForwardIndexEntry<String, ServerEntry>();
         indexEntry.setValue( "3" );
         cursor.before( indexEntry );
         assertFalse( cursor.available() );
@@ -326,7 +353,7 @@
         // ---------- test after() ----------
 
         cursor = new GreaterEqCursor( store, evaluator );
-        indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+        indexEntry = new ForwardIndexEntry<String, ServerEntry>();
         indexEntry.setValue( "4" );
 
         assertFalse( cursor.available() );
@@ -349,7 +376,7 @@
         assertTrue( cursor.isClosed() );
 
         cursor = new GreaterEqCursor( store, evaluator );
-        indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+        indexEntry = new ForwardIndexEntry<String, ServerEntry>();
         indexEntry.setValue( "7" );
         cursor.after( indexEntry );
         assertFalse( cursor.available() );
@@ -359,7 +386,7 @@
         cursor.close();
 
         cursor = new GreaterEqCursor( store, evaluator );
-        indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+        indexEntry = new ForwardIndexEntry<String, ServerEntry>();
         indexEntry.setValue( "3" );
         cursor.after( indexEntry );
         assertFalse( cursor.available() );
@@ -373,9 +400,9 @@
     @Test
     public void testCursorNotIndexed() throws Exception
     {
-        AttributeType at = attributeRegistry.lookup( SchemaConstants.POSTOFFICEBOX_AT_OID );
+        AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.POSTOFFICEBOX_AT_OID );
         GreaterEqNode node = new GreaterEqNode( SchemaConstants.POSTOFFICEBOX_AT_OID, new ServerStringValue( at, "3" ) );
-        GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, registries );
+        GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, schemaManager );
         GreaterEqCursor cursor = new GreaterEqCursor( store, evaluator );
         assertNotNull( cursor );
         assertFalse( cursor.available() );
@@ -384,8 +411,14 @@
 
         // ---------- test bad get() ----------
 
-        try { cursor.get(); fail(); }
-        catch( InvalidCursorPositionException e ) {}
+        try
+        {
+            cursor.get();
+            fail();
+        }
+        catch ( InvalidCursorPositionException e )
+        {
+        }
 
         // ---------- test beforeFirst() ----------
 
@@ -507,18 +540,30 @@
         // ---------- test before() ----------
 
         cursor = new GreaterEqCursor( store, evaluator );
-        ForwardIndexEntry<String,ServerEntry> indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+        ForwardIndexEntry<String, ServerEntry> indexEntry = new ForwardIndexEntry<String, ServerEntry>();
         indexEntry.setValue( "2" );
-        try { cursor.before( indexEntry ); fail( "Should never get here." );}
-        catch ( UnsupportedOperationException e ) {}
+        try
+        {
+            cursor.before( indexEntry );
+            fail( "Should never get here." );
+        }
+        catch ( UnsupportedOperationException e )
+        {
+        }
 
         // ---------- test after() ----------
 
         cursor = new GreaterEqCursor( store, evaluator );
-        indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+        indexEntry = new ForwardIndexEntry<String, ServerEntry>();
         indexEntry.setValue( "2" );
-        try { cursor.after( indexEntry ); fail( "Should never get here." );}
-        catch ( UnsupportedOperationException e ) {}
+        try
+        {
+            cursor.after( indexEntry );
+            fail( "Should never get here." );
+        }
+        catch ( UnsupportedOperationException e )
+        {
+        }
     }
 
 
@@ -526,14 +571,13 @@
     // Evaluator Test Cases
     // -----------------------------------------------------------------------
 
-
     @Test
     public void testEvaluatorIndexed() throws Exception
     {
-        AttributeType at = attributeRegistry.lookup( SchemaConstants.POSTALCODE_AT_OID );
+        AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.POSTALCODE_AT_OID );
         GreaterEqNode node = new GreaterEqNode( SchemaConstants.POSTALCODE_AT_OID, new ServerStringValue( at, "3" ) );
-        GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, registries );
-        ForwardIndexEntry<String,ServerEntry> indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+        GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, schemaManager );
+        ForwardIndexEntry<String, ServerEntry> indexEntry = new ForwardIndexEntry<String, ServerEntry>();
         assertEquals( node, evaluator.getExpression() );
         assertEquals( SchemaConstants.POSTALCODE_AT_OID, evaluator.getAttributeType().getOid() );
         assertNotNull( evaluator.getNormalizer() );
@@ -542,31 +586,31 @@
         indexEntry.setId( 1L );
         assertFalse( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+        indexEntry = new ForwardIndexEntry<String, ServerEntry>();
         indexEntry.setId( 4L );
         assertFalse( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+        indexEntry = new ForwardIndexEntry<String, ServerEntry>();
         indexEntry.setId( 5L );
         assertTrue( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+        indexEntry = new ForwardIndexEntry<String, ServerEntry>();
         indexEntry.setId( 6L );
         assertTrue( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+        indexEntry = new ForwardIndexEntry<String, ServerEntry>();
         indexEntry.setId( 7L );
         assertTrue( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+        indexEntry = new ForwardIndexEntry<String, ServerEntry>();
         indexEntry.setId( 8L );
         assertTrue( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+        indexEntry = new ForwardIndexEntry<String, ServerEntry>();
         indexEntry.setId( 9L );
         assertFalse( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+        indexEntry = new ForwardIndexEntry<String, ServerEntry>();
         indexEntry.setId( 10L );
         assertFalse( evaluator.evaluate( indexEntry ) );
     }
@@ -575,25 +619,25 @@
     @Test
     public void testEvaluatorWithDescendantValue() throws Exception
     {
-        AttributeType at = attributeRegistry.lookup( SchemaConstants.STREET_AT_OID );
+        AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.STREET_AT_OID );
         GreaterEqNode node = new GreaterEqNode( SchemaConstants.STREET_AT_OID, new ServerStringValue( at, "2" ) );
-        GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, registries );
-        ForwardIndexEntry<String,ServerEntry> indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+        GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, schemaManager );
+        ForwardIndexEntry<String, ServerEntry> indexEntry = new ForwardIndexEntry<String, ServerEntry>();
         assertEquals( node, evaluator.getExpression() );
         assertEquals( SchemaConstants.STREET_AT_OID, evaluator.getAttributeType().getOid() );
         assertNotNull( evaluator.getNormalizer() );
         assertNotNull( evaluator.getComparator() );
 
         LdapDN dn = new LdapDN( "cn=jane doe,o=good times co." );
-        dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
-        ServerEntry attrs = new DefaultServerEntry( registries, dn );
+        dn.normalize( schemaManager.getNormalizerMapping() );
+        ServerEntry attrs = new DefaultServerEntry( schemaManager, dn );
         attrs.add( "objectClass", "person" );
         attrs.add( "c-street", "3" );
         attrs.add( "cn", "jane doe" );
         attrs.add( "sn", "doe" );
         attrs.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
         attrs.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
-        store.add(  attrs );
+        store.add( attrs );
 
         indexEntry.setId( 12L );
         assertTrue( evaluator.evaluate( indexEntry ) );
@@ -603,11 +647,11 @@
     @Test
     public void testEvaluatorWithoutDescendants() throws Exception
     {
-        AttributeType at = attributeRegistry.lookup( SchemaConstants.C_POSTALCODE_AT_OID );
+        AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.C_POSTALCODE_AT_OID );
         GreaterEqNode node = new GreaterEqNode( SchemaConstants.C_POSTALCODE_AT_OID, new ServerStringValue( at, "2" ) );
 
-        GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, registries );
-        ForwardIndexEntry<String,ServerEntry> indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+        GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, schemaManager );
+        ForwardIndexEntry<String, ServerEntry> indexEntry = new ForwardIndexEntry<String, ServerEntry>();
         assertEquals( node, evaluator.getExpression() );
         assertEquals( SchemaConstants.C_POSTALCODE_AT_OID, evaluator.getAttributeType().getOid() );
         assertNotNull( evaluator.getNormalizer() );
@@ -621,11 +665,11 @@
     @Test
     public void testEvaluatorNotIndexed() throws Exception
     {
-        AttributeType at = attributeRegistry.lookup( SchemaConstants.POSTOFFICEBOX_AT_OID );
+        AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.POSTOFFICEBOX_AT_OID );
         GreaterEqNode node = new GreaterEqNode( SchemaConstants.POSTOFFICEBOX_AT_OID, new ServerStringValue( at, "3" ) );
 
-        GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, registries );
-        ForwardIndexEntry<String,ServerEntry> indexEntry = new ForwardIndexEntry<String, ServerEntry>();
+        GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, schemaManager );
+        ForwardIndexEntry<String, ServerEntry> indexEntry = new ForwardIndexEntry<String, ServerEntry>();
         assertEquals( node, evaluator.getExpression() );
         assertEquals( SchemaConstants.POSTOFFICEBOX_AT_OID, evaluator.getAttributeType().getOid() );
         assertNotNull( evaluator.getNormalizer() );
@@ -634,76 +678,90 @@
         indexEntry.setId( 1L );
         assertFalse( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+        indexEntry = new ForwardIndexEntry<String, ServerEntry>();
         indexEntry.setId( 4L );
         assertFalse( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+        indexEntry = new ForwardIndexEntry<String, ServerEntry>();
         indexEntry.setId( 5L );
         assertTrue( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+        indexEntry = new ForwardIndexEntry<String, ServerEntry>();
         indexEntry.setId( 6L );
         assertTrue( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+        indexEntry = new ForwardIndexEntry<String, ServerEntry>();
         indexEntry.setId( 7L );
         assertTrue( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+        indexEntry = new ForwardIndexEntry<String, ServerEntry>();
         indexEntry.setId( 8L );
         assertTrue( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+        indexEntry = new ForwardIndexEntry<String, ServerEntry>();
         indexEntry.setId( 9L );
         assertFalse( evaluator.evaluate( indexEntry ) );
 
-        indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+        indexEntry = new ForwardIndexEntry<String, ServerEntry>();
         indexEntry.setId( 10L );
         assertFalse( evaluator.evaluate( indexEntry ) );
     }
 
 
-    @Test ( expected = IllegalStateException.class )
+    @Test(expected = IllegalStateException.class)
     public void testEvaluatorAttributeNoMatchingRule() throws Exception
     {
-        AttributeType at = new NoMatchingRuleAttributeType();
-        registries.getAttributeTypeRegistry().register( at );
-        registries.getSyntaxRegistry().register( at.getSyntax() );
-        SyntaxCheckerDescription desc = new SyntaxCheckerDescription();
-        desc.setDescription( "bogus" );
-        desc.setFqcn( BogusSyntax.class.getName() );
-        List<String> names = new ArrayList<String>();
-        names.add( "bogus" );
-        desc.setNames( names );
-        desc.setNumericOid( at.getSyntax().getOid() );
-        desc.setObsolete( false );
-        registries.getSyntaxCheckerRegistry().register( desc, at.getSyntax().getSyntaxChecker() );
+        LdapSyntax syntax = new BogusSyntax( 1 );
+        AttributeType at = new AttributeType( SchemaConstants.ATTRIBUTE_TYPES_AT_OID + ".2000" );
+        at.addName( "bogus" );
+        at.setSchemaName( "other" );
+        at.setSyntax( syntax );
 
-        GreaterEqNode node = new GreaterEqNode( at.getOid(), new ServerStringValue( at, "3" ) );
-        new GreaterEqEvaluator( node, store, registries );
-        registries.getAttributeTypeRegistry().unregister( at.getOid() );
+        schemaManager.add( syntax );
+        schemaManager.add( at );
+
+        try
+        {
+            GreaterEqNode node = new GreaterEqNode( at.getOid(), new ServerStringValue( at, "3" ) );
+            new GreaterEqEvaluator( node, store, schemaManager );
+        }
+        finally 
+        {
+            schemaManager.delete( at );
+            schemaManager.delete( syntax );
+        }
     }
 
 
     @Test
     public void testEvaluatorAttributeOrderingMatchingRule() throws Exception
     {
-        AttributeType at = new OrderingOnlyMatchingRuleAttributeType();
-        registries.getAttributeTypeRegistry().register( at );
-        registries.getSyntaxRegistry().register( at.getSyntax() );
-        SyntaxCheckerDescription desc = new SyntaxCheckerDescription();
+        LdapSyntax syntax = new BogusSyntax( 1 );
+        MatchingRule mr = new MatchingRule( "1.1" );
+        mr.setSyntax( syntax );
+        mr.setLdapComparator( new StringComparator( "1.1" ) );
+
+        AttributeType at = new AttributeType( SchemaConstants.ATTRIBUTE_TYPES_AT_OID + ".5000" );
+        at.addName( "bogus" );
+        at.setSchemaName( "other" );
+        at.setSyntax( syntax );
+        at.setOrdering( mr );
+
+        assertTrue( schemaManager.add( syntax ) );
+        assertTrue( schemaManager.add( mr ) );
+        assertTrue( schemaManager.add( at ) );
+
+        SyntaxCheckerDescription desc = new SyntaxCheckerDescription( at.getSyntax().getOid() );
         desc.setDescription( "bogus" );
         desc.setFqcn( BogusSyntax.class.getName() );
         List<String> names = new ArrayList<String>();
         names.add( "bogus" );
         desc.setNames( names );
-        desc.setNumericOid( at.getSyntax().getOid() );
         desc.setObsolete( false );
-        registries.getSyntaxCheckerRegistry().register( desc, at.getSyntax().getSyntaxChecker() );
+        //schemaManager.register( at.getSyntax().getSyntaxChecker() );
 
         GreaterEqNode node = new GreaterEqNode( at.getOid(), new ServerStringValue( at, "3" ) );
-        new GreaterEqEvaluator( node, store, registries );
-        registries.getAttributeTypeRegistry().unregister( at.getOid() );
+        new GreaterEqEvaluator( node, store, schemaManager );
+        schemaManager.delete( at );
     }
 }
\ No newline at end of file



Mime
View raw message