You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2010/04/26 13:17:20 UTC

svn commit: r938001 [2/2] - in /directory/apacheds/trunk: avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/ avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/ jdbm-partition/src/main/java/org/apache/di...

Modified: directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java?rev=938001&r1=938000&r2=938001&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java (original)
+++ directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java Mon Apr 26 11:17:19 2010
@@ -21,14 +21,12 @@ package org.apache.directory.server.core
 
 
 import java.io.File;
-import java.util.Collections;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
 
 import javax.naming.directory.SearchControls;
 
-import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.core.entry.ClonedServerEntry;
 import org.apache.directory.server.core.filtering.BaseEntryFilteringCursor;
 import org.apache.directory.server.core.filtering.EntryFilteringCursor;
@@ -66,23 +64,6 @@ import org.apache.directory.shared.ldap.
  */
 public abstract class BTreePartition<ID> extends AbstractPartition
 {
-    protected static final Set<String> SYS_INDEX_OIDS;
-
-    static
-    {
-        Set<String> set = new HashSet<String>();
-        set.add( ApacheSchemaConstants.APACHE_ALIAS_AT_OID );
-        set.add( ApacheSchemaConstants.APACHE_EXISTENCE_AT_OID );
-        set.add( ApacheSchemaConstants.APACHE_ONE_LEVEL_AT_OID );
-        set.add( ApacheSchemaConstants.APACHE_N_DN_AT_OID );
-        set.add( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID );
-        set.add( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID );
-        set.add( ApacheSchemaConstants.APACHE_UP_DN_AT_OID );
-        //set.add( ApacheSchemaConstants.ENTRY_CSN_AT_OID );
-        //set.add( ApacheSchemaConstants.ENTRY_UUID_AT_OID );
-        //set.add( SchemaConstants.OBJECT_CLASS_AT_OID );
-        SYS_INDEX_OIDS = Collections.unmodifiableSet( set );
-    }
 
     /** the search engine used to search the database */
     protected SearchEngine<ServerEntry, ID> searchEngine;
@@ -430,83 +411,6 @@ public abstract class BTreePartition<ID>
 
 
     /**
-     * Sets the system index defined on the ALIAS_ATTRIBUTE which for LDAP would
-     * be the aliasedObjectName and for X.500 would be aliasedEntryName.
-     * 
-     * @org.apache.xbean.Property hidden="true"
-     * @param index the index on the ALIAS_ATTRIBUTE
-     * @throws Exception if there is a problem setting up the index
-     */
-    public abstract void setAliasIndexOn( Index<String, ServerEntry, ID> index ) throws Exception;
-
-
-    /**
-     * Sets the attribute existence Index.
-     *
-     * @org.apache.xbean.Property hidden="true"
-     * @param index the attribute existence Index
-     * @throws Exception if there is a problem setting up the index
-     */
-    public abstract void setPresenceIndexOn( Index<String, ServerEntry, ID> index ) throws Exception;
-
-
-    /**
-     * Sets the one level Index.
-     *
-     * @org.apache.xbean.Property hidden="true"
-     * @param index the one level Index
-     * @throws Exception if there is a problem setting up the index
-     */
-    public abstract void setOneLevelIndexOn( Index<ID, ServerEntry, ID> index ) throws Exception;
-
-
-    // TODO - add sub level index setter
-
-    /**
-     * Sets the user provided distinguished name Index.
-     *
-     * @org.apache.xbean.Property hidden="true"
-     * @param index the updn Index
-     * @throws Exception if there is a problem setting up the index
-     */
-    public abstract void setUpdnIndexOn( Index<String, ServerEntry, ID> index ) throws Exception;
-
-
-    /**
-     * Sets the normalized distinguished name Index.
-     *
-     * @org.apache.xbean.Property hidden="true"
-     * @param index the ndn Index
-     * @throws Exception if there is a problem setting up the index
-     */
-    public abstract void setNdnIndexOn( Index<String, ServerEntry, ID> index ) throws Exception;
-
-
-    /**
-     * Sets the alias index mapping parent entries with scope expanding aliases 
-     * children one level below them; this system index is used to dereference
-     * aliases on one/single level scoped searches.
-     * 
-     * @org.apache.xbean.Property hidden="true"
-     * @param index a one level alias index
-     * @throws Exception if there is a problem setting up the index
-     */
-    public abstract void setOneAliasIndexOn( Index<ID, ServerEntry, ID> index ) throws Exception;
-
-
-    /**
-     * Sets the alias index mapping relative entries with scope expanding 
-     * alias descendents; this system index is used to dereference aliases on 
-     * subtree scoped searches.
-     * 
-     * @org.apache.xbean.Property hidden="true"
-     * @param index a subtree alias index
-     * @throws Exception if there is a problem setting up the index
-     */
-    public abstract void setSubAliasIndexOn( Index<ID, ServerEntry, ID> index ) throws Exception;
-
-
-    /**
      * {@inheritDoc}
      */
     public void setSuffix( String suffix ) throws LdapInvalidDnException

Modified: directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java?rev=938001&r1=938000&r2=938001&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java (original)
+++ directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java Mon Apr 26 11:17:19 2010
@@ -21,10 +21,23 @@ package org.apache.directory.server.xdbm
 
 
 import java.io.File;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
 
+import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.i18n.I18n;
+import org.apache.directory.shared.asn1.primitives.OID;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.name.DN;
+import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.MatchingRule;
 import org.apache.directory.shared.ldap.schema.SchemaManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -35,6 +48,8 @@ import org.apache.directory.shared.ldap.
  */
 public abstract class AbstractStore<E, ID> implements Store<E, ID>
 {
+    /** static logger */
+    private static final Logger LOG = LoggerFactory.getLogger( AbstractStore.class );
 
     /** The default cache size is set to 10 000 objects */
     public static final int DEFAULT_CACHE_SIZE = 10000;
@@ -60,6 +75,45 @@ public abstract class AbstractStore<E, I
     /** A pointer on the schemaManager */
     protected SchemaManager schemaManager;
 
+    /** a map of attributeType numeric ID to user userIndices */
+    protected Map<String, Index<?, E, ID>> userIndices = new HashMap<String, Index<?, E, ID>>();
+
+    /** a map of attributeType numeric ID to system userIndices */
+    protected Map<String, Index<?, E, ID>> systemIndices = new HashMap<String, Index<?, E, ID>>();
+
+    /** the normalized distinguished name index */
+    protected Index<String, E, ID> ndnIdx;
+
+    /** the user provided distinguished name index */
+    protected Index<String, E, ID> updnIdx;
+
+    /** the attribute presence index */
+    protected Index<String, E, ID> presenceIdx;
+
+    /** a system index on the entries of descendants of root DN*/
+    protected Index<ID, E, ID> subLevelIdx;
+
+    /** the parent child relationship index */
+    protected Index<ID, E, ID> oneLevelIdx;
+
+    /** a system index on aliasedObjectName attribute */
+    protected Index<String, E, ID> aliasIdx;
+
+    /** the one level scope alias index */
+    protected Index<ID, E, ID> oneAliasIdx;
+
+    /** the subtree scope alias index */
+    protected Index<ID, E, ID> subAliasIdx;
+
+    /** a system index on objectClass attribute*/
+    protected Index<String, E, ID> objectClassIdx;
+
+    /** a system index on entryUUID attribute */
+    protected Index<String, E, ID> entryUuidIdx;
+
+    /** a system index on entryCSN attribute */
+    protected Index<String, E, ID> entryCsnIdx;
+
 
     protected void protect( String property )
     {
@@ -143,4 +197,389 @@ public abstract class AbstractStore<E, I
     {
         return suffixDn;
     }
+
+
+    //------------------------------------------------------------------------
+    // Index
+    //------------------------------------------------------------------------
+
+    /**
+     * Sets up the user indices.
+     */
+    @SuppressWarnings("unchecked")
+    protected void setupUserIndices() throws Exception
+    {
+        // convert and initialize system indices
+        Map<String, Index<?, E, ID>> tmp = new HashMap<String, Index<?, E, ID>>();
+        for ( String oid : userIndices.keySet() )
+        {
+            // check that the attributeType has an EQUALITY matchingRule
+            AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( oid );
+            MatchingRule mr = attributeType.getEquality();
+            if ( mr != null )
+            {
+                Index<?, E, ID> index = userIndices.get( oid );
+                index = convertAndInit( index );
+                tmp.put( oid, index );
+            }
+            else
+            {
+                LOG.error( I18n.err( I18n.ERR_4, attributeType.getName() ) );
+            }
+        }
+        userIndices = tmp;
+    }
+
+
+    /**
+     * Sets up the system indices.
+     */
+    @SuppressWarnings("unchecked")
+    protected void setupSystemIndices() throws Exception
+    {
+        // add missing system indices
+        if ( getPresenceIndex() == null )
+        {
+            addIndex( new GenericIndex<String, E, ID>( ApacheSchemaConstants.APACHE_EXISTENCE_AT_OID ) );
+        }
+        if ( getOneLevelIndex() == null )
+        {
+            addIndex( new GenericIndex<ID, E, ID>( ApacheSchemaConstants.APACHE_ONE_LEVEL_AT_OID ) );
+        }
+        if ( getSubLevelIndex() == null )
+        {
+            addIndex( new GenericIndex<ID, E, ID>( ApacheSchemaConstants.APACHE_SUB_LEVEL_AT_OID ) );
+        }
+        if ( getNdnIndex() == null )
+        {
+            addIndex( new GenericIndex<String, E, ID>( ApacheSchemaConstants.APACHE_N_DN_AT_OID ) );
+        }
+        if ( getUpdnIndex() == null )
+        {
+            addIndex( new GenericIndex<String, E, ID>( ApacheSchemaConstants.APACHE_UP_DN_AT_OID ) );
+        }
+        if ( getAliasIndex() == null )
+        {
+            addIndex( new GenericIndex<String, E, ID>( ApacheSchemaConstants.APACHE_ALIAS_AT_OID ) );
+        }
+        if ( getOneAliasIndex() == null )
+        {
+            addIndex( new GenericIndex<ID, E, ID>( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID ) );
+        }
+        if ( getSubAliasIndex() == null )
+        {
+            addIndex( new GenericIndex<ID, E, ID>( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID ) );
+        }
+        if ( getObjectClassIndex() == null )
+        {
+            addIndex( new GenericIndex<String, E, ID>( SchemaConstants.OBJECT_CLASS_AT_OID ) );
+        }
+        if ( getEntryUuidIndex() == null )
+        {
+            addIndex( new GenericIndex<String, E, ID>( SchemaConstants.ENTRY_UUID_AT_OID ) );
+        }
+        if ( getEntryCsnIndex() == null )
+        {
+            addIndex( new GenericIndex<String, E, ID>( SchemaConstants.ENTRY_CSN_AT_OID ) );
+        }
+
+        // convert and initialize system indices
+        for ( String oid : systemIndices.keySet() )
+        {
+            Index<?, E, ID> index = systemIndices.get( oid );
+            index = convertAndInit( index );
+            systemIndices.put( oid, index );
+        }
+
+        // set index shortcuts
+        ndnIdx = ( Index<String, E, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_N_DN_AT_OID );
+        updnIdx = ( Index<String, E, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_UP_DN_AT_OID );
+        presenceIdx = ( Index<String, E, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_EXISTENCE_AT_OID );
+        oneLevelIdx = ( Index<ID, E, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_ONE_LEVEL_AT_OID );
+        subLevelIdx = ( Index<ID, E, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_SUB_LEVEL_AT_OID );
+        aliasIdx = ( Index<String, E, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_ALIAS_AT_OID );
+        oneAliasIdx = ( Index<ID, E, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID );
+        subAliasIdx = ( Index<ID, E, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID );
+        objectClassIdx = ( Index<String, E, ID> ) systemIndices.get( SchemaConstants.OBJECT_CLASS_AT_OID );
+        entryUuidIdx = ( Index<String, E, ID> ) systemIndices.get( SchemaConstants.ENTRY_UUID_AT_OID );
+        entryCsnIdx = ( Index<String, E, ID> ) systemIndices.get( SchemaConstants.ENTRY_CSN_AT_OID );
+    }
+
+
+    /**
+     * Convert and initialize an index for a specific store implementation.
+     * 
+     * @param index the index
+     * @return the converted and initialized index
+     * @throws Exception 
+     */
+    protected abstract Index<?, E, ID> convertAndInit( Index<?, E, ID> index ) throws Exception;
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<String> userIndices()
+    {
+        return userIndices.keySet().iterator();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<String> systemIndices()
+    {
+        return systemIndices.keySet().iterator();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasIndexOn( String id ) throws LdapException
+    {
+        return hasUserIndexOn( id ) || hasSystemIndexOn( id );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasUserIndexOn( String id ) throws LdapException
+    {
+        return userIndices.containsKey( schemaManager.getAttributeTypeRegistry().getOidByName( id ) );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasSystemIndexOn( String id ) throws LdapException
+    {
+        return systemIndices.containsKey( schemaManager.getAttributeTypeRegistry().getOidByName( id ) );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Set<Index<?, E, ID>> getUserIndices()
+    {
+        return new HashSet<Index<?, E, ID>>( userIndices.values() );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Index<?, E, ID> getIndex( String id ) throws IndexNotFoundException
+    {
+        try
+        {
+            id = schemaManager.getAttributeTypeRegistry().getOidByName( id );
+        }
+        catch ( LdapException e )
+        {
+            String msg = I18n.err( I18n.ERR_128, id );
+            LOG.error( msg, e );
+            throw new IndexNotFoundException( msg, id, e );
+        }
+
+        if ( userIndices.containsKey( id ) )
+        {
+            return userIndices.get( id );
+        }
+        if ( systemIndices.containsKey( id ) )
+        {
+            return systemIndices.get( id );
+        }
+
+        throw new IndexNotFoundException( I18n.err( I18n.ERR_3, id, id ) );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Index<?, E, ID> getUserIndex( String id ) throws IndexNotFoundException
+    {
+        try
+        {
+            id = schemaManager.getAttributeTypeRegistry().getOidByName( id );
+        }
+        catch ( LdapException e )
+        {
+            String msg = I18n.err( I18n.ERR_128, id );
+            LOG.error( msg, e );
+            throw new IndexNotFoundException( msg, id, e );
+        }
+
+        if ( userIndices.containsKey( id ) )
+        {
+            return userIndices.get( id );
+        }
+
+        throw new IndexNotFoundException( I18n.err( I18n.ERR_3, id, id ) );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Index<?, E, ID> getSystemIndex( String id ) throws IndexNotFoundException
+    {
+        try
+        {
+            id = schemaManager.getAttributeTypeRegistry().getOidByName( id );
+        }
+        catch ( LdapException e )
+        {
+            String msg = I18n.err( I18n.ERR_128, id );
+            LOG.error( msg, e );
+            throw new IndexNotFoundException( msg, id, e );
+        }
+
+        if ( systemIndices.containsKey( id ) )
+        {
+            return systemIndices.get( id );
+        }
+
+        throw new IndexNotFoundException( I18n.err( I18n.ERR_2, id, id ) );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addIndex( Index<?, E, ID> index ) throws Exception
+    {
+        protect( "addIndex" );
+
+        String oid = index.getAttributeId();
+        if ( !OID.isOID( oid ) )
+        {
+            throw new IllegalArgumentException( I18n.err( I18n.ERR_309, oid ) );
+        }
+
+        if ( SYS_INDEX_OIDS.contains( oid ) )
+        {
+            systemIndices.put( oid, index );
+        }
+        else
+        {
+            userIndices.put( oid, index );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @SuppressWarnings("unchecked")
+    public Index<String, E, ID> getNdnIndex()
+    {
+        return ( Index<String, E, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_N_DN_AT_OID );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @SuppressWarnings("unchecked")
+    public Index<String, E, ID> getUpdnIndex()
+    {
+        return ( Index<String, E, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_UP_DN_AT_OID );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @SuppressWarnings("unchecked")
+    public Index<String, E, ID> getPresenceIndex()
+    {
+        return ( Index<String, E, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_EXISTENCE_AT_OID );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @SuppressWarnings("unchecked")
+    public Index<ID, E, ID> getOneLevelIndex()
+    {
+        return ( Index<ID, E, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_ONE_LEVEL_AT_OID );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @SuppressWarnings("unchecked")
+    public Index<ID, E, ID> getSubLevelIndex()
+    {
+        return ( Index<ID, E, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_SUB_LEVEL_AT_OID );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @SuppressWarnings("unchecked")
+    public Index<String, E, ID> getAliasIndex()
+    {
+        return ( Index<String, E, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_ALIAS_AT_OID );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @SuppressWarnings("unchecked")
+    public Index<ID, E, ID> getOneAliasIndex()
+    {
+        return ( Index<ID, E, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @SuppressWarnings("unchecked")
+    public Index<ID, E, ID> getSubAliasIndex()
+    {
+        return ( Index<ID, E, ID> ) systemIndices.get( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @SuppressWarnings("unchecked")
+    public Index<String, E, ID> getObjectClassIndex()
+    {
+        return ( Index<String, E, ID> ) systemIndices.get( SchemaConstants.OBJECT_CLASS_AT_OID );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @SuppressWarnings("unchecked")
+    public Index<String, E, ID> getEntryUuidIndex()
+    {
+        return ( Index<String, E, ID> ) systemIndices.get( SchemaConstants.ENTRY_UUID_AT_OID );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @SuppressWarnings("unchecked")
+    public Index<String, E, ID> getEntryCsnIndex()
+    {
+        return ( Index<String, E, ID> ) systemIndices.get( SchemaConstants.ENTRY_CSN_AT_OID );
+    }
+
 }

Modified: directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/AbstractXdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/AbstractXdbmPartition.java?rev=938001&r1=938000&r2=938001&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/AbstractXdbmPartition.java (original)
+++ directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/AbstractXdbmPartition.java Mon Apr 26 11:17:19 2010
@@ -127,111 +127,42 @@ public abstract class AbstractXdbmPartit
     }
 
 
-    public final Index<String, ServerEntry, ID> getExistenceIndex()
-    {
-        return store.getPresenceIndex();
-    }
-
-
-    /**
-     * @org.apache.xbean.Property hidden="true"
-     */
-    public final void setPresenceIndexOn( Index<String, ServerEntry, ID> index ) throws Exception
-    {
-        store.setPresenceIndex( index );
-    }
-
-
     public final Index<ID, ServerEntry, ID> getOneLevelIndex()
     {
         return store.getOneLevelIndex();
     }
 
 
-    /**
-     * @org.apache.xbean.Property hidden="true"
-     */
-    public final void setOneLevelIndexOn( Index<ID, ServerEntry, ID> index ) throws Exception
-    {
-        store.setOneLevelIndex( index );
-    }
-
-
     public final Index<String, ServerEntry, ID> getAliasIndex()
     {
         return store.getAliasIndex();
     }
 
 
-    /**
-     * @org.apache.xbean.Property hidden="true"
-     */
-    public final void setAliasIndexOn( Index<String, ServerEntry, ID> index ) throws Exception
-    {
-        store.setAliasIndex( index );
-    }
-
-
     public final Index<ID, ServerEntry, ID> getOneAliasIndex()
     {
         return store.getOneAliasIndex();
     }
 
 
-    /**
-     * @org.apache.xbean.Property hidden="true"
-     */
-    public final void setOneAliasIndexOn( Index<ID, ServerEntry, ID> index ) throws Exception
-    {
-        store.setOneAliasIndex( index );
-    }
-
-
     public final Index<ID, ServerEntry, ID> getSubAliasIndex()
     {
         return store.getSubAliasIndex();
     }
 
 
-    /**
-     * @org.apache.xbean.Property hidden="true"
-     */
-    public final void setSubAliasIndexOn( Index<ID, ServerEntry, ID> index ) throws Exception
-    {
-        store.setSubAliasIndex( index );
-    }
-
-
     public final Index<String, ServerEntry, ID> getUpdnIndex()
     {
         return store.getUpdnIndex();
     }
 
 
-    /**
-     * @org.apache.xbean.Property hidden="true"
-     */
-    public final void setUpdnIndexOn( Index<String, ServerEntry, ID> index ) throws Exception
-    {
-        store.setUpdnIndex( index );
-    }
-
-
     public final Index<String, ServerEntry, ID> getNdnIndex()
     {
         return store.getNdnIndex();
     }
 
 
-    /**
-     * @org.apache.xbean.Property hidden="true"
-     */
-    public final void setNdnIndexOn( Index<String, ServerEntry, ID> index ) throws Exception
-    {
-        store.setNdnIndex( index );
-    }
-
-
     public final Iterator<String> getUserIndices()
     {
         return store.userIndices();
@@ -437,16 +368,16 @@ public abstract class AbstractXdbmPartit
         }
 
         // does nothing
-        throw new LdapAuthenticationNotSupportedException( ResultCodeEnum.AUTH_METHOD_NOT_SUPPORTED,
-            I18n.err( I18n.ERR_702 ) );
+        throw new LdapAuthenticationNotSupportedException( ResultCodeEnum.AUTH_METHOD_NOT_SUPPORTED, I18n
+            .err( I18n.ERR_702 ) );
     }
 
 
     public final void bind( BindOperationContext bindContext ) throws Exception
     {
         // does nothing
-        throw new LdapAuthenticationNotSupportedException( ResultCodeEnum.AUTH_METHOD_NOT_SUPPORTED,
-            I18n.err( I18n.ERR_702 ) );
+        throw new LdapAuthenticationNotSupportedException( ResultCodeEnum.AUTH_METHOD_NOT_SUPPORTED, I18n
+            .err( I18n.ERR_702 ) );
     }
 
 

Modified: directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/GenericIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/GenericIndex.java?rev=938001&r1=938000&r2=938001&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/GenericIndex.java (original)
+++ directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/GenericIndex.java Mon Apr 26 11:17:19 2010
@@ -45,6 +45,17 @@ public class GenericIndex<K, O, ID> impl
      * Creates a new instance of GenericIndex.
      * 
      * @param attributeId the attribute ID
+     */
+    public GenericIndex( String attributeId )
+    {
+        this( attributeId, DEFAULT_INDEX_CACHE_SIZE, null );
+    }
+
+
+    /**
+     * Creates a new instance of GenericIndex.
+     * 
+     * @param attributeId the attribute ID
      * @param cacheSize the cache size
      */
     public GenericIndex( String attributeId, int cacheSize )

Modified: directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/Store.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/Store.java?rev=938001&r1=938000&r2=938001&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/Store.java (original)
+++ directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/Store.java Mon Apr 26 11:17:19 2010
@@ -21,10 +21,15 @@ package org.apache.directory.server.xdbm
 
 
 import java.io.File;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
+import org.apache.directory.server.constants.ApacheSchemaConstants;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.entry.ServerEntry;
@@ -87,6 +92,32 @@ public interface Store<E, ID>
      * store and it's indices to conduct search operations.
      */
 
+    public static final String[] SYS_INDEX_OID_ARRAY =
+        { ApacheSchemaConstants.APACHE_EXISTENCE_AT_OID,
+
+        ApacheSchemaConstants.APACHE_ONE_LEVEL_AT_OID,
+
+        ApacheSchemaConstants.APACHE_SUB_LEVEL_AT_OID,
+
+        ApacheSchemaConstants.APACHE_N_DN_AT_OID,
+
+        ApacheSchemaConstants.APACHE_UP_DN_AT_OID,
+
+        ApacheSchemaConstants.APACHE_ALIAS_AT_OID,
+
+        ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID,
+
+        ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID,
+
+        SchemaConstants.ENTRY_CSN_AT_OID,
+
+        SchemaConstants.ENTRY_UUID_AT_OID,
+
+        SchemaConstants.OBJECT_CLASS_AT_OID };
+    public static final Set<String> SYS_INDEX_OIDS = Collections.unmodifiableSet( new HashSet<String>( Arrays
+        .asList( SYS_INDEX_OID_ARRAY ) ) );
+
+    
     /**
      * Sets the partition directory (working directory) for the store.
      * 
@@ -104,13 +135,8 @@ public interface Store<E, ID>
 
 
     /**
-     * Stores the list of user index
-     * @param userIndices The list of user index
-     */
-    void setUserIndices( Set<Index<?, E, ID>> userIndices );
-
-
-    /**
+     * Gets the user indices.
+     * 
      * @return The list of user index
      */
     Set<Index<?, E, ID>> getUserIndices();
@@ -214,7 +240,9 @@ public interface Store<E, ID>
 
 
     /**
-     * Adds a user index to the list of index for this store
+     * Adds a (system or user) index to the list of index for this store. 
+     * Note that the attribute id returned by Index.getAttributeId() must be
+     * the numeric OID. 
      * @param index The index to add
      * @throws Exception If the addition failed
      */
@@ -231,158 +259,66 @@ public interface Store<E, ID>
 
 
     /**
-     * Set the Presence index
-     * @param index The Presence index
-     * @throws Exception If the addition failed
-     */
-    void setPresenceIndex( Index<String, E, ID> index ) throws Exception;
-
-
-    /**
      * @return The OneLevel system index
      */
     Index<ID, E, ID> getOneLevelIndex();
 
 
     /**
-     * Set the OneLevel index
-     * @param index The OneLevel index
-     * @throws Exception If the addition failed
-     */
-    void setOneLevelIndex( Index<ID, E, ID> index ) throws Exception;
-
-
-    /**
      * @return The SubLevel system index
      */
     Index<ID, E, ID> getSubLevelIndex();
 
 
     /**
-     * Set the SubLevel index
-     * @param index The SubLevel index
-     * @throws Exception If the addition failed
-     */
-    void setSubLevelIndex( Index<ID, E, ID> index ) throws Exception;
-
-
-    /**
      * @return The Alias system index
      */
     Index<String, E, ID> getAliasIndex();
 
 
     /**
-     * Set the Alias index
-     * @param index The Alias index
-     * @throws Exception If the addition failed
-     */
-    void setAliasIndex( Index<String, E, ID> index ) throws Exception;
-
-
-    /**
      * @return The OneAlias system index
      */
     Index<ID, E, ID> getOneAliasIndex();
 
 
     /**
-     * Set the OneAlias index
-     * @param index The OneAlias index
-     * @throws Exception If the addition failed
-     */
-    void setOneAliasIndex( Index<ID, E, ID> index ) throws Exception;
-
-
-    /**
      * @return The SubAlias system index
      */
     Index<ID, E, ID> getSubAliasIndex();
 
 
     /**
-     * Set the SubAlias index
-     * @param index The SubAlias index
-     * @throws Exception If the addition failed
-     */
-    void setSubAliasIndex( Index<ID, E, ID> index ) throws Exception;
-
-
-    /**
      * @return The UpDN system index
      */
     Index<String, E, ID> getUpdnIndex();
 
 
     /**
-     * Set the UpDn index
-     * @param index The UpDn index
-     * @throws Exception If the addition failed
-     */
-    void setUpdnIndex( Index<String, E, ID> index ) throws Exception;
-
-
-    /**
      * @return The Ndn system index
      */
     Index<String, E, ID> getNdnIndex();
 
 
     /**
-     * Set the NDN index
-     * @param index The NDN index
-     * @throws Exception If the addition failed
-     */
-    void setNdnIndex( Index<String, E, ID> index ) throws Exception;
-
-
-    /**
      * @return The ObjectClass system index
      */
     Index<String, E, ID> getObjectClassIndex();
 
 
     /**
-     * Set the ObjectClass index
-     * @param index The ObjectClass index
-     * @throws Exception If the addition failed
-     */
-    void setObjectClassIndex( Index<String, E, ID> index ) throws Exception;
-
-
-    /**
      * @return The EntryUUID system index
      */
     Index<String, E, ID> getEntryUuidIndex();
 
 
     /**
-     * Set the EntryUUID index
-     * @param index The EntryUUID index
-     * @throws Exception If the addition failed
-     */
-    void setEntryUuidIndex( Index<String, E, ID> index ) throws Exception;
-
-
-    /**
      * @return The EntryCSN system index
      */
     Index<String, E, ID> getEntryCsnIndex();
 
 
     /**
-     * Set the EntryCSN index
-     * @param index The EntryCSN index
-     * @throws Exception If the addition failed
-     */
-    void setEntryCsnIndex( Index<String, E, ID> index ) throws Exception;
-
-
-    //------------------------------------------------------------------------
-    // End of the system index
-    //------------------------------------------------------------------------
-
-    /**
      * An iterator build on top of the User's index
      */
     Iterator<String> userIndices();