You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2009/10/09 02:03:51 UTC

svn commit: r823360 [4/6] - in /directory: apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/ apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/syn...

Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java?rev=823360&r1=823359&r2=823360&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java Fri Oct  9 00:03:45 2009
@@ -20,7 +20,6 @@
 package org.apache.directory.server.core.operational;
 
 
-import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
@@ -28,7 +27,6 @@
 import java.util.UUID;
 
 import org.apache.directory.server.constants.ApacheSchemaConstants;
-import org.apache.directory.server.constants.ServerDNConstants;
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.entry.ClonedServerEntry;
 import org.apache.directory.server.core.entry.DefaultServerAttribute;
@@ -124,6 +122,8 @@
     private Registries registries;
     
     private static AttributeType CREATE_TIMESTAMP_ATTRIBUTE_TYPE;
+    private static AttributeType MODIFIERS_NAME_ATTRIBUTE_TYPE;
+    private static AttributeType MODIFY_TIMESTAMP_ATTRIBUTE_TYPE;
 
 
     /**
@@ -147,6 +147,8 @@
         subschemaSubentryDn.normalize( atRegistry.getNormalizerMapping() );
         
         CREATE_TIMESTAMP_ATTRIBUTE_TYPE = atRegistry.lookup( SchemaConstants.CREATE_TIMESTAMP_AT );
+        MODIFIERS_NAME_ATTRIBUTE_TYPE = atRegistry.lookup( SchemaConstants.MODIFIERS_NAME_AT );
+        MODIFY_TIMESTAMP_ATTRIBUTE_TYPE = atRegistry.lookup( SchemaConstants.MODIFY_TIMESTAMP_AT );
     }
 
 
@@ -171,8 +173,9 @@
         
         ServerEntry entry = opContext.getEntry();
 
-        entry.put( SchemaConstants.CREATORS_NAME_AT, principal );
-        
+        /*
+         * @TODO : This code was probably created while working on Mitosis. Most probably dead code. Commented. 
+         * Check JIRA DIRSERVER-1416
         if ( opContext.getEntry().containsAttribute( CREATE_TIMESTAMP_ATTRIBUTE_TYPE ) )
         {
             // As we already have a CreateTimeStamp value in the context, use it, but only if
@@ -193,9 +196,14 @@
         {
             entry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
         }
+        */
         
         // Add the UUID and the entryCSN. The UUID is stored as a byte[] representation of 
         // its String value
+        // @TODO : If we are using replication, those four OAs may be already present.
+        // We have to deal with this as soon as we have the replication working again.
+        entry.put( SchemaConstants.CREATORS_NAME_AT, principal );
+        entry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
         entry.put( SchemaConstants.ENTRY_UUID_AT, SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
         entry.put( SchemaConstants.ENTRY_CSN_AT, service.getCSN().toString() );
         
@@ -211,6 +219,46 @@
         // added at this point.
         // If so, remove them, and if there are no more attributes, simply return.
         // otherwise, inject those values into the list of modifications
+        List<Modification> mods = opContext.getModItems();
+        
+        for ( Modification modification: mods )
+        {
+            AttributeType attributeType = ((ServerAttribute)modification.getAttribute()).getAttributeType();
+            
+            if ( attributeType.equals( MODIFIERS_NAME_ATTRIBUTE_TYPE ) )
+            {
+                String message = "The ModifiersName operational attribute cannot be modified by a user";
+                LOG.error( message );
+                throw new LdapSchemaViolationException( message, ResultCodeEnum.INSUFFICIENT_ACCESS_RIGHTS );
+            }
+
+            if ( attributeType.equals( MODIFY_TIMESTAMP_ATTRIBUTE_TYPE ) )
+            {
+                String message = "The ModifyTimestamp operational attribute cannot be modified by a user";
+                LOG.error( message );
+                throw new LdapSchemaViolationException( message, ResultCodeEnum.INSUFFICIENT_ACCESS_RIGHTS );
+            }
+        }
+        
+        // Inject the ModifiersName AT if it's not present
+        ServerAttribute attribute = new DefaultServerAttribute( 
+            MODIFIERS_NAME_ATTRIBUTE_TYPE, 
+            getPrincipal().getName());
+
+        Modification modifiersName = new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, attribute );
+
+        mods.add( modifiersName );
+        
+        // Inject the ModifyTimestamp AT if it's not present
+        attribute = new DefaultServerAttribute( 
+            MODIFY_TIMESTAMP_ATTRIBUTE_TYPE,
+            DateUtils.getGeneralizedTime() );
+        
+        Modification timestamp = new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, attribute );
+
+        mods.add( timestamp );
+        
+        // Go down in the chain
         nextInterceptor.modify( opContext );
         
         if ( opContext.getDn().getNormName().equals( subschemaSubentryDn.getNormName() ) ) 
@@ -223,6 +271,7 @@
         // -------------------------------------------------------------------
         // TODO : Why can't we add those elements on teh original modifications ???
         // Or into the context ?
+        /*
         List<Modification> modItemList = new ArrayList<Modification>(2);
         
         AttributeType modifiersNameAt = atRegistry.lookup( SchemaConstants.MODIFIERS_NAME_AT );
@@ -248,6 +297,7 @@
             opContext.getDn(), modItemList );
         newModify.setEntry( opContext.getAlteredEntry() );
         service.getPartitionNexus().modify( newModify );
+        */
     }
 
 

Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java?rev=823360&r1=823359&r2=823360&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java Fri Oct  9 00:03:45 2009
@@ -42,6 +42,7 @@
 import org.apache.directory.server.core.entry.ServerAttribute;
 import org.apache.directory.server.core.entry.ServerBinaryValue;
 import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerModification;
 import org.apache.directory.server.core.entry.ServerStringValue;
 import org.apache.directory.server.core.filtering.BaseEntryFilteringCursor;
 import org.apache.directory.server.core.filtering.EntryFilter;
@@ -100,7 +101,7 @@
 import org.apache.directory.shared.ldap.schema.registries.OidRegistry;
 import org.apache.directory.shared.ldap.schema.registries.Registries;
 import org.apache.directory.shared.ldap.schema.registries.Schema;
-import org.apache.directory.shared.ldap.schema.syntaxCheckers.AcceptAllSyntaxChecker;
+import org.apache.directory.shared.ldap.schema.syntaxCheckers.OctetStringSyntaxChecker;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -186,6 +187,8 @@
     /** A map used to store all the objectClasses allowed attributes (may + must) */
     private Map<String, List<AttributeType>> allowed;
 
+    private static AttributeType MODIFIERS_NAME_ATTRIBUTE_TYPE;
+    private static AttributeType MODIFY_TIMESTAMP_ATTRIBUTE_TYPE;
 
     /**
      * Initialize the Schema Service
@@ -209,7 +212,7 @@
         filters.add( binaryAttributeFilter );
         filters.add( topFilter );
 
-        schemaBaseDN = new LdapDN( ServerDNConstants.OU_SCHEMA_DN );
+        schemaBaseDN = new LdapDN( SchemaConstants.OU_SCHEMA );
         schemaBaseDN.normalize( atRegistry.getNormalizerMapping() );
         schemaService = directoryService.getSchemaService();
 
@@ -229,6 +232,9 @@
         SchemaPartitionDao dao = loader.getDao();
         schemaManager = new SchemaSubentryManager( registries, loader, dao );
 
+        MODIFIERS_NAME_ATTRIBUTE_TYPE = atRegistry.lookup( SchemaConstants.MODIFIERS_NAME_AT );
+        MODIFY_TIMESTAMP_ATTRIBUTE_TYPE = atRegistry.lookup( SchemaConstants.MODIFY_TIMESTAMP_AT );
+        
         if ( IS_DEBUG )
         {
             LOG.debug( "SchemaInterceptor Initialized !" );
@@ -1207,9 +1213,13 @@
             // We don't allow modification of operational attributes
             if ( !attributeType.isUserModifiable() )
             {
-                String msg = "Cannot modify the attribute : " + attributeType;
-                LOG.error( msg );
-                throw new NoPermissionException( msg );
+                if ( !attributeType.equals( MODIFIERS_NAME_ATTRIBUTE_TYPE ) &&
+                     !attributeType.equals( MODIFY_TIMESTAMP_ATTRIBUTE_TYPE ) )
+                {
+                    String msg = "Cannot modify the attribute : " + attributeType;
+                    LOG.error( msg );
+                    throw new NoPermissionException( msg );
+                }
             }
             
             switch ( mod.getOperation() )
@@ -1388,6 +1398,22 @@
         {
             LOG.debug( "Modification attempt on schema subentry {}: \n{}", dn, opContext );
             
+            // We can get rid of the modifiersName and modifyTimestamp, they are useless.
+            List<Modification> mods = opContext.getModItems();
+            List<Modification> cleanMods = new ArrayList<Modification>(); 
+            
+            for ( Modification mod:mods )
+            {
+                AttributeType at = ((ServerAttribute)( (ServerModification)mod).getAttribute()).getAttributeType();
+                
+                if ( !MODIFIERS_NAME_ATTRIBUTE_TYPE.equals( at ) && !MODIFY_TIMESTAMP_ATTRIBUTE_TYPE.equals( at ) ) 
+                {
+                    cleanMods.add( mod );
+                }
+            }
+            
+            opContext.setModItems( cleanMods );
+            
             // Now that the entry has been modified, update the SSSE
             schemaManager.modifySchemaSubentry(  opContext, opContext.hasRequestControl( CascadeControl.CONTROL_OID ) );
             
@@ -1895,7 +1921,7 @@
             AttributeType attributeType = ( ( ServerAttribute ) attribute ).getAttributeType();
             SyntaxChecker syntaxChecker = attributeType.getSyntax().getSyntaxChecker();
 
-            if ( syntaxChecker instanceof AcceptAllSyntaxChecker )
+            if ( syntaxChecker instanceof OctetStringSyntaxChecker )
             {
                 // This is a speedup : no need to check the syntax of any value
                 // if all the syntaxes are accepted...

Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java?rev=823360&r1=823359&r2=823360&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java (original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java Fri Oct  9 00:03:45 2009
@@ -145,8 +145,12 @@
     public void add( OperationContext opContext, LdapComparatorDescription comparatorDescription ) throws Exception
     {
         String schemaName = getSchema( comparatorDescription );   
-        LdapDN dn = new LdapDN( "m-oid=" + comparatorDescription.getOid() + ",ou=comparators,cn=" 
-            + schemaName + ",ou=schema" );
+        LdapDN dn = new LdapDN( 
+            "m-oid=" + comparatorDescription.getOid(),
+            SchemaConstants.COMPARATORS_PATH,
+            "cn=" + schemaName,
+            SchemaConstants.OU_SCHEMA );
+        
         Entry entry = getEntry( dn, comparatorDescription );
 
         opContext.add( (ServerEntry)entry, BYPASS );
@@ -156,8 +160,12 @@
     public void add( OperationContext opContext, NormalizerDescription normalizerDescription ) throws Exception
     {
         String schemaName = getSchema( normalizerDescription );
-        LdapDN dn = new LdapDN( "m-oid=" + normalizerDescription.getOid() + ",ou=normalizers,cn=" 
-            + schemaName + ",ou=schema" );
+        LdapDN dn = new LdapDN( 
+            "m-oid=" + normalizerDescription.getOid(),
+            SchemaConstants.NORMALIZERS_PATH , 
+            "cn=" + schemaName,
+            SchemaConstants.OU_SCHEMA );
+        
         Entry entry = getEntry( dn, normalizerDescription );
 
         opContext.add( (ServerEntry)entry, BYPASS );
@@ -167,8 +175,12 @@
     public void add( OperationContext opContext, SyntaxCheckerDescription syntaxCheckerDescription ) throws Exception
     {
         String schemaName = getSchema( syntaxCheckerDescription );
-        LdapDN dn = new LdapDN( "m-oid=" + syntaxCheckerDescription.getOid() + ",ou=syntaxCheckers,cn=" 
-            + schemaName + ",ou=schema" );
+        LdapDN dn = new LdapDN( 
+            "m-oid=" + syntaxCheckerDescription.getOid(),
+            SchemaConstants.SYNTAX_CHECKERS_PATH,
+            "cn=" + schemaName, 
+            SchemaConstants.OU_SCHEMA );
+        
         Entry entry = getEntry( dn, syntaxCheckerDescription );
         opContext.add( (ServerEntry)entry, BYPASS );
     }
@@ -195,8 +207,12 @@
     public void delete( OperationContext opContext, NormalizerDescription normalizerDescription ) throws Exception
     {
         String schemaName = getSchema( normalizerDescription );
-        LdapDN dn = new LdapDN( "m-oid=" + normalizerDescription.getOid() + ",ou=normalizers,cn=" 
-            + schemaName + ",ou=schema" );
+        LdapDN dn = new LdapDN( 
+            "m-oid=" + normalizerDescription.getOid(),
+            SchemaConstants.NORMALIZERS_PATH,
+            "cn=" + schemaName, 
+            SchemaConstants.OU_SCHEMA );
+        
         opContext.delete( dn, BYPASS );
     }
 
@@ -204,8 +220,11 @@
     public void delete( OperationContext opContext, SyntaxCheckerDescription syntaxCheckerDescription ) throws Exception
     {
         String schemaName = getSchema( syntaxCheckerDescription );
-        LdapDN dn = new LdapDN( "m-oid=" + syntaxCheckerDescription.getOid() + ",ou=syntaxCheckers,cn=" 
-            + schemaName + ",ou=schema" );
+        LdapDN dn = new LdapDN( 
+            "m-oid=" + syntaxCheckerDescription.getOid(), 
+            SchemaConstants.SYNTAX_CHECKERS_PATH,
+            "cn=" + schemaName,
+            SchemaConstants.OU_SCHEMA );
         opContext.delete( dn, BYPASS );
     }
 
@@ -213,8 +232,12 @@
     public void delete( OperationContext opContext, LdapComparatorDescription comparatorDescription ) throws Exception
     {
         String schemaName = getSchema( comparatorDescription );
-        LdapDN dn = new LdapDN( "m-oid=" + comparatorDescription.getOid() + ",ou=comparators,cn=" 
-            + schemaName + ",ou=schema" );
+        LdapDN dn = new LdapDN( 
+            "m-oid=" + comparatorDescription.getOid(),
+            SchemaConstants.COMPARATORS_PATH,
+            "cn=" + schemaName,
+            SchemaConstants.OU_SCHEMA );
+        
         opContext.delete( dn, BYPASS );
     }
 

Modified: directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/schema/SchemaServiceTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/schema/SchemaServiceTest.java?rev=823360&r1=823359&r2=823360&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/schema/SchemaServiceTest.java (original)
+++ directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/schema/SchemaServiceTest.java Fri Oct  9 00:03:45 2009
@@ -20,6 +20,8 @@
 package org.apache.directory.server.core.schema;
 
 
+import static org.junit.Assert.assertEquals;
+
 import java.io.File;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -32,8 +34,6 @@
 import org.apache.directory.shared.schema.loader.ldif.LdifSchemaLoader;
 import org.junit.Before;
 import org.junit.Test;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertEquals;
 
 
 /**
@@ -79,19 +79,37 @@
             nameAttrs.add( type.getName() );
         }
         
-        assertTrue( "size of attributes extending name", nameAttrs.size() == 15 || nameAttrs.size() == 23 );
-        assertTrue( nameAttrs.contains( "dmdName" ) );
-        assertTrue( nameAttrs.contains( "o" ) );
-        assertTrue( nameAttrs.contains( "c" ) );
-        assertTrue( nameAttrs.contains( "initials" ) );
-        assertTrue( nameAttrs.contains( "ou" ) );
-        assertTrue( nameAttrs.contains( "sn" ) );
-        assertTrue( nameAttrs.contains( "title" ) );
-        assertTrue( nameAttrs.contains( "l" ) );
-        assertTrue( nameAttrs.contains( "apacheExistence" ) );
-        assertTrue( nameAttrs.contains( "cn" ) );
-        assertTrue( nameAttrs.contains( "st" ) );
-        assertTrue( nameAttrs.contains( "givenName" ) );
+        // We should only have 13 AT
+        String[] expectedNames = new String[]
+        {
+            "sn", 
+            "generationQualifier", 
+            "ou", 
+            "c", 
+            "o", 
+            "l", 
+            "c-st", 
+            "givenName", 
+            "title", 
+            "cn", 
+            "initials", 
+            "dmdName", 
+            "c-ou", 
+            "c-o", 
+            "apacheExistence", 
+            "st", 
+            "c-l"
+        };
+        
+        for ( String name : expectedNames )
+        {
+            if ( nameAttrs.contains( name) )
+            {
+                nameAttrs.remove( name );
+            }
+        }
+        
+        assertEquals( 0, nameAttrs.size() );
     }
 /*
     public void testAlterObjectClassesBogusAttr() throws NamingException

Modified: directory/apacheds/branches/apacheds-schema/ldap-api-test/src/test/java/org/apache/directory/shared/client/api/unit/AbstractServerTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/ldap-api-test/src/test/java/org/apache/directory/shared/client/api/unit/AbstractServerTest.java?rev=823360&r1=823359&r2=823360&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/ldap-api-test/src/test/java/org/apache/directory/shared/client/api/unit/AbstractServerTest.java (original)
+++ directory/apacheds/branches/apacheds-schema/ldap-api-test/src/test/java/org/apache/directory/shared/client/api/unit/AbstractServerTest.java Fri Oct  9 00:03:45 2009
@@ -54,6 +54,7 @@
 import org.apache.directory.server.ldap.handlers.extended.StartTlsHandler;
 import org.apache.directory.server.ldap.handlers.extended.StoredProcedureExtendedOperationHandler;
 import org.apache.directory.server.protocol.shared.transport.TcpTransport;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.constants.SupportedSaslMechanisms;
 import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
@@ -65,7 +66,6 @@
 import org.apache.mina.util.AvailablePortFinder;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -363,7 +363,7 @@
         envFinal.put( Context.PROVIDER_URL, "" );
         rootDSE = directoryService.getAdminSession();
 
-        envFinal.put( Context.PROVIDER_URL, ServerDNConstants.OU_SCHEMA_DN );
+        envFinal.put( Context.PROVIDER_URL, SchemaConstants.OU_SCHEMA );
         schemaRoot = new InitialLdapContext( envFinal, null );
     }
 

Modified: directory/apacheds/branches/apacheds-schema/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java?rev=823360&r1=823359&r2=823360&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java (original)
+++ directory/apacheds/branches/apacheds-schema/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java Fri Oct  9 00:03:45 2009
@@ -54,6 +54,7 @@
 import org.apache.directory.server.ldap.handlers.extended.StartTlsHandler;
 import org.apache.directory.server.ldap.handlers.extended.StoredProcedureExtendedOperationHandler;
 import org.apache.directory.server.protocol.shared.transport.TcpTransport;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.constants.SupportedSaslMechanisms;
 import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
@@ -65,7 +66,6 @@
 import org.apache.mina.util.AvailablePortFinder;
 import org.junit.After;
 import org.junit.Before;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -369,7 +369,7 @@
         envFinal.put( Context.PROVIDER_URL, "" );
         rootDSE = directoryService.getAdminSession();
 
-        envFinal.put( Context.PROVIDER_URL, ServerDNConstants.OU_SCHEMA_DN );
+        envFinal.put( Context.PROVIDER_URL, SchemaConstants.OU_SCHEMA );
         schemaRoot = new InitialLdapContext( envFinal, null );
     }
 

Modified: directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/BogusSyntax.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/BogusSyntax.java?rev=823360&r1=823359&r2=823360&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/BogusSyntax.java (original)
+++ directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/BogusSyntax.java Fri Oct  9 00:03:45 2009
@@ -22,7 +22,7 @@
 
 import org.apache.directory.shared.ldap.schema.LdapSyntax;
 import org.apache.directory.shared.ldap.schema.SyntaxChecker;
-import org.apache.directory.shared.ldap.schema.syntaxCheckers.AcceptAllSyntaxChecker;
+import org.apache.directory.shared.ldap.schema.syntaxCheckers.OctetStringSyntaxChecker;
 
 import javax.naming.NamingException;
 
@@ -50,6 +50,6 @@
 
     public SyntaxChecker getSyntaxChecker() throws NamingException
     {
-        return new AcceptAllSyntaxChecker( getOid() );
+        return new OctetStringSyntaxChecker();
     }
 }

Modified: directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java?rev=823360&r1=823359&r2=823360&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java (original)
+++ directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java Fri Oct  9 00:03:45 2009
@@ -20,47 +20,47 @@
 package org.apache.directory.server.xdbm.search.impl;
 
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.directory.server.xdbm.Store;
-import org.apache.directory.server.xdbm.ForwardIndexEntry;
-import org.apache.directory.server.xdbm.tools.StoreUtils;
-import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmStore;
-import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.directory.server.core.entry.DefaultServerEntry;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.ServerStringValue;
-import org.apache.directory.server.core.entry.DefaultServerEntry;
+import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
+import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmStore;
+import org.apache.directory.server.xdbm.ForwardIndexEntry;
+import org.apache.directory.server.xdbm.Store;
+import org.apache.directory.server.xdbm.tools.StoreUtils;
 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.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.MatchingRule;
 import org.apache.directory.shared.ldap.schema.SchemaUtils;
 import org.apache.directory.shared.ldap.schema.comparators.SerializableComparator;
 import org.apache.directory.shared.ldap.schema.comparators.StringComparator;
 import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
-import org.apache.directory.shared.ldap.schema.normalizers.NoOpNormalizer;
 import org.apache.directory.shared.ldap.schema.parsers.SyntaxCheckerDescription;
 import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.shared.ldap.schema.registries.Registries;
-import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.schema.loader.ldif.LdifSchemaLoader;
-import org.apache.commons.io.FileUtils;
-import org.junit.Before;
 import org.junit.After;
+import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -707,7 +707,6 @@
         MatchingRule mr = new MatchingRule( "1.1" );
         mr.setSyntax( new BogusSyntax( 1 ) );
         mr.setLdapComparator( new StringComparator() );
-        mr.setNormalizer( new NoOpNormalizer( "1.1" ) );
         
         AttributeType at = new AttributeType( SchemaConstants.ATTRIBUTE_TYPES_AT_OID + ".5000" );
         at.addName( "bogus" );

Modified: directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java?rev=823360&r1=823359&r2=823360&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java (original)
+++ directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java Fri Oct  9 00:03:45 2009
@@ -20,45 +20,47 @@
 package org.apache.directory.server.xdbm.search.impl;
 
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.directory.server.xdbm.Store;
-import org.apache.directory.server.xdbm.ForwardIndexEntry;
-import org.apache.directory.server.xdbm.tools.StoreUtils;
-import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmStore;
-import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
-import org.apache.directory.server.core.entry.ServerEntry;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import org.apache.commons.io.FileUtils;
 import org.apache.directory.server.core.entry.DefaultServerEntry;
+import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.ServerStringValue;
+import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
+import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmStore;
+import org.apache.directory.server.xdbm.ForwardIndexEntry;
+import org.apache.directory.server.xdbm.Store;
+import org.apache.directory.server.xdbm.tools.StoreUtils;
 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.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.MatchingRule;
 import org.apache.directory.shared.ldap.schema.SchemaUtils;
 import org.apache.directory.shared.ldap.schema.comparators.SerializableComparator;
 import org.apache.directory.shared.ldap.schema.comparators.StringComparator;
 import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
-import org.apache.directory.shared.ldap.schema.normalizers.NoOpNormalizer;
 import org.apache.directory.shared.ldap.schema.parsers.SyntaxCheckerDescription;
 import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.shared.ldap.schema.registries.Registries;
-import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.schema.loader.ldif.LdifSchemaLoader;
-import org.apache.commons.io.FileUtils;
-import org.junit.Before;
 import org.junit.After;
+import org.junit.Before;
 import org.junit.BeforeClass;
-import org.junit.Test;import static org.junit.Assert.assertTrue;import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -739,7 +741,6 @@
         MatchingRule mr = new MatchingRule( "1.1" );
         mr.setSyntax( new BogusSyntax( 2 ) );
         mr.setLdapComparator( new StringComparator() );
-        mr.setNormalizer( new NoOpNormalizer( "1.1" ) );
         
         AttributeType at = new AttributeType( SchemaConstants.ATTRIBUTE_TYPES_AT_OID + ".3000" );
         at.addName( "bogus" );

Modified: directory/shared/branches/shared-schema/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/MetaSchemaConstants.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/MetaSchemaConstants.java?rev=823360&r1=823359&r2=823360&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/MetaSchemaConstants.java (original)
+++ directory/shared/branches/shared-schema/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/MetaSchemaConstants.java Fri Oct  9 00:03:45 2009
@@ -167,8 +167,10 @@
     String M_LENGTH_AT_OID                  = "1.3.6.1.4.1.18060.0.4.0.2.39";
     
     // -- schema extensions & values --
+    String X_SCHEMA                         = "X-SCHEMA";
+    String X_IS_HUMAN_READABLE              = "X-IS-HUMAN-READABLE";
+    String X_READ_ONLY                      = "X-READ-ONLY";
+    String X_ENABLED                        = "X-ENABLED";
     
-    String X_SCHEMA = "X-SCHEMA";
-    String X_IS_HUMAN_READABLE = "X-IS-HUMAN-READABLE";
     String SCHEMA_OTHER = "other";
 }

Modified: directory/shared/branches/shared-schema/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/SchemaConstants.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/SchemaConstants.java?rev=823360&r1=823359&r2=823360&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/SchemaConstants.java (original)
+++ directory/shared/branches/shared-schema/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/SchemaConstants.java Fri Oct  9 00:03:45 2009
@@ -20,6 +20,7 @@
 package org.apache.directory.shared.ldap.constants;
 
 
+
 /**
  * A utility class where we declare all the schema objects being used by any
  * ldap server.
@@ -29,15 +30,44 @@
  */
 public interface SchemaConstants
 {
+    // SchemaEntity names
+    String ATTRIBUTE_TYPE                       = "AttributeType";
+    String COMPARATOR                           = "Comparator";
+    String DIT_CONTENT_RULE                     = "DitContentRule";
+    String DIT_STRUCTURE_RULE                   = "DitStructureRule";
+    String MATCHING_RULE                        = "MatchingRule";
+    String MATCHING_RULE_USE                    = "MatchingRuleUse";
+    String NAME_FORM                            = "NameForm";
+    String NORMALIZER                           = "Normalizer";
+    String OBJECT_CLASS                         = "ObjectCLass";
+    String SYNTAX                               = "Syntax";
+    String SYNTAX_CHECKER                       = "SyntaxChecker";
+    
+    // SchemaEntity paths
+    String ATTRIBUTES_TYPE_PATH                 = "ou=attributetypes";
+    String COMPARATORS_PATH                     = "ou=comparators";
+    String DIT_CONTENT_RULES_PATH               = "ou=ditcontentrules";
+    String DIT_STRUCTURE_RULES_PATH             = "ou=ditstructurerules";
+    String MATCHING_RULES_PATH                  = "ou=matchingrules";
+    String MATCHING_RULE_USE_PATH               = "ou=matchingruleuse";
+    String NAME_FORMS_PATH                      = "ou=nameforms";
+    String NORMALIZERS_PATH                     = "ou=normalizers";
+    String OBJECT_CLASSES_PATH                  = "ou=objectclasses";
+    String SYNTAXES_PATH                        = "ou=syntaxes";
+    String SYNTAX_CHECKERS_PATH                 = "ou=syntaxcheckers";
+    
+    // Schema root
+    String OU_SCHEMA                            = "ou=schema";
+    
     // Special attributes 1.1 , * and + for search operations
-    String NO_ATTRIBUTE = "1.1";
-    String[] NO_ATTRIBUTE_ARRAY = new String[]{ NO_ATTRIBUTE };
+    String NO_ATTRIBUTE                         = "1.1";
+    String[] NO_ATTRIBUTE_ARRAY                 = new String[]{ NO_ATTRIBUTE };
     
-    String ALL_USER_ATTRIBUTES = "*";
-    String[] ALL_USER_ATTRIBUTES_ARRAY = new String[]{ ALL_USER_ATTRIBUTES };
+    String ALL_USER_ATTRIBUTES                  = "*";
+    String[] ALL_USER_ATTRIBUTES_ARRAY          = new String[]{ ALL_USER_ATTRIBUTES };
     
-    String ALL_OPERATIONAL_ATTRIBUTES = "+";
-    String[] ALL_OPERATIONAL_ATTRIBUTES_ARRAY = new String[]{ ALL_OPERATIONAL_ATTRIBUTES };
+    String ALL_OPERATIONAL_ATTRIBUTES           = "+";
+    String[] ALL_OPERATIONAL_ATTRIBUTES_ARRAY   = new String[]{ ALL_OPERATIONAL_ATTRIBUTES };
     
     // ---- ObjectClasses -----------------------------------------------------
     // Krb5Principal
@@ -437,222 +467,222 @@
     //-------------------------------------------------------------------------
     // ---- Syntaxes ----------------------------------------------------------
     //-------------------------------------------------------------------------
-    String NAME_OR_NUMERIC_ID_SYNTAX                = "1.3.6.1.4.1.18060.0.4.0.0.0";
+    String NAME_OR_NUMERIC_ID_SYNTAX                      = "1.3.6.1.4.1.18060.0.4.0.0.0";
     
-    String OBJECT_CLASS_TYPE_SYNTAX                 = "1.3.6.1.4.1.18060.0.4.0.0.1";
+    String OBJECT_CLASS_TYPE_SYNTAX                       = "1.3.6.1.4.1.18060.0.4.0.0.1";
     
-    String NUMERIC_OID_SYNTAX                       = "1.3.6.1.4.1.18060.0.4.0.0.2";
+    String NUMERIC_OID_SYNTAX                             = "1.3.6.1.4.1.18060.0.4.0.0.2";
     
-    String ATTRIBUTE_TYPE_USAGE_SYNTAX              = "1.3.6.1.4.1.18060.0.4.0.0.3";
+    String ATTRIBUTE_TYPE_USAGE_SYNTAX                    = "1.3.6.1.4.1.18060.0.4.0.0.3";
         
     // RFC 4517, par. 3.3.23
-    String NUMBER_SYNTAX                            = "1.3.6.1.4.1.18060.0.4.0.0.4";
+    String NUMBER_SYNTAX                                  = "1.3.6.1.4.1.18060.0.4.0.0.4";
     
-    String OID_LEN_SYNTAX                           = "1.3.6.1.4.1.18060.0.4.0.0.5";
+    String OID_LEN_SYNTAX                                 = "1.3.6.1.4.1.18060.0.4.0.0.5";
     
-    String OBJECT_NAME_SYNTAX                       = "1.3.6.1.4.1.18060.0.4.0.0.6";
+    String OBJECT_NAME_SYNTAX                             = "1.3.6.1.4.1.18060.0.4.0.0.6";
 
     // RFC 2252, removed in RFC 4517
-    String ACI_ITEM_SYNTAX                          = "1.3.6.1.4.1.1466.115.121.1.1";
+    String ACI_ITEM_SYNTAX                                = "1.3.6.1.4.1.1466.115.121.1.1";
 
     // RFC 2252, removed in RFC 4517
-    String ACCESS_POINT_SYNTAX                      = "1.3.6.1.4.1.1466.115.121.1.2";
+    String ACCESS_POINT_SYNTAX                            = "1.3.6.1.4.1.1466.115.121.1.2";
     
     // RFC 4517, chap 3.3.1
-    String ATTRIBUTE_TYPE_DESCRIPTION_SYNTAX        = "1.3.6.1.4.1.1466.115.121.1.3";
+    String ATTRIBUTE_TYPE_DESCRIPTION_SYNTAX              = "1.3.6.1.4.1.1466.115.121.1.3";
 
     // RFC 2252, removed in RFC 4517
-    String AUDIO_SYNTAX                             = "1.3.6.1.4.1.1466.115.121.1.4";
+    String AUDIO_SYNTAX                                   = "1.3.6.1.4.1.1466.115.121.1.4";
 
     // RFC 2252, removed in RFC 4517
-    String BINARY_SYNTAX                            = "1.3.6.1.4.1.1466.115.121.1.5";
+    String BINARY_SYNTAX                                  = "1.3.6.1.4.1.1466.115.121.1.5";
     
     // RFC 4517, chap 3.3.2
-    String BIT_STRING_SYNTAX                        = "1.3.6.1.4.1.1466.115.121.1.6";
+    String BIT_STRING_SYNTAX                              = "1.3.6.1.4.1.1466.115.121.1.6";
     
     // RFC 4517, chap 3.3.3
-    String BOOLEAN_SYNTAX                           = "1.3.6.1.4.1.1466.115.121.1.7";
+    String BOOLEAN_SYNTAX                                 = "1.3.6.1.4.1.1466.115.121.1.7";
     
     // RFC 2252, removed in RFC 4517, reintroduced in RFC 4523, chap. 2.1 
-    String CERTIFICATE_SYNTAX                       = "1.3.6.1.4.1.1466.115.121.1.8";
+    String CERTIFICATE_SYNTAX                             = "1.3.6.1.4.1.1466.115.121.1.8";
     
     // RFC 2252, removed in RFC 4517, reintroduced in RFC 4523, chap. 2.2 
-    String CERTIFICATE_LIST_SYNTAX                  = "1.3.6.1.4.1.1466.115.121.1.9";
+    String CERTIFICATE_LIST_SYNTAX                        = "1.3.6.1.4.1.1466.115.121.1.9";
 
     // RFC 2252, removed in RFC 4517, reintroduced in RFC 4523, chap. 2.3 
-    String CERTIFICATE_PAIR_SYNTAX                  = "1.3.6.1.4.1.1466.115.121.1.10";
+    String CERTIFICATE_PAIR_SYNTAX                        = "1.3.6.1.4.1.1466.115.121.1.10";
     
     // RFC 4517, chap 3.3.4
-    String COUNTRY_STRING_SYNTAX                    = "1.3.6.1.4.1.1466.115.121.1.11";
+    String COUNTRY_STRING_SYNTAX                          = "1.3.6.1.4.1.1466.115.121.1.11";
     
     // RFC 4517, chap 3.3.9
-    String DN_SYNTAX                                = "1.3.6.1.4.1.1466.115.121.1.12";
+    String DN_SYNTAX                                      = "1.3.6.1.4.1.1466.115.121.1.12";
 
     // RFC 2252, removed in RFC 4517
-    String DATA_QUALITY_SYNTAX                      = "1.3.6.1.4.1.1466.115.121.1.13";
+    String DATA_QUALITY_SYNTAX                            = "1.3.6.1.4.1.1466.115.121.1.13";
     
     // RFC 4517, chap 3.3.5
-    String DELIVERY_METHOD_SYNTAX                   = "1.3.6.1.4.1.1466.115.121.1.14";
+    String DELIVERY_METHOD_SYNTAX                         = "1.3.6.1.4.1.1466.115.121.1.14";
     
     // RFC 4517, chap 3.3.6
-    String DIRECTORY_STRING_SYNTAX                  = "1.3.6.1.4.1.1466.115.121.1.15";
+    String DIRECTORY_STRING_SYNTAX                        = "1.3.6.1.4.1.1466.115.121.1.15";
     
     // RFC 4517, chap 3.3.7
-    String DIT_CONTENT_RULE_SYNTAX                  = "1.3.6.1.4.1.1466.115.121.1.16";
+    String DIT_CONTENT_RULE_SYNTAX                        = "1.3.6.1.4.1.1466.115.121.1.16";
     
     // RFC 4517, chap 3.3.8
-    String DIT_STRUCTURE_RULE_SYNTAX                = "1.3.6.1.4.1.1466.115.121.1.17";
+    String DIT_STRUCTURE_RULE_SYNTAX                      = "1.3.6.1.4.1.1466.115.121.1.17";
     
     // RFC 2252, removed in RFC 4517
-    String DL_SUBMIT_PERMISSION_SYNTAX              = "1.3.6.1.4.1.1466.115.121.1.18";
+    String DL_SUBMIT_PERMISSION_SYNTAX                    = "1.3.6.1.4.1.1466.115.121.1.18";
 
     // RFC 2252, removed in RFC 4517
-    String DSA_QUALITY_SYNTAX                       = "1.3.6.1.4.1.1466.115.121.1.19";
+    String DSA_QUALITY_SYNTAX                             = "1.3.6.1.4.1.1466.115.121.1.19";
 
     // RFC 2252, removed in RFC 4517
-    String DSE_TYPE_SYNTAX                          = "1.3.6.1.4.1.1466.115.121.1.20";
+    String DSE_TYPE_SYNTAX                                = "1.3.6.1.4.1.1466.115.121.1.20";
     
     // RFC 4517, chap 3.3.10
-    String ENHANCED_GUIDE_SYNTAX                    = "1.3.6.1.4.1.1466.115.121.1.21";
+    String ENHANCED_GUIDE_SYNTAX                          = "1.3.6.1.4.1.1466.115.121.1.21";
     
     // RFC 4517, chap 3.3.11
-    String FACSIMILE_TELEPHONE_NUMBER_SYNTAX        = "1.3.6.1.4.1.1466.115.121.1.22";
+    String FACSIMILE_TELEPHONE_NUMBER_SYNTAX              = "1.3.6.1.4.1.1466.115.121.1.22";
     
     // RFC 4517, chap 3.3.12
-    String FAX_SYNTAX                               = "1.3.6.1.4.1.1466.115.121.1.23";
+    String FAX_SYNTAX                                     = "1.3.6.1.4.1.1466.115.121.1.23";
     
     // RFC 4517, chap 3.3.13
-    String GENERALIZED_TIME_SYNTAX                  = "1.3.6.1.4.1.1466.115.121.1.24";
+    String GENERALIZED_TIME_SYNTAX                        = "1.3.6.1.4.1.1466.115.121.1.24";
     
     // RFC 4517, chap 3.3.14
-    String GUIDE_SYNTAX                             = "1.3.6.1.4.1.1466.115.121.1.25";
+    String GUIDE_SYNTAX                                   = "1.3.6.1.4.1.1466.115.121.1.25";
     
     // RFC 4517, chap 3.3.15
-    String IA5_STRING_SYNTAX                        = "1.3.6.1.4.1.1466.115.121.1.26";
+    String IA5_STRING_SYNTAX                              = "1.3.6.1.4.1.1466.115.121.1.26";
     
     // RFC 4517, chap 3.3.16
-    String INTEGER_SYNTAX                           = "1.3.6.1.4.1.1466.115.121.1.27";
+    String INTEGER_SYNTAX                                 = "1.3.6.1.4.1.1466.115.121.1.27";
     
     // RFC 4517, chap 3.3.17
-    String JPEG_SYNTAX                              = "1.3.6.1.4.1.1466.115.121.1.28";
+    String JPEG_SYNTAX                                    = "1.3.6.1.4.1.1466.115.121.1.28";
     
     // RFC 2252, removed in RFC 4517
-    String MASTER_AND_SHADOW_ACCESS_POINTS_SYNTAX   = "1.3.6.1.4.1.1466.115.121.1.29";
+    String MASTER_AND_SHADOW_ACCESS_POINTS_SYNTAX         = "1.3.6.1.4.1.1466.115.121.1.29";
     
     // RFC 4517, chap 3.3.19
-    String MATCHING_RULE_DESCRIPTION_SYNTAX         = "1.3.6.1.4.1.1466.115.121.1.30";
+    String MATCHING_RULE_DESCRIPTION_SYNTAX               = "1.3.6.1.4.1.1466.115.121.1.30";
     
     // RFC 4517, chap 3.3.20
-    String MATCHING_RULE_USE_DESCRIPTION_SYNTAX     = "1.3.6.1.4.1.1466.115.121.1.31";
+    String MATCHING_RULE_USE_DESCRIPTION_SYNTAX           = "1.3.6.1.4.1.1466.115.121.1.31";
     
     // RFC 2252, removed in RFC 4517
-    String MAIL_PREFERENCE_SYNTAX                   = "1.3.6.1.4.1.1466.115.121.1.32";
+    String MAIL_PREFERENCE_SYNTAX                         = "1.3.6.1.4.1.1466.115.121.1.32";
     
     // RFC 2252, removed in RFC 4517
-    String MHS_OR_ADDRESS_SYNTAX                    = "1.3.6.1.4.1.1466.115.121.1.33"; 
+    String MHS_OR_ADDRESS_SYNTAX                          = "1.3.6.1.4.1.1466.115.121.1.33"; 
     
     // RFC 4517, chap 3.3.21
-    String NAME_AND_OPTIONAL_UID_SYNTAX             = "1.3.6.1.4.1.1466.115.121.1.34";
+    String NAME_AND_OPTIONAL_UID_SYNTAX                   = "1.3.6.1.4.1.1466.115.121.1.34";
     
     // RFC 4517, chap 3.3.22
-    String NAME_FORM_DESCRIPTION_SYNTAX             = "1.3.6.1.4.1.1466.115.121.1.35";
+    String NAME_FORM_DESCRIPTION_SYNTAX                   = "1.3.6.1.4.1.1466.115.121.1.35";
     
     // RFC 4517, chap 3.3.23
-    String NUMERIC_STRING_SYNTAX                    = "1.3.6.1.4.1.1466.115.121.1.36";
+    String NUMERIC_STRING_SYNTAX                          = "1.3.6.1.4.1.1466.115.121.1.36";
     
     // RFC 4517, chap 3.3.24
-    String OBJECT_CLASS_DESCRIPTION_SYNTAX          = "1.3.6.1.4.1.1466.115.121.1.37";
+    String OBJECT_CLASS_DESCRIPTION_SYNTAX                = "1.3.6.1.4.1.1466.115.121.1.37";
     
     // RFC 4517, chap 3.3.26
-    String OID_SYNTAX                               = "1.3.6.1.4.1.1466.115.121.1.38";
+    String OID_SYNTAX                                     = "1.3.6.1.4.1.1466.115.121.1.38";
     
     // RFC 4517, chap 3.3.27
-    String OTHER_MAILBOX_SYNTAX                     = "1.3.6.1.4.1.1466.115.121.1.39";
+    String OTHER_MAILBOX_SYNTAX                           = "1.3.6.1.4.1.1466.115.121.1.39";
     
     // RFC 4517, chap 3.3.25
-    String OCTET_STRING_SYNTAX                      = "1.3.6.1.4.1.1466.115.121.1.40";
+    String OCTET_STRING_SYNTAX                            = "1.3.6.1.4.1.1466.115.121.1.40";
     
     // RFC 4517, chap 3.3.28
-    String POSTAL_ADDRESS_SYNTAX                    = "1.3.6.1.4.1.1466.115.121.1.41";
+    String POSTAL_ADDRESS_SYNTAX                          = "1.3.6.1.4.1.1466.115.121.1.41";
     
     // RFC 2252, removed in RFC 4517
-    String PROTOCOL_INFORMATION_SYNTAX              = "1.3.6.1.4.1.1466.115.121.1.42";
+    String PROTOCOL_INFORMATION_SYNTAX                    = "1.3.6.1.4.1.1466.115.121.1.42";
     
     // RFC 2252, removed in RFC 4517
-    String PRESENTATION_ADDRESS_SYNTAX              = "1.3.6.1.4.1.1466.115.121.1.43";
+    String PRESENTATION_ADDRESS_SYNTAX                    = "1.3.6.1.4.1.1466.115.121.1.43";
     
     // RFC 4517, chap 3.3.29
-    String PRINTABLE_STRING_SYNTAX                  = "1.3.6.1.4.1.1466.115.121.1.44";
+    String PRINTABLE_STRING_SYNTAX                        = "1.3.6.1.4.1.1466.115.121.1.44";
     
     // RFC 2252, removed in RFC 4517
-    String SUBTREE_SPECIFICATION_SYNTAX             = "1.3.6.1.4.1.1466.115.121.1.45";
+    String SUBTREE_SPECIFICATION_SYNTAX                   = "1.3.6.1.4.1.1466.115.121.1.45";
     
     // RFC 2252, removed in RFC 4517
-    String SUPPLIER_INFORMATION_SYNTAX              = "1.3.6.1.4.1.1466.115.121.1.46";
+    String SUPPLIER_INFORMATION_SYNTAX                    = "1.3.6.1.4.1.1466.115.121.1.46";
     
     // RFC 2252, removed in RFC 4517
-    String SUPPLIER_OR_CONSUMER_SYNTAX              = "1.3.6.1.4.1.1466.115.121.1.47";
+    String SUPPLIER_OR_CONSUMER_SYNTAX                    = "1.3.6.1.4.1.1466.115.121.1.47";
     
     // RFC 2252, removed in RFC 4517
-    String SUPPLIER_AND_CONSUMER_SYNTAX             = "1.3.6.1.4.1.1466.115.121.1.48";
+    String SUPPLIER_AND_CONSUMER_SYNTAX                   = "1.3.6.1.4.1.1466.115.121.1.48";
 
     // RFC 2252, removed in RFC 4517, reintroduced in RFC 4523, chap. 2.4
-    String SUPPORTED_ALGORITHM_SYNTAX               = "1.3.6.1.4.1.1466.115.121.1.49";
+    String SUPPORTED_ALGORITHM_SYNTAX                     = "1.3.6.1.4.1.1466.115.121.1.49";
     
     // RFC 4517, chap 3.3.31
-    String TELEPHONE_NUMBER_SYNTAX                  = "1.3.6.1.4.1.1466.115.121.1.50";
+    String TELEPHONE_NUMBER_SYNTAX                        = "1.3.6.1.4.1.1466.115.121.1.50";
 
     // RFC 4517, chap 3.3.32
-    String TELETEX_TERMINAL_IDENTIFIER_SYNTAX       = "1.3.6.1.4.1.1466.115.121.1.51";
+    String TELETEX_TERMINAL_IDENTIFIER_SYNTAX             = "1.3.6.1.4.1.1466.115.121.1.51";
     
     // RFC 4517, chap 3.3.33
-    String TELEX_NUMBER_SYNTAX                      = "1.3.6.1.4.1.1466.115.121.1.52"; 
+    String TELEX_NUMBER_SYNTAX                            = "1.3.6.1.4.1.1466.115.121.1.52"; 
     
     // RFC 4517, chap 3.3.34
-    String UTC_TIME_SYNTAX                          = "1.3.6.1.4.1.1466.115.121.1.53";
+    String UTC_TIME_SYNTAX                                = "1.3.6.1.4.1.1466.115.121.1.53";
     
     // RFC 4517, chap 3.3.18
-    String LDAP_SYNTAX_DESCRIPTION_SYNTAX           = "1.3.6.1.4.1.1466.115.121.1.54";
+    String LDAP_SYNTAX_DESCRIPTION_SYNTAX                 = "1.3.6.1.4.1.1466.115.121.1.54";
     
     // RFC 2252, removed in RFC 4517
-    String MODIFY_RIGHTS_SYNTAX                     = "1.3.6.1.4.1.1466.115.121.1.55";
+    String MODIFY_RIGHTS_SYNTAX                           = "1.3.6.1.4.1.1466.115.121.1.55";
     
     // RFC 2252, removed in RFC 4517
-    String LDAP_SCHEMA_DEFINITION_SYNTAX            = "1.3.6.1.4.1.1466.115.121.1.56";
+    String LDAP_SCHEMA_DEFINITION_SYNTAX                  = "1.3.6.1.4.1.1466.115.121.1.56";
     
     // RFC 2252, removed in RFC 4517
-    String LDAP_SCHEMA_DESCRIPTION_SYNTAX           = "1.3.6.1.4.1.1466.115.121.1.57";
+    String LDAP_SCHEMA_DESCRIPTION_SYNTAX                 = "1.3.6.1.4.1.1466.115.121.1.57";
     
     // RFC 4517, chap 3.3.30
-    String SUBSTRING_ASSERTION_SYNTAX               = "1.3.6.1.4.1.1466.115.121.1.58";
+    String SUBSTRING_ASSERTION_SYNTAX                     = "1.3.6.1.4.1.1466.115.121.1.58";
 
     // From draft-ietf-pkix-ldap-v3-01.txt. Obsolete.
-    String ATTRIBUTE_CERTIFICATE_ASSERTION_SYNTAX   = "1.3.6.1.4.1.1466.115.121.1.59";
+    String ATTRIBUTE_CERTIFICATE_ASSERTION_SYNTAX         = "1.3.6.1.4.1.1466.115.121.1.59";
 
     //From RFC 4530, chap. 2.1
-    String UUID_SYNTAX                              = "1.3.6.1.1.16.1";
+    String UUID_SYNTAX                                    = "1.3.6.1.1.16.1";
     
     // From http://www.openldap.org/faq/data/cache/1145.html
-    String CSN_SYNTAX                               = "1.3.6.1.4.1.4203.666.11.2.1"; 
+    String CSN_SYNTAX                                     = "1.3.6.1.4.1.4203.666.11.2.1"; 
     
     // From http://www.openldap.org/faq/data/cache/1145.html
-    String CSN_SID_SYNTAX                           = "1.3.6.1.4.1.4203.666.11.2.4";
+    String CSN_SID_SYNTAX                                 = "1.3.6.1.4.1.4203.666.11.2.4";
 
     // Apache DS
-    String JAVA_BYTE_SYNTAX                         = "1.3.6.1.4.1.18060.0.4.1.0.0";
-    String JAVA_CHAR_SYNTAX                         = "1.3.6.1.4.1.18060.0.4.1.0.1";
-    String JAVA_SHORT_SYNTAX                        = "1.3.6.1.4.1.18060.0.4.1.0.2";
-    String JAVA_LONG_SYNTAX                         = "1.3.6.1.4.1.18060.0.4.1.0.3";
-    String JAVA_INT_SYNTAX                          = "1.3.6.1.4.1.18060.0.4.1.0.4";
+    String JAVA_BYTE_SYNTAX                               = "1.3.6.1.4.1.18060.0.4.1.0.0";
+    String JAVA_CHAR_SYNTAX                               = "1.3.6.1.4.1.18060.0.4.1.0.1";
+    String JAVA_SHORT_SYNTAX                              = "1.3.6.1.4.1.18060.0.4.1.0.2";
+    String JAVA_LONG_SYNTAX                               = "1.3.6.1.4.1.18060.0.4.1.0.3";
+    String JAVA_INT_SYNTAX                                = "1.3.6.1.4.1.18060.0.4.1.0.4";
 
     // Comparator syntax
-    String COMPARATOR_SYNTAX                        = "1.3.6.1.4.1.18060.0.4.1.0.5";
+    String COMPARATOR_SYNTAX                              = "1.3.6.1.4.1.18060.0.4.1.0.5";
     
     // Normalizer Syntax
-    String NORMALIZER_SYNTAX                        = "1.3.6.1.4.1.18060.0.4.1.0.6";
+    String NORMALIZER_SYNTAX                              = "1.3.6.1.4.1.18060.0.4.1.0.6";
     
     // SyntaxChecker Syntax
-    String SYNTAX_CHECKER_SYNTAX                    = "1.3.6.1.4.1.18060.0.4.1.0.7";
+    String SYNTAX_CHECKER_SYNTAX                          = "1.3.6.1.4.1.18060.0.4.1.0.7";
     
     //-------------------------------------------------------------------------
     // ---- MatchingRules -----------------------------------------------------

Modified: directory/shared/branches/shared-schema/ldap-convert/src/main/java/org/apache/directory/shared/converter/schema/AttributeTypeHolder.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap-convert/src/main/java/org/apache/directory/shared/converter/schema/AttributeTypeHolder.java?rev=823360&r1=823359&r2=823360&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap-convert/src/main/java/org/apache/directory/shared/converter/schema/AttributeTypeHolder.java (original)
+++ directory/shared/branches/shared-schema/ldap-convert/src/main/java/org/apache/directory/shared/converter/schema/AttributeTypeHolder.java Fri Oct  9 00:03:45 2009
@@ -22,6 +22,7 @@
 
 import javax.naming.NamingException;
 
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.client.DefaultClientEntry;
 import org.apache.directory.shared.ldap.ldif.LdifUtils;
@@ -419,7 +420,7 @@
     {
         StringBuilder sb = new StringBuilder();
 
-        String dn = "m-oid=" + oid + ", ou=attributetypes" + ", cn=" + Rdn.escapeValue( schemaName ) + ", ou=schema";
+        String dn = "m-oid=" + oid + ", " + SchemaConstants.ATTRIBUTES_TYPE_PATH + ", cn=" + Rdn.escapeValue( schemaName ) + ", ou=schema";
 
         // First dump the DN only
         Entry entry = new DefaultClientEntry( new LdapDN( dn ) );

Modified: directory/shared/branches/shared-schema/ldap-convert/src/main/java/org/apache/directory/shared/converter/schema/ObjectClassHolder.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap-convert/src/main/java/org/apache/directory/shared/converter/schema/ObjectClassHolder.java?rev=823360&r1=823359&r2=823360&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap-convert/src/main/java/org/apache/directory/shared/converter/schema/ObjectClassHolder.java (original)
+++ directory/shared/branches/shared-schema/ldap-convert/src/main/java/org/apache/directory/shared/converter/schema/ObjectClassHolder.java Fri Oct  9 00:03:45 2009
@@ -25,6 +25,7 @@
 
 import javax.naming.NamingException;
 
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.client.DefaultClientEntry;
 import org.apache.directory.shared.ldap.ldif.LdifUtils;
@@ -212,7 +213,7 @@
     {
         StringBuilder sb = new StringBuilder();
 
-        String dn = "m-oid=" + oid + ", ou=objectclasses" + ", cn=" + Rdn.escapeValue( schemaName ) + ", ou=schema";
+        String dn = "m-oid=" + oid + ", " + SchemaConstants.OBJECT_CLASSES_PATH + ", cn=" + Rdn.escapeValue( schemaName ) + ", ou=schema";
 
         // First dump the DN only
         Entry entry = new DefaultClientEntry( new LdapDN( dn ) );

Modified: directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/loader/ldif/JarLdifSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/loader/ldif/JarLdifSchemaLoader.java?rev=823360&r1=823359&r2=823360&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/loader/ldif/JarLdifSchemaLoader.java (original)
+++ directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/loader/ldif/JarLdifSchemaLoader.java Fri Oct  9 00:03:45 2009
@@ -32,6 +32,7 @@
 
 import org.apache.directory.shared.ldap.NotImplementedException;
 import org.apache.directory.shared.ldap.constants.MetaSchemaConstants;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.ldif.LdifEntry;
@@ -74,39 +75,6 @@
     /** Speedup for DEBUG mode */
     private static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
-    /** name of directory containing ldapComparators */
-    private static final String COMPARATORS_DIRNAME = "ou=comparators";
-    
-    /** name of directory containing syntaxCheckers */
-    private static final String SYNTAX_CHECKERS_DIRNAME = "ou=syntaxcheckers";
-
-    /** name of the directory containing normalizers */
-    private static final String NORMALIZERS_DIRNAME = "ou=normalizers";
-
-    /** name of the directory containing syntaxes */
-    private static final String SYNTAXES_DIRNAME = "ou=syntaxes";
-    
-    /** name of the directory containing attributeTypes */
-    private static final String ATTRIBUTE_TYPES_DIRNAME = "ou=attributetypes";
-    
-    /** name of the directory containing matchingRules */
-    private final static String MATCHING_RULES_DIRNAME = "ou=matchingrules";
-
-    /** name of the directory containing objectClasses */
-    private static final String OBJECT_CLASSES_DIRNAME = "ou=objectclasses";
-    
-    /** name of the directory containing ditStructureRules */
-    private static final String DIT_STRUCTURE_RULES_DIRNAME = "ou=ditstructurerules";
-    
-    /** name of the directory containing ditContentRules */
-    private static final String DIT_CONTENT_RULES_DIRNAME = "ou=ditcontentrules";
-    
-    /** name of the directory containing nameForms */
-    private static final String NAME_FORMS_DIRNAME = "ou=nameforms";
-    
-    /** name of the directory containing matchingRuleUses */
-    private static final String MATCHING_RULE_USES_DIRNAME = "ou=matchingruleuse";
-
     /** the factory that generates respective SchemaObjects from LDIF entries */
     private final SchemaEntityFactory factory = new SchemaEntityFactory();
     
@@ -265,17 +233,26 @@
         
         LOG.info( "Loading {} schema: \n{}", schema.getSchemaName(), schema );
         
-        loadComparators( schema, registries );
-        loadNormalizers( schema, registries );
-        loadSyntaxCheckers( schema, registries );
-        loadSyntaxes( schema, registries );
-        loadMatchingRules( schema, registries );
-        loadAttributeTypes( schema, registries );
-        loadObjectClasses( schema, registries );
-        loadMatchingRuleUses( schema, registries );
-        loadDitContentRules( schema, registries );
-        loadNameForms( schema, registries );
-        loadDitStructureRules( schema, registries );
+        registries.schemaLoaded( schema );
+        
+        try
+        {
+            loadComparators( schema, registries );
+            loadNormalizers( schema, registries );
+            loadSyntaxCheckers( schema, registries );
+            loadSyntaxes( schema, registries );
+            loadMatchingRules( schema, registries );
+            loadAttributeTypes( schema, registries );
+            loadObjectClasses( schema, registries );
+            loadMatchingRuleUses( schema, registries );
+            loadDitContentRules( schema, registries );
+            loadNameForms( schema, registries );
+            loadDitStructureRules( schema, registries );
+        }
+        catch ( Exception e )
+        {
+            LOG.error( e.getMessage() );
+        }
 
         notifyListenerOrRegistries( schema, registries );
     }
@@ -305,7 +282,7 @@
     private void loadComparators( Schema schema, Registries registries ) throws Exception
     {
         String comparatorsDirectory = getSchemaDirectory( schema ) 
-            + "/" + COMPARATORS_DIRNAME;
+            + "/" + SchemaConstants.COMPARATORS_PATH;
         
         for ( String resourcePath : RESOURCE_MAP.keySet() )
         {
@@ -317,8 +294,14 @@
                 LdifReader reader = new LdifReader( resource.openStream() );
                 LdifEntry entry = reader.next();
                 LdapComparator<?> comparator = 
-                    factory.getLdapComparator( entry.getEntry(), registries );
+                    factory.getLdapComparator( entry.getEntry(), registries, schema.getSchemaName() );
                 comparator.setOid( entry.get( MetaSchemaConstants.M_OID_AT ).getString() );
+
+                if ( schema.isEnabled() && comparator.isEnabled() )
+                {
+                    comparator.applyRegistries( registries );
+                }
+
                 registries.register( comparator );
             }
         }
@@ -337,7 +320,7 @@
     private void loadSyntaxCheckers( Schema schema, Registries registries ) throws Exception
     {
         String syntaxCheckersDirectory = getSchemaDirectory( schema ) 
-            +  "/" + SYNTAX_CHECKERS_DIRNAME;
+            +  "/" + SchemaConstants.SYNTAX_CHECKERS_PATH;
 
         for ( String resourcePath : RESOURCE_MAP.keySet() )
         {
@@ -349,7 +332,13 @@
                 LdifReader reader = new LdifReader( resource.openStream() );
                 LdifEntry entry = reader.next();
                 SyntaxChecker syntaxChecker = 
-                    factory.getSyntaxChecker( entry.getEntry(), registries );
+                    factory.getSyntaxChecker( entry.getEntry(), registries, schema.getSchemaName() );
+
+                if ( schema.isEnabled() && syntaxChecker.isEnabled() )
+                {
+                    syntaxChecker.applyRegistries( registries );
+                }
+
                 registries.register( syntaxChecker );
             }
         }
@@ -368,7 +357,7 @@
     private void loadNormalizers( Schema schema, Registries registries ) throws Exception
     {
         String normalizersDirectory = getSchemaDirectory( schema )
-            + "/" + NORMALIZERS_DIRNAME;
+            + "/" + SchemaConstants.NORMALIZERS_PATH;
 
         for ( String resourcePath : RESOURCE_MAP.keySet() )
         {
@@ -380,7 +369,13 @@
                 LdifReader reader = new LdifReader( resource.openStream() );
                 LdifEntry entry = reader.next();
                 Normalizer normalizer =
-                    factory.getNormalizer( entry.getEntry(), registries );
+                    factory.getNormalizer( entry.getEntry(), registries, schema.getSchemaName() );
+
+                if ( schema.isEnabled() && normalizer.isEnabled() )
+                {
+                    normalizer.applyRegistries( registries );
+                }
+
                 registries.register( normalizer );
             }
         }
@@ -399,7 +394,7 @@
     private void loadMatchingRules( Schema schema, Registries registries ) throws Exception
     {
         String matchingRulesDirectory = getSchemaDirectory( schema )
-            + "/" + MATCHING_RULES_DIRNAME;
+            + "/" + SchemaConstants.MATCHING_RULES_PATH;
         
         for ( String resourcePath : RESOURCE_MAP.keySet() )
         {
@@ -412,6 +407,12 @@
                 LdifEntry entry = reader.next();
                 MatchingRule matchingRule = factory.getMatchingRule( 
                     entry.getEntry(), registries, schema.getSchemaName() );
+
+                if ( matchingRule.isEnabled() )
+                {
+                    matchingRule.applyRegistries( registries );
+                }
+                
                 registries.register( matchingRule );
             }
         }
@@ -430,7 +431,7 @@
     private void loadSyntaxes( Schema schema, Registries registries ) throws Exception
     {
         String syntaxesDirectory = getSchemaDirectory( schema )
-            + "/" + SYNTAXES_DIRNAME;
+            + "/" + SchemaConstants.SYNTAXES_PATH;
 
         for ( String resourcePath : RESOURCE_MAP.keySet() )
         {
@@ -443,6 +444,12 @@
                 LdifEntry entry = reader.next();
                 LdapSyntax syntax = factory.getSyntax( 
                     entry.getEntry(), registries, schema.getSchemaName() );
+
+                if ( syntax.isEnabled() )
+                {
+                    syntax.applyRegistries( registries );
+                }
+
                 registries.register( syntax );
             }
         }
@@ -483,7 +490,7 @@
 
     	// check that the attributeTypes directory exists for the schema
         String attributeTypesDirectory = getSchemaDirectory( schema )
-            + "/" + ATTRIBUTE_TYPES_DIRNAME;
+            + "/" + SchemaConstants.ATTRIBUTES_TYPE_PATH;
         
         // get list of attributeType LDIF schema files in attributeTypes
         for ( String resourcePath : RESOURCE_MAP.keySet() )
@@ -563,6 +570,12 @@
         }
         
         AttributeType attributeType = factory.getAttributeType( entry.getEntry(), registries, schema.getSchemaName() );
+        
+        if ( attributeType.isEnabled() )
+        {
+            attributeType.applyRegistries( registries );
+        }
+        
         registries.register( attributeType );
 
         // after registering AT check if any deferred entries depend on it
@@ -607,7 +620,7 @@
     private void loadMatchingRuleUses( Schema schema, Registries registries ) throws Exception
     {
         String matchingRuleUsesDirectory = getSchemaDirectory( schema )
-            + "/" + MATCHING_RULE_USES_DIRNAME;
+            + "/" + SchemaConstants.MATCHING_RULE_USE_PATH;
         
         for ( String resourcePath : RESOURCE_MAP.keySet() )
         {
@@ -644,7 +657,7 @@
      */
     private void loadNameForms( Schema schema, Registries registries ) throws Exception
     {
-        String nameFormsDirectory = getSchemaDirectory( schema ) + "/" + NAME_FORMS_DIRNAME;
+        String nameFormsDirectory = getSchemaDirectory( schema ) + "/" + SchemaConstants.NAME_FORMS_PATH;
 
         for ( String resourcePath : RESOURCE_MAP.keySet() )
         {
@@ -681,7 +694,8 @@
      */
     private void loadDitContentRules( Schema schema, Registries registries ) throws Exception
     {
-        String ditContentRulesDirectory = getSchemaDirectory( schema ) + "/" + DIT_CONTENT_RULES_DIRNAME;
+        String ditContentRulesDirectory = getSchemaDirectory( schema ) + "/" + 
+            SchemaConstants.DIT_CONTENT_RULES_PATH;
 
         for ( String resourcePath : RESOURCE_MAP.keySet() )
         {
@@ -719,7 +733,7 @@
     private void loadDitStructureRules( Schema schema, Registries registries ) throws Exception
     {
         String ditStructureRulesDirectory = getSchemaDirectory( schema )
-            + "/" + DIT_STRUCTURE_RULES_DIRNAME;
+            + "/" + SchemaConstants.DIT_STRUCTURE_RULES_PATH;
 
         for ( String resourcePath : RESOURCE_MAP.keySet() )
         {
@@ -779,7 +793,7 @@
     	Map<String,List<LdifEntry>> deferredEntries = new HashMap<String, List<LdifEntry>>();
 
     	// get objectClasses directory, check if exists, return if not
-    	String objectClassesDirectory = getSchemaDirectory( schema ) + "/" + OBJECT_CLASSES_DIRNAME;
+    	String objectClassesDirectory = getSchemaDirectory( schema ) + "/" + SchemaConstants.OBJECT_CLASSES_PATH;
 
         for ( String resourcePath : RESOURCE_MAP.keySet() )
         {
@@ -860,6 +874,12 @@
         }
         
         ObjectClass objectClass = factory.getObjectClass( entry.getEntry(), registries, schema.getSchemaName() );
+
+        if ( objectClass.isEnabled() )
+        {
+            objectClass.applyRegistries( registries );
+        }
+
         registries.register( objectClass );
 
         // after registering AT check if any deferred entries depend on it

Modified: directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/loader/ldif/LdifSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/loader/ldif/LdifSchemaLoader.java?rev=823360&r1=823359&r2=823360&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/loader/ldif/LdifSchemaLoader.java (original)
+++ directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/loader/ldif/LdifSchemaLoader.java Fri Oct  9 00:03:45 2009
@@ -31,6 +31,8 @@
 import java.util.Map;
 import java.util.Stack;
 
+import javax.naming.NamingException;
+
 import org.apache.directory.shared.ldap.NotImplementedException;
 import org.apache.directory.shared.ldap.constants.MetaSchemaConstants;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
@@ -80,39 +82,6 @@
     /** Speedup for DEBUG mode */
     private static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
-    /** name of directory containing ldapComparators */
-    private static final String COMPARATORS_DIRNAME = "ou=comparators";
-    
-    /** name of directory containing syntaxCheckers */
-    private static final String SYNTAX_CHECKERS_DIRNAME = "ou=syntaxcheckers";
-
-    /** name of the directory containing normalizers */
-    private static final String NORMALIZERS_DIRNAME = "ou=normalizers";
-
-    /** name of the directory containing syntaxes */
-    private static final String SYNTAXES_DIRNAME = "ou=syntaxes";
-    
-    /** name of the directory containing attributeTypes */
-    private static final String ATTRIBUTE_TYPES_DIRNAME = "ou=attributetypes";
-    
-    /** name of the directory containing matchingRules */
-    private final static String MATCHING_RULES_DIRNAME = "ou=matchingrules";
-
-    /** name of the directory containing objectClasses */
-    private static final String OBJECT_CLASSES_DIRNAME = "ou=objectclasses";
-    
-    /** name of the directory containing ditStructureRules */
-    private static final String DIT_STRUCTURE_RULES_DIRNAME = "ou=ditstructurerules";
-    
-    /** name of the directory containing ditContentRules */
-    private static final String DIT_CONTENT_RULES_DIRNAME = "ou=ditcontentrules";
-    
-    /** name of the directory containing nameForms */
-    private static final String NAME_FORMS_DIRNAME = "ou=nameforms";
-    
-    /** name of the directory containing matchingRuleUses */
-    private static final String MATCHING_RULE_USES_DIRNAME = "ou=matchingruleuse";
-
     /**
      * the administrator DN - very ADS specific but we need some DN here for
      * the modifiers name when the system modifies by itself enabled and 
@@ -189,7 +158,7 @@
             LOG.debug( "Initializing schema" );
         }
         
-        File schemaDirectory = new File( baseDirectory, "ou=schema" );
+        File schemaDirectory = new File( baseDirectory, SchemaConstants.OU_SCHEMA );
         String[] ldifFiles = schemaDirectory.list( ldifFilter );
 
         for ( String ldifFile : ldifFiles )
@@ -286,6 +255,8 @@
         
         LOG.info( "Loading {} schema: \n{}", schema.getSchemaName(), schema );
         
+        registries.schemaLoaded( schema );
+        
         loadComparators( schema, registries );
         loadNormalizers( schema, registries );
         loadSyntaxCheckers( schema, registries );
@@ -320,7 +291,7 @@
         // have to now update the timestamps and update the modifiersName
         // -------------------------------------------------------------------
         
-        File schemaLdifFile = new File( new File( baseDirectory, "ou=schema" ), 
+        File schemaLdifFile = new File( new File( baseDirectory, SchemaConstants.OU_SCHEMA ), 
             "cn=" + schema.getSchemaName() + "." + LDIF_EXT );
         LdifReader reader = new LdifReader( schemaLdifFile );
         LdifEntry ldifEntry = reader.next();
@@ -373,7 +344,7 @@
      */
     private final File getSchemaDirectory( Schema schema )
     {
-        return new File( new File( baseDirectory, "ou=schema" ), 
+        return new File( new File( baseDirectory, SchemaConstants.OU_SCHEMA ), 
             "cn=" + schema.getSchemaName() );
     }
     
@@ -390,7 +361,7 @@
     private void loadComparators( Schema schema, Registries registries ) throws Exception
     {
         File comparatorsDirectory = new File( getSchemaDirectory( schema ), 
-            COMPARATORS_DIRNAME );
+            SchemaConstants.COMPARATORS_PATH );
         
         if ( ! comparatorsDirectory.exists() )
         {
@@ -404,8 +375,14 @@
             LdifReader reader = new LdifReader( ldifFile );
             LdifEntry entry = reader.next();
             LdapComparator<?> comparator = 
-                factory.getLdapComparator( entry.getEntry(), registries );
+                factory.getLdapComparator( entry.getEntry(), registries, schema.getSchemaName() );
             comparator.setOid( entry.get( MetaSchemaConstants.M_OID_AT ).getString() );
+
+            if ( schema.isEnabled() && comparator.isEnabled() )
+            {
+                comparator.applyRegistries( registries );
+            }
+
             registries.getComparatorRegistry().register( comparator );
         }
     }
@@ -423,7 +400,7 @@
     private void loadSyntaxCheckers( Schema schema, Registries registries ) throws Exception
     {
         File syntaxCheckersDirectory = new File( getSchemaDirectory( schema ), 
-            SYNTAX_CHECKERS_DIRNAME );
+            SchemaConstants.SYNTAX_CHECKERS_PATH );
         
         if ( ! syntaxCheckersDirectory.exists() )
         {
@@ -437,14 +414,15 @@
             LdifReader reader = new LdifReader( ldifFile );
             LdifEntry entry = reader.next();
             SyntaxChecker syntaxChecker = 
-                factory.getSyntaxChecker( entry.getEntry(), registries );
+                factory.getSyntaxChecker( entry.getEntry(), registries, schema.getSchemaName() );
             try
             {
             	registries.getSyntaxCheckerRegistry().register( syntaxChecker );
             }
-            catch ( Exception e )
+            catch ( NamingException e )
             {
-            	e.printStackTrace();
+            	// Do nothing at this point. Just log the event
+                LOG.warn( e.getMessage() );
             }
         }
     }
@@ -462,7 +440,7 @@
     private void loadNormalizers( Schema schema, Registries registries ) throws Exception
     {
         File normalizersDirectory = new File( getSchemaDirectory( schema ), 
-            NORMALIZERS_DIRNAME );
+            SchemaConstants.NORMALIZERS_PATH );
         
         if ( ! normalizersDirectory.exists() )
         {
@@ -476,7 +454,13 @@
             LdifReader reader = new LdifReader( ldifFile );
             LdifEntry entry = reader.next();
             Normalizer normalizer =
-                factory.getNormalizer( entry.getEntry(), registries );
+                factory.getNormalizer( entry.getEntry(), registries, schema.getSchemaName() );
+            
+            if ( schema.isEnabled() && normalizer.isEnabled() )
+            {
+                normalizer.applyRegistries( registries );
+            }
+            
             registries.getNormalizerRegistry().register( normalizer );
         }
     }
@@ -494,7 +478,7 @@
     private void loadMatchingRules( Schema schema, Registries registries ) throws Exception
     {
         File matchingRulesDirectory = new File( getSchemaDirectory( schema ), 
-            MATCHING_RULES_DIRNAME );
+            SchemaConstants.MATCHING_RULES_PATH );
         
         if ( ! matchingRulesDirectory.exists() )
         {
@@ -509,6 +493,12 @@
             LdifEntry entry = reader.next();
             MatchingRule matchingRule = factory.getMatchingRule( 
                 entry.getEntry(), registries, schema.getSchemaName() );
+
+            if ( schema.isEnabled() && matchingRule.isEnabled() )
+            {
+                matchingRule.applyRegistries( registries );
+            }
+
             registries.getMatchingRuleRegistry().register( matchingRule );
         }
     }
@@ -526,7 +516,7 @@
     private void loadSyntaxes( Schema schema, Registries registries ) throws Exception
     {
         File syntaxesDirectory = new File( getSchemaDirectory( schema ), 
-            SYNTAXES_DIRNAME );
+            SchemaConstants.SYNTAXES_PATH );
         
         if ( ! syntaxesDirectory.exists() )
         {
@@ -541,6 +531,12 @@
             LdifEntry entry = reader.next();
             LdapSyntax syntax = factory.getSyntax( 
                 entry.getEntry(), registries, schema.getSchemaName() );
+
+            if ( schema.isEnabled() && syntax.isEnabled() )
+            {
+                syntax.applyRegistries( registries );
+            }
+
             registries.getLdapSyntaxRegistry().register( syntax );
         }
     }
@@ -579,7 +575,7 @@
     	Map<String,List<LdifEntry>> deferredEntries = new HashMap<String, List<LdifEntry>>();
 
     	// check that the attributeTypes directory exists for the schema
-        File attributeTypesDirectory = new File ( getSchemaDirectory( schema ), ATTRIBUTE_TYPES_DIRNAME );
+        File attributeTypesDirectory = new File ( getSchemaDirectory( schema ), SchemaConstants.ATTRIBUTES_TYPE_PATH );
         
         if ( ! attributeTypesDirectory.exists() )
         {
@@ -661,6 +657,11 @@
         
         AttributeType attributeType = factory.getAttributeType( entry.getEntry(), registries, schema.getSchemaName() );
         registries.getAttributeTypeRegistry().register( attributeType );
+        
+        if ( schema.isEnabled() && attributeType.isEnabled() )
+        {
+            attributeType.applyRegistries( registries );
+        }
 
         // after registering AT check if any deferred entries depend on it
         if ( attributeType.getNames() != null )
@@ -704,7 +705,7 @@
     private void loadMatchingRuleUses( Schema schema, Registries registries ) throws Exception
     {
         File matchingRuleUsesDirectory = new File( getSchemaDirectory( schema ),
-            MATCHING_RULE_USES_DIRNAME );
+            SchemaConstants.MATCHING_RULE_USE_PATH );
         
         if ( ! matchingRuleUsesDirectory.exists() )
         {
@@ -743,7 +744,7 @@
     private void loadNameForms( Schema schema, Registries registries ) throws Exception
     {
         File nameFormsDirectory = new File( getSchemaDirectory( schema ),
-            NAME_FORMS_DIRNAME );
+            SchemaConstants.NAME_FORMS_PATH );
         
         if ( ! nameFormsDirectory.exists() )
         {
@@ -782,7 +783,7 @@
     private void loadDitContentRules( Schema schema, Registries registries ) throws Exception
     {
         File ditContentRulesDirectory = new File( getSchemaDirectory( schema ),
-            DIT_CONTENT_RULES_DIRNAME );
+            SchemaConstants.DIT_CONTENT_RULES_PATH );
         
         if ( ! ditContentRulesDirectory.exists() )
         {
@@ -821,7 +822,7 @@
     private void loadDitStructureRules( Schema schema, Registries registries ) throws Exception
     {
         File ditStructureRulesDirectory = new File( getSchemaDirectory( schema ),
-            DIT_STRUCTURE_RULES_DIRNAME );
+            SchemaConstants.DIT_STRUCTURE_RULES_PATH );
         
         if ( ! ditStructureRulesDirectory.exists() )
         {
@@ -881,7 +882,7 @@
     	Map<String,List<LdifEntry>> deferredEntries = new HashMap<String, List<LdifEntry>>();
 
     	// get objectClasses directory, check if exists, return if not
-    	File objectClassesDirectory = new File( getSchemaDirectory( schema ), OBJECT_CLASSES_DIRNAME );
+    	File objectClassesDirectory = new File( getSchemaDirectory( schema ), SchemaConstants.OBJECT_CLASSES_PATH );
         
     	if ( ! objectClassesDirectory.exists() )
         {
@@ -964,6 +965,12 @@
         }
         
         ObjectClass objectClass = factory.getObjectClass( entry.getEntry(), registries, schema.getSchemaName() );
+
+        if ( schema.isEnabled() && objectClass.isEnabled() )
+        {
+            objectClass.applyRegistries( registries );
+        }
+
         registries.getObjectClassRegistry().register( objectClass );
 
         // after registering AT check if any deferred entries depend on it