directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r781052 - in /directory/apacheds/trunk: bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/ core-integ/src/test/java/org/apache/directory/server/core/configuration/ core/src/main/java/org/apache/directory/serve...
Date Tue, 02 Jun 2009 15:09:15 GMT
Author: elecharny
Date: Tue Jun  2 15:09:14 2009
New Revision: 781052

URL: http://svn.apache.org/viewvc?rev=781052&view=rev
Log:
o Finishing to add the entryCsn, EntryUuid and ObjectClass index
o Reflected the renaming of Csn etc

Modified:
    directory/apacheds/trunk/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/configuration/PartitionConfigurationIT.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DirectoryService.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
    directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
    directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
    directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
    directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
    directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/ApacheComparatorProducer.java
    directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/ApacheSyntaxProducer.java
    directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
    directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
    directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeTest.java
    directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeTest.java
    directory/apacheds/trunk/xdbm-tools/src/main/java/org/apache/directory/server/xdbm/tools/StoreUtils.java

Modified: directory/apacheds/trunk/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java?rev=781052&r1=781051&r2=781052&view=diff
==============================================================================
--- directory/apacheds/trunk/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java
(original)
+++ directory/apacheds/trunk/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java
Tue Jun  2 15:09:14 2009
@@ -71,7 +71,7 @@
 import org.apache.directory.server.schema.registries.SyntaxRegistry;
 import org.apache.directory.server.utils.AttributesFactory;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.csn.CSNFactory;
+import org.apache.directory.shared.ldap.csn.CsnFactory;
 import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.name.LdapDN;
@@ -177,7 +177,7 @@
     private Map<String, Schema> schemas = new HashMap<String, Schema>();
 
     /** CSN factory instance */
-    private static final CSNFactory CSN_FACTORY = new CSNFactory();
+    private static final CsnFactory CSN_FACTORY = new CsnFactory();
 
     /**
      * Loads a bunch of bootstrap classes into memory then adds them to a new

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/configuration/PartitionConfigurationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/configuration/PartitionConfigurationIT.java?rev=781052&r1=781051&r2=781052&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/configuration/PartitionConfigurationIT.java
(original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/configuration/PartitionConfigurationIT.java
Tue Jun  2 15:09:14 2009
@@ -29,7 +29,9 @@
 import org.apache.directory.server.core.jndi.CoreContextFactory;
 import org.apache.directory.server.core.partition.Partition;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
+import org.apache.directory.shared.ldap.csn.CsnFactory;
 import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.schema.SchemaUtils;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -37,6 +39,7 @@
 import javax.naming.InitialContext;
 import javax.naming.NameNotFoundException;
 import java.util.Hashtable;
+import java.util.UUID;
 
 
 /**
@@ -67,6 +70,8 @@
         ctxEntry.put( "objectClass", "top" );
         ctxEntry.get( "objectClass" ).add( "organizationalUnit" );
         ctxEntry.put( "ou", "removable" );
+        ctxEntry.put( "entryCSN", new CsnFactory().newInstance( 1 ).toString() );
+        ctxEntry.put( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
         partition.add( new AddOperationContext( service.getAdminSession(), ctxEntry ) );
         
         Hashtable<String,Object> env = new Hashtable<String,Object>();

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=781052&r1=781051&r2=781052&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
Tue Jun  2 15:09:14 2009
@@ -83,8 +83,8 @@
 import org.apache.directory.shared.ldap.NotImplementedException;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.csn.CSN;
-import org.apache.directory.shared.ldap.csn.CSNFactory;
+import org.apache.directory.shared.ldap.csn.Csn;
+import org.apache.directory.shared.ldap.csn.CsnFactory;
 import org.apache.directory.shared.ldap.cursor.Cursor;
 import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
@@ -179,7 +179,7 @@
     private boolean passwordHidden = false;
     
     /** The service's CSN factory */
-    private CSNFactory csnFactory;
+    private CsnFactory csnFactory;
     
     /** The directory instance replication ID */
     private int replicaId;
@@ -250,7 +250,7 @@
         
         SerializableComparator.setRegistry( registries.getComparatorRegistry() );
         
-        csnFactory = new CSNFactory();
+        csnFactory = new CsnFactory();
     }
 
 
@@ -1726,7 +1726,7 @@
      * Get a new CSN
      * @return The CSN generated for this directory service
      */
-    public CSN getCSN()
+    public Csn getCSN()
     {
         return csnFactory.newInstance( replicaId );
     }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DirectoryService.java?rev=781052&r1=781051&r2=781052&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DirectoryService.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DirectoryService.java
Tue Jun  2 15:09:14 2009
@@ -32,7 +32,7 @@
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.server.core.schema.SchemaService;
 import org.apache.directory.server.schema.registries.Registries;
-import org.apache.directory.shared.ldap.csn.CSN;
+import org.apache.directory.shared.ldap.csn.Csn;
 import org.apache.directory.shared.ldap.ldif.LdifEntry;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
@@ -468,7 +468,7 @@
      * Get a new CSN
      * @return The CSN generated for this directory service
      */
-    CSN getCSN();
+    Csn getCSN();
 
 
     /**

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java?rev=781052&r1=781051&r2=781052&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
Tue Jun  2 15:09:14 2009
@@ -1201,6 +1201,7 @@
                     }
                     catch ( Throwable e )
                     {
+                        e.printStackTrace();
                         throwInterceptorException( interceptor, e );
                     }
                 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java?rev=781052&r1=781051&r2=781052&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
Tue Jun  2 15:09:14 2009
@@ -42,6 +42,7 @@
 import org.apache.directory.server.xdbm.search.impl.EvaluatorBuilder;
 import org.apache.directory.server.xdbm.search.impl.NoOpOptimizer;
 import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.exception.LdapAuthenticationNotSupportedException;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.LdapDN;
@@ -235,6 +236,18 @@
                 {
                     store.setUpdnIndex( ( Index<String,ServerEntry> ) index );
                 }
+                else if ( oid.equals( SchemaConstants.OBJECT_CLASS_AT_OID ) )
+                {
+                    store.setObjectClassIndex( ( Index<String,ServerEntry> ) index
);
+                }
+                else if ( oid.equals( ApacheSchemaConstants.ENTRY_CSN_AT_OID ) )
+                {
+                    store.setEntryCsnIndex( ( Index<String,ServerEntry> ) index );
+                }
+                else if ( oid.equals( ApacheSchemaConstants.ENTRY_UUID_AT_OID ) )
+                {
+                    store.setEntryUuidIndex( ( Index<byte[],ServerEntry> ) index );
+                }
                 else
                 {
                     throw new IllegalStateException( "Unrecognized system index " + oid );
@@ -281,7 +294,7 @@
     }
 
 
-    public final Index<String, ServerEntry> getExistanceIndex()
+    public final Index<String, ServerEntry> getExistenceIndex()
     {
         return store.getPresenceIndex();
     }
@@ -591,6 +604,24 @@
     }
     
     
+    public Index<String, ServerEntry> getObjectClassIndex()
+    {
+        return store.getObjectClassIndex();
+    }
+         
+    
+    public Index<String, ServerEntry> getEntryCsnIndex()
+    {
+        return store.getEntryCsnIndex();
+    }
+
+    
+    public Index<byte[], ServerEntry> getEntryUuidIndex()
+    {
+        return store.getEntryUuidIndex();
+    }
+
+    
     /**
      * @see Object#toString()
      */

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java?rev=781052&r1=781051&r2=781052&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
(original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
Tue Jun  2 15:09:14 2009
@@ -67,7 +67,7 @@
 import org.apache.directory.shared.ldap.aci.ProtectedItem;
 import org.apache.directory.shared.ldap.aci.UserClass;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
-import org.apache.directory.shared.ldap.csn.CSN;
+import org.apache.directory.shared.ldap.csn.Csn;
 import org.apache.directory.shared.ldap.cursor.ClosureMonitor;
 import org.apache.directory.shared.ldap.cursor.Cursor;
 import org.apache.directory.shared.ldap.cursor.CursorIterator;
@@ -852,7 +852,7 @@
         }
         
         
-        public CSN getCSN()
+        public Csn getCSN()
         {
             return null;
         }

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java?rev=781052&r1=781051&r2=781052&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
(original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
Tue Jun  2 15:09:14 2009
@@ -41,7 +41,7 @@
 import org.apache.directory.server.core.schema.SchemaService;
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
-import org.apache.directory.shared.ldap.csn.CSN;
+import org.apache.directory.shared.ldap.csn.Csn;
 import org.apache.directory.shared.ldap.ldif.LdifEntry;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
@@ -662,7 +662,7 @@
         }
         
         
-        public CSN getCSN()
+        public Csn getCSN()
         {
             return null;
         }

Modified: directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java?rev=781052&r1=781051&r2=781052&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
(original)
+++ directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
Tue Jun  2 15:09:14 2009
@@ -130,7 +130,6 @@
     /** the subtree scope alias index */
     private JdbmIndex<Long,E> subAliasIdx;
     
-    
     /** a system index on objectClass attribute*/
     private JdbmIndex<String,E> objectClassIdx;
     
@@ -382,19 +381,50 @@
             systemIndices.put( ApacheSchemaConstants.APACHE_SUB_LEVEL_AT_OID, subLevelIdx
);
             subLevelIdx.init( attributeTypeRegistry.lookup( ApacheSchemaConstants.APACHE_SUB_LEVEL_AT_OID
), workingDirectory );
         }
+        
+        if ( entryCsnIdx == null )
+        {
+            entryCsnIdx = new JdbmIndex<String, E>();
+            entryCsnIdx.setAttributeId( SchemaConstants.ENTRY_CSN_AT_OID );
+            systemIndices.put( SchemaConstants.ENTRY_CSN_AT_OID, entryCsnIdx );
+            entryCsnIdx.init( attributeTypeRegistry.lookup( SchemaConstants.ENTRY_CSN_AT_OID
), workingDirectory );
+        }
+        
+        if ( entryUuidIdx == null )
+        {
+            entryUuidIdx = new JdbmIndex<byte[], E>();
+            entryUuidIdx.setAttributeId( SchemaConstants.ENTRY_UUID_AT_OID );
+            systemIndices.put( SchemaConstants.ENTRY_UUID_AT_OID, entryUuidIdx );
+            entryUuidIdx.init( attributeTypeRegistry.lookup( SchemaConstants.ENTRY_UUID_AT_OID
), workingDirectory );
+        }
+        
+        if ( objectClassIdx == null )
+        {
+            objectClassIdx = new JdbmIndex<String, E>();
+            objectClassIdx.setAttributeId( SchemaConstants.OBJECT_CLASS_AT_OID );
+            systemIndices.put( SchemaConstants.OBJECT_CLASS_AT_OID, objectClassIdx );
+            objectClassIdx.init( attributeTypeRegistry.lookup( SchemaConstants.OBJECT_CLASS_AT_OID
), workingDirectory );
+        }
     }
 
 
     @SuppressWarnings("unchecked")
     private void setupUserIndices() throws Exception
     {
-        if ( userIndices != null && userIndices.size() > 0 )
+        if ( ( userIndices != null ) && ( userIndices.size() > 0 ) )
         {
             Map<String, Index<?,E>> tmp = new HashMap<String, Index<?,E>>();
             
             for ( Index<?,E> index : userIndices.values() )
             {
                 String oid = oidRegistry.getOid( index.getAttributeId() );
+
+                if ( systemIndices.containsKey( oid ) )
+                {
+                    // Bypass some specific index for AttributeTypes like ObjectClass hich
are already
+                    // present in the SystemIndices
+                    continue;
+                }
                 AttributeType attributeType = attributeTypeRegistry.lookup( oid );
                 
                 // Check that the attributeType has an EQUALITY matchingRule
@@ -520,6 +550,9 @@
         array.add( oneLevelIdx );
         array.add( presenceIdx );
         array.add( subLevelIdx );
+        array.add( entryCsnIdx );
+        array.add( entryUuidIdx );
+        array.add( objectClassIdx );
         
         // Sync all user defined userIndices
         for ( Index<?,E> idx : array )
@@ -736,8 +769,8 @@
         subLevelIdx = convertIndex( index );
         systemIndices.put( index.getAttributeId(), subLevelIdx );
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
@@ -796,7 +829,7 @@
         entryCsnIdx = convertIndex( index );
         systemIndices.put( index.getAttributeId(), entryCsnIdx );
     }
-
+    
     
     public Iterator<String> userIndices()
     {
@@ -1178,6 +1211,13 @@
         // Start adding the system userIndices
         // Why bother doing a lookup if this is not an alias.
 
+        // First, the ObjectClass index
+        for ( Value<?> value : objectClass )
+        {
+            objectClassIdx.add( (String)value.get(), id );
+        }
+        
+        
         if ( objectClass.contains( SchemaConstants.ALIAS_OC ) )
         {
             EntryAttribute aliasAttr = entry.get( ALIASED_OBJECT_NAME_AT );
@@ -1192,6 +1232,28 @@
         ndnIdx.add( entryDn.toNormName(), id );
         updnIdx.add( entryDn.getUpName(), id );
         oneLevelIdx.add( parentId, id );
+
+        // Update the EntryCsn index
+        EntryAttribute entryCsn = entry.get( ENTRY_CSN_AT );
+
+        if ( entryCsn == null )
+        {
+            String msg = "Entry " + entryDn.getUpName() + " contains no entryCsn attribute:
" + entry;
+            throw new LdapSchemaViolationException( msg, ResultCodeEnum.OBJECT_CLASS_VIOLATION
);
+        }
+        
+        entryCsnIdx.add( entryCsn.getString(), id );
+        
+        // Update the EntryUuid index
+        EntryAttribute entryUuid = entry.get( ENTRY_UUID_AT );
+
+        if ( entryUuid == null )
+        {
+            String msg = "Entry " + entryDn.getUpName() + " contains no entryUuid attribute:
" + entry;
+            throw new LdapSchemaViolationException( msg, ResultCodeEnum.OBJECT_CLASS_VIOLATION
);
+        }
+        
+        entryUuidIdx.add( entryUuid.getBytes(), id );
         
         Long tempId = parentId;
         
@@ -1243,7 +1305,6 @@
     /**
      * {@inheritDoc}
      */
-    @SuppressWarnings("unchecked")
     public void delete( Long id ) throws Exception
     {
         ServerEntry entry = lookup( id );
@@ -1255,10 +1316,17 @@
         {
             dropAliasIndices( id );
         }
+        
+        for ( Value<?> value : objectClass )
+        {
+            objectClassIdx.drop( (String)value.get(), id );
+        }
 
         ndnIdx.drop( id );
         updnIdx.drop( id );
         oneLevelIdx.drop( id );
+        entryCsnIdx.drop( id );
+        entryUuidIdx.drop( id );
 
         if( parentId != 1 )// should not use getParentId() to compare, onelevel index drops
the 'id'
         {
@@ -1364,7 +1432,15 @@
         
         String modsOid = oidRegistry.getOid( mods.getId() );
 
-        if ( hasUserIndexOn( modsOid ) )
+        // Special case for the ObjectClass index
+        if ( modsOid.equals( SchemaConstants.OBJECT_CLASS_AT_OID ) )
+        {
+            for ( Value<?> value : mods )
+            {
+                objectClassIdx.drop( (String)value.get(), id );
+            }
+        }
+        else if ( hasUserIndexOn( modsOid ) )
         {
             Index<?,E> index = getUserIndex( modsOid );
 
@@ -1388,7 +1464,7 @@
             entry.add( type, value );
         }
 
-        if ( modsOid.equals( oidRegistry.getOid( SchemaConstants.ALIASED_OBJECT_NAME_AT )
) )
+        if ( modsOid.equals( SchemaConstants.ALIASED_OBJECT_NAME_AT_OID ) )
         {
             String ndnStr = ndnIdx.reverseLookup( id );
             addAliasIndices( id, new LdapDN( ndnStr ), mods.getString() );
@@ -1418,8 +1494,16 @@
         }
         
         String modsOid = oidRegistry.getOid( mods.getId() );
-
-        if ( hasUserIndexOn( modsOid ) )
+        
+        // Special case for the ObjectClass index
+        if ( modsOid.equals( SchemaConstants.OBJECT_CLASS_AT_OID ) )
+        {
+            for ( Value<?> value : mods )
+            {
+                objectClassIdx.drop( (String)value.get(), id );
+            }
+        }
+        else if ( hasUserIndexOn( modsOid ) )
         {
             Index<?,E> index = getUserIndex( modsOid );
             
@@ -1502,11 +1586,27 @@
         
         String modsOid = oidRegistry.getOid( mods.getId() );
 
-        if ( hasUserIndexOn( modsOid ) )
+        // Special case for the ObjectClass index
+        if ( modsOid.equals( SchemaConstants.OBJECT_CLASS_AT_OID ) )
+        {
+            // if the id exists in the index drop all existing attribute 
+            // value index entries and add new ones
+            if( objectClassIdx.reverse( id ) )
+            {
+                objectClassIdx.drop( id );
+            }
+            
+            for ( Value<?> value : mods )
+            {
+                objectClassIdx.add( (String)value.get(), id );
+            }
+        }
+        else if ( hasUserIndexOn( modsOid ) )
         {
             Index<?,E> index = getUserIndex( modsOid );
 
-            // if the id exists in the index drop all existing attribute value index entries
and add new ones
+            // if the id exists in the index drop all existing attribute 
+            // value index entries and add new ones
             if( index.reverse( id ) )
             {
                 ( ( JdbmIndex<?,E> ) index ).drop( id );

Modified: directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java?rev=781052&r1=781051&r2=781052&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
(original)
+++ directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
Tue Jun  2 15:09:14 2009
@@ -43,8 +43,10 @@
 import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.csn.CsnFactory;
 import org.apache.directory.shared.ldap.cursor.Cursor;
 import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.SchemaUtils;
 import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException;
@@ -59,6 +61,7 @@
 import java.util.Set;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.UUID;
 
 
 /**
@@ -261,11 +264,13 @@
         try { store.setUpdnIndex( new JdbmIndex<String,ServerEntry>( "updn" ) ); fail();
}
         catch( IllegalStateException e ) {}
         Iterator<String> systemIndices = store.systemIndices();
-        for ( int ii = 0; ii < 8; ii++ )
+        
+        for ( int ii = 0; ii < 11; ii++ )
         {
             assertTrue( systemIndices.hasNext() );
             assertNotNull( systemIndices.next() );
         }
+        
         assertFalse( systemIndices.hasNext() );
         assertNotNull( store.getSystemIndex( ApacheSchemaConstants.APACHE_ALIAS_AT ) );
         try { store.getSystemIndex( "bogus" ); fail(); }
@@ -357,6 +362,8 @@
         entry.add( "ou", "Apache" );
         entry.add( "commonName",  "Jack Daniels");
         entry.add( "aliasedObjectName", "cn=Jack Daniels,ou=Engineering,o=Good Times Co."
);
+        entry.add( "entryCSN", new CsnFactory().newInstance( 1 ).toString() );
+        entry.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
         store.add( entry );
         
         store.delete( 12L ); // drops the alias indices
@@ -403,6 +410,8 @@
       entry.add( "objectClass", "top", "person", "organizationalPerson" );
       entry.add( "ou", "Sales" );
       entry.add( "cn",  "Martin King");
+      entry.add( "entryCSN", new CsnFactory().newInstance( 1 ).toString() );
+      entry.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
       store.add( entry );
       
       cursor = idx.forwardCursor( 2L);
@@ -425,6 +434,8 @@
       entry = new DefaultServerEntry( registries, marketingDn );
       entry.add( "objectClass", "top", "organizationalUnit" );
       entry.add( "ou", "Marketing" );
+      entry.add( "entryCSN", new CsnFactory().newInstance( 1 ).toString() );
+      entry.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
       store.add( entry );
 
       // dn id 14
@@ -434,6 +445,8 @@
       entry.add( "objectClass", "top", "person", "organizationalPerson" );
       entry.add( "ou", "Marketing" );
       entry.add( "cn",  "Jimmy Wales");
+      entry.add( "entryCSN", new CsnFactory().newInstance( 1 ).toString() );
+      entry.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
       store.add( entry );
       
       store.move( marketingDn, newParentDn );
@@ -715,6 +728,8 @@
         entry.add( "objectClass", "top", "person", "organizationalPerson" );
         entry.add( "ou", "Engineering" );
         entry.add( "cn",  "Private Ryan");
+        entry.add( "entryCSN", new CsnFactory().newInstance( 1 ).toString() );
+        entry.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
 
         store.add( entry );
         
@@ -733,6 +748,8 @@
         childEntry.add( "objectClass", "top", "person", "organizationalPerson" );
         childEntry.add( "ou", "Engineering" );
         childEntry.add( "cn",  "Private Ryan");
+        childEntry.add( "entryCSN", new CsnFactory().newInstance( 1 ).toString() );
+        childEntry.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
 
         store.add( childEntry );
 
@@ -864,6 +881,8 @@
         DefaultServerEntry entry = new DefaultServerEntry( registries, dn );
         entry.add( "objectClass", "top", "person", "organizationalPerson" );
         entry.add( "cn", "Tim B");
+        entry.add( "entryCSN", new CsnFactory().newInstance( 1 ).toString() );
+        entry.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
         
         store.add( entry );
         

Modified: directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/ApacheComparatorProducer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/ApacheComparatorProducer.java?rev=781052&r1=781051&r2=781052&view=diff
==============================================================================
--- directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/ApacheComparatorProducer.java
(original)
+++ directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/ApacheComparatorProducer.java
Tue Jun  2 15:09:14 2009
@@ -28,7 +28,7 @@
 
 import org.apache.directory.server.schema.bootstrap.ProducerTypeEnum;
 import org.apache.directory.server.schema.registries.Registries;
-import org.apache.directory.shared.ldap.schema.comparators.CSNComparator;
+import org.apache.directory.shared.ldap.schema.comparators.CsnComparator;
 import org.apache.directory.shared.ldap.schema.comparators.ComparableComparator;
 import org.apache.directory.shared.ldap.schema.comparators.CsnSidComparator;
 import org.apache.directory.shared.ldap.schema.comparators.UUIDComparator;
@@ -82,11 +82,11 @@
         cb.schemaObjectProduced( this, "1.3.6.1.1.16.3", comparator );
         
         // For CSNMatch
-        comparator = new CSNComparator();
+        comparator = new CsnComparator();
         cb.schemaObjectProduced( this, "1.3.6.1.4.1.4203.666.11.2.2", comparator );
         
         // For CSNOrderingMatch
-        comparator = new CSNComparator();
+        comparator = new CsnComparator();
         cb.schemaObjectProduced( this, "1.3.6.1.4.1.4203.666.11.2.3", comparator );
         
         // For CSNSIDMatch

Modified: directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/ApacheSyntaxProducer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/ApacheSyntaxProducer.java?rev=781052&r1=781051&r2=781052&view=diff
==============================================================================
--- directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/ApacheSyntaxProducer.java
(original)
+++ directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/ApacheSyntaxProducer.java
Tue Jun  2 15:09:14 2009
@@ -220,7 +220,7 @@
         cb.schemaObjectProduced( this, syntax.getOid(), syntax );
 
         // A Syntax for CSN, OID = 1.3.6.1.4.1.4203.666.11.2.1
-        syntax = new AbstractSyntax( SchemaConstants.CSN_SYNTAX, "a syntax for CSN values",
false )
+        syntax = new AbstractSyntax( SchemaConstants.CSN_SYNTAX, "a syntax for CSN values",
true )
         {
             private static final long serialVersionUID = 1L;
             private final CsnSyntaxChecker CSN_SYNTAX_CHECKER = new CsnSyntaxChecker();
@@ -245,7 +245,7 @@
         cb.schemaObjectProduced( this, syntax.getOid(), syntax );
 
         // A Syntax for CSNSid, OID = 1.3.6.1.4.1.4203.666.11.2.5
-        syntax = new AbstractSyntax( SchemaConstants.CSN_SID_SYNTAX, "a syntax for CSN SID
values", false )
+        syntax = new AbstractSyntax( SchemaConstants.CSN_SID_SYNTAX, "a syntax for CSN SID
values", true )
         {
             private static final long serialVersionUID = 1L;
             private final CsnSidSyntaxChecker CSN_SID_SYNTAX_CHECKER = new CsnSidSyntaxChecker();

Modified: directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java?rev=781052&r1=781051&r2=781052&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
(original)
+++ directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
Tue Jun  2 15:09:14 2009
@@ -34,6 +34,7 @@
 import org.apache.directory.server.core.entry.ServerStringValue;
 import org.apache.directory.server.core.entry.DefaultServerEntry;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.csn.CsnFactory;
 import org.apache.directory.shared.ldap.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.filter.GreaterEqNode;
 import org.apache.directory.shared.ldap.schema.*;
@@ -52,6 +53,7 @@
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
+import java.util.UUID;
 
 
 
@@ -589,6 +591,8 @@
         attrs.add( "c-street", "3" );
         attrs.add( "cn", "jane doe" );
         attrs.add( "sn", "doe" );
+        attrs.add( "entryCSN", new CsnFactory().newInstance( 1 ).toString() );
+        attrs.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
         store.add(  attrs );
 
         indexEntry.setId( 12L );

Modified: directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java?rev=781052&r1=781051&r2=781052&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
(original)
+++ directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
Tue Jun  2 15:09:14 2009
@@ -44,9 +44,11 @@
 import org.apache.directory.server.core.entry.DefaultServerEntry;
 import org.apache.directory.server.core.entry.ServerStringValue;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.csn.CsnFactory;
 import org.apache.directory.shared.ldap.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.filter.LessEqNode;
 import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.SchemaUtils;
 import org.apache.directory.shared.ldap.schema.parsers.SyntaxCheckerDescription;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.commons.io.FileUtils;
@@ -62,6 +64,7 @@
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
+import java.util.UUID;
 
 
 /**
@@ -640,6 +643,8 @@
         attrs.add( "c-street", "1" );
         attrs.add( "cn", "jane doe" );
         attrs.add( "sn", "doe" );
+        attrs.add( "entryCSN", new CsnFactory().newInstance( 1 ).toString() );
+        attrs.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
         store.add( attrs );
 
         indexEntry.setId( 12L );

Modified: directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeTest.java?rev=781052&r1=781051&r2=781052&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeTest.java
(original)
+++ directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeTest.java
Tue Jun  2 15:09:14 2009
@@ -44,11 +44,13 @@
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.DefaultServerEntry;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.csn.CsnFactory;
 import org.apache.directory.shared.ldap.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.filter.ScopeNode;
 import org.apache.directory.shared.ldap.filter.SearchScope;
 import org.apache.directory.shared.ldap.message.AliasDerefMode;
 import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.schema.SchemaUtils;
 import org.apache.commons.io.FileUtils;
 import org.junit.Before;
 import org.junit.After;
@@ -61,6 +63,7 @@
 import java.io.File;
 import java.util.Set;
 import java.util.HashSet;
+import java.util.UUID;
 
 
 /**
@@ -667,6 +670,8 @@
         attrs.add( "objectClass", "alias", "extensibleObject" );
         attrs.add( "cn", "jd" );
         attrs.add( "aliasedObjectName", "cn=Jack Daniels,ou=Engineering,o=Good Times Co."
);
+        attrs.add( "entryCSN", new CsnFactory().newInstance( 1 ).toString() );
+        attrs.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
         store.add( attrs );
 
         dn = new LdapDN(
@@ -680,6 +685,8 @@
         attrs.add( "objectClass", "person" );
         attrs.add( "cn", "jdoe" );
         attrs.add( "sn", "doe" );
+        attrs.add( "entryCSN", new CsnFactory().newInstance( 1 ).toString() );
+        attrs.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
         store.add( attrs );
 
         ScopeNode node = new ScopeNode( AliasDerefMode.DEREF_IN_SEARCHING,

Modified: directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeTest.java?rev=781052&r1=781051&r2=781052&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeTest.java
(original)
+++ directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeTest.java
Tue Jun  2 15:09:14 2009
@@ -44,11 +44,13 @@
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.DefaultServerEntry;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.csn.CsnFactory;
 import org.apache.directory.shared.ldap.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.filter.ScopeNode;
 import org.apache.directory.shared.ldap.filter.SearchScope;
 import org.apache.directory.shared.ldap.message.AliasDerefMode;
 import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.schema.SchemaUtils;
 import org.apache.commons.io.FileUtils;
 import org.junit.Before;
 import org.junit.After;
@@ -62,6 +64,7 @@
 import java.io.File;
 import java.util.Set;
 import java.util.HashSet;
+import java.util.UUID;
 
 
 /**
@@ -635,6 +638,8 @@
         attrs.add( "objectClass", "alias", "extensibleObject" );
         attrs.add( "cn", "jd" );
         attrs.add( "aliasedObjectName", "cn=Jack Daniels,ou=Engineering,o=Good Times Co."
);
+        attrs.add( "entryCSN", new CsnFactory().newInstance( 1 ).toString() );
+        attrs.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
         store.add( attrs );
 
         dn = new LdapDN(
@@ -648,6 +653,8 @@
         attrs.add( "objectClass", "person" );
         attrs.add( "cn", "jdoe" );
         attrs.add( "sn", "doe" );
+        attrs.add( "entryCSN", new CsnFactory().newInstance( 1 ).toString() );
+        attrs.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
         store.add( attrs );
 
         ScopeNode node = new ScopeNode( AliasDerefMode.DEREF_IN_SEARCHING,

Modified: directory/apacheds/trunk/xdbm-tools/src/main/java/org/apache/directory/server/xdbm/tools/StoreUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-tools/src/main/java/org/apache/directory/server/xdbm/tools/StoreUtils.java?rev=781052&r1=781051&r2=781052&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-tools/src/main/java/org/apache/directory/server/xdbm/tools/StoreUtils.java
(original)
+++ directory/apacheds/trunk/xdbm-tools/src/main/java/org/apache/directory/server/xdbm/tools/StoreUtils.java
Tue Jun  2 15:09:14 2009
@@ -32,7 +32,7 @@
 import org.apache.directory.server.xdbm.Index;
 import org.apache.directory.server.xdbm.IndexEntry;
 import org.apache.directory.server.xdbm.Store;
-import org.apache.directory.shared.ldap.csn.CSNFactory;
+import org.apache.directory.shared.ldap.csn.CsnFactory;
 import org.apache.directory.shared.ldap.cursor.Cursor;
 import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
@@ -51,7 +51,7 @@
 public class StoreUtils
 {
     /** CSN factory instance */
-    private static final CSNFactory CSN_FACTORY = new CSNFactory();
+    private static final CsnFactory CSN_FACTORY = new CsnFactory();
 
     /**
      * Initializes and loads a store with the example data shown in



Mime
View raw message