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 2006/07/07 19:56:06 UTC

svn commit: r419940 - in /directory/branches/apacheds/optimization: core/src/main/java/org/apache/directory/server/core/authz/ core/src/main/java/org/apache/directory/server/core/configuration/ core/src/main/java/org/apache/directory/server/core/partit...

Author: akarasulu
Date: Fri Jul  7 10:56:05 2006
New Revision: 419940

URL: http://svn.apache.org/viewvc?rev=419940&view=rev
Log:
Adding feature to be able to configure the cache size on indices in 
btree based partition implementations.


Added:
    directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexConfiguration.java
    directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/MutableIndexConfiguration.java
Modified:
    directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationService.java
    directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/configuration/DirectoryPartitionConfiguration.java
    directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreeDirectoryPartition.java
    directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmDirectoryPartition.java
    directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
    directory/branches/apacheds/optimization/server-installers/pom.xml
    directory/branches/apacheds/optimization/server-installers/src/main/installers/server.xml
    directory/branches/apacheds/optimization/server-main/server.xml
    directory/branches/apacheds/optimization/server-tools/src/main/java/org/apache/directory/server/tools/DumpCommand.java

Modified: directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationService.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationService.java?rev=419940&r1=419939&r2=419940&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationService.java (original)
+++ directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationService.java Fri Jul  7 10:56:05 2006
@@ -40,7 +40,6 @@
 import org.apache.directory.server.core.invocation.InvocationStack;
 import org.apache.directory.server.core.jndi.ServerContext;
 import org.apache.directory.server.core.partition.DirectoryPartitionNexus;
-import org.apache.directory.server.core.schema.AttributeTypeRegistry;
 import org.apache.directory.shared.ldap.exception.LdapNoPermissionException;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.name.LdapDN;

Modified: directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/configuration/DirectoryPartitionConfiguration.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/configuration/DirectoryPartitionConfiguration.java?rev=419940&r1=419939&r2=419940&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/configuration/DirectoryPartitionConfiguration.java (original)
+++ directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/configuration/DirectoryPartitionConfiguration.java Fri Jul  7 10:56:05 2006
@@ -20,7 +20,6 @@
 
 
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Set;
 
 import javax.naming.Name;
@@ -29,7 +28,6 @@
 import javax.naming.directory.BasicAttributes;
 
 import org.apache.directory.server.core.partition.DirectoryPartition;
-import org.apache.directory.server.core.partition.Oid;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmDirectoryPartition;
 import org.apache.directory.server.core.schema.MatchingRuleRegistry;
 import org.apache.directory.shared.ldap.exception.LdapConfigurationException;
@@ -50,7 +48,7 @@
 
     private String name;
     private String suffix;
-    private Set indexedAttributes; // Set<String>
+    private Set indexedAttributes; // Set<String> or <IndexConfiguration>
     private Attributes contextEntry = new BasicAttributes( true );
     private DirectoryPartition contextPartition = new JdbmDirectoryPartition();
 
@@ -80,7 +78,6 @@
      */
     protected void setName( String name )
     {
-        // TODO name can be a directory name.
         name = name.trim();
         this.name = name;
     }
@@ -100,26 +97,7 @@
      */
     protected void setIndexedAttributes( Set indexedAttributes )
     {
-        Set newIndexedAttributes = ConfigurationUtil.getTypeSafeSet( indexedAttributes, String.class );
-
-        Iterator i = newIndexedAttributes.iterator();
-        while ( i.hasNext() )
-        {
-            String attribute = ( String ) i.next();
-            // TODO Attribute name must be normalized and validated
-            newIndexedAttributes.add( attribute );
-        }
-
-        // Add default indices
-        newIndexedAttributes.add( Oid.ALIAS );
-        newIndexedAttributes.add( Oid.EXISTANCE );
-        newIndexedAttributes.add( Oid.HIERARCHY );
-        newIndexedAttributes.add( Oid.NDN );
-        newIndexedAttributes.add( Oid.ONEALIAS );
-        newIndexedAttributes.add( Oid.SUBALIAS );
-        newIndexedAttributes.add( Oid.UPDN );
-
-        this.indexedAttributes = newIndexedAttributes;
+        this.indexedAttributes = indexedAttributes;
     }
 
 

Modified: directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreeDirectoryPartition.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreeDirectoryPartition.java?rev=419940&r1=419939&r2=419940&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreeDirectoryPartition.java (original)
+++ directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreeDirectoryPartition.java Fri Jul  7 10:56:05 2006
@@ -45,6 +45,9 @@
 import org.apache.directory.shared.ldap.util.ArrayUtils;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 
 /**
  * An abstract {@link DirectoryPartition} that uses general BTree operations.
@@ -54,6 +57,8 @@
  */
 public abstract class BTreeDirectoryPartition implements DirectoryPartition
 {
+    private static final Logger log = LoggerFactory.getLogger( BTreeDirectoryPartition.class );
+
     /** ===================================================================
 
      The following OID branch is reserved for the directory TLP once it
@@ -128,10 +133,47 @@
         sysOidSet.add( Oid.SUBALIAS );
         sysOidSet.add( Oid.ALIAS );
 
-        Iterator i = cfg.getIndexedAttributes().iterator();
-        while ( i.hasNext() )
+        // Used to calculate the system indices we must automatically add
+        HashSet customAddedSystemIndices = new HashSet();
+        
+        for ( Iterator ii = cfg.getIndexedAttributes().iterator(); ii.hasNext(); /**/ )
         {
-            String name = ( String ) i.next();
+            /*
+             * 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;
+            
+            // 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();
+                log.info( "Using cache size of {} for index on attribute {}", 
+                    new Integer( cacheSize ), name );
+            }
+            
             String oid = oidRegistry.getOid( name );
             AttributeType type = attributeTypeRegistry.lookup( oid );
 
@@ -140,31 +182,38 @@
             {
                 if ( oid.equals( Oid.EXISTANCE ) )
                 {
-                    setExistanceIndexOn( type );
+                    setExistanceIndexOn( type, cacheSize );
+                    customAddedSystemIndices.add( Oid.EXISTANCE );
                 }
                 else if ( oid.equals( Oid.HIERARCHY ) )
                 {
-                    setHierarchyIndexOn( type );
+                    setHierarchyIndexOn( type, cacheSize );
+                    customAddedSystemIndices.add( Oid.HIERARCHY );
                 }
                 else if ( oid.equals( Oid.UPDN ) )
                 {
-                    setUpdnIndexOn( type );
+                    setUpdnIndexOn( type, cacheSize );
+                    customAddedSystemIndices.add( Oid.UPDN );
                 }
                 else if ( oid.equals( Oid.NDN ) )
                 {
-                    setNdnIndexOn( type );
+                    setNdnIndexOn( type, cacheSize );
+                    customAddedSystemIndices.add( Oid.NDN );
                 }
                 else if ( oid.equals( Oid.ONEALIAS ) )
                 {
-                    setOneAliasIndexOn( type );
+                    setOneAliasIndexOn( type, cacheSize );
+                    customAddedSystemIndices.add( Oid.ONEALIAS );
                 }
                 else if ( oid.equals( Oid.SUBALIAS ) )
                 {
-                    setSubAliasIndexOn( type );
+                    setSubAliasIndexOn( type, cacheSize );
+                    customAddedSystemIndices.add( Oid.SUBALIAS);
                 }
                 else if ( oid.equals( Oid.ALIAS ) )
                 {
-                    setAliasIndexOn( type );
+                    setAliasIndexOn( type, cacheSize );
+                    customAddedSystemIndices.add( Oid.ALIAS );
                 }
                 else
                 {
@@ -173,7 +222,58 @@
             }
             else
             {
-                addIndexOn( type );
+                addIndexOn( type, cacheSize );
+            }
+        }
+        
+        // -------------------------------------------------------------------
+        // 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 );
+                }
+                else if ( systemIndexName.equals( Oid.HIERARCHY ) )
+                {
+                    setHierarchyIndexOn( type, IndexConfiguration.DEFAULT_INDEX_CACHE_SIZE );
+                }
+                else if ( systemIndexName.equals( Oid.UPDN ) )
+                {
+                    setUpdnIndexOn( type, IndexConfiguration.DEFAULT_INDEX_CACHE_SIZE );
+                }
+                else if ( systemIndexName.equals( Oid.NDN ) )
+                {
+                    setNdnIndexOn( type, IndexConfiguration.DEFAULT_INDEX_CACHE_SIZE );
+                }
+                else if ( systemIndexName.equals( Oid.ONEALIAS ) )
+                {
+                    setOneAliasIndexOn( type, IndexConfiguration.DEFAULT_INDEX_CACHE_SIZE );
+                }
+                else if ( systemIndexName.equals( Oid.SUBALIAS ) )
+                {
+                    setSubAliasIndexOn( type, IndexConfiguration.DEFAULT_INDEX_CACHE_SIZE );
+                }
+                else if ( systemIndexName.equals( Oid.ALIAS ) )
+                {
+                    setAliasIndexOn( type, IndexConfiguration.DEFAULT_INDEX_CACHE_SIZE );
+                }
+                else
+                {
+                    throw new NamingException( "Unidentified system index " + systemIndexName );
+                }
             }
         }
 
@@ -335,7 +435,7 @@
     // Index Operations 
     // ------------------------------------------------------------------------
 
-    public abstract void addIndexOn( AttributeType attribute ) throws NamingException;
+    public abstract void addIndexOn( AttributeType attribute, int cacheSize ) throws NamingException;
 
 
     public abstract boolean hasUserIndexOn( String attribute ) throws NamingException;
@@ -409,7 +509,7 @@
      * 
      * @param attrType the index on the ALIAS_ATTRIBUTE
      */
-    public abstract void setAliasIndexOn( AttributeType attrType ) throws NamingException;
+    public abstract void setAliasIndexOn( AttributeType attrType, int cacheSize ) throws NamingException;
 
 
     /**
@@ -417,7 +517,7 @@
      *
      * @param attrType the attribute existance Index
      */
-    public abstract void setExistanceIndexOn( AttributeType attrType ) throws NamingException;
+    public abstract void setExistanceIndexOn( AttributeType attrType, int cacheSize ) throws NamingException;
 
 
     /**
@@ -425,7 +525,7 @@
      *
      * @param attrType the hierarchy Index
      */
-    public abstract void setHierarchyIndexOn( AttributeType attrType ) throws NamingException;
+    public abstract void setHierarchyIndexOn( AttributeType attrType, int cacheSize ) throws NamingException;
 
 
     /**
@@ -433,7 +533,7 @@
      *
      * @param attrType the updn Index
      */
-    public abstract void setUpdnIndexOn( AttributeType attrType ) throws NamingException;
+    public abstract void setUpdnIndexOn( AttributeType attrType, int cacheSize ) throws NamingException;
 
 
     /**
@@ -441,7 +541,7 @@
      *
      * @param attrType the ndn Index
      */
-    public abstract void setNdnIndexOn( AttributeType attrType ) throws NamingException;
+    public abstract void setNdnIndexOn( AttributeType attrType, int cacheSize ) throws NamingException;
 
 
     /**
@@ -451,7 +551,7 @@
      * 
      * @param attrType a one level alias index
      */
-    public abstract void setOneAliasIndexOn( AttributeType attrType ) throws NamingException;
+    public abstract void setOneAliasIndexOn( AttributeType attrType, int cacheSize ) throws NamingException;
 
 
     /**
@@ -461,7 +561,7 @@
      * 
      * @param attrType a subtree alias index
      */
-    public abstract void setSubAliasIndexOn( AttributeType attrType ) throws NamingException;
+    public abstract void setSubAliasIndexOn( AttributeType attrType, int cacheSize ) throws NamingException;
 
 
     public abstract Index getUserIndex( String attribute ) throws IndexNotFoundException;

Added: directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexConfiguration.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexConfiguration.java?rev=419940&view=auto
==============================================================================
--- directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexConfiguration.java (added)
+++ directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexConfiguration.java Fri Jul  7 10:56:05 2006
@@ -0,0 +1,56 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.directory.server.core.partition.impl.btree;
+
+
+/**
+ * An immutable configuration object for partition indices on entry attributes.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class IndexConfiguration
+{
+    public static final int DEFAULT_INDEX_CACHE_SIZE = 1000;
+    
+    private String attributeId;
+    private int cacheSize = DEFAULT_INDEX_CACHE_SIZE;
+    
+    
+    protected void setAttributeId( String attributeId )
+    {
+        this.attributeId = attributeId;
+    }
+    
+    
+    public String getAttributeId()
+    {
+        return attributeId;
+    }
+
+
+    protected void setCacheSize( int cacheSize )
+    {
+        this.cacheSize = cacheSize;
+    }
+
+
+    public int getCacheSize()
+    {
+        return cacheSize;
+    }
+}

Added: directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/MutableIndexConfiguration.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/MutableIndexConfiguration.java?rev=419940&view=auto
==============================================================================
--- directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/MutableIndexConfiguration.java (added)
+++ directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/MutableIndexConfiguration.java Fri Jul  7 10:56:05 2006
@@ -0,0 +1,38 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.directory.server.core.partition.impl.btree;
+
+
+/**
+ * A mutable version of {@link IndexConfiguration}.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class MutableIndexConfiguration extends IndexConfiguration
+{
+    public void setAttributeId( String attributeId )
+    {
+        super.setAttributeId( attributeId );
+    }
+    
+    
+    public void setCacheSize( int cacheSize )
+    {
+        super.setCacheSize( cacheSize );
+    }
+}

Modified: directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmDirectoryPartition.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmDirectoryPartition.java?rev=419940&r1=419939&r2=419940&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmDirectoryPartition.java (original)
+++ directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmDirectoryPartition.java Fri Jul  7 10:56:05 2006
@@ -297,9 +297,9 @@
     // I N D E X   M E T H O D S
     // ------------------------------------------------------------------------
 
-    public void addIndexOn( AttributeType spec ) throws NamingException
+    public void addIndexOn( AttributeType spec, int cacheSize ) throws NamingException
     {
-        Index idx = new JdbmIndex( spec, workingDirectory );
+        Index idx = new JdbmIndex( spec, workingDirectory, cacheSize );
         indices.put( spec.getOid(), idx );
     }
 
@@ -310,7 +310,7 @@
     }
 
 
-    public void setExistanceIndexOn( AttributeType attrType ) throws NamingException
+    public void setExistanceIndexOn( AttributeType attrType, int cacheSize ) throws NamingException
     {
         if ( existanceIdx != null )
         {
@@ -318,7 +318,7 @@
             throw e;
         }
 
-        existanceIdx = new JdbmIndex( attrType, workingDirectory );
+        existanceIdx = new JdbmIndex( attrType, workingDirectory, cacheSize );
         sysIndices.put( attrType.getOid(), existanceIdx );
     }
 
@@ -329,7 +329,7 @@
     }
 
 
-    public void setHierarchyIndexOn( AttributeType attrType ) throws NamingException
+    public void setHierarchyIndexOn( AttributeType attrType, int cacheSize ) throws NamingException
     {
         if ( hierarchyIdx != null )
         {
@@ -337,7 +337,7 @@
             throw e;
         }
 
-        hierarchyIdx = new JdbmIndex( attrType, workingDirectory );
+        hierarchyIdx = new JdbmIndex( attrType, workingDirectory, cacheSize );
         sysIndices.put( attrType.getOid(), hierarchyIdx );
     }
 
@@ -348,7 +348,7 @@
     }
 
 
-    public void setAliasIndexOn( AttributeType attrType ) throws NamingException
+    public void setAliasIndexOn( AttributeType attrType, int cacheSize ) throws NamingException
     {
         if ( aliasIdx != null )
         {
@@ -356,7 +356,7 @@
             throw e;
         }
 
-        aliasIdx = new JdbmIndex( attrType, workingDirectory );
+        aliasIdx = new JdbmIndex( attrType, workingDirectory, cacheSize );
         sysIndices.put( attrType.getOid(), aliasIdx );
     }
 
@@ -367,7 +367,7 @@
     }
 
 
-    public void setOneAliasIndexOn( AttributeType attrType ) throws NamingException
+    public void setOneAliasIndexOn( AttributeType attrType, int cacheSize ) throws NamingException
     {
         if ( oneAliasIdx != null )
         {
@@ -375,7 +375,7 @@
             throw e;
         }
 
-        oneAliasIdx = new JdbmIndex( attrType, workingDirectory );
+        oneAliasIdx = new JdbmIndex( attrType, workingDirectory, cacheSize );
         sysIndices.put( attrType.getOid(), oneAliasIdx );
     }
 
@@ -386,7 +386,7 @@
     }
 
 
-    public void setSubAliasIndexOn( AttributeType attrType ) throws NamingException
+    public void setSubAliasIndexOn( AttributeType attrType, int cacheSize ) throws NamingException
     {
         if ( subAliasIdx != null )
         {
@@ -394,7 +394,7 @@
             throw e;
         }
 
-        subAliasIdx = new JdbmIndex( attrType, workingDirectory );
+        subAliasIdx = new JdbmIndex( attrType, workingDirectory, cacheSize );
         sysIndices.put( attrType.getOid(), subAliasIdx );
     }
 
@@ -405,7 +405,7 @@
     }
 
 
-    public void setUpdnIndexOn( AttributeType attrType ) throws NamingException
+    public void setUpdnIndexOn( AttributeType attrType, int cacheSize ) throws NamingException
     {
         if ( updnIdx != null )
         {
@@ -413,7 +413,7 @@
             throw e;
         }
 
-        updnIdx = new JdbmIndex( attrType, workingDirectory );
+        updnIdx = new JdbmIndex( attrType, workingDirectory, cacheSize );
         sysIndices.put( attrType.getOid(), updnIdx );
     }
 
@@ -424,7 +424,7 @@
     }
 
 
-    public void setNdnIndexOn( AttributeType attrType ) throws NamingException
+    public void setNdnIndexOn( AttributeType attrType, int cacheSize ) throws NamingException
     {
         if ( ndnIdx != null )
         {
@@ -432,7 +432,7 @@
             throw e;
         }
 
-        ndnIdx = new JdbmIndex( attrType, workingDirectory );
+        ndnIdx = new JdbmIndex( attrType, workingDirectory, cacheSize );
         sysIndices.put( attrType.getOid(), ndnIdx );
     }
 

Modified: directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java?rev=419940&r1=419939&r2=419940&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java (original)
+++ directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java Fri Jul  7 10:56:05 2006
@@ -82,27 +82,27 @@
      * @param recMan the record manager
      * @throws NamingException if we fail to create B+Trees using recMan
      */
-    public JdbmIndex( AttributeType attribute, RecordManager recMan ) throws NamingException
-    {
-        this.attribute = attribute;
-        keyCache = new SynchronizedLRUMap( 1000 );
-        this.recMan = recMan;
-        initTables();
-    }
+//    public JdbmIndex( AttributeType attribute, RecordManager recMan ) throws NamingException
+//    {
+//        this.attribute = attribute;
+//        keyCache = new SynchronizedLRUMap( 1000 );
+//        this.recMan = recMan;
+//        initTables();
+//    }
 
 
-    public JdbmIndex( AttributeType attribute, File wkDirPath ) throws NamingException
+    public JdbmIndex( AttributeType attribute, File wkDirPath, int cacheSize ) throws NamingException
     {
         File file = new File( wkDirPath.getPath() + File.separator + attribute.getName() );
         this.attribute = attribute;
-        keyCache = new SynchronizedLRUMap( 1000 );
+        keyCache = new SynchronizedLRUMap( cacheSize );
 
         try
         {
             String path = file.getAbsolutePath();
             BaseRecordManager base = new BaseRecordManager( path );
             base.disableTransactions();
-            recMan = new CacheRecordManager( base, new MRU( 1000 ) );
+            recMan = new CacheRecordManager( base, new MRU( cacheSize ) );
         }
         catch ( IOException e )
         {

Modified: directory/branches/apacheds/optimization/server-installers/pom.xml
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/server-installers/pom.xml?rev=419940&r1=419939&r2=419940&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/server-installers/pom.xml (original)
+++ directory/branches/apacheds/optimization/server-installers/pom.xml Fri Jul  7 10:56:05 2006
@@ -128,11 +128,13 @@
               <installationBundleId>Binaries</installationBundleId>
             </packagedFile>
           </packagedFiles>
+<!--
           <svnBaseUrl>
             http://svn.apache.org/repos/asf/directory/branches/apacheds/1.0
           </svnBaseUrl>
           <packageSources>true</packageSources>
           <packageDocs>true</packageDocs>
+-->
           <applicationClass>
             org.apache.ldap.server.Service
           </applicationClass>

Modified: directory/branches/apacheds/optimization/server-installers/src/main/installers/server.xml
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/server-installers/src/main/installers/server.xml?rev=419940&r1=419939&r2=419940&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/server-installers/src/main/installers/server.xml (original)
+++ directory/branches/apacheds/optimization/server-installers/src/main/installers/server.xml Fri Jul  7 10:56:05 2006
@@ -164,11 +164,26 @@
     <property name="suffix"><value>dc=example,dc=com</value></property>
     <property name="indexedAttributes">
       <set>
+        <!-- Use attributeId strings for default index configuration -->
         <value>dc</value>
         <value>ou</value>
         <value>objectClass</value>
         <value>krb5PrincipalName</value>
         <value>uid</value>
+
+        <!-- 
+             If the partition is a BTree implementation then you can configure
+             indices to have custom cache sizes using the following bean to
+             specify the index and it's cache size.
+             
+             System indices may also be included here to override default cache
+             size values for btree based partitions.
+         -->
+
+        <bean class="org.apache.directory.server.core.partition.impl.btree.MutableIndexConfiguration">
+          <property name="attributeId"><value>objectClass</value></property>
+          <property name="cacheSize"><value>5000</value></property>
+        </bean>
       </set>
     </property>
     <property name="contextEntry">

Modified: directory/branches/apacheds/optimization/server-main/server.xml
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/server-main/server.xml?rev=419940&r1=419939&r2=419940&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/server-main/server.xml (original)
+++ directory/branches/apacheds/optimization/server-main/server.xml Fri Jul  7 10:56:05 2006
@@ -164,11 +164,26 @@
     <property name="suffix"><value>dc=example,dc=com</value></property>
     <property name="indexedAttributes">
       <set>
+        <!-- Use attributeId strings for default index configuration -->
         <value>dc</value>
         <value>ou</value>
         <value>objectClass</value>
         <value>krb5PrincipalName</value>
         <value>uid</value>
+
+        <!-- 
+             If the partition is a BTree implementation then you can configure
+             indices to have custom cache sizes using the following bean to
+             specify the index and it's cache size.
+             
+             System indices may also be included here to override default cache
+             size values for btree based partitions.
+         -->
+
+        <bean class="org.apache.directory.server.core.partition.impl.btree.MutableIndexConfiguration">
+          <property name="attributeId"><value>objectClass</value></property>
+          <property name="cacheSize"><value>5000</value></property>
+        </bean>
       </set>
     </property>
     <property name="contextEntry">

Modified: directory/branches/apacheds/optimization/server-tools/src/main/java/org/apache/directory/server/tools/DumpCommand.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/server-tools/src/main/java/org/apache/directory/server/tools/DumpCommand.java?rev=419940&r1=419939&r2=419940&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/server-tools/src/main/java/org/apache/directory/server/tools/DumpCommand.java (original)
+++ directory/branches/apacheds/optimization/server-tools/src/main/java/org/apache/directory/server/tools/DumpCommand.java Fri Jul  7 10:56:05 2006
@@ -129,7 +129,7 @@
 
         JdbmMasterTable master = new JdbmMasterTable( recMan );
         AttributeType attributeType = bootstrapRegistries.getAttributeTypeRegistry().lookup( "apacheUpdn" );
-        JdbmIndex idIndex = new JdbmIndex( attributeType, partitionDirectory );
+        JdbmIndex idIndex = new JdbmIndex( attributeType, partitionDirectory, 1000 );
 
         out.println( "#---------------------" );
         NamingEnumeration list = master.listTuples();