directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r655151 [1/3] - in /directory/sandbox/akarasulu/bigbang: apacheds/btree-base/src/main/java/org/apache/directory/server/xdbm/ apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/ apacheds/jdbm-store/src/main/java/org/apa...
Date Sat, 10 May 2008 20:19:41 GMT
Author: akarasulu
Date: Sat May 10 13:19:40 2008
New Revision: 655151

URL: http://svn.apache.org/viewvc?rev=655151&view=rev
Log:
commiting fixes after merge more to go

Modified:
    directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/xdbm/Store.java
    directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerStringValue.java
    directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
    directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java
    directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
    directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
    directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTableTest.java
    directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
    directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/AndCursor.java
    directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/AndEvaluator.java
    directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateCursor.java
    directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java
    directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/CursorBuilder.java
    directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java
    directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityCursor.java
    directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java
    directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EvaluatorBuilder.java
    directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqCursor.java
    directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java
    directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java
    directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java
    directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/NotCursor.java
    directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/NotEvaluator.java
    directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeCursor.java
    directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OrCursor.java
    directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OrEvaluator.java
    directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java
    directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java
    directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java
    directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java
    directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java
    directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java
    directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
    directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
    directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java
    directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeTest.java
    directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OrCursorTest.java
    directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java
    directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java
    directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeTest.java
    directory/sandbox/akarasulu/bigbang/apacheds/xdbm-tools/src/main/java/org/apache/directory/server/xdbm/tools/StoreUtils.java
    directory/sandbox/akarasulu/bigbang/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/LessEqNode.java
    directory/sandbox/akarasulu/bigbang/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AttributeType.java

Modified: directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/xdbm/Store.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/xdbm/Store.java?rev=655151&r1=655150&r2=655151&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/xdbm/Store.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/xdbm/Store.java Sat May 10 13:19:40 2008
@@ -30,8 +30,6 @@
 import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.entry.Modification;
 
-import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
 import java.io.File;
 import java.util.Set;
 import java.util.Iterator;
@@ -155,13 +153,11 @@
     /**
      * Initialize the JDBM storage system.
      *
-     * @param oidRegistry an OID registry to resolve numeric identifiers from names
-     * @param attributeTypeRegistry an attributeType specification registry to lookup type specs
-     * @throws javax.naming.NamingException on failure to lookup elements in registries
+     * @param registries the schema registries
+     * @throws Exception on failure to lookup elements in registries
      * @throws Exception on failure to create database files
      */
-    void init( OidRegistry oidRegistry, AttributeTypeRegistry attributeTypeRegistry )
-            throws Exception;
+    void init( Registries registries ) throws Exception;
 
 
     /**
@@ -190,55 +186,55 @@
     void sync() throws Exception;
 
 
-    void addIndex( Index index ) throws NamingException;
+    void addIndex( Index index ) throws Exception;
 
 
     Index<String,E> getPresenceIndex();
 
 
-    void setPresenceIndex( Index<String,E> index ) throws NamingException;
+    void setPresenceIndex( Index<String,E> index ) throws Exception;
 
 
     Index<Long,E> getOneLevelIndex();
 
 
-    void setOneLevelIndex( Index<Long,E> index ) throws NamingException;
+    void setOneLevelIndex( Index<Long,E> index ) throws Exception;
 
 
     Index<Long,E> getSubLevelIndex();
 
 
-    void setSubLevelIndex( Index<Long,E> index ) throws NamingException;
+    void setSubLevelIndex( Index<Long,E> index ) throws Exception;
 
 
     Index<String,E> getAliasIndex();
 
 
-    void setAliasIndex( Index<String,E> index ) throws NamingException;
+    void setAliasIndex( Index<String,E> index ) throws Exception;
 
 
     Index<Long,E> getOneAliasIndex();
 
 
-    void setOneAliasIndex( Index<Long,E> index ) throws NamingException;
+    void setOneAliasIndex( Index<Long,E> index ) throws Exception;
 
 
     Index<Long,E> getSubAliasIndex();
 
 
-    void setSubAliasIndex( Index<Long,E> index ) throws NamingException;
+    void setSubAliasIndex( Index<Long,E> index ) throws Exception;
 
 
     Index<String,E> getUpdnIndex();
 
 
-    void setUpdnIndex( Index<String,E> index ) throws NamingException;
+    void setUpdnIndex( Index<String,E> index ) throws Exception;
 
 
     Index<String,E> getNdnIndex();
 
 
-    void setNdnIndex( Index<String,E> index ) throws NamingException;
+    void setNdnIndex( Index<String,E> index ) throws Exception;
 
 
     Iterator<String> userIndices();
@@ -247,10 +243,10 @@
     Iterator<String> systemIndices();
 
 
-    boolean hasUserIndexOn( String id ) throws NamingException;
+    boolean hasUserIndexOn( String id ) throws Exception;
 
 
-    boolean hasSystemIndexOn( String id ) throws NamingException;
+    boolean hasSystemIndexOn( String id ) throws Exception;
 
 
     Index getUserIndex( String id ) throws IndexNotFoundException;
@@ -290,10 +286,10 @@
     int count() throws Exception;
 
 
-    void add( LdapDN normName, Attributes entry ) throws Exception;
+    void add( LdapDN normName, ServerEntry entry ) throws Exception;
 
 
-    Attributes lookup( Long id ) throws Exception;
+    ServerEntry lookup( Long id ) throws Exception;
 
 
     void delete( Long id ) throws Exception;
@@ -318,7 +314,7 @@
     LdapDN getUpSuffix();
 
 
-    Attributes getSuffixEntry() throws Exception;
+    ServerEntry getSuffixEntry() throws Exception;
 
 
     void setProperty( String propertyName, String propertyValue ) throws Exception;

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerStringValue.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerStringValue.java?rev=655151&r1=655150&r2=655151&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerStringValue.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerStringValue.java Sat May 10 13:19:40 2008
@@ -284,7 +284,7 @@
 
 
     /**
-     * @see Value#compareTo(Value)
+     * @see Value#compareTo(Object)
      * @throws IllegalStateException on failures to extract the comparator, or the
      * normalizers needed to perform the required comparisons based on the schema
      */

Modified: directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java?rev=655151&r1=655150&r2=655151&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java Sat May 10 13:19:40 2008
@@ -30,7 +30,6 @@
 import org.apache.directory.server.xdbm.Index;
 import org.apache.directory.server.xdbm.IndexEntry;
 import org.apache.directory.server.xdbm.Tuple;
-import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.util.SynchronizedLRUMap;
 
@@ -654,15 +653,8 @@
 
         if ( null == normalized )
         {
-            if ( attrVal instanceof Value<?> )
-            {
-                normalized = attribute.getEquality().getNormalizer().normalize( ( ( Value<?> ) attrVal ).get() );
-            }
-            else
-            {
-                //noinspection unchecked
-                normalized = ( K ) attribute.getEquality().getNormalizer().normalize( attrVal );
-            }
+            //noinspection unchecked
+            normalized = ( K ) attribute.getEquality().getNormalizer().normalize( attrVal );
 
             // Double map it so if we use an already normalized
             // value we can get back the same normalized value.

Modified: directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java?rev=655151&r1=655150&r2=655151&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java Sat May 10 13:19:40 2008
@@ -24,15 +24,11 @@
 import jdbm.helper.LongSerializer;
 import jdbm.helper.StringComparator;
 
-import jdbm.helper.Serializer;
 import org.apache.directory.server.xdbm.MasterTable;
-import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.ServerEntrySerializer;
 import org.apache.directory.server.schema.SerializableComparator;
 import org.apache.directory.server.schema.registries.Registries;
 
-import java.io.IOException;
-
 
 /**
  * The master table used to store the Attributes of entries.
@@ -62,37 +58,34 @@
                 throw new IllegalArgumentException( "Argument 'obj2' is null" );
             }
 
-            long thisVal = ( Long ) o1;
-            long anotherVal = ( Long ) o2;
-            
-            if ( thisVal == anotherVal )
+            if ( o1 == ( long ) o2 )
             {
                 return 0;
             }
             
-            if ( thisVal == anotherVal )
+            if ( o1 == ( long ) o2 )
             {
                 return 0;
             }
             
-            if ( thisVal >= 0 )
+            if ( o1 >= 0 )
             {
-                if ( anotherVal >= 0 )
+                if ( o2 >= 0 )
                 {
-                    return ( thisVal > anotherVal ) ? 1 : -1;
+                    return ( o1 > ( long ) o2 ) ? 1 : -1;
                 }
                 else
                 {
                     return -1;
                 }
             }
-            else if ( anotherVal >= 0 )
+            else if ( o2 >= 0 )
             {
                 return 1;
             }
             else
             {
-                return ( thisVal < anotherVal ) ? -1 : 1;
+                return ( o1 < ( long ) o2 ) ? -1 : 1;
             }
         }
     };
@@ -118,7 +111,7 @@
      * Creates the master table using JDBM B+Trees for the backing store.
      *
      * @param recMan the JDBM record manager
-     * @param serializer the serializer to use for persisting objects
+     * @param registries the schema registries
      * @throws Exception if there is an error opening the Db file.
      */
     public JdbmMasterTable( RecordManager recMan, Registries registries ) throws Exception
@@ -139,9 +132,9 @@
      *
      * @param id the Long id of the entry to retrieve.
      * @return the ServerEntry with operational attributes and all.
-     * @throws NamingException if there is a read error on the underlying Db.
+     * @throws Exception if there is a read error on the underlying Db.
      */
-    public E get( Object id ) throws Exception
+    public E get( Long id ) throws Exception
     {
         return super.get( id );
     }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java?rev=655151&r1=655150&r2=655151&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java Sat May 10 13:19:40 2008
@@ -26,7 +26,6 @@
 import jdbm.recman.CacheRecordManager;
 
 import org.apache.directory.server.core.entry.DefaultServerAttribute;
-import org.apache.directory.server.core.entry.DefaultServerEntry;
 import org.apache.directory.server.core.entry.ServerAttribute;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.ServerEntryUtils;
@@ -46,18 +45,15 @@
 import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException;
 import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
 import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
-import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.name.Rdn;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.util.NamespaceTools;
-import org.apache.directory.shared.ldap.NotImplementedException;
 import org.apache.directory.shared.ldap.MultiException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import java.io.File;
 import java.util.ArrayList;
@@ -85,7 +81,7 @@
     /** the working directory to use for files */
     private File workingDirectory;
     /** the master table storing entries by primary key */
-    private JdbmMasterTable<Attributes> master;
+    private JdbmMasterTable<E> master;
     /** a map of attributeType numeric ids to user userIndices */
     private Map<String, JdbmIndex> userIndices = new HashMap<String, JdbmIndex>();
     /** a map of attributeType numeric ids to system userIndices */
@@ -247,8 +243,7 @@
      * Initialize the JDBM storage system.
      *
      * @param registries the schema registries
-     * @throws Exception on failure to lookup elements in registries
-     * @throws Exception on failure to create database files
+     * @throws Exception on failure to lookup elements in registries or create database files
      */
     public synchronized void init( Registries registries ) throws Exception
     {
@@ -1081,7 +1076,7 @@
             }
         }
 
-        master.put( id, entry );
+        master.put( id, ( E ) entry );
 
         if ( isSyncOnWrite )
         {
@@ -1092,7 +1087,7 @@
 
     public ServerEntry lookup( Long id ) throws Exception
     {
-        return master.get( id );
+        return ( ServerEntry ) master.get( id );
     }
 
 
@@ -1396,7 +1391,7 @@
     public void modify( LdapDN dn, ModificationOperation modOp, ServerEntry mods ) throws Exception
     {
         Long id = getEntryId( dn.toString() );
-        ServerEntry entry = master.get( id );
+        ServerEntry entry = ( ServerEntry ) master.get( id );
 
         for ( AttributeType attributeType : mods.getAttributeTypes() )
         {
@@ -1422,7 +1417,7 @@
             }
         }
 
-        master.put( id, entry );
+        master.put( id, ( E ) entry );
 
         if ( isSyncOnWrite )
         {
@@ -1434,7 +1429,7 @@
     public void modify( LdapDN dn, List<Modification> mods ) throws Exception
     {
         Long id = getEntryId( dn.toString() );
-        ServerEntry entry = master.get( id );
+        ServerEntry entry = ( ServerEntry ) master.get( id );
 
         for ( Modification mod : mods )
         {
@@ -1459,7 +1454,7 @@
             }
         }
 
-        master.put( id, entry );
+        master.put( id, ( E ) entry );
 
         if ( isSyncOnWrite )
         {
@@ -1589,7 +1584,7 @@
 
         // Update the current entry
         entry.setDn( newUpdn );
-        master.put( entry, id );
+        master.put( id, ( E ) entry );
 
         if ( isSyncOnWrite )
         {
@@ -1673,7 +1668,7 @@
             // Modify the child
             ServerEntry entry = lookup( childId );
             entry.setDn( childUpdn );
-            master.put( childId, entry );
+            master.put( childId, ( E ) entry );
 
             // Recursively change the names of the children below
             modifyDn( childId, childUpdn, isMove );

Modified: directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java?rev=655151&r1=655150&r2=655151&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java Sat May 10 13:19:40 2008
@@ -370,7 +370,7 @@
     // ------------------------------------------------------------------------
 
 
-    public V get( K key ) throws IOException
+    public V get( K key ) throws Exception
     {
         if ( key == null )
         {

Modified: directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTableTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTableTest.java?rev=655151&r1=655150&r2=655151&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTableTest.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTableTest.java Sat May 10 13:19:40 2008
@@ -26,11 +26,15 @@
 import org.junit.After;
 import org.junit.Test;
 import static org.junit.Assert.*;
+import org.apache.directory.server.schema.bootstrap.*;
+import org.apache.directory.server.schema.registries.*;
+import org.apache.directory.server.schema.SerializableComparator;
 
 import java.io.File;
+import java.util.Set;
+import java.util.HashSet;
 
 import jdbm.RecordManager;
-import jdbm.helper.IntegerSerializer;
 import jdbm.recman.BaseRecordManager;
 
 
@@ -48,6 +52,27 @@
     transient JdbmMasterTable<Integer> table;
     transient File dbFile;
     transient RecordManager recman;
+    transient Registries registries = null;
+    transient AttributeTypeRegistry attributeRegistry;
+
+
+    public JdbmMasterTableTest() 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() );
+        loader.loadWithDependencies( bootstrapSchemas, registries );
+        attributeRegistry = registries.getAttributeTypeRegistry();
+    }
 
 
     @Before
@@ -63,10 +88,10 @@
         dbFile = File.createTempFile( getClass().getSimpleName(), "db", tmpDir );
         recman = new BaseRecordManager( dbFile.getAbsolutePath() );
 
-        table = new JdbmMasterTable<Integer>( recman, new IntegerSerializer() );
+        table = new JdbmMasterTable<Integer>( recman, registries );
         LOG.debug( "Created new table and populated it with data" );
 
-        JdbmMasterTable t2 = new JdbmMasterTable<Integer>( recman, new IntegerSerializer() );
+        JdbmMasterTable t2 = new JdbmMasterTable<Integer>( recman, registries );
         t2.close();
     }
 

Modified: directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java?rev=655151&r1=655150&r2=655151&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java Sat May 10 13:19:40 2008
@@ -38,7 +38,6 @@
 import org.apache.directory.server.xdbm.tools.StoreUtils;
 import org.apache.directory.server.core.cursor.Cursor;
 import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.entry.ServerEntryUtils;
 import org.apache.directory.server.core.entry.ServerModification;
 import org.apache.directory.server.core.entry.DefaultServerAttribute;
 import org.apache.directory.server.core.entry.ServerAttribute;
@@ -371,7 +370,7 @@
         entry.add( "ou", "Apache" );
         entry.add( "commonName",  "Jack Daniels");
         entry.add( "aliasedObjectName", "cn=Jack Daniels,ou=Engineering,o=Good Times Co." );
-        store.add( dn, ServerEntryUtils.toAttributesImpl( entry ) );
+        store.add( dn, entry );
         
         store.delete( 12L ); // drops the alias indices
         
@@ -411,7 +410,7 @@
       entry.add( "objectClass", "top", "person", "organizationalPerson" );
       entry.add( "ou", "Sales" );
       entry.add( "cn",  "Martin King");
-      store.add( martinDn, ServerEntryUtils.toAttributesImpl( entry ) );
+      store.add( martinDn, entry );
       
       cursor = idx.forwardCursor( 2L);
       cursor.afterLast();
@@ -433,7 +432,7 @@
       entry = new DefaultServerEntry( registries, marketingDn );
       entry.add( "objectClass", "top", "organizationalUnit" );
       entry.add( "ou", "Marketing" );
-      store.add( marketingDn, ServerEntryUtils.toAttributesImpl( entry ) );
+      store.add( marketingDn, entry );
 
       // dn id 14
       LdapDN jimmyDn = new LdapDN( "cn=Jimmy Wales,ou=Marketing, ou=Sales,o=Good Times Co." );
@@ -442,7 +441,7 @@
       entry.add( "objectClass", "top", "person", "organizationalPerson" );
       entry.add( "ou", "Marketing" );
       entry.add( "cn",  "Jimmy Wales");
-      store.add( jimmyDn, ServerEntryUtils.toAttributesImpl( entry ) );
+      store.add( jimmyDn, entry );
       
       store.move( marketingDn, newParentDn );
 
@@ -661,7 +660,7 @@
         entry.add( "objectClass", "top", "person", "organizationalPerson" );
         entry.add( "ou", "Not Present" );
         entry.add( "cn",  "Martin King");
-        store.add( dn, ServerEntryUtils.toAttributesImpl( entry ) );
+        store.add( dn, entry );
     }
     
     
@@ -673,7 +672,7 @@
         DefaultServerEntry entry = new DefaultServerEntry( registries, dn );
         entry.add( "ou", "Sales" );
         entry.add( "cn",  "Martin King");
-        store.add( dn, ServerEntryUtils.toAttributesImpl( entry ) );
+        store.add( dn, entry );
     }
         
     
@@ -707,7 +706,7 @@
         entry.add( "ou", "Engineering" );
         entry.add( "cn",  "Private Ryan");
 
-        store.add( dn, ServerEntryUtils.toAttributesImpl( entry ) );
+        store.add( dn, entry );
         
         Rdn rdn = new Rdn("sn=James");
         
@@ -725,7 +724,7 @@
         childEntry.add( "ou", "Engineering" );
         childEntry.add( "cn",  "Private Ryan");
 
-        store.add( childDn, ServerEntryUtils.toAttributesImpl( childEntry ) );
+        store.add( childDn, childEntry );
 
         LdapDN parentDn = new LdapDN( "ou=Sales,o=Good Times Co." );
         parentDn.normalize( attributeRegistry.getNormalizerMapping() );
@@ -765,10 +764,10 @@
         Modification add = new ServerModification( ModificationOperation.ADD_ATTRIBUTE, attrib );
         mods.add( add );
         
-        Attributes attributes = store.lookup( store.getEntryId( dn.toNormName() ) );
+        ServerEntry lookedup = store.lookup( store.getEntryId( dn.toNormName() ) );
 
         store.modify( dn, mods );
-        assertTrue( attributes.get( "sn" ).contains( attribVal ) );
+        assertTrue( lookedup.get( "sn" ).contains( attribVal ) );
         
         // testing the store.modify( dn, mod, entry ) API
         ServerEntry entry = new DefaultServerEntry( registries, dn );
@@ -776,7 +775,8 @@
         entry.add( "telephoneNumber", attribVal );
         
         store.modify( dn, ModificationOperation.ADD_ATTRIBUTE, entry );
-        assertTrue( attributes.get( "telephoneNumber" ).contains( attribVal ) );
+        lookedup = store.lookup( store.getEntryId( dn.toNormName() ) );
+        assertTrue( lookedup.get( "telephoneNumber" ).contains( attribVal ) );
     }
     
     
@@ -796,12 +796,12 @@
         Modification add = new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, attrib );
         mods.add( add );
         
-        Attributes attributes = store.lookup( store.getEntryId( dn.toNormName() ) );
+        ServerEntry lookedup = store.lookup( store.getEntryId( dn.toNormName() ) );
         
-        assertEquals( "WAlkeR", attributes.get( "sn" ).get() ); // before replacing
+        assertEquals( "WAlkeR", lookedup.get( "sn" ).get().get() ); // before replacing
         
         store.modify( dn, mods );
-        assertEquals( attribVal, attributes.get( "sn" ).get() );
+        assertEquals( attribVal, lookedup.get( "sn" ).get().get() );
         
         // testing the store.modify( dn, mod, entry ) API
         ServerEntry entry = new DefaultServerEntry( registries, dn );
@@ -809,7 +809,7 @@
         entry.add( "sn", attribVal );
         
         store.modify( dn, ModificationOperation.REPLACE_ATTRIBUTE, entry );
-        assertEquals( attribVal, attributes.get( "sn" ).get() );
+        assertEquals( attribVal, lookedup.get( "sn" ).get().get() );
     }
     
     
@@ -826,12 +826,12 @@
         Modification add = new ServerModification( ModificationOperation.REMOVE_ATTRIBUTE, attrib );
         mods.add( add );
         
-        Attributes attributes = store.lookup( store.getEntryId( dn.toNormName() ) );
+        ServerEntry lookedup = store.lookup( store.getEntryId( dn.toNormName() ) );
         
-        assertNotNull( attributes.get( "sn" ) );
+        assertNotNull( lookedup.get( "sn" ).get() );
         
         store.modify( dn, mods );
-        assertNull( attributes.get( "sn" ) );
+        assertNull( lookedup.get( "sn" ).get() );
         
         // testing the store.modify( dn, mod, entry ) API
         ServerEntry entry = new DefaultServerEntry( registries, dn );
@@ -839,10 +839,10 @@
         // add an entry for the sake of testing the remove operation
         entry.add( "sn", "JWalker" );
         store.modify( dn, ModificationOperation.ADD_ATTRIBUTE, entry );
-        assertNotNull( attributes.get( "sn" ) );
+        assertNotNull( lookedup.get( "sn" ).get() );
         
         store.modify( dn, ModificationOperation.REMOVE_ATTRIBUTE, entry );
-        assertNull( attributes.get( "sn" ) );
+        assertNull( lookedup.get( "sn" ).get() );
     }
 
 }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/AndCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/AndCursor.java?rev=655151&r1=655150&r2=655151&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/AndCursor.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/AndCursor.java Sat May 10 13:19:40 2008
@@ -24,9 +24,9 @@
 import org.apache.directory.server.core.cursor.AbstractCursor;
 import org.apache.directory.server.core.cursor.Cursor;
 import org.apache.directory.server.core.cursor.InvalidCursorPositionException;
+import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 
-import javax.naming.directory.Attributes;
 import java.util.*;
 
 
@@ -36,17 +36,17 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class AndCursor extends AbstractCursor<IndexEntry<?,Attributes>>
+public class AndCursor extends AbstractCursor<IndexEntry<?, ServerEntry>>
 {
     private static final String UNSUPPORTED_MSG =
         "AndCursors are not ordered and do not support positioning by element.";
-    private final Cursor<IndexEntry<?,Attributes>> wrapped;
-    private final List<Evaluator<? extends ExprNode, Attributes>> evaluators;
+    private final Cursor<IndexEntry<?,ServerEntry>> wrapped;
+    private final List<Evaluator<? extends ExprNode, ServerEntry>> evaluators;
     private boolean available = false;
 
 
-    public AndCursor( Cursor<IndexEntry<?, Attributes>> wrapped,
-                      List<Evaluator<? extends ExprNode, Attributes>> evaluators )
+    public AndCursor( Cursor<IndexEntry<?, ServerEntry>> wrapped,
+                      List<Evaluator<? extends ExprNode, ServerEntry>> evaluators )
     {
         this.wrapped = wrapped;
         this.evaluators = optimize( evaluators );
@@ -59,13 +59,13 @@
     }
 
 
-    public void before( IndexEntry<?, Attributes> element ) throws Exception
+    public void before( IndexEntry<?, ServerEntry> element ) throws Exception
     {
         throw new UnsupportedOperationException( UNSUPPORTED_MSG );
     }
 
 
-    public void after( IndexEntry<?, Attributes> element ) throws Exception
+    public void after( IndexEntry<?, ServerEntry> element ) throws Exception
     {
         throw new UnsupportedOperationException( UNSUPPORTED_MSG );
     }
@@ -103,7 +103,7 @@
     {
         while ( wrapped.previous() )
         {
-            IndexEntry<?,Attributes> candidate = wrapped.get();
+            IndexEntry<?,ServerEntry> candidate = wrapped.get();
             if ( matches( candidate ) )
             {
                 return available = true;
@@ -118,7 +118,7 @@
     {
         while ( wrapped.next() )
         {
-            IndexEntry<?,Attributes> candidate = wrapped.get();
+            IndexEntry<?,ServerEntry> candidate = wrapped.get();
             if ( matches( candidate ) )
             {
                 return available = true;
@@ -129,7 +129,7 @@
     }
 
 
-    public IndexEntry<?, Attributes> get() throws Exception
+    public IndexEntry<?, ServerEntry> get() throws Exception
     {
         if ( available )
         {
@@ -167,15 +167,15 @@
      * @param unoptimized the unoptimized list of Evaluators
      * @return optimized Evaluator list with increasing scan count ordering
      */
-    private List<Evaluator<? extends ExprNode,Attributes>>
-        optimize( List<Evaluator<? extends ExprNode,Attributes>> unoptimized )
+    private List<Evaluator<? extends ExprNode,ServerEntry>>
+        optimize( List<Evaluator<? extends ExprNode,ServerEntry>> unoptimized )
     {
-        List<Evaluator<? extends ExprNode,Attributes>> optimized =
-            new ArrayList<Evaluator<? extends ExprNode,Attributes>>( unoptimized.size() );
+        List<Evaluator<? extends ExprNode,ServerEntry>> optimized =
+            new ArrayList<Evaluator<? extends ExprNode,ServerEntry>>( unoptimized.size() );
         optimized.addAll( unoptimized );
-        Collections.sort( optimized, new Comparator<Evaluator<?,Attributes>>()
+        Collections.sort( optimized, new Comparator<Evaluator<?,ServerEntry>>()
         {
-            public int compare( Evaluator<?, Attributes> e1, Evaluator<?, Attributes> e2 )
+            public int compare( Evaluator<?, ServerEntry> e1, Evaluator<?, ServerEntry> e2 )
             {
                 long scanCount1 = ( Long ) e1.getExpression().get( "count" );
                 long scanCount2 = ( Long ) e2.getExpression().get( "count" );
@@ -204,9 +204,9 @@
     }
 
 
-    private boolean matches( IndexEntry<?, Attributes> indexEntry ) throws Exception
+    private boolean matches( IndexEntry<?, ServerEntry> indexEntry ) throws Exception
     {
-        for ( Evaluator<?,Attributes> evaluator : evaluators )
+        for ( Evaluator<?,ServerEntry> evaluator : evaluators )
         {
             if ( ! evaluator.evaluate( indexEntry ) )
             {

Modified: directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/AndEvaluator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/AndEvaluator.java?rev=655151&r1=655150&r2=655151&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/AndEvaluator.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/AndEvaluator.java Sat May 10 13:19:40 2008
@@ -23,8 +23,8 @@
 import org.apache.directory.shared.ldap.filter.AndNode;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.server.xdbm.IndexEntry;
+import org.apache.directory.server.core.entry.ServerEntry;
 
-import javax.naming.directory.Attributes;
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -37,14 +37,14 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $$Rev$$
  */
-public class AndEvaluator implements Evaluator<AndNode,Attributes>
+public class AndEvaluator implements Evaluator<AndNode, ServerEntry>
 {
-    private final List<Evaluator<? extends ExprNode,Attributes>> evaluators;
+    private final List<Evaluator<? extends ExprNode,ServerEntry>> evaluators;
 
     private final AndNode node;
 
 
-    public AndEvaluator( AndNode node, List<Evaluator<? extends ExprNode, Attributes>> evaluators )
+    public AndEvaluator( AndNode node, List<Evaluator<? extends ExprNode, ServerEntry>> evaluators )
     {
         this.node = node;
         this.evaluators = optimize( evaluators );
@@ -62,15 +62,15 @@
      * @param unoptimized the unoptimized list of Evaluators
      * @return optimized Evaluator list with increasing scan count ordering
      */
-    private List<Evaluator<? extends ExprNode,Attributes>>
-        optimize( List<Evaluator<? extends ExprNode,Attributes>> unoptimized )
+    private List<Evaluator<? extends ExprNode,ServerEntry>>
+        optimize( List<Evaluator<? extends ExprNode,ServerEntry>> unoptimized )
     {
-        List<Evaluator<? extends ExprNode,Attributes>> optimized =
-            new ArrayList<Evaluator<? extends ExprNode,Attributes>>( unoptimized.size() );
+        List<Evaluator<? extends ExprNode,ServerEntry>> optimized =
+            new ArrayList<Evaluator<? extends ExprNode,ServerEntry>>( unoptimized.size() );
         optimized.addAll( unoptimized );
-        Collections.sort( optimized, new Comparator<Evaluator<?,Attributes>>()
+        Collections.sort( optimized, new Comparator<Evaluator<?,ServerEntry>>()
         {
-            public int compare( Evaluator<?, Attributes> e1, Evaluator<?, Attributes> e2 )
+            public int compare( Evaluator<?, ServerEntry> e1, Evaluator<?, ServerEntry> e2 )
             {
                 long scanCount1 = ( Long ) e1.getExpression().get( "count" );
                 long scanCount2 = ( Long ) e2.getExpression().get( "count" );
@@ -99,9 +99,9 @@
     }
 
 
-    public boolean evaluate( IndexEntry<?, Attributes> indexEntry ) throws Exception
+    public boolean evaluate( IndexEntry<?, ServerEntry> indexEntry ) throws Exception
     {
-        for ( Evaluator<?,Attributes> evaluator : evaluators )
+        for ( Evaluator<?,ServerEntry> evaluator : evaluators )
         {
             if ( ! evaluator.evaluate( indexEntry ) )
             {

Modified: directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateCursor.java?rev=655151&r1=655150&r2=655151&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateCursor.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateCursor.java Sat May 10 13:19:40 2008
@@ -25,8 +25,7 @@
 import org.apache.directory.server.core.cursor.AbstractCursor;
 import org.apache.directory.server.core.cursor.Cursor;
 import org.apache.directory.server.core.cursor.InvalidCursorPositionException;
-
-import javax.naming.directory.Attributes;
+import org.apache.directory.server.core.entry.ServerEntry;
 
 
 /**
@@ -41,7 +40,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $$Rev$$
  */
-public class ApproximateCursor extends AbstractCursor<IndexEntry<?, Attributes>>
+public class ApproximateCursor extends AbstractCursor<IndexEntry<?, ServerEntry>>
 {
     private static final String UNSUPPORTED_MSG =
         "ApproximateCursors only support positioning by element when a user index exists on the asserted attribute.";
@@ -50,16 +49,16 @@
     private final ApproximateEvaluator approximateEvaluator;
 
     /** Cursor over attribute entry matching filter: set when index present */
-    private final Cursor<IndexEntry<?,Attributes>> userIdxCursor;
+    private final Cursor<IndexEntry<?,ServerEntry>> userIdxCursor;
 
     /** NDN Cursor on all entries in  (set when no index on user attribute) */
-    private final Cursor<IndexEntry<String,Attributes>> ndnIdxCursor;
+    private final Cursor<IndexEntry<String,ServerEntry>> ndnIdxCursor;
 
     /** used only when ndnIdxCursor is used (no index on attribute) */
     private boolean available = false;
 
 
-    public ApproximateCursor( Store<Attributes> db, ApproximateEvaluator approximateEvaluator ) throws Exception
+    public ApproximateCursor( Store<ServerEntry> db, ApproximateEvaluator approximateEvaluator ) throws Exception
     {
         this.approximateEvaluator = approximateEvaluator;
 
@@ -90,7 +89,7 @@
     }
 
 
-    public void before( IndexEntry<?, Attributes> element ) throws Exception
+    public void before( IndexEntry<?, ServerEntry> element ) throws Exception
     {
         if ( userIdxCursor != null )
         {
@@ -103,7 +102,7 @@
     }
 
 
-    public void after( IndexEntry<?, Attributes> element ) throws Exception
+    public void after( IndexEntry<?, ServerEntry> element ) throws Exception
     {
         if ( userIdxCursor != null )
         {
@@ -167,7 +166,7 @@
 
         while( ndnIdxCursor.previous() )
         {
-            IndexEntry<?,Attributes> candidate = ndnIdxCursor.get();
+            IndexEntry<?,ServerEntry> candidate = ndnIdxCursor.get();
             if ( approximateEvaluator.evaluate( candidate ) )
             {
                  return available = true;
@@ -187,7 +186,7 @@
 
         while( ndnIdxCursor.next() )
         {
-            IndexEntry<?,Attributes> candidate = ndnIdxCursor.get();
+            IndexEntry<?,ServerEntry> candidate = ndnIdxCursor.get();
             if ( approximateEvaluator.evaluate( candidate ) )
             {
                  return available = true;
@@ -198,7 +197,7 @@
     }
 
 
-    public IndexEntry<?, Attributes> get() throws Exception
+    public IndexEntry<?, ServerEntry> get() throws Exception
     {
         if ( userIdxCursor != null )
         {

Modified: directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java?rev=655151&r1=655150&r2=655151&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java Sat May 10 13:19:40 2008
@@ -21,18 +21,17 @@
 
 
 import org.apache.directory.shared.ldap.filter.ApproximateNode;
-import org.apache.directory.shared.ldap.util.AttributeUtils;
 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.schema.registries.Registries;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerAttribute;
 
-import javax.naming.directory.Attributes;
-import javax.naming.directory.Attribute;
-import javax.naming.NamingEnumeration;
 import java.util.Iterator;
 import java.util.Comparator;
 
@@ -44,18 +43,18 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class ApproximateEvaluator implements Evaluator<ApproximateNode, Attributes>
+public class ApproximateEvaluator implements Evaluator<ApproximateNode, ServerEntry>
 {
     private final ApproximateNode node;
-    private final Store<Attributes> db;
+    private final Store<ServerEntry> db;
     private final Registries registries;
     private final AttributeType type;
     private final Normalizer normalizer;
     private final Comparator comparator;
-    private final Index<Number,Attributes> idx;
+    private final Index<Number,ServerEntry> idx;
 
 
-    public ApproximateEvaluator( ApproximateNode node, Store<Attributes> db, Registries registries )
+    public ApproximateEvaluator( ApproximateNode node, Store<ServerEntry> db, Registries registries )
         throws Exception
     {
         this.db = db;
@@ -95,14 +94,14 @@
     }
 
 
-    public boolean evaluate( IndexEntry<?,Attributes> indexEntry ) throws Exception
+    public boolean evaluate( IndexEntry<?,ServerEntry> indexEntry ) throws Exception
     {
         if ( idx != null )
         {
             return idx.forward( ( Number ) indexEntry.getValue(), indexEntry.getId() );
         }
 
-        Attributes entry = indexEntry.getObject();
+        ServerEntry entry = indexEntry.getObject();
 
         // resuscitate the entry if it has not been and set entry in IndexEntry
         if ( null == entry )
@@ -112,7 +111,7 @@
         }
 
         // get the attribute
-        Attribute attr = AttributeUtils.getAttribute( entry, type );
+        ServerAttribute attr = ( ServerAttribute ) entry.get( type );
 
         // if the attribute does not exist just return false
         if ( attr != null && evaluate( attr ) )
@@ -135,7 +134,7 @@
             {
                 AttributeType descendant = descendants.next();
 
-                attr = AttributeUtils.getAttribute( entry, descendant );
+                attr = ( ServerAttribute ) entry.get( descendant );
 
                 if ( attr != null && evaluate( attr ) )
                 {
@@ -149,7 +148,9 @@
     }
 
 
-    private boolean evaluate( Attribute attribute ) throws Exception
+    // TODO - determine if comaparator and index entry should have the Value
+    // wrapper or the raw normalized value
+    private boolean evaluate( ServerAttribute attribute ) throws Exception
     {
         /*
          * Cycle through the attribute values testing normalized version
@@ -157,17 +158,13 @@
          * normalizer.  The test uses the comparator obtained from the
          * appropriate matching rule to perform the check.
          */
-        NamingEnumeration values = attribute.getAll();
 
-        while ( values.hasMore() )
+        for ( Value value : attribute )
         {
-            Object value = normalizer.normalize( values.next() );
+            value.normalize( normalizer );
 
-            // Once match is found cleanup and return true
-            //noinspection unchecked
-            if ( comparator.compare( value, node.getValue() ) == 0 )
+            if ( comparator.compare( value.getNormalizedValue(), node.getValue().getNormalizedValue() ) == 0 )
             {
-                values.close();
                 return true;
             }
         }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/CursorBuilder.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/CursorBuilder.java?rev=655151&r1=655150&r2=655151&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/CursorBuilder.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/CursorBuilder.java Sat May 10 13:19:40 2008
@@ -23,12 +23,12 @@
 import java.util.List;
 import java.util.ArrayList;
 
-import javax.naming.directory.Attributes;
 import javax.naming.directory.SearchControls;
 
 import org.apache.directory.server.xdbm.IndexEntry;
 import org.apache.directory.server.xdbm.Store;
 import org.apache.directory.server.core.cursor.Cursor;
+import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.shared.ldap.NotImplementedException;
 import org.apache.directory.shared.ldap.filter.*;
 
@@ -42,7 +42,7 @@
 public class CursorBuilder
 {
     /** The database used by this builder */
-    private Store<Attributes> db = null;
+    private Store<ServerEntry> db = null;
 
     /** Evaluator dependency on a EvaluatorBuilder */
     private EvaluatorBuilder evaluatorBuilder;
@@ -54,14 +54,14 @@
      * @param db database used by this enumerator
      * @param evaluatorBuilder the evaluator builder
      */
-    public CursorBuilder( Store<Attributes> db, EvaluatorBuilder evaluatorBuilder )
+    public CursorBuilder( Store<ServerEntry> db, EvaluatorBuilder evaluatorBuilder )
     {
         this.db = db;
         this.evaluatorBuilder = evaluatorBuilder;
     }
 
 
-    public Cursor<IndexEntry<?,Attributes>> build( ExprNode node ) throws Exception
+    public Cursor<IndexEntry<?,ServerEntry>> build( ExprNode node ) throws Exception
     {
         switch ( node.getAssertionType() )
         {
@@ -117,11 +117,12 @@
      * @return Cursor over candidates satisfying disjunction expression
      * @throws Exception on db access failures
      */
-    private Cursor<IndexEntry<?,Attributes>> buildOrCursor( OrNode node ) throws Exception
+    private Cursor<IndexEntry<?,ServerEntry>> buildOrCursor( OrNode node ) throws Exception
     {
         List<ExprNode> children = node.getChildren();
-        List<Cursor<IndexEntry<?,Attributes>>> childCursors = new ArrayList<Cursor<IndexEntry<?,Attributes>>>(children.size());
-        List<Evaluator> childEvaluators = new ArrayList<Evaluator>( children.size() );
+        List<Cursor<IndexEntry<?,ServerEntry>>> childCursors = new ArrayList<Cursor<IndexEntry<?,ServerEntry>>>(children.size());
+        List<Evaluator<? extends ExprNode, ServerEntry>> childEvaluators
+            = new ArrayList<Evaluator<? extends ExprNode, ServerEntry>>( children.size() );
 
         // Recursively create Cursors and Evaluators for each child expression node
         for ( ExprNode child : children )
@@ -142,7 +143,7 @@
      * @return Cursor over the conjunction expression
      * @throws Exception on db access failures
      */
-    private Cursor<IndexEntry<?,Attributes>> buildAndCursor( AndNode node ) throws Exception
+    private Cursor<IndexEntry<?,ServerEntry>> buildAndCursor( AndNode node ) throws Exception
     {
         int minIndex = 0;
         long minValue = Long.MAX_VALUE;
@@ -175,8 +176,8 @@
 
         // Once found we build the child Evaluators minus the one for the minChild
         ExprNode minChild = children.get( minIndex );
-        List<Evaluator<? extends ExprNode, Attributes>> childEvaluators =
-            new ArrayList<Evaluator<? extends ExprNode, Attributes>>( children.size() - 1 );
+        List<Evaluator<? extends ExprNode, ServerEntry>> childEvaluators =
+            new ArrayList<Evaluator<? extends ExprNode, ServerEntry>>( children.size() - 1 );
         for ( ExprNode child : children )
         {
             if ( child == minChild )
@@ -188,7 +189,7 @@
         }
 
         // Do recursive call to build min child Cursor then create AndCursor
-        Cursor<IndexEntry<?,Attributes>> childCursor = build( minChild );
+        Cursor<IndexEntry<?,ServerEntry>> childCursor = build( minChild );
         return new AndCursor( childCursor, childEvaluators );
     }
 }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java?rev=655151&r1=655150&r2=655151&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java Sat May 10 13:19:40 2008
@@ -21,7 +21,6 @@
 
 
 import javax.naming.directory.SearchControls;
-import javax.naming.directory.Attributes;
 
 import org.apache.directory.shared.ldap.filter.AndNode;
 import org.apache.directory.shared.ldap.filter.BranchNode;
@@ -33,6 +32,7 @@
 import org.apache.directory.server.xdbm.search.Optimizer;
 import org.apache.directory.server.xdbm.search.SearchEngine;
 import org.apache.directory.server.core.cursor.Cursor;
+import org.apache.directory.server.core.entry.ServerEntry;
 
 
 /**
@@ -42,14 +42,14 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class DefaultSearchEngine implements SearchEngine<Attributes>
+public class DefaultSearchEngine implements SearchEngine<ServerEntry>
 {
     /** the Optimizer used by this DefaultSearchEngine */
     private final Optimizer optimizer;
     /** the Database this DefaultSearchEngine operates on */
-    private Store<Attributes> db;
+    private Store<ServerEntry> db;
     /** Evaluator flyweight used for filter expression assertions */
-    private Evaluator<? extends ExprNode, Attributes> evaluator;
+    private Evaluator<? extends ExprNode, ServerEntry> evaluator;
     /** CursorBuilder flyweight that creates enumerations on filter expressions */
     private CursorBuilder cursorBuilder;
 
@@ -66,8 +66,8 @@
      * @param evaluator an expression evaluator
      * @param optimizer an optimizer to use during search
      */
-    public DefaultSearchEngine( Store<Attributes> db,
-                                Evaluator<? extends ExprNode, Attributes> evaluator,
+    public DefaultSearchEngine( Store<ServerEntry> db,
+                                Evaluator<? extends ExprNode, ServerEntry> evaluator,
                                 CursorBuilder cursorBuilder, Optimizer optimizer )
     {
         this.db = db;
@@ -88,7 +88,7 @@
     }
 
 
-    public Cursor<IndexEntry<?,Attributes>> search( LdapDN base, AliasDerefMode aliasDerefMode, ExprNode filter, SearchControls searchCtls )
+    public Cursor<IndexEntry<?,ServerEntry>> search( LdapDN base, AliasDerefMode aliasDerefMode, ExprNode filter, SearchControls searchCtls )
         throws Exception
     {
         LdapDN effectiveBase;
@@ -136,7 +136,7 @@
      */
     public boolean evaluate( ExprNode filter, Long id ) throws Exception
     {
-        IndexEntry<?,Attributes> rec = new ForwardIndexEntry<Object,Attributes>();
+        IndexEntry<?,ServerEntry> rec = new ForwardIndexEntry<Object,ServerEntry>();
         rec.setId( id );
         return evaluator.evaluate( rec );
     }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityCursor.java?rev=655151&r1=655150&r2=655151&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityCursor.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityCursor.java Sat May 10 13:19:40 2008
@@ -25,8 +25,7 @@
 import org.apache.directory.server.core.cursor.AbstractCursor;
 import org.apache.directory.server.core.cursor.Cursor;
 import org.apache.directory.server.core.cursor.InvalidCursorPositionException;
-
-import javax.naming.directory.Attributes;
+import org.apache.directory.server.core.entry.ServerEntry;
 
 
 /**
@@ -39,7 +38,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $$Rev$$
  */
-public class EqualityCursor extends AbstractCursor<IndexEntry<?, Attributes>>
+public class EqualityCursor extends AbstractCursor<IndexEntry<?, ServerEntry>>
 {
     private static final String UNSUPPORTED_MSG =
         "EqualityCursors only support positioning by element when a user index exists on the asserted attribute.";
@@ -48,16 +47,16 @@
     private final EqualityEvaluator equalityEvaluator;
 
     /** Cursor over attribute entry matching filter: set when index present */
-    private final Cursor<IndexEntry<?,Attributes>> userIdxCursor;
+    private final Cursor<IndexEntry<?,ServerEntry>> userIdxCursor;
 
     /** NDN Cursor on all entries in  (set when no index on user attribute) */
-    private final Cursor<IndexEntry<String,Attributes>> ndnIdxCursor;
+    private final Cursor<IndexEntry<String,ServerEntry>> ndnIdxCursor;
 
     /** used only when ndnIdxCursor is used (no index on attribute) */
     private boolean available = false;
 
 
-    public EqualityCursor( Store<Attributes> db, EqualityEvaluator equalityEvaluator ) throws Exception
+    public EqualityCursor( Store<ServerEntry> db, EqualityEvaluator equalityEvaluator ) throws Exception
     {
         this.equalityEvaluator = equalityEvaluator;
 
@@ -88,7 +87,7 @@
     }
 
 
-    public void before( IndexEntry<?, Attributes> element ) throws Exception
+    public void before( IndexEntry<?, ServerEntry> element ) throws Exception
     {
         if ( userIdxCursor != null )
         {
@@ -101,7 +100,7 @@
     }
 
 
-    public void after( IndexEntry<?, Attributes> element ) throws Exception
+    public void after( IndexEntry<?, ServerEntry> element ) throws Exception
     {
         if ( userIdxCursor != null )
         {
@@ -165,7 +164,7 @@
 
         while( ndnIdxCursor.previous() )
         {
-            IndexEntry<?,Attributes> candidate = ndnIdxCursor.get();
+            IndexEntry<?,ServerEntry> candidate = ndnIdxCursor.get();
             if ( equalityEvaluator.evaluate( candidate ) )
             {
                  return available = true;
@@ -185,7 +184,7 @@
 
         while( ndnIdxCursor.next() )
         {
-            IndexEntry<?,Attributes> candidate = ndnIdxCursor.get();
+            IndexEntry<?,ServerEntry> candidate = ndnIdxCursor.get();
             if ( equalityEvaluator.evaluate( candidate ) )
             {
                  return available = true;
@@ -196,7 +195,7 @@
     }
 
 
-    public IndexEntry<?, Attributes> get() throws Exception
+    public IndexEntry<?, ServerEntry> get() throws Exception
     {
         if ( userIdxCursor != null )
         {

Modified: directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java?rev=655151&r1=655150&r2=655151&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java Sat May 10 13:19:40 2008
@@ -21,18 +21,17 @@
 
 
 import org.apache.directory.shared.ldap.filter.EqualityNode;
-import org.apache.directory.shared.ldap.util.AttributeUtils;
 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.schema.registries.Registries;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerAttribute;
 
-import javax.naming.directory.Attributes;
-import javax.naming.directory.Attribute;
-import javax.naming.NamingEnumeration;
 import java.util.Iterator;
 import java.util.Comparator;
 
@@ -44,18 +43,18 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class EqualityEvaluator implements Evaluator<EqualityNode, Attributes>
+public class EqualityEvaluator implements Evaluator<EqualityNode, ServerEntry>
 {
     private final EqualityNode node;
-    private final Store<Attributes> db;
+    private final Store<ServerEntry> db;
     private final Registries registries;
     private final AttributeType type;
     private final Normalizer normalizer;
     private final Comparator comparator;
-    private final Index<Number,Attributes> idx;
+    private final Index<Number,ServerEntry> idx;
 
 
-    public EqualityEvaluator( EqualityNode node, Store<Attributes> db, Registries registries )
+    public EqualityEvaluator( EqualityNode node, Store<ServerEntry> db, Registries registries )
         throws Exception
     {
         this.db = db;
@@ -95,14 +94,14 @@
     }
 
 
-    public boolean evaluate( IndexEntry<?,Attributes> indexEntry ) throws Exception
+    public boolean evaluate( IndexEntry<?,ServerEntry> indexEntry ) throws Exception
     {
         if ( idx != null )
         {
             return idx.forward( ( Number ) indexEntry.getValue(), indexEntry.getId() );
         }
 
-        Attributes entry = indexEntry.getObject();
+        ServerEntry entry = indexEntry.getObject();
 
         // resuscitate the entry if it has not been and set entry in IndexEntry
         if ( null == entry )
@@ -112,7 +111,7 @@
         }
 
         // get the attribute
-        Attribute attr = AttributeUtils.getAttribute( entry, type );
+        ServerAttribute attr = ( ServerAttribute ) entry.get( type );
 
         // if the attribute does not exist just return false
         if ( attr != null && evaluate( attr ) )
@@ -135,7 +134,7 @@
             {
                 AttributeType descendant = descendants.next();
 
-                attr = AttributeUtils.getAttribute( entry, descendant );
+                attr = ( ServerAttribute ) entry.get( descendant );
 
                 if ( attr != null && evaluate( attr ) )
                 {
@@ -149,7 +148,9 @@
     }
 
 
-    private boolean evaluate( Attribute attribute ) throws Exception
+    // TODO - determine if comaparator and index entry should have the Value
+    // wrapper or the raw normalized value
+    private boolean evaluate( ServerAttribute attribute ) throws Exception
     {
         /*
          * Cycle through the attribute values testing normalized version
@@ -157,17 +158,12 @@
          * normalizer.  The test uses the comparator obtained from the
          * appropriate matching rule to perform the check.
          */
-        NamingEnumeration values = attribute.getAll();
-
-        while ( values.hasMore() )
+        for ( Value value : attribute )
         {
-            Object value = normalizer.normalize( values.next() );
+            value.normalize( normalizer );
 
-            // Once match is found cleanup and return true
-            //noinspection unchecked
-            if ( comparator.compare( value, node.getValue() ) == 0 )
+            if ( comparator.compare( value.getNormalizedValue(), node.getValue().getNormalizedValue() ) == 0 )
             {
-                values.close();
                 return true;
             }
         }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EvaluatorBuilder.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EvaluatorBuilder.java?rev=655151&r1=655150&r2=655151&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EvaluatorBuilder.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EvaluatorBuilder.java Sat May 10 13:19:40 2008
@@ -25,6 +25,7 @@
 
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.server.xdbm.Store;
+import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.shared.ldap.filter.*;
 import org.apache.directory.shared.ldap.NotImplementedException;
 
@@ -40,7 +41,7 @@
  */
 public class EvaluatorBuilder
 {
-    private final Store<Attributes> db;
+    private final Store<ServerEntry> db;
     private final Registries registries;
 
 
@@ -52,14 +53,14 @@
      * @param registries the schema registries
      * @throws Exception failure to access db or lookup schema in registries
      */
-    public EvaluatorBuilder( Store<Attributes> db, Registries registries ) throws Exception
+    public EvaluatorBuilder( Store<ServerEntry> db, Registries registries ) throws Exception
     {
         this.db = db;
         this.registries = registries;
     }
 
 
-    public Evaluator<? extends ExprNode, Attributes> build( ExprNode node ) throws Exception
+    public Evaluator<? extends ExprNode, ServerEntry> build( ExprNode node ) throws Exception
     {
         switch ( node.getAssertionType() )
         {
@@ -78,11 +79,11 @@
             case SCOPE:
                 if ( ( ( ScopeNode ) node ).getScope() == SearchControls.ONELEVEL_SCOPE )
                 {
-                    return new OneLevelScopeEvaluator<Attributes>( db, ( ScopeNode ) node );
+                    return new OneLevelScopeEvaluator<ServerEntry>( db, ( ScopeNode ) node );
                 }
                 else
                 {
-                    return new SubtreeScopeEvaluator<Attributes>( db, ( ScopeNode ) node );
+                    return new SubtreeScopeEvaluator<ServerEntry>( db, ( ScopeNode ) node );
                 }
             case SUBSTRING:
                 return new SubstringEvaluator( ( SubstringNode ) node, db, registries );
@@ -111,8 +112,8 @@
     AndEvaluator buildAndEvaluator( AndNode node ) throws Exception
     {
         List<ExprNode> children = node.getChildren();
-        List<Evaluator<? extends ExprNode,Attributes>> evaluators =
-            new ArrayList<Evaluator<? extends ExprNode,Attributes>>( children.size() );
+        List<Evaluator<? extends ExprNode,ServerEntry>> evaluators =
+            new ArrayList<Evaluator<? extends ExprNode,ServerEntry>>( children.size() );
         for ( ExprNode child : children )
         {
             evaluators.add( build( child ) );
@@ -124,8 +125,8 @@
     OrEvaluator buildOrEvaluator( OrNode node ) throws Exception
     {
         List<ExprNode> children = node.getChildren();
-        List<Evaluator<? extends ExprNode,Attributes>> evaluators =
-            new ArrayList<Evaluator<? extends ExprNode,Attributes>>( children.size() );
+        List<Evaluator<? extends ExprNode,ServerEntry>> evaluators =
+            new ArrayList<Evaluator<? extends ExprNode,ServerEntry>>( children.size() );
         for ( ExprNode child : children )
         {
             evaluators.add( build( child ) );

Modified: directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqCursor.java?rev=655151&r1=655150&r2=655151&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqCursor.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqCursor.java Sat May 10 13:19:40 2008
@@ -26,8 +26,7 @@
 import org.apache.directory.server.core.cursor.AbstractCursor;
 import org.apache.directory.server.core.cursor.Cursor;
 import org.apache.directory.server.core.cursor.InvalidCursorPositionException;
-
-import javax.naming.directory.Attributes;
+import org.apache.directory.server.core.entry.ServerEntry;
 
 
 /**
@@ -40,7 +39,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $$Rev$$
  */
-public class GreaterEqCursor extends AbstractCursor<IndexEntry<?, Attributes>>
+public class GreaterEqCursor extends AbstractCursor<IndexEntry<?, ServerEntry>>
 {
     private static final String UNSUPPORTED_MSG =
         "GreaterEqCursors only support positioning by element when a user index exists on the asserted attribute.";
@@ -49,23 +48,23 @@
     private final GreaterEqEvaluator greaterEqEvaluator;
 
     /** Cursor over attribute entry matching filter: set when index present */
-    private final Cursor<IndexEntry<?,Attributes>> userIdxCursor;
+    private final Cursor<IndexEntry<?,ServerEntry>> userIdxCursor;
 
     /** NDN Cursor on all entries in  (set when no index on user attribute) */
-    private final Cursor<IndexEntry<String,Attributes>> ndnIdxCursor;
+    private final Cursor<IndexEntry<String,ServerEntry>> ndnIdxCursor;
 
     /**
      * Used to store indexEntry from ndnCandidate so it can be saved after
      * call to evaluate() which changes the value so it's not referring to
      * the NDN but to the value of the attribute instead.
      */
-    IndexEntry<String, Attributes> ndnCandidate;
+    IndexEntry<String, ServerEntry> ndnCandidate;
 
     /** used in both modes */
     private boolean available = false;
 
 
-    public GreaterEqCursor( Store<Attributes> db, GreaterEqEvaluator greaterEqEvaluator ) throws Exception
+    public GreaterEqCursor( Store<ServerEntry> db, GreaterEqEvaluator greaterEqEvaluator ) throws Exception
     {
         this.greaterEqEvaluator = greaterEqEvaluator;
 
@@ -90,7 +89,7 @@
     }
 
 
-    public void before( IndexEntry<?, Attributes> element ) throws Exception
+    public void before( IndexEntry<?, ServerEntry> element ) throws Exception
     {
         if ( userIdxCursor != null )
         {
@@ -120,7 +119,7 @@
     }
 
 
-    public void after( IndexEntry<?, Attributes> element ) throws Exception
+    public void after( IndexEntry<?, ServerEntry> element ) throws Exception
     {
         if ( userIdxCursor != null )
         {
@@ -163,7 +162,7 @@
     {
         if ( userIdxCursor != null )
         {
-            IndexEntry<Object,Attributes> advanceTo = new ForwardIndexEntry<Object,Attributes>();
+            IndexEntry<Object,ServerEntry> advanceTo = new ForwardIndexEntry<Object,ServerEntry>();
             advanceTo.setValue( greaterEqEvaluator.getExpression().getValue() );
             userIdxCursor.before( advanceTo );
         }
@@ -217,7 +216,7 @@
              */
             while ( userIdxCursor.previous() )
             {
-                IndexEntry<?,Attributes> candidate = userIdxCursor.get();
+                IndexEntry<?,ServerEntry> candidate = userIdxCursor.get();
                 //noinspection unchecked
                 if ( greaterEqEvaluator.getComparator().compare( candidate.getValue(), greaterEqEvaluator.getExpression().getValue() ) >= 0 )
                 {
@@ -265,7 +264,7 @@
     }
 
 
-    public IndexEntry<?, Attributes> get() throws Exception
+    public IndexEntry<?, ServerEntry> get() throws Exception
     {
         if ( userIdxCursor != null )
         {

Modified: directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java?rev=655151&r1=655150&r2=655151&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java Sat May 10 13:19:40 2008
@@ -21,18 +21,17 @@
 
 
 import org.apache.directory.shared.ldap.filter.GreaterEqNode;
-import org.apache.directory.shared.ldap.util.AttributeUtils;
 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.schema.registries.Registries;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerAttribute;
 
-import javax.naming.directory.Attributes;
-import javax.naming.directory.Attribute;
-import javax.naming.NamingEnumeration;
 import java.util.Iterator;
 import java.util.Comparator;
 
@@ -44,18 +43,18 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class GreaterEqEvaluator implements Evaluator<GreaterEqNode, Attributes>
+public class GreaterEqEvaluator implements Evaluator<GreaterEqNode, ServerEntry>
 {
     private final GreaterEqNode node;
-    private final Store<Attributes> db;
+    private final Store<ServerEntry> db;
     private final Registries registries;
     private final AttributeType type;
     private final Normalizer normalizer;
     private final Comparator comparator;
-    private final Index<Object,Attributes> idx;
+    private final Index<Object,ServerEntry> idx;
 
 
-    public GreaterEqEvaluator( GreaterEqNode node, Store<Attributes> db, Registries registries )
+    public GreaterEqEvaluator( GreaterEqNode node, Store<ServerEntry> db, Registries registries )
         throws Exception
     {
         this.db = db;
@@ -121,14 +120,14 @@
     }
 
 
-    public boolean evaluate( IndexEntry<?,Attributes> indexEntry ) throws Exception
+    public boolean evaluate( IndexEntry<?,ServerEntry> indexEntry ) throws Exception
     {
         if ( idx != null )
         {
             return idx.reverseGreaterOrEq( indexEntry.getId(), node.getValue() );
         }
 
-        Attributes entry = indexEntry.getObject();
+        ServerEntry entry = indexEntry.getObject();
 
         // resuscitate the entry if it has not been and set entry in IndexEntry
         if ( null == entry )
@@ -138,10 +137,10 @@
         }
 
         // get the attribute
-        Attribute attr = AttributeUtils.getAttribute( entry, type );
+        ServerAttribute attr = ( ServerAttribute ) entry.get( type );
 
-        // if the attribute does not exist just return false
-        if ( attr != null && evaluate( ( IndexEntry<Object,Attributes> ) indexEntry, attr ) )
+        // if the attribute exists and has a greater than or equal value return true
+        if ( attr != null && evaluate( ( IndexEntry<Object,ServerEntry> ) indexEntry, attr ) )
         {
             return true;
         }
@@ -161,9 +160,9 @@
             {
                 AttributeType descendant = descendants.next();
 
-                attr = AttributeUtils.getAttribute( entry, descendant );
+                attr = ( ServerAttribute ) entry.get( descendant );
 
-                if ( attr != null && evaluate( ( IndexEntry<Object,Attributes> ) indexEntry, attr ) )
+                if ( attr != null && evaluate( ( IndexEntry<Object, ServerEntry> ) indexEntry, attr ) )
                 {
                     return true;
                 }
@@ -175,7 +174,9 @@
     }
 
 
-    private boolean evaluate( IndexEntry<Object,Attributes> indexEntry, Attribute attribute ) throws Exception
+    // TODO - determine if comaparator and index entry should have the Value
+    // wrapper or the raw normalized value 
+    private boolean evaluate( IndexEntry<Object,ServerEntry> indexEntry, ServerAttribute attribute ) throws Exception
     {
         /*
          * Cycle through the attribute values testing normalized version
@@ -183,18 +184,13 @@
          * normalizer.  The test uses the comparator obtained from the
          * appropriate matching rule to perform the check.
          */
-        NamingEnumeration values = attribute.getAll();
-
-        while ( values.hasMore() )
+        for ( Value value : attribute )
         {
-            Object value = normalizer.normalize( values.next() );
+            value.normalize( normalizer );
 
-            // Once match is found cleanup and return true
-            //noinspection unchecked
-            if ( comparator.compare( value, node.getValue() ) >= 0 )
+            if ( comparator.compare( value.getNormalizedValue(), node.getValue().getNormalizedValue() ) >= 0 )
             {
-                indexEntry.setValue( value );
-                values.close();
+                indexEntry.setValue( value.getNormalizedValue() );
                 return true;
             }
         }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java?rev=655151&r1=655150&r2=655151&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java Sat May 10 13:19:40 2008
@@ -26,8 +26,7 @@
 import org.apache.directory.server.core.cursor.AbstractCursor;
 import org.apache.directory.server.core.cursor.Cursor;
 import org.apache.directory.server.core.cursor.InvalidCursorPositionException;
-
-import javax.naming.directory.Attributes;
+import org.apache.directory.server.core.entry.ServerEntry;
 
 
 /**
@@ -40,7 +39,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $$Rev$$
  */
-public class LessEqCursor extends AbstractCursor<IndexEntry<?, Attributes>>
+public class LessEqCursor extends AbstractCursor<IndexEntry<?, ServerEntry>>
 {
     private static final String UNSUPPORTED_MSG =
         "LessEqCursors only support positioning by element when a user index exists on the asserted attribute.";
@@ -49,23 +48,23 @@
     private final LessEqEvaluator lessEqEvaluator;
 
     /** Cursor over attribute entry matching filter: set when index present */
-    private final Cursor<IndexEntry<?,Attributes>> userIdxCursor;
+    private final Cursor<IndexEntry<?,ServerEntry>> userIdxCursor;
 
     /** NDN Cursor on all entries in  (set when no index on user attribute) */
-    private final Cursor<IndexEntry<String,Attributes>> ndnIdxCursor;
+    private final Cursor<IndexEntry<String,ServerEntry>> ndnIdxCursor;
 
     /**
      * Used to store indexEntry from ndnCandidate so it can be saved after
      * call to evaluate() which changes the value so it's not referring to
      * the NDN but to the value of the attribute instead.
      */
-    IndexEntry<String, Attributes> ndnCandidate;
+    IndexEntry<String, ServerEntry> ndnCandidate;
 
     /** used in both modes */
     private boolean available = false;
 
 
-    public LessEqCursor( Store<Attributes> db, LessEqEvaluator lessEqEvaluator ) throws Exception
+    public LessEqCursor( Store<ServerEntry> db, LessEqEvaluator lessEqEvaluator ) throws Exception
     {
         this.lessEqEvaluator = lessEqEvaluator;
 
@@ -90,7 +89,7 @@
     }
 
 
-    public void before( IndexEntry<?, Attributes> element ) throws Exception
+    public void before( IndexEntry<?, ServerEntry> element ) throws Exception
     {
         if ( userIdxCursor != null )
         {
@@ -134,7 +133,7 @@
     }
 
 
-    public void after( IndexEntry<?, Attributes> element ) throws Exception
+    public void after( IndexEntry<?, ServerEntry> element ) throws Exception
     {
         if ( userIdxCursor != null )
         {
@@ -190,7 +189,7 @@
     {
         if ( userIdxCursor != null )
         {
-            IndexEntry<Object,Attributes> advanceTo = new ForwardIndexEntry<Object,Attributes>();
+            IndexEntry<Object,ServerEntry> advanceTo = new ForwardIndexEntry<Object,ServerEntry>();
             advanceTo.setValue( lessEqEvaluator.getExpression().getValue() );
             userIdxCursor.after( advanceTo );
         }
@@ -259,7 +258,7 @@
              */
             while ( userIdxCursor.next() )
             {
-                IndexEntry<?,Attributes> candidate = userIdxCursor.get();
+                IndexEntry<?,ServerEntry> candidate = userIdxCursor.get();
                 //noinspection unchecked
                 if ( lessEqEvaluator.getComparator().compare( candidate.getValue(), lessEqEvaluator.getExpression().getValue() ) <= 0 )
                 {
@@ -287,7 +286,7 @@
     }
 
 
-    public IndexEntry<?, Attributes> get() throws Exception
+    public IndexEntry<?, ServerEntry> get() throws Exception
     {
         if ( userIdxCursor != null )
         {



Mime
View raw message