You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2007/09/30 06:19:20 UTC

svn commit: r580674 - in /directory/apacheds/branches/bigbang: btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/ core-unit/src/test/java/org/apache/directory/server/core/ core-unit/src/test/java/org/apache/directory/server...

Author: akarasulu
Date: Sat Sep 29 21:19:12 2007
New Revision: 580674

URL: http://svn.apache.org/viewvc?rev=580674&view=rev
Log:
removed IndexConfiguration: build is pristine with all itests passing

Removed:
    directory/apacheds/branches/bigbang/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexConfiguration.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/MutableIndexConfiguration.java
Modified:
    directory/apacheds/branches/bigbang/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/Index.java
    directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/SearchOpsITest.java
    directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/jndi/RootDSEITest.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/MutableBTreePartitionConfiguration.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
    directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
    directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
    directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/NegationOperatorITest.java

Modified: directory/apacheds/branches/bigbang/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/Index.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/Index.java?rev=580674&r1=580673&r2=580674&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/Index.java (original)
+++ directory/apacheds/branches/bigbang/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/Index.java Sat Sep 29 21:19:12 2007
@@ -38,6 +38,8 @@
  */
 public interface Index
 {
+    int DEFAULT_INDEX_CACHE_SIZE = 100;
+    
     // -----------------------------------------------------------------------
     // C O N F I G U R A T I O N   M E T H O D S
     // -----------------------------------------------------------------------

Modified: directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/SearchOpsITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/SearchOpsITest.java?rev=580674&r1=580673&r2=580674&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/SearchOpsITest.java (original)
+++ directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/SearchOpsITest.java Sat Sep 29 21:19:12 2007
@@ -22,7 +22,6 @@
 
 import org.apache.directory.server.core.partition.impl.btree.Index;
 import org.apache.directory.server.core.partition.impl.btree.MutableBTreePartitionConfiguration;
-import org.apache.directory.server.core.partition.impl.btree.MutableIndexConfiguration;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
 import org.apache.directory.server.core.unit.AbstractAdminTestCase;
 import org.apache.directory.shared.ldap.message.AttributeImpl;

Modified: directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/jndi/RootDSEITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/jndi/RootDSEITest.java?rev=580674&r1=580673&r2=580674&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/jndi/RootDSEITest.java (original)
+++ directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/jndi/RootDSEITest.java Sat Sep 29 21:19:12 2007
@@ -118,6 +118,7 @@
     public void testGetInitialContext() throws NamingException
     {
         MutableStartupConfiguration cfg = new MutableStartupConfiguration();
+        cfg.setShutdownHookEnabled( false );
         cfg.setWorkingDirectory( new File( "target" + File.separator + "server" ) );
 
         Hashtable<String,Object> env = new Hashtable<String,Object>( cfg.toJndiEnvironment() );
@@ -141,6 +142,7 @@
     public void testGetInitialContextLookupAttributes() throws NamingException
     {
         MutableStartupConfiguration cfg = new MutableStartupConfiguration();
+        cfg.setShutdownHookEnabled( false );
         cfg.setWorkingDirectory( new File( "target" + File.separator + "server" ) );
 
         Hashtable<String,Object> env = new Hashtable<String,Object>( cfg.toJndiEnvironment() );
@@ -171,6 +173,7 @@
     public void testGetInitialContextLookupAttributesByName() throws NamingException
     {
         MutableStartupConfiguration cfg = new MutableStartupConfiguration();
+        cfg.setShutdownHookEnabled( false );
         cfg.setWorkingDirectory( new File( "target" + File.separator + "server" ) );
 
         Hashtable<String,Object> env = new Hashtable<String,Object>( cfg.toJndiEnvironment() );
@@ -200,6 +203,7 @@
     public void testDelete() throws NamingException
     {
         MutableStartupConfiguration cfg = new MutableStartupConfiguration();
+        cfg.setShutdownHookEnabled( false );
         cfg.setWorkingDirectory( new File( "target" + File.separator + "server" ) );
 
         Hashtable<String,Object> env = new Hashtable<String,Object>( cfg.toJndiEnvironment() );
@@ -272,6 +276,7 @@
     public void testModify() throws NamingException
     {
         MutableStartupConfiguration cfg = new MutableStartupConfiguration();
+        cfg.setShutdownHookEnabled( false );
         cfg.setWorkingDirectory( new File( "target" + File.separator + "server" ) );
 
         Hashtable<String,Object> env = new Hashtable<String,Object>( cfg.toJndiEnvironment() );
@@ -308,6 +313,7 @@
     public void testModify2() throws NamingException
     {
         MutableStartupConfiguration cfg = new MutableStartupConfiguration();
+        cfg.setShutdownHookEnabled( false );
         cfg.setWorkingDirectory( new File( "target" + File.separator + "server" ) );
 
         Hashtable<String,Object> env = new Hashtable<String,Object>( cfg.toJndiEnvironment() );

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=580674&r1=580673&r2=580674&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java Sat Sep 29 21:19:12 2007
@@ -278,7 +278,7 @@
     {
         if ( !started )
         {
-            throw new IllegalStateException( "Attempt to shutdown server before it has started!" );
+            return;
         }
 
         serviceListener.beforeShutdown( this );

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java?rev=580674&r1=580673&r2=580674&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java Sat Sep 29 21:19:12 2007
@@ -20,30 +20,8 @@
 package org.apache.directory.server.core.partition.impl.btree;
 
 
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
-
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
-import org.apache.directory.server.core.configuration.PartitionConfiguration;
 import org.apache.directory.server.core.enumeration.SearchResultEnumeration;
-import org.apache.directory.server.core.interceptor.context.AddOperationContext;
-import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
-import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
-import org.apache.directory.server.core.interceptor.context.ListOperationContext;
-import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
-import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
-import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
+import org.apache.directory.server.core.interceptor.context.*;
 import org.apache.directory.server.core.partition.Oid;
 import org.apache.directory.server.core.partition.Partition;
 import org.apache.directory.server.core.partition.impl.btree.gui.PartitionViewer;
@@ -54,9 +32,17 @@
 import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.schema.AttributeType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.SearchControls;
+import javax.naming.directory.SearchResult;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
 
 
 /**
@@ -67,15 +53,28 @@
  */
 public abstract class BTreePartition implements Partition
 {
-    private static final Logger log = LoggerFactory.getLogger( BTreePartition.class );
+    protected final static Set<String> SYS_INDEX_OIDS;
+
+    static
+    {
+        Set<String> set = new HashSet<String>();
+        set.add( Oid.ALIAS );
+        set.add( Oid.EXISTANCE );
+        set.add( Oid.HIERARCHY );
+        set.add( Oid.NDN );
+        set.add( Oid.ONEALIAS );
+        set.add( Oid.SUBALIAS );
+        set.add( Oid.UPDN );
+        SYS_INDEX_OIDS = Collections.unmodifiableSet( set );
+    }
 
     /** the search engine used to search the database */
-    private SearchEngine searchEngine = null;
-    private Optimizer optimizer;
-    private BTreePartitionConfiguration cfg;
+    protected SearchEngine searchEngine;
+    protected Optimizer optimizer;
+    protected BTreePartitionConfiguration cfg;
     
-    protected AttributeTypeRegistry attributeTypeRegistry = null;
-    protected OidRegistry oidRegistry = null;
+    protected AttributeTypeRegistry attributeTypeRegistry;
+    protected OidRegistry oidRegistry;
 
 
     // ------------------------------------------------------------------------
@@ -110,289 +109,9 @@
      * 
      * @param registries the schema entity registries
      */
-    public void initRegistries( Registries registries )
-    {
-        initRegistries1( registries );
-    }
-    
-    
-    /**
-     * This should be called second after initializing the optimizer with 
-     * initOptimizer0.  This is the same as calling initRegistries() 
-     * (initRegistries actually calls initRegistries1) except it is protected 
-     * to hide the '1' at the end of the method name.  The '1' indicates it 
-     * is the 2nd thing that must be executed during initialization.
-     * 
-     * @param registries the schema entity registries
-     */
-    protected void initRegistries1( Registries registries )
-    {
-        attributeTypeRegistry = registries.getAttributeTypeRegistry();
-        oidRegistry = registries.getOidRegistry();
-        ExpressionEvaluator evaluator = new ExpressionEvaluator( this, oidRegistry, attributeTypeRegistry );
-        ExpressionEnumerator enumerator = new ExpressionEnumerator( this, attributeTypeRegistry, evaluator );
-        this.searchEngine = new DefaultSearchEngine( this, evaluator, enumerator, optimizer );
-    }
-    
-    
-    /**
-     * Use this method to initialize the indices.  Only call this after
-     * the registries and the optimizer have been enabled.  The '2' at the end
-     * shows this is the 3rd init method called in the init sequence.
-     * 
-     * @param indices
-     * @throws NamingException
-     */
-    protected void initIndices2( Set<Index> indices ) throws NamingException
-    {
-        Set<String> sysOidSet = new HashSet<String>();
-        sysOidSet.add( Oid.EXISTANCE );
-        sysOidSet.add( Oid.HIERARCHY );
-        sysOidSet.add( Oid.UPDN );
-        sysOidSet.add( Oid.NDN );
-        sysOidSet.add( Oid.ONEALIAS );
-        sysOidSet.add( Oid.SUBALIAS );
-        sysOidSet.add( Oid.ALIAS );
-
-        // Used to calculate the system indices we must automatically add
-        Set<String> customAddedSystemIndices = new HashSet<String>();
-        
-        for ( Iterator ii = indices.iterator(); ii.hasNext(); /**/ )
-        {
-            /*
-             * NOTE
-             * ====
-             * 
-             * The object returned by the indexedAttributes property
-             * of the configuration may include just a simple set of <String> 
-             * names for the attributes being index OR may include a set 
-             * of IndexConfiguration objects.
-             * 
-             * If the objects are strings extra information about the
-             * cacheSize of an index is not available and so the default is
-             * used.  If an IndexConfiguration is available then the custom
-             * cacheSize is used.
-             */
-            
-            Object nextObject = ii.next();
-            String name = null;
-            int cacheSize = IndexConfiguration.DEFAULT_INDEX_CACHE_SIZE;
-            int numDupLimit = IndexConfiguration.DEFAULT_DUPLICATE_LIMIT;
-            
-            // no custom cacheSize info is available so default sticks
-            if ( nextObject instanceof String ) 
-            {
-                name = ( String ) nextObject;
-                log.warn( "Using default cache size of {} for index on attribute {}", 
-                    new Integer( cacheSize ), name );
-            }
-            // custom cache size is used
-            else if ( nextObject instanceof IndexConfiguration )
-            {
-                IndexConfiguration indexConfiguration = ( IndexConfiguration ) nextObject;
-                name = indexConfiguration.getAttributeId();
-                cacheSize = indexConfiguration.getCacheSize();
-                numDupLimit = indexConfiguration.getDuplicateLimit();
-                
-                if ( cacheSize <= 0 ) 
-                {
-                    log.warn( "Cache size {} for index on attribute is null or negative. Using default value.", 
-                        new Integer(cacheSize), name );
-                    cacheSize = IndexConfiguration.DEFAULT_INDEX_CACHE_SIZE;
-                }
-                else
-                {
-                    log.info( "Using cache size of {} for index on attribute {}", 
-                        new Integer( cacheSize ), name );
-                }
-                
-                if ( cacheSize <= 0 ) 
-                {
-                    log.warn( "Duplicate limit {} for index on attribute is null or negative. Using default value.", 
-                        new Integer(numDupLimit), name );
-                    cacheSize = IndexConfiguration.DEFAULT_INDEX_CACHE_SIZE;
-                }
-                else
-                {
-                    log.info( "Using duplicate limit of {} for index on attribute {}", 
-                        new Integer( numDupLimit ), name );
-                }
-            }
-            
-            String oid = oidRegistry.getOid( name );
-            AttributeType type = attributeTypeRegistry.lookup( oid );
-
-            // check if attribute is a system attribute
-            if ( sysOidSet.contains( oid ) )
-            {
-                if ( oid.equals( Oid.EXISTANCE ) )
-                {
-                    setExistanceIndexOn( type, cacheSize, numDupLimit );
-                    customAddedSystemIndices.add( Oid.EXISTANCE );
-                }
-                else if ( oid.equals( Oid.HIERARCHY ) )
-                {
-                    setHierarchyIndexOn( type, cacheSize, numDupLimit );
-                    customAddedSystemIndices.add( Oid.HIERARCHY );
-                }
-                else if ( oid.equals( Oid.UPDN ) )
-                {
-                    setUpdnIndexOn( type, cacheSize, numDupLimit );
-                    customAddedSystemIndices.add( Oid.UPDN );
-                }
-                else if ( oid.equals( Oid.NDN ) )
-                {
-                    setNdnIndexOn( type, cacheSize, numDupLimit );
-                    customAddedSystemIndices.add( Oid.NDN );
-                }
-                else if ( oid.equals( Oid.ONEALIAS ) )
-                {
-                    setOneAliasIndexOn( type, cacheSize, numDupLimit );
-                    customAddedSystemIndices.add( Oid.ONEALIAS );
-                }
-                else if ( oid.equals( Oid.SUBALIAS ) )
-                {
-                    setSubAliasIndexOn( type, cacheSize, numDupLimit );
-                    customAddedSystemIndices.add( Oid.SUBALIAS);
-                }
-                else if ( oid.equals( Oid.ALIAS ) )
-                {
-                    setAliasIndexOn( type, cacheSize, numDupLimit );
-                    customAddedSystemIndices.add( Oid.ALIAS );
-                }
-                else
-                {
-                    throw new NamingException( "Unidentified system index " + oid );
-                }
-            }
-            else
-            {
-                addIndexOn( type, cacheSize, numDupLimit );
-            }
-        }
-        
-        // -------------------------------------------------------------------
-        // Add all system indices that were not custom configured by iterating
-        // through all system index oids and checking of that index is 
-        // contained within the customAddedSystemIndices set.  If it is not
-        // contained in this set then the system index was not custom 
-        // configured above and must be configured with defaults below.
-        // -------------------------------------------------------------------
-        
-        for ( Iterator ii = sysOidSet.iterator(); ii.hasNext(); /**/ )
-        {
-            String systemIndexName = ( String ) ii.next();
-            if ( ! customAddedSystemIndices.contains( systemIndexName ) )
-            {
-                AttributeType type = attributeTypeRegistry.lookup( systemIndexName );
-                log.warn( "Using default cache size of {} for index on attribute {}", 
-                    new Integer( IndexConfiguration.DEFAULT_INDEX_CACHE_SIZE ), systemIndexName );
-                if ( systemIndexName.equals( Oid.EXISTANCE ) )
-                {
-                    setExistanceIndexOn( type, IndexConfiguration.DEFAULT_INDEX_CACHE_SIZE, 
-                        IndexConfiguration.DEFAULT_DUPLICATE_LIMIT );
-                }
-                else if ( systemIndexName.equals( Oid.HIERARCHY ) )
-                {
-                    setHierarchyIndexOn( type, IndexConfiguration.DEFAULT_INDEX_CACHE_SIZE,
-                        IndexConfiguration.DEFAULT_DUPLICATE_LIMIT );
-                }
-                else if ( systemIndexName.equals( Oid.UPDN ) )
-                {
-                    setUpdnIndexOn( type, IndexConfiguration.DEFAULT_INDEX_CACHE_SIZE,
-                        IndexConfiguration.DEFAULT_DUPLICATE_LIMIT );
-                }
-                else if ( systemIndexName.equals( Oid.NDN ) )
-                {
-                    setNdnIndexOn( type, IndexConfiguration.DEFAULT_INDEX_CACHE_SIZE,
-                        IndexConfiguration.DEFAULT_DUPLICATE_LIMIT );
-                }
-                else if ( systemIndexName.equals( Oid.ONEALIAS ) )
-                {
-                    setOneAliasIndexOn( type, IndexConfiguration.DEFAULT_INDEX_CACHE_SIZE,
-                        IndexConfiguration.DEFAULT_DUPLICATE_LIMIT );
-                }
-                else if ( systemIndexName.equals( Oid.SUBALIAS ) )
-                {
-                    setSubAliasIndexOn( type, IndexConfiguration.DEFAULT_INDEX_CACHE_SIZE,
-                        IndexConfiguration.DEFAULT_DUPLICATE_LIMIT );
-                }
-                else if ( systemIndexName.equals( Oid.ALIAS ) )
-                {
-                    setAliasIndexOn( type, IndexConfiguration.DEFAULT_INDEX_CACHE_SIZE,
-                        IndexConfiguration.DEFAULT_DUPLICATE_LIMIT );
-                }
-                else
-                {
-                    throw new NamingException( "Unidentified system index " + systemIndexName );
-                }
-            }
-        }
-    }
+    public abstract void setRegistries( Registries registries );
 
     
-    /**
-     * Called last (4th) to check if the suffix entry has been created on disk,
-     * and if not it is created.
-     *  
-     * @param suffix
-     * @param entry
-     * @throws NamingException
-     */
-    protected void initSuffixEntry3( String suffix, Attributes entry ) throws NamingException
-    {
-        // add entry for context, if it does not exist
-        Attributes suffixOnDisk = getSuffixEntry();
-        if ( suffixOnDisk == null )
-        {
-            LdapDN dn = new LdapDN( suffix );
-            LdapDN normalizedSuffix = LdapDN.normalize( dn, attributeTypeRegistry.getNormalizerMapping() );
-            add( new AddOperationContext( normalizedSuffix, entry ) );
-        }
-    }
-
-    
-    /**
-     * Call this first in the init sequence to initialize the optimizer.
-     * 
-     * @param cfg
-     */
-    protected void initOptimizerAndConfiguration0( PartitionConfiguration cfg ) throws NamingException
-    {
-        if ( cfg instanceof BTreePartitionConfiguration )
-        {
-            this.cfg = ( BTreePartitionConfiguration ) cfg;
-            if ( ! this.cfg.isOptimizerEnabled() )
-            {
-                optimizer = new NoOpOptimizer();
-            }
-            else
-            {
-                optimizer = new DefaultOptimizer( this );
-            }
-        }
-        else
-        {
-            this.cfg = BTreePartitionConfiguration.convert( cfg );
-            optimizer = new DefaultOptimizer( this );
-        }
-    }
-
-    
-    public void init( DirectoryServiceConfiguration factoryCfg, PartitionConfiguration cfg )
-        throws NamingException
-    {
-        initOptimizerAndConfiguration0( cfg );
-        initRegistries1( factoryCfg.getRegistries() );
-        if ( cfg instanceof BTreePartitionConfiguration )
-        {
-            BTreePartitionConfiguration btpconf = ( BTreePartitionConfiguration ) cfg;
-            initIndices2( btpconf.getIndexedAttributes() );
-        }
-        initSuffixEntry3( cfg.getSuffix(), cfg.getContextEntry() );
-    }
-
-
     // ------------------------------------------------------------------------
     // Public Accessors - not declared in any interfaces just for this class
     // ------------------------------------------------------------------------
@@ -444,8 +163,9 @@
 
 
     private static final String[] ENTRY_DELETED_ATTRS = new String[] { "entrydeleted" };
-    
-    public NamingEnumeration list( ListOperationContext opContext ) throws NamingException
+
+
+    public NamingEnumeration<SearchResult> list( ListOperationContext opContext ) throws NamingException
     {
         SearchResultEnumeration list;
         list = new BTreeSearchResultEnumeration( ENTRY_DELETED_ATTRS, list( getEntryId( opContext.getDn().getNormName() ) ),
@@ -459,7 +179,7 @@
     {
         SearchControls searchCtls = opContext.getSearchControls();
         String[] attrIds = searchCtls.getReturningAttributes();
-        NamingEnumeration underlying = null;
+        NamingEnumeration underlying;
 
         underlying = searchEngine.search( 
             opContext.getDn(), 
@@ -535,7 +255,7 @@
     // Index Operations 
     // ------------------------------------------------------------------------
 
-    public abstract void addIndexOn( AttributeType attribute, int cacheSize, int numDupLimit ) throws NamingException;
+    public abstract void addIndexOn( Index index ) throws NamingException;
 
 
     public abstract boolean hasUserIndexOn( String attribute ) throws NamingException;
@@ -607,41 +327,46 @@
      * Sets the system index defined on the ALIAS_ATTRIBUTE which for LDAP would
      * be the aliasedObjectName and for X.500 would be aliasedEntryName.
      * 
-     * @param attrType the index on the ALIAS_ATTRIBUTE
+     * @param index the index on the ALIAS_ATTRIBUTE
+     * @throws NamingException if there is a problem setting up the index
      */
-    public abstract void setAliasIndexOn( AttributeType attrType, int cacheSize, int numDupLimit ) throws NamingException;
+    public abstract void setAliasIndexOn( Index index ) throws NamingException;
 
 
     /**
      * Sets the attribute existance Index.
      *
-     * @param attrType the attribute existance Index
+     * @param index the attribute existance Index
+     * @throws NamingException if there is a problem setting up the index
      */
-    public abstract void setExistanceIndexOn( AttributeType attrType, int cacheSize, int numDupLimit ) throws NamingException;
+    public abstract void setExistanceIndexOn( Index index ) throws NamingException;
 
 
     /**
      * Sets the hierarchy Index.
      *
-     * @param attrType the hierarchy Index
+     * @param index the hierarchy Index
+     * @throws NamingException if there is a problem setting up the index
      */
-    public abstract void setHierarchyIndexOn( AttributeType attrType, int cacheSize, int numDupLimit ) throws NamingException;
+    public abstract void setHierarchyIndexOn( Index index ) throws NamingException;
 
 
     /**
      * Sets the user provided distinguished name Index.
      *
-     * @param attrType the updn Index
+     * @param index the updn Index
+     * @throws NamingException if there is a problem setting up the index
      */
-    public abstract void setUpdnIndexOn( AttributeType attrType, int cacheSize, int numDupLimit ) throws NamingException;
+    public abstract void setUpdnIndexOn( Index index ) throws NamingException;
 
 
     /**
      * Sets the normalized distinguished name Index.
      *
-     * @param attrType the ndn Index
+     * @param index the ndn Index
+     * @throws NamingException if there is a problem setting up the index
      */
-    public abstract void setNdnIndexOn( AttributeType attrType, int cacheSize, int numDupLimit ) throws NamingException;
+    public abstract void setNdnIndexOn( Index index ) throws NamingException;
 
 
     /**
@@ -649,9 +374,10 @@
      * children one level below them; this system index is used to dereference
      * aliases on one/single level scoped searches.
      * 
-     * @param attrType a one level alias index
+     * @param index a one level alias index
+     * @throws NamingException if there is a problem setting up the index
      */
-    public abstract void setOneAliasIndexOn( AttributeType attrType, int cacheSize, int numDupLimit ) throws NamingException;
+    public abstract void setOneAliasIndexOn( Index index ) throws NamingException;
 
 
     /**
@@ -659,9 +385,10 @@
      * alias descendents; this system index is used to dereference aliases on 
      * subtree scoped searches.
      * 
-     * @param attrType a subtree alias index
+     * @param index a subtree alias index
+     * @throws NamingException if there is a problem setting up the index
      */
-    public abstract void setSubAliasIndexOn( AttributeType attrType, int cacheSize, int numDupLimit ) throws NamingException;
+    public abstract void setSubAliasIndexOn( Index index ) throws NamingException;
 
 
     public abstract Index getUserIndex( String attribute ) throws IndexNotFoundException;
@@ -708,7 +435,7 @@
     public abstract void delete( Long id ) throws NamingException;
 
 
-    public abstract NamingEnumeration list( Long id ) throws NamingException;
+    public abstract NamingEnumeration<IndexRecord> list( Long id ) throws NamingException;
 
 
     public abstract int getChildCount( Long id ) throws NamingException;

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/MutableBTreePartitionConfiguration.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/MutableBTreePartitionConfiguration.java?rev=580674&r1=580673&r2=580674&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/MutableBTreePartitionConfiguration.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/MutableBTreePartitionConfiguration.java Sat Sep 29 21:19:12 2007
@@ -50,8 +50,6 @@
     }
 
     /**
-     * @org.apache.xbean.Property nestedType="org.apache.directory.server.core.partition.impl.btree.MutableIndexConfiguration"
-     *
      * @param indexedAttributes
      */
     public void setIndexedAttributes( Set<? extends Index> indexedAttributes )

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java?rev=580674&r1=580673&r2=580674&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java Sat Sep 29 21:19:12 2007
@@ -23,13 +23,13 @@
 import org.apache.directory.server.core.DirectoryServiceConfiguration;
 import org.apache.directory.server.core.configuration.PartitionConfiguration;
 import org.apache.directory.server.core.interceptor.context.*;
+import org.apache.directory.server.core.partition.Oid;
 import org.apache.directory.server.core.partition.Partition;
 import org.apache.directory.server.core.partition.impl.btree.*;
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.exception.LdapAuthenticationNotSupportedException;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.schema.AttributeType;
 
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
@@ -52,10 +52,12 @@
 {
     private JdbmStore store;
 
+
     // ------------------------------------------------------------------------
     // C O N S T R U C T O R S
     // ------------------------------------------------------------------------
 
+
     /**
      * Creates a store based on JDBM B+Trees.
      */
@@ -64,20 +66,46 @@
         store = new JdbmStore();
     }
 
-    
-    protected void initRegistries1( Registries registries ) 
+
+    public void setRegistries( Registries registries )
     {
-        super.initRegistries1( registries );
+        initRegistries( registries );
+    }
+
+
+    protected void initRegistries( Registries registries )
+    {
+        attributeTypeRegistry = registries.getAttributeTypeRegistry();
+        oidRegistry = registries.getOidRegistry();
+        ExpressionEvaluator evaluator = new ExpressionEvaluator( this, oidRegistry, attributeTypeRegistry );
+        ExpressionEnumerator enumerator = new ExpressionEnumerator( this, attributeTypeRegistry, evaluator );
+        this.searchEngine = new DefaultSearchEngine( this, evaluator, enumerator, optimizer );
         store.initRegistries( registries );
     }
-    
+
 
     public final void init( DirectoryServiceConfiguration factoryCfg, PartitionConfiguration cfg )
         throws NamingException
     {
         // setup optimizer and registries for parent
-        initOptimizerAndConfiguration0( cfg );
-        initRegistries1( factoryCfg.getRegistries() );
+        if ( cfg instanceof BTreePartitionConfiguration )
+        {
+            this.cfg = ( BTreePartitionConfiguration ) cfg;
+            if ( ! this.cfg.isOptimizerEnabled() )
+            {
+                optimizer = new NoOpOptimizer();
+            }
+            else
+            {
+                optimizer = new DefaultOptimizer( this );
+            }
+        }
+        else
+        {
+            this.cfg = BTreePartitionConfiguration.convert( cfg );
+            optimizer = new DefaultOptimizer( this );
+        }
+        initRegistries( factoryCfg.getRegistries() );
         
         // initialize the store
         store.setCacheSize( cfg.getCacheSize() );
@@ -108,7 +136,46 @@
                     index.setWkDirPath( obj.getWkDirPath() );
                 }
 
-                userIndices.add( index );
+                String oid = oidRegistry.getOid( index.getAttributeId() );
+                if ( SYS_INDEX_OIDS.contains( oidRegistry.getOid( index.getAttributeId() ) ) )
+                {
+                    if ( oid.equals( Oid.ALIAS ) )
+                    {
+                        store.setAliasIndex( index );
+                    }
+                    else if ( oid.equals( Oid.EXISTANCE ) )
+                    {
+                        store.setExistanceIndex( index );
+                    }
+                    else if ( oid.equals( Oid.HIERARCHY ) )
+                    {
+                        store.setHierarchyIndex( index );
+                    }
+                    else if ( oid.equals( Oid.NDN ) )
+                    {
+                        store.setNdnIndex( index );
+                    }
+                    else if ( oid.equals( Oid.ONEALIAS ) )
+                    {
+                        store.setOneAliasIndex( index );
+                    }
+                    else if ( oid.equals( Oid.SUBALIAS ) )
+                    {
+                        store.setSubAliasIndex( index );
+                    }
+                    else if ( oid.equals( Oid.UPDN ) )
+                    {
+                        store.setUpdnIndex( index );
+                    }
+                    else
+                    {
+                        throw new IllegalStateException( "Unrecognized system index " + oid );
+                    }
+                }
+                else
+                {
+                    userIndices.add( index );
+                }
             }
             store.setUserIndices( userIndices );
             store.setSyncOnWrite( ( ( BTreePartitionConfiguration ) cfg ).isSynchOnWrite() );
@@ -141,13 +208,13 @@
     // I N D E X   M E T H O D S
     // ------------------------------------------------------------------------
 
-    public final void addIndexOn( AttributeType spec, int cacheSize, int numDupLimit ) throws NamingException
+
+    public final void addIndexOn( Index index ) throws NamingException
     {
-        JdbmIndex index = new JdbmIndex();
-        index.setAttributeId( spec.getName() );
-        index.setCacheSize( cacheSize );
-        index.setNumDupLimit( numDupLimit );
-        store.addIndex( index );
+        if ( index instanceof JdbmIndex)
+        {
+            store.addIndex( ( JdbmIndex ) index );
+        }
     }
 
 
@@ -157,13 +224,12 @@
     }
 
 
-    public final void setExistanceIndexOn( AttributeType attrType, int cacheSize, int numDupLimit ) throws NamingException
+    public final void setExistanceIndexOn( Index index ) throws NamingException
     {
-        JdbmIndex index = new JdbmIndex();
-        index.setAttributeId( attrType.getName() );
-        index.setCacheSize( cacheSize );
-        index.setNumDupLimit( numDupLimit );
-        store.setExistanceIndex( index );
+        if ( index instanceof JdbmIndex )
+        {
+            store.setExistanceIndex( ( JdbmIndex ) index );
+        }
     }
 
 
@@ -173,13 +239,12 @@
     }
 
 
-    public final void setHierarchyIndexOn( AttributeType attrType, int cacheSize, int numDupLimit ) throws NamingException
+    public final void setHierarchyIndexOn( Index index ) throws NamingException
     {
-        JdbmIndex index = new JdbmIndex();
-        index.setAttributeId( attrType.getName() );
-        index.setCacheSize( cacheSize );
-        index.setNumDupLimit( numDupLimit );
-        store.setHierarchyIndex( index );
+        if ( index instanceof JdbmIndex )
+        {
+            store.setHierarchyIndex( ( JdbmIndex ) index );
+        }
     }
 
 
@@ -189,13 +254,12 @@
     }
 
 
-    public final void setAliasIndexOn( AttributeType attrType, int cacheSize, int numDupLimit ) throws NamingException
+    public final void setAliasIndexOn( Index index ) throws NamingException
     {
-        JdbmIndex index = new JdbmIndex();
-        index.setAttributeId( attrType.getName() );
-        index.setCacheSize( cacheSize );
-        index.setNumDupLimit( numDupLimit );
-        store.setAliasIndex( index );
+        if ( index instanceof JdbmIndex )
+        {
+            store.setAliasIndex( ( JdbmIndex ) index );
+        }
     }
 
 
@@ -205,13 +269,12 @@
     }
 
 
-    public final void setOneAliasIndexOn( AttributeType attrType, int cacheSize, int numDupLimit ) throws NamingException
+    public final void setOneAliasIndexOn( Index index ) throws NamingException
     {
-        JdbmIndex index = new JdbmIndex();
-        index.setAttributeId( attrType.getName() );
-        index.setCacheSize( cacheSize );
-        index.setNumDupLimit( numDupLimit );
-        store.setOneAliasIndex( index );
+        if ( index instanceof JdbmIndex )
+        {
+            store.setOneAliasIndex( ( JdbmIndex ) index );
+        }
     }
 
 
@@ -221,13 +284,12 @@
     }
 
 
-    public final void setSubAliasIndexOn( AttributeType attrType, int cacheSize, int numDupLimit ) throws NamingException
+    public final void setSubAliasIndexOn( Index index ) throws NamingException
     {
-        JdbmIndex index = new JdbmIndex();
-        index.setAttributeId( attrType.getName() );
-        index.setCacheSize( cacheSize );
-        index.setNumDupLimit( numDupLimit );
-        store.setSubAliasIndex( index );
+        if ( index instanceof JdbmIndex )
+        {
+            store.setSubAliasIndex( ( JdbmIndex ) index );
+        }
     }
 
 
@@ -237,13 +299,12 @@
     }
 
 
-    public final void setUpdnIndexOn( AttributeType attrType, int cacheSize, int numDupLimit ) throws NamingException
+    public final void setUpdnIndexOn( Index index ) throws NamingException
     {
-        JdbmIndex index = new JdbmIndex();
-        index.setAttributeId( attrType.getName() );
-        index.setCacheSize( cacheSize );
-        index.setNumDupLimit( numDupLimit );
-        store.setUpdnIndex( index );
+        if ( index instanceof JdbmIndex )
+        {
+            store.setUpdnIndex( ( JdbmIndex ) index );
+        }
     }
 
 
@@ -253,13 +314,12 @@
     }
 
 
-    public final void setNdnIndexOn( AttributeType attrType, int cacheSize, int numDupLimit ) throws NamingException
+    public final void setNdnIndexOn( Index index ) throws NamingException
     {
-        JdbmIndex index = new JdbmIndex();
-        index.setAttributeId( attrType.getName() );
-        index.setCacheSize( cacheSize );
-        index.setNumDupLimit( numDupLimit );
-        store.setNdnIndex( index );
+        if ( index instanceof JdbmIndex )
+        {
+            store.setNdnIndex( ( JdbmIndex ) index );
+        }
     }
 
 
@@ -438,12 +498,17 @@
 
     public final void bind( LdapDN bindDn, byte[] credentials, List mechanisms, String saslAuthId ) throws NamingException
     {
+        if ( bindDn == null || credentials == null || mechanisms == null ||  saslAuthId == null )
+        {
+            // do nothing just using variables to prevent yellow lights : bad :)
+        }
         // does nothing
         throw new LdapAuthenticationNotSupportedException(
                 "Bind requests only tunnel down into partitions if there are no authenticators to handle the mechanism.\n"
                         + "Check to see if you have correctly configured authenticators for the server.",
                 ResultCodeEnum.AUTH_METHOD_NOT_SUPPORTED );
     }
+    
 
     public final void bind( BindOperationContext bindContext ) throws NamingException
     {

Modified: directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java?rev=580674&r1=580673&r2=580674&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java (original)
+++ directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java Sat Sep 29 21:19:12 2007
@@ -50,8 +50,6 @@
  */
 public class JdbmIndex implements Index
 {
-    /** default cache size to use */
-    public static final int DEFAULT_INDEX_CACHE_SIZE = 100;
     /**
      * default duplicate limit before duplicate keys switch to using a btree for values
      */

Modified: directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java?rev=580674&r1=580673&r2=580674&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java (original)
+++ directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java Sat Sep 29 21:19:12 2007
@@ -65,7 +65,7 @@
     /** */
     private TupleRenderer renderer;
 
-    private int numDupLimit = IndexConfiguration.DEFAULT_DUPLICATE_LIMIT;
+    private int numDupLimit = JdbmIndex.DEFAULT_DUPLICATE_LIMIT;
 
     private Map<Long, BTree> duplicateBtrees = new HashMap<Long, BTree>();
     

Modified: directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/NegationOperatorITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/NegationOperatorITest.java?rev=580674&r1=580673&r2=580674&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/NegationOperatorITest.java (original)
+++ directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/NegationOperatorITest.java Sat Sep 29 21:19:12 2007
@@ -77,13 +77,6 @@
     
             // Add indexed attributes for system partition
             Set<Index> indexedAttrs = new HashSet<Index>();
-            indexedAttrs.add( new JdbmIndex( Oid.ALIAS ) );
-            indexedAttrs.add( new JdbmIndex( Oid.EXISTANCE ) );
-            indexedAttrs.add( new JdbmIndex( Oid.HIERARCHY ) );
-            indexedAttrs.add( new JdbmIndex( Oid.NDN ) );
-            indexedAttrs.add( new JdbmIndex( Oid.ONEALIAS ) );
-            indexedAttrs.add( new JdbmIndex( Oid.SUBALIAS ) );
-            indexedAttrs.add( new JdbmIndex( Oid.UPDN ) );
             indexedAttrs.add( new JdbmIndex( SchemaConstants.OBJECT_CLASS_AT ) );
             indexedAttrs.add( new JdbmIndex( SchemaConstants.OU_AT ) );
             systemCfg.setIndexedAttributes( indexedAttrs );