directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r887284 [1/2] - /directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/
Date Fri, 04 Dec 2009 17:34:14 GMT
Author: elecharny
Date: Fri Dec  4 17:34:13 2009
New Revision: 887284

URL: http://svn.apache.org/viewvc?rev=887284&view=rev
Log:
Fixed compilation errors (a new parameter added in a method was missing in the callers)

Modified:
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ComparatorSynchronizer.java
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/MatchingRuleSynchronizer.java
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/NormalizerSynchronizer.java
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ObjectClassSynchronizer.java
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SyntaxCheckerSynchronizer.java
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SyntaxSynchronizer.java

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ComparatorSynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ComparatorSynchronizer.java?rev=887284&r1=887283&r2=887284&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ComparatorSynchronizer.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ComparatorSynchronizer.java Fri Dec  4 17:34:13 2009
@@ -57,7 +57,7 @@
     /** A logger for this class */
     private static final Logger LOG = LoggerFactory.getLogger( ComparatorSynchronizer.class );
 
-    
+
     /**
      * Creates a new instance of ComparatorSynchronizer.
      *
@@ -69,31 +69,33 @@
         super( schemaManager );
     }
 
-    
+
     /**
      * {@inheritDoc}
      */
-    public boolean modify( ModifyOperationContext opContext, ServerEntry targetEntry, boolean cascade ) throws Exception
+    public boolean modify( ModifyOperationContext opContext, ServerEntry targetEntry, boolean cascade )
+        throws Exception
     {
         LdapDN name = opContext.getDn();
         ServerEntry entry = opContext.getEntry();
         String schemaName = getSchemaName( name );
         String oid = getOid( entry );
-        LdapComparator<?> comparator = factory.getLdapComparator( schemaManager, targetEntry, schemaManager.getRegistries(), schemaName );
-        
+        LdapComparator<?> comparator = factory.getLdapComparator( schemaManager, targetEntry, schemaManager
+            .getRegistries(), schemaName );
+
         if ( isSchemaEnabled( schemaName ) )
         {
             comparator.setSchemaName( schemaName );
 
             schemaManager.unregisterComparator( oid );
             schemaManager.add( comparator );
-            
+
             return SCHEMA_MODIFIED;
         }
-        
+
         return SCHEMA_UNCHANGED;
     }
-    
+
 
     /**
      * {@inheritDoc}
@@ -103,18 +105,19 @@
         LdapDN dn = entry.getDn();
         LdapDN parentDn = ( LdapDN ) dn.clone();
         parentDn.remove( parentDn.size() - 1 );
-        
+
         // The parent DN must be ou=comparators,cn=<schemaName>,ou=schema
         checkParent( parentDn, schemaManager, SchemaConstants.COMPARATOR );
-        
+
         // The new schemaObject's OID must not already exist
         checkOidIsUniqueForComparator( entry );
 
         // Build the new Comparator from the given entry
         String schemaName = getSchemaName( dn );
-        
-        LdapComparator<?> comparator = factory.getLdapComparator( schemaManager, entry, schemaManager.getRegistries(), schemaName );
-        
+
+        LdapComparator<?> comparator = factory.getLdapComparator( schemaManager, entry, schemaManager.getRegistries(),
+            schemaName );
+
         // At this point, the constructed LdapComparator has not been checked against the 
         // existing Registries. It will be checked there, if the schema and the 
         // LdapComparator are both enabled.
@@ -125,36 +128,45 @@
         {
             // As we may break the registries, work on a cloned registries
             Registries clonedRegistries = schemaManager.getRegistries().clone();
-            
+
             // Inject the newly created Comparator in the cloned registries
             clonedRegistries.add( errors, comparator );
-            
+
             // Remove the cloned registries
             clonedRegistries.clear();
-            
+
             // If we didn't get any error, add the Comparator into the real registries
             if ( errors.isEmpty() )
             {
                 // Apply the addition to the real registries
-            	schemaManager.getRegistries().add( errors, comparator );
+                schemaManager.getRegistries().add( errors, comparator );
+
+                LOG.debug( "Added {} into the enabled schema {}", dn.getUpName(), schemaName );
+
             }
             else
             {
                 // We have some error : reject the addition and get out
-                String msg = "Cannot add the Comparator " + entry.getDn().getUpName() + " into the registries, "+
-                    "the resulting registries would be inconsistent :" + StringTools.listToString( errors );
+                String msg = "Cannot add the Comparator " + entry.getDn().getUpName() + " into the registries, "
+                    + "the resulting registries would be inconsistent :" + StringTools.listToString( errors );
                 LOG.info( msg );
                 throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM );
             }
-            
-            LOG.debug( "Added {} into the enabled schema {}", dn.getUpName(), schemaName );
         }
         else
         {
-            LOG.debug( "The comparator {} cannot be added in schema {}", dn.getUpName(), schemaName );
-
             // At least, we associates the comparator with the schema
-            schemaManager.getRegistries().associateWithSchema( comparator );
+            schemaManager.getRegistries().associateWithSchema( errors, comparator );
+
+            if ( !errors.isEmpty() )
+            {
+                String msg = "Cannot add the Comparator " + entry.getDn().getUpName() + " into the registries, "
+                    + "we have got some errors :" + StringTools.listToString( errors );
+
+                throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM );
+            }
+
+            LOG.debug( "The comparator {} cannot be added in schema {}", dn.getUpName(), schemaName );
         }
     }
 
@@ -167,16 +179,16 @@
         LdapDN dn = entry.getDn();
         LdapDN parentDn = ( LdapDN ) dn.clone();
         parentDn.remove( parentDn.size() - 1 );
-        
+
         // The parent DN must be ou=comparators,cn=<schemaName>,ou=schema
         checkParent( parentDn, schemaManager, SchemaConstants.COMPARATOR );
-        
+
         // Test that the Oid exists
         LdapComparator<?> comparator = null;
-        
+
         try
         {
-            comparator = (LdapComparator<?>)checkComparatorOidExists( entry );
+            comparator = ( LdapComparator<?> ) checkComparatorOidExists( entry );
         }
         catch ( LdapSchemaViolationException lsve )
         {
@@ -184,11 +196,11 @@
             // We will check that by looking on the disk
             String schemaName = getSchemaName( dn );
             comparator = factory.getLdapComparator( schemaManager, entry, schemaManager.getRegistries(), schemaName );
-            
+
             if ( schemaManager.getRegistries().contains( comparator ) )
             {
                 // Remove the Comparator from the schema/SchemaObject Map
-                schemaManager.getRegistries().dissociateFromSchema( comparator);
+                schemaManager.getRegistries().dissociateFromSchema( comparator );
 
                 // Ok, we can exit. 
                 return;
@@ -196,27 +208,27 @@
             else
             {
                 // Ok, definitively an error
-                String msg = "Cannot delete the Comparator " + entry.getDn().getUpName() + " as it "+
-                    "does not exist in any schema";
+                String msg = "Cannot delete the Comparator " + entry.getDn().getUpName() + " as it "
+                    + "does not exist in any schema";
                 LOG.info( msg );
                 throw new LdapSchemaViolationException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM );
             }
         }
-        
+
         // Get the SchemaName
-        String schemaName = getSchemaName( entry.getDn() ); 
-        
+        String schemaName = getSchemaName( entry.getDn() );
+
         // Get the Schema
         Schema schema = schemaManager.getLoadedSchema( schemaName );
-        
+
         if ( schema.isEnabled() && comparator.isEnabled() )
         {
             // As we may break the registries, work on a cloned registries
             Registries clonedRegistries = schemaManager.getRegistries().clone();
-            
+
             // Relax the cloned registries
             clonedRegistries.setRelaxed();
-            
+
             // Before removing a comparator, we have to check that there are no MR pointing
             // on it, as it won't be done during the integrity check : in this case, the
             // check will create a default comparator instead of raising an error...
@@ -228,7 +240,7 @@
 
                 String msg = "There is at least one MatchingRule using the Comparator with OID " + comparator.getOid();
                 LOG.debug( msg );
-                
+
                 throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM );
             }
 
@@ -240,22 +252,22 @@
 
             // Check the registries now
             List<Throwable> errors = clonedRegistries.checkRefInteg();
-            
+
             // If we didn't get any error, swap the registries
             if ( errors.size() == 0 )
             {
                 clonedRegistries.setStrict();
-                schemaManager.swapRegistries( clonedRegistries  );
+                schemaManager.swapRegistries( clonedRegistries );
             }
             else
             {
                 // We have some error : reject the deletion and get out
                 // Destroy the cloned registries
                 clonedRegistries.clear();
-                
+
                 // The schema is disabled. We still have to update the backend
-                String msg = "Cannot delete the Comparator " + entry.getDn().getUpName() + " into the registries, "+
-                    "the resulting registries would be inconsistent :" + StringTools.listToString( errors );
+                String msg = "Cannot delete the Comparator " + entry.getDn().getUpName() + " into the registries, "
+                    + "the resulting registries would be inconsistent :" + StringTools.listToString( errors );
                 LOG.info( msg );
                 throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM );
             }
@@ -266,7 +278,7 @@
         }
     }
 
-    
+
     /**
      * {@inheritDoc}
      */
@@ -276,17 +288,16 @@
 
         if ( schemaManager.getMatchingRuleRegistry().contains( oldOid ) )
         {
-            throw new LdapOperationNotSupportedException( "The comparator with OID " + oldOid 
-                + " cannot have it's OID changed until all " 
-                + "matchingRules using that comparator have been deleted.", 
-                ResultCodeEnum.UNWILLING_TO_PERFORM );
+            throw new LdapOperationNotSupportedException(
+                "The comparator with OID " + oldOid + " cannot have it's OID changed until all "
+                    + "matchingRules using that comparator have been deleted.", ResultCodeEnum.UNWILLING_TO_PERFORM );
         }
 
         String oid = ( String ) newRdn.getValue();
         checkOidIsUniqueForComparator( oid );
-        
+
         String schemaName = getSchemaName( entry.getDn() );
-        
+
         if ( isSchemaEnabled( schemaName ) )
         {
             // Inject the new OID in the entry
@@ -294,15 +305,16 @@
             String newOid = ( String ) newRdn.getValue();
             checkOidIsUnique( newOid );
             targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
-            
+
             // Inject the new DN
             LdapDN newDn = new LdapDN( targetEntry.getDn() );
             newDn.remove( newDn.size() - 1 );
             newDn.add( newRdn );
             targetEntry.setDn( newDn );
-            
+
             // Register the new comparator, and unregister the old one
-            LdapComparator<?> comparator = factory.getLdapComparator( schemaManager, targetEntry, schemaManager.getRegistries(), schemaName );
+            LdapComparator<?> comparator = factory.getLdapComparator( schemaManager, targetEntry, schemaManager
+                .getRegistries(), schemaName );
             schemaManager.unregisterComparator( oldOid );
             schemaManager.add( comparator );
         }
@@ -317,21 +329,21 @@
 
         if ( schemaManager.getMatchingRuleRegistry().contains( oldOid ) )
         {
-            throw new LdapOperationNotSupportedException( "The comparator with OID " + oldOid 
-                + " cannot have it's OID changed until all " 
-                + "matchingRules using that comparator have been deleted.", 
-                ResultCodeEnum.UNWILLING_TO_PERFORM );
+            throw new LdapOperationNotSupportedException(
+                "The comparator with OID " + oldOid + " cannot have it's OID changed until all "
+                    + "matchingRules using that comparator have been deleted.", ResultCodeEnum.UNWILLING_TO_PERFORM );
         }
 
         String oid = ( String ) newRdn.getValue();
         checkOidIsUniqueForComparator( oid );
-        
+
         String newSchemaName = getSchemaName( newParentName );
-        
-        LdapComparator<?> comparator = factory.getLdapComparator( schemaManager, entry, schemaManager.getRegistries(), newSchemaName );
+
+        LdapComparator<?> comparator = factory.getLdapComparator( schemaManager, entry, schemaManager.getRegistries(),
+            newSchemaName );
 
         String oldSchemaName = getSchemaName( oriChildName );
-        
+
         if ( isSchemaEnabled( oldSchemaName ) )
         {
             schemaManager.unregisterComparator( oldOid );
@@ -344,43 +356,42 @@
     }
 
 
-    public void move( LdapDN oriChildName, LdapDN newParentName, ServerEntry entry, boolean cascade ) 
-        throws Exception
+    public void move( LdapDN oriChildName, LdapDN newParentName, ServerEntry entry, boolean cascade ) throws Exception
     {
         checkNewParent( newParentName );
         String oid = getOid( entry );
 
         if ( schemaManager.getMatchingRuleRegistry().contains( oid ) )
         {
-            throw new LdapOperationNotSupportedException( "The comparator with OID " + oid 
-                + " cannot be moved to another schema until all " 
-                + "matchingRules using that comparator have been deleted.", 
-                ResultCodeEnum.UNWILLING_TO_PERFORM );
+            throw new LdapOperationNotSupportedException( "The comparator with OID " + oid
+                + " cannot be moved to another schema until all "
+                + "matchingRules using that comparator have been deleted.", ResultCodeEnum.UNWILLING_TO_PERFORM );
         }
 
         String newSchemaName = getSchemaName( newParentName );
 
-        LdapComparator<?> comparator = factory.getLdapComparator( schemaManager, entry, schemaManager.getRegistries(), newSchemaName );
-        
+        LdapComparator<?> comparator = factory.getLdapComparator( schemaManager, entry, schemaManager.getRegistries(),
+            newSchemaName );
+
         String oldSchemaName = getSchemaName( oriChildName );
-        
+
         if ( isSchemaEnabled( oldSchemaName ) )
         {
             schemaManager.unregisterComparator( oid );
         }
-        
+
         if ( isSchemaEnabled( newSchemaName ) )
         {
             schemaManager.add( comparator );
         }
     }
-    
-    
+
+
     private void checkOidIsUniqueForComparator( String oid ) throws NamingException
     {
         if ( schemaManager.getComparatorRegistry().contains( oid ) )
         {
-            throw new LdapNamingException( "Oid " + oid + " for new schema comparator is not unique.", 
+            throw new LdapNamingException( "Oid " + oid + " for new schema comparator is not unique.",
                 ResultCodeEnum.OTHER );
         }
     }
@@ -389,10 +400,10 @@
     private void checkOidIsUniqueForComparator( ServerEntry entry ) throws Exception
     {
         String oid = getOid( entry );
-        
+
         if ( schemaManager.getComparatorRegistry().contains( oid ) )
         {
-            throw new LdapNamingException( "Oid " + oid + " for new schema comparator is not unique.", 
+            throw new LdapNamingException( "Oid " + oid + " for new schema comparator is not unique.",
                 ResultCodeEnum.OTHER );
         }
     }
@@ -408,7 +419,7 @@
 
         if ( schemaManager.getComparatorRegistry().contains( oid ) )
         {
-            return (LdapComparator<?>)schemaManager.getComparatorRegistry().get( oid );
+            return ( LdapComparator<?> ) schemaManager.getComparatorRegistry().get( oid );
         }
         else
         {
@@ -417,28 +428,29 @@
         }
     }
 
-    
+
     private void checkNewParent( LdapDN newParent ) throws NamingException
     {
         if ( newParent.size() != 3 )
         {
-            throw new LdapInvalidNameException( 
-                "The parent dn of a comparator should be at most 3 name components in length.", 
+            throw new LdapInvalidNameException(
+                "The parent dn of a comparator should be at most 3 name components in length.",
                 ResultCodeEnum.NAMING_VIOLATION );
         }
-        
+
         Rdn rdn = newParent.getRdn();
-        
-        if ( ! schemaManager.getAttributeTypeRegistry().getOidByName( rdn.getNormType() ).equals( SchemaConstants.OU_AT_OID ) )
+
+        if ( !schemaManager.getAttributeTypeRegistry().getOidByName( rdn.getNormType() ).equals(
+            SchemaConstants.OU_AT_OID ) )
         {
-            throw new LdapInvalidNameException( "The parent entry of a comparator should be an organizationalUnit.", 
+            throw new LdapInvalidNameException( "The parent entry of a comparator should be an organizationalUnit.",
                 ResultCodeEnum.NAMING_VIOLATION );
         }
-        
-        if ( ! ( ( String ) rdn.getValue() ).equalsIgnoreCase( SchemaConstants.COMPARATORS_AT ) )
+
+        if ( !( ( String ) rdn.getValue() ).equalsIgnoreCase( SchemaConstants.COMPARATORS_AT ) )
         {
-            throw new LdapInvalidNameException( 
-                "The parent entry of a comparator should have a relative name of ou=comparators.", 
+            throw new LdapInvalidNameException(
+                "The parent entry of a comparator should have a relative name of ou=comparators.",
                 ResultCodeEnum.NAMING_VIOLATION );
         }
     }

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/MatchingRuleSynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/MatchingRuleSynchronizer.java?rev=887284&r1=887283&r2=887284&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/MatchingRuleSynchronizer.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/MatchingRuleSynchronizer.java Fri Dec  4 17:34:13 2009
@@ -55,14 +55,14 @@
     /** A logger for this class */
     private static final Logger LOG = LoggerFactory.getLogger( MatchingRuleSynchronizer.class );
 
+
     /**
      * Creates a new instance of MatchingRuleSynchronizer.
      *
      * @param schemaManager The global schemaManager
      * @throws Exception If the initialization failed
      */
-    public MatchingRuleSynchronizer( SchemaManager schemaManager ) 
-        throws Exception
+    public MatchingRuleSynchronizer( SchemaManager schemaManager ) throws Exception
     {
         super( schemaManager );
     }
@@ -71,21 +71,22 @@
     /**
      * {@inheritDoc}
      */
-    public boolean modify( ModifyOperationContext opContext, ServerEntry targetEntry, 
-        boolean cascade ) throws Exception
+    public boolean modify( ModifyOperationContext opContext, ServerEntry targetEntry, boolean cascade )
+        throws Exception
     {
         LdapDN name = opContext.getDn();
         ServerEntry entry = opContext.getEntry();
         String schemaName = getSchemaName( name );
-        MatchingRule mr = factory.getMatchingRule( schemaManager, targetEntry, schemaManager.getRegistries(), schemaName );
-        
+        MatchingRule mr = factory.getMatchingRule( schemaManager, targetEntry, schemaManager.getRegistries(),
+            schemaName );
+
         String oldOid = getOid( entry );
-        
+
         if ( isSchemaEnabled( schemaName ) )
         {
             schemaManager.unregisterMatchingRule( oldOid );
             schemaManager.add( mr );
-            
+
             return SCHEMA_MODIFIED;
         }
         else
@@ -109,41 +110,42 @@
 
         // The new schemaObject's OID must not already exist
         checkOidIsUnique( entry );
-        
+
         // Build the new MatchingRule from the given entry
         String schemaName = getSchemaName( dn );
-        
-        MatchingRule matchingRule = factory.getMatchingRule( schemaManager, entry, schemaManager.getRegistries(), schemaName );
+
+        MatchingRule matchingRule = factory.getMatchingRule( schemaManager, entry, schemaManager.getRegistries(),
+            schemaName );
         List<Throwable> errors = new ArrayList<Throwable>();
 
         // At this point, the constructed MatchingRule has not been checked against the 
         // existing Registries. It may be broken (missing SUP, or such), it will be checked
         // there, if the schema and the MatchingRule are both enabled.
         Schema schema = schemaManager.getLoadedSchema( schemaName );
-        
+
         if ( schema.isEnabled() && matchingRule.isEnabled() )
         {
             // As we may break the registries, work on a cloned registries
             Registries clonedRegistries = schemaManager.getRegistries().clone();
 
             clonedRegistries.add( errors, matchingRule );
-            
+
             // Remove the cloned registries
             clonedRegistries.clear();
-            
+
             // If we didn't get any error, swap the registries
             if ( errors.isEmpty() )
             {
                 // Apply the addition to the real registries
-            	schemaManager.getRegistries().add( errors, matchingRule );
+                schemaManager.getRegistries().add( errors, matchingRule );
 
                 LOG.debug( "Added {} into the enabled schema {}", dn.getUpName(), schemaName );
             }
             else
             {
                 // We have some error : reject the addition and get out
-                String msg = "Cannot add the MatchingRule " + entry.getDn().getUpName() + " into the registries, "+
-                    "the resulting registries would be inconsistent :" + StringTools.listToString( errors );
+                String msg = "Cannot add the MatchingRule " + entry.getDn().getUpName() + " into the registries, "
+                    + "the resulting registries would be inconsistent :" + StringTools.listToString( errors );
                 LOG.info( msg );
                 throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM );
             }
@@ -152,7 +154,15 @@
         {
             // At least, we register the OID in the globalOidRegistry, and associates it with the
             // schema
-            schemaManager.getRegistries().associateWithSchema( matchingRule );
+            schemaManager.getRegistries().associateWithSchema( errors, matchingRule );
+
+            if ( !errors.isEmpty() )
+            {
+                String msg = "Cannot add the MatchingRule " + entry.getDn().getUpName() + " into the registries, "
+                    + "we have got some errors :" + StringTools.listToString( errors );
+
+                throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM );
+            }
 
             LOG.debug( "Added {} into the disabled schema {}", dn.getUpName(), schemaName );
         }
@@ -167,54 +177,54 @@
         LdapDN dn = entry.getDn();
         LdapDN parentDn = ( LdapDN ) dn.clone();
         parentDn.remove( parentDn.size() - 1 );
-        
+
         // The parent DN must be ou=matchingrules,cn=<schemaName>,ou=schema
         checkParent( parentDn, schemaManager, SchemaConstants.MATCHING_RULE );
 
         // Test that the Oid exists
-        MatchingRule matchingRule = (MatchingRule)checkOidExists( entry );
-        
+        MatchingRule matchingRule = ( MatchingRule ) checkOidExists( entry );
+
         // Get the SchemaName
         String schemaName = getSchemaName( entry.getDn() );
-        
+
         // Get the schema 
         Schema schema = schemaManager.getLoadedSchema( schemaName );
-        
+
         if ( schema.isEnabled() && matchingRule.isEnabled() )
         {
             // As we may break the registries, work on a cloned registries
             Registries clonedRegistries = schemaManager.getRegistries().clone();
-            
+
             // Relax the cloned registries
             clonedRegistries.setRelaxed();
-            
+
             // Remove this MatchingRule from the Registries
             clonedRegistries.unregister( matchingRule );
-            
+
             // Remove the MatchingRule from the schema/SchemaObject Map
             clonedRegistries.dissociateFromSchema( matchingRule );
 
             // Update the cross references for MatchingRule
             clonedRegistries.delCrossReferences( matchingRule );
-            
+
             // Check the registries now
             List<Throwable> errors = clonedRegistries.checkRefInteg();
-            
+
             // If we didn't get any error, swap the registries
             if ( errors.size() == 0 )
             {
                 clonedRegistries.setStrict();
-                schemaManager.swapRegistries( clonedRegistries  );
+                schemaManager.swapRegistries( clonedRegistries );
             }
             else
             {
                 // We have some error : reject the deletion and get out
                 // Destroy the cloned registries
                 clonedRegistries.clear();
-                
+
                 // The schema is disabled. We still have to update the backend
-                String msg = "Cannot delete the MatchingRule " + entry.getDn().getUpName() + " into the registries, "+
-                    "the resulting registries would be inconsistent :" + StringTools.listToString( errors );
+                String msg = "Cannot delete the MatchingRule " + entry.getDn().getUpName() + " into the registries, "
+                    + "the resulting registries would be inconsistent :" + StringTools.listToString( errors );
                 LOG.info( msg );
                 throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM );
             }
@@ -222,15 +232,15 @@
         else
         {
             unregisterOids( matchingRule );
-            
+
             // Remove the MatchingRule from the schema/SchemaObject Map
             schemaManager.getRegistries().dissociateFromSchema( matchingRule );
-            
+
             LOG.debug( "Removed {} from the disabled schema {}", matchingRule, schemaName );
         }
     }
 
-    
+
     /**
      * {@inheritDoc}
      */
@@ -241,9 +251,10 @@
         ServerEntry targetEntry = ( ServerEntry ) entry.clone();
         String newOid = ( String ) newRdn.getValue();
         checkOidIsUnique( newOid );
-        
+
         targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
-        MatchingRule mr = factory.getMatchingRule( schemaManager, targetEntry, schemaManager.getRegistries(), schemaName );
+        MatchingRule mr = factory.getMatchingRule( schemaManager, targetEntry, schemaManager.getRegistries(),
+            schemaName );
 
         if ( isSchemaEnabled( schemaName ) )
         {
@@ -258,20 +269,22 @@
     }
 
 
-    public void moveAndRename( LdapDN oriChildName, LdapDN newParentName, Rdn newRdn, boolean deleteOldRn, 
+    public void moveAndRename( LdapDN oriChildName, LdapDN newParentName, Rdn newRdn, boolean deleteOldRn,
         ServerEntry entry, boolean cascade ) throws Exception
     {
         checkNewParent( newParentName );
         String oldSchemaName = getSchemaName( oriChildName );
         String newSchemaName = getSchemaName( newParentName );
-        MatchingRule oldMr = factory.getMatchingRule( schemaManager, entry, schemaManager.getRegistries(), oldSchemaName );
+        MatchingRule oldMr = factory.getMatchingRule( schemaManager, entry, schemaManager.getRegistries(),
+            oldSchemaName );
         ServerEntry targetEntry = ( ServerEntry ) entry.clone();
         String newOid = ( String ) newRdn.getValue();
         checkOidIsUnique( newOid );
-        
+
         targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
-        MatchingRule mr = factory.getMatchingRule( schemaManager, targetEntry, schemaManager.getRegistries(), newSchemaName );
-        
+        MatchingRule mr = factory.getMatchingRule( schemaManager, targetEntry, schemaManager.getRegistries(),
+            newSchemaName );
+
         if ( isSchemaEnabled( oldSchemaName ) )
         {
             schemaManager.unregisterMatchingRule( oldMr.getOid() );
@@ -292,14 +305,15 @@
     }
 
 
-    public void move( LdapDN oriChildName, LdapDN newParentName, ServerEntry entry, boolean cascade ) 
-        throws Exception
+    public void move( LdapDN oriChildName, LdapDN newParentName, ServerEntry entry, boolean cascade ) throws Exception
     {
         checkNewParent( newParentName );
         String oldSchemaName = getSchemaName( oriChildName );
         String newSchemaName = getSchemaName( newParentName );
-        MatchingRule oldMr = factory.getMatchingRule( schemaManager, entry, schemaManager.getRegistries(), oldSchemaName );
-        MatchingRule newMr = factory.getMatchingRule( schemaManager, entry, schemaManager.getRegistries(), newSchemaName );
+        MatchingRule oldMr = factory.getMatchingRule( schemaManager, entry, schemaManager.getRegistries(),
+            oldSchemaName );
+        MatchingRule newMr = factory.getMatchingRule( schemaManager, entry, schemaManager.getRegistries(),
+            newSchemaName );
 
         if ( isSchemaEnabled( oldSchemaName ) )
         {
@@ -309,7 +323,7 @@
         {
             unregisterOids( oldMr );
         }
-        
+
         if ( isSchemaEnabled( newSchemaName ) )
         {
             schemaManager.add( newMr );
@@ -319,28 +333,29 @@
             registerOids( newMr );
         }
     }
-    
-    
+
+
     private void checkNewParent( LdapDN newParent ) throws NamingException
     {
         if ( newParent.size() != 3 )
         {
-            throw new LdapInvalidNameException( 
-                "The parent dn of a matchingRule should be at most 3 name components in length.", 
+            throw new LdapInvalidNameException(
+                "The parent dn of a matchingRule should be at most 3 name components in length.",
                 ResultCodeEnum.NAMING_VIOLATION );
         }
-        
+
         Rdn rdn = newParent.getRdn();
-        if ( ! schemaManager.getAttributeTypeRegistry().getOidByName( rdn.getNormType() ).equals( SchemaConstants.OU_AT_OID ) )
+        if ( !schemaManager.getAttributeTypeRegistry().getOidByName( rdn.getNormType() ).equals(
+            SchemaConstants.OU_AT_OID ) )
         {
-            throw new LdapInvalidNameException( "The parent entry of a matchingRule should be an organizationalUnit.", 
+            throw new LdapInvalidNameException( "The parent entry of a matchingRule should be an organizationalUnit.",
                 ResultCodeEnum.NAMING_VIOLATION );
         }
-        
-        if ( ! ( ( String ) rdn.getValue() ).equalsIgnoreCase( SchemaConstants.MATCHING_RULES_AT ) )
+
+        if ( !( ( String ) rdn.getValue() ).equalsIgnoreCase( SchemaConstants.MATCHING_RULES_AT ) )
         {
-            throw new LdapInvalidNameException( 
-                "The parent entry of a syntax should have a relative name of ou=matchingRules.", 
+            throw new LdapInvalidNameException(
+                "The parent entry of a syntax should have a relative name of ou=matchingRules.",
                 ResultCodeEnum.NAMING_VIOLATION );
         }
     }

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/NormalizerSynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/NormalizerSynchronizer.java?rev=887284&r1=887283&r2=887284&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/NormalizerSynchronizer.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/NormalizerSynchronizer.java Fri Dec  4 17:34:13 2009
@@ -55,6 +55,7 @@
     /** A logger for this class */
     private static final Logger LOG = LoggerFactory.getLogger( NormalizerSynchronizer.class );
 
+
     /**
      * Creates a new instance of NormalizerSynchronizer.
      *
@@ -65,29 +66,31 @@
     {
         super( schemaManager );
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
-    public boolean modify( ModifyOperationContext opContext, ServerEntry targetEntry, boolean cascade ) throws Exception
+    public boolean modify( ModifyOperationContext opContext, ServerEntry targetEntry, boolean cascade )
+        throws Exception
     {
         LdapDN name = opContext.getDn();
         ServerEntry entry = opContext.getEntry();
         String schemaName = getSchemaName( name );
         String oldOid = getOid( entry );
-        Normalizer normalizer = factory.getNormalizer( schemaManager, targetEntry, schemaManager.getRegistries(), schemaName );
-        
+        Normalizer normalizer = factory.getNormalizer( schemaManager, targetEntry, schemaManager.getRegistries(),
+            schemaName );
+
         if ( isSchemaEnabled( schemaName ) )
         {
             normalizer.setSchemaName( schemaName );
 
             schemaManager.unregisterNormalizer( oldOid );
             schemaManager.add( normalizer );
-            
+
             return SCHEMA_MODIFIED;
         }
-        
+
         return SCHEMA_UNCHANGED;
     }
 
@@ -106,10 +109,10 @@
 
         // The new schemaObject's OID must not already exist
         checkOidIsUniqueForNormalizer( entry );
-        
+
         // Build the new Normalizer from the given entry
         String schemaName = getSchemaName( dn );
-        
+
         Normalizer normalizer = factory.getNormalizer( schemaManager, entry, schemaManager.getRegistries(), schemaName );
 
         // At this point, the constructed Normalizer has not been checked against the 
@@ -117,41 +120,49 @@
         // Normalizer are both enabled.
         Schema schema = schemaManager.getLoadedSchema( schemaName );
         List<Throwable> errors = new ArrayList<Throwable>();
-        
+
         if ( schema.isEnabled() && normalizer.isEnabled() )
         {
             // As we may break the registries, work on a cloned registries
             Registries clonedRegistries = schemaManager.getRegistries().clone();
-            
+
             // Inject the newly created Normalizer in the cloned registries
             clonedRegistries.add( errors, normalizer );
-            
+
             // Remove the cloned registries
             clonedRegistries.clear();
-            
+
             // If we didn't get any error, add the Normalizer into the real registries
             if ( errors.isEmpty() )
             {
                 // Apply the addition to the real registries
-            	schemaManager.getRegistries().add( errors, normalizer );
+                schemaManager.getRegistries().add( errors, normalizer );
+
+                LOG.debug( "Added {} into the enabled schema {}", dn.getUpName(), schemaName );
             }
             else
             {
                 // We have some error : reject the addition and get out
-                String msg = "Cannot add the Normalizer " + entry.getDn().getUpName() + " into the registries, "+
-                    "the resulting registries would be inconsistent :" + StringTools.listToString( errors );
+                String msg = "Cannot add the Normalizer " + entry.getDn().getUpName() + " into the registries, "
+                    + "the resulting registries would be inconsistent :" + StringTools.listToString( errors );
                 LOG.info( msg );
                 throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM );
             }
-            
-            LOG.debug( "Added {} into the enabled schema {}", dn.getUpName(), schemaName );
         }
         else
         {
-            LOG.debug( "The normalizer {} cannot be added in schema {}", dn.getUpName(), schemaName );
-
             // At least, we associates the Normalizer with the schema
-            schemaManager.getRegistries().associateWithSchema( normalizer );
+            schemaManager.getRegistries().associateWithSchema( errors, normalizer );
+
+            if ( !errors.isEmpty() )
+            {
+                String msg = "Cannot add the Normalizer " + entry.getDn().getUpName() + " into the registries, "
+                    + "we have got some errors :" + StringTools.listToString( errors );
+
+                throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM );
+            }
+
+            LOG.debug( "The normalizer {} cannot be added in schema {}", dn.getUpName(), schemaName );
         }
     }
 
@@ -164,22 +175,22 @@
         LdapDN dn = entry.getDn();
         LdapDN parentDn = ( LdapDN ) dn.clone();
         parentDn.remove( parentDn.size() - 1 );
-        
+
         // The parent DN must be ou=normalizers,cn=<schemaName>,ou=schema
         checkParent( parentDn, schemaManager, SchemaConstants.NORMALIZER );
-        
+
         // Get the Normalizer from the given entry ( it has been grabbed from the server earlier)
         String schemaName = getSchemaName( entry.getDn() );
         Normalizer normalizer = factory.getNormalizer( schemaManager, entry, schemaManager.getRegistries(), schemaName );
-        
+
         String oid = normalizer.getOid();
-        
+
         if ( isSchemaEnabled( schemaName ) )
         {
             if ( schemaManager.getRegistries().isReferenced( normalizer ) )
             {
-                String msg = "Cannot delete " + entry.getDn().getUpName() + ", as there are some " +
-                    " dependant SchemaObjects :\n" + getReferenced( normalizer );
+                String msg = "Cannot delete " + entry.getDn().getUpName() + ", as there are some "
+                    + " dependant SchemaObjects :\n" + getReferenced( normalizer );
                 LOG.warn( msg );
                 throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM );
             }
@@ -188,7 +199,6 @@
             // be loaded into the schemaManager if it's disabled
             deleteFromSchema( normalizer, schemaName );
         }
-        
 
         if ( schemaManager.getNormalizerRegistry().contains( oid ) )
         {
@@ -200,7 +210,7 @@
             LOG.debug( "Removed {} from the enabled schema {}", normalizer, schemaName );
         }
     }
-    
+
 
     /**
      * {@inheritDoc}
@@ -212,28 +222,28 @@
 
         if ( schemaManager.getMatchingRuleRegistry().contains( oldOid ) )
         {
-            throw new LdapOperationNotSupportedException( "The normalizer with OID " + oldOid 
-                + " cannot have it's OID changed until all " 
-                + "matchingRules using that normalizer have been deleted.", 
-                ResultCodeEnum.UNWILLING_TO_PERFORM );
+            throw new LdapOperationNotSupportedException(
+                "The normalizer with OID " + oldOid + " cannot have it's OID changed until all "
+                    + "matchingRules using that normalizer have been deleted.", ResultCodeEnum.UNWILLING_TO_PERFORM );
         }
 
         String newOid = ( String ) newRdn.getValue();
         checkOidIsUniqueForNormalizer( newOid );
-        
+
         if ( isSchemaEnabled( schemaName ) )
         {
             // Inject the new OID
             ServerEntry targetEntry = ( ServerEntry ) entry.clone();
             targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
-            
+
             // Inject the new DN
             LdapDN newDn = new LdapDN( targetEntry.getDn() );
             newDn.remove( newDn.size() - 1 );
             newDn.add( newRdn );
             targetEntry.setDn( newDn );
 
-            Normalizer normalizer = factory.getNormalizer( schemaManager, targetEntry, schemaManager.getRegistries(), schemaName );
+            Normalizer normalizer = factory.getNormalizer( schemaManager, targetEntry, schemaManager.getRegistries(),
+                schemaName );
             schemaManager.unregisterNormalizer( oldOid );
             schemaManager.add( normalizer );
         }
@@ -250,15 +260,15 @@
 
         if ( schemaManager.getMatchingRuleRegistry().contains( oldOid ) )
         {
-            throw new LdapOperationNotSupportedException( "The normalizer with OID " + oldOid 
-                + " cannot have it's OID changed until all " 
-                + "matchingRules using that normalizer have been deleted.", 
-                ResultCodeEnum.UNWILLING_TO_PERFORM );
+            throw new LdapOperationNotSupportedException(
+                "The normalizer with OID " + oldOid + " cannot have it's OID changed until all "
+                    + "matchingRules using that normalizer have been deleted.", ResultCodeEnum.UNWILLING_TO_PERFORM );
         }
 
         String oid = ( String ) newRdn.getValue();
         checkOidIsUniqueForNormalizer( oid );
-        Normalizer normalizer = factory.getNormalizer( schemaManager, entry, schemaManager.getRegistries(), newSchemaName );
+        Normalizer normalizer = factory.getNormalizer( schemaManager, entry, schemaManager.getRegistries(),
+            newSchemaName );
 
         if ( isSchemaEnabled( oldSchemaName ) )
         {
@@ -272,8 +282,7 @@
     }
 
 
-    public void move( LdapDN oriChildName, LdapDN newParentName, ServerEntry entry, boolean cascade ) 
-        throws Exception
+    public void move( LdapDN oriChildName, LdapDN newParentName, ServerEntry entry, boolean cascade ) throws Exception
     {
         checkNewParent( newParentName );
         String oid = getOid( entry );
@@ -282,32 +291,31 @@
 
         if ( schemaManager.getMatchingRuleRegistry().contains( oid ) )
         {
-            throw new LdapOperationNotSupportedException( "The normalizer with OID " + oid 
-                + " cannot be moved to another schema until all " 
-                + "matchingRules using that normalizer have been deleted.", 
-                ResultCodeEnum.UNWILLING_TO_PERFORM );
+            throw new LdapOperationNotSupportedException( "The normalizer with OID " + oid
+                + " cannot be moved to another schema until all "
+                + "matchingRules using that normalizer have been deleted.", ResultCodeEnum.UNWILLING_TO_PERFORM );
         }
 
-        Normalizer normalizer = factory.getNormalizer( schemaManager, entry, schemaManager.getRegistries(), newSchemaName );
-        
+        Normalizer normalizer = factory.getNormalizer( schemaManager, entry, schemaManager.getRegistries(),
+            newSchemaName );
+
         if ( isSchemaEnabled( oldSchemaName ) )
         {
             schemaManager.unregisterNormalizer( oid );
         }
-        
-        
+
         if ( isSchemaEnabled( newSchemaName ) )
         {
             schemaManager.add( normalizer );
         }
     }
 
-    
+
     private void checkOidIsUniqueForNormalizer( String oid ) throws NamingException
     {
         if ( schemaManager.getNormalizerRegistry().contains( oid ) )
         {
-            throw new LdapNamingException( "Oid " + oid + " for new schema normalizer is not unique.", 
+            throw new LdapNamingException( "Oid " + oid + " for new schema normalizer is not unique.",
                 ResultCodeEnum.OTHER );
         }
     }
@@ -316,10 +324,10 @@
     private void checkOidIsUniqueForNormalizer( ServerEntry entry ) throws Exception
     {
         String oid = getOid( entry );
-        
+
         if ( schemaManager.getNormalizerRegistry().contains( oid ) )
         {
-            throw new LdapNamingException( "Oid " + oid + " for new schema normalizer is not unique.", 
+            throw new LdapNamingException( "Oid " + oid + " for new schema normalizer is not unique.",
                 ResultCodeEnum.OTHER );
         }
     }
@@ -329,23 +337,24 @@
     {
         if ( newParent.size() != 3 )
         {
-            throw new LdapInvalidNameException( 
-                "The parent dn of a normalizer should be at most 3 name components in length.", 
+            throw new LdapInvalidNameException(
+                "The parent dn of a normalizer should be at most 3 name components in length.",
                 ResultCodeEnum.NAMING_VIOLATION );
         }
-        
+
         Rdn rdn = newParent.getRdn();
 
-        if ( ! schemaManager.getAttributeTypeRegistry().getOidByName( rdn.getNormType() ).equals( SchemaConstants.OU_AT_OID ) )
+        if ( !schemaManager.getAttributeTypeRegistry().getOidByName( rdn.getNormType() ).equals(
+            SchemaConstants.OU_AT_OID ) )
         {
-            throw new LdapInvalidNameException( "The parent entry of a normalizer should be an organizationalUnit.", 
+            throw new LdapInvalidNameException( "The parent entry of a normalizer should be an organizationalUnit.",
                 ResultCodeEnum.NAMING_VIOLATION );
         }
-        
-        if ( ! ( ( String ) rdn.getValue() ).equalsIgnoreCase( SchemaConstants.NORMALIZERS_AT ) )
+
+        if ( !( ( String ) rdn.getValue() ).equalsIgnoreCase( SchemaConstants.NORMALIZERS_AT ) )
         {
-            throw new LdapInvalidNameException( 
-                "The parent entry of a normalizer should have a relative name of ou=normalizers.", 
+            throw new LdapInvalidNameException(
+                "The parent entry of a normalizer should have a relative name of ou=normalizers.",
                 ResultCodeEnum.NAMING_VIOLATION );
         }
     }

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ObjectClassSynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ObjectClassSynchronizer.java?rev=887284&r1=887283&r2=887284&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ObjectClassSynchronizer.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ObjectClassSynchronizer.java Fri Dec  4 17:34:13 2009
@@ -71,22 +71,24 @@
     /**
      * {@inheritDoc}
      */
-    public boolean modify( ModifyOperationContext opContext, ServerEntry targetEntry, boolean cascade ) throws Exception
+    public boolean modify( ModifyOperationContext opContext, ServerEntry targetEntry, boolean cascade )
+        throws Exception
     {
         LdapDN name = opContext.getDn();
         ServerEntry entry = opContext.getEntry();
         String oid = getOid( entry );
-        ObjectClass oc = factory.getObjectClass( schemaManager, targetEntry, schemaManager.getRegistries(), getSchemaName( name ) );
+        ObjectClass oc = factory.getObjectClass( schemaManager, targetEntry, schemaManager.getRegistries(),
+            getSchemaName( name ) );
         String schemaName = getSchemaName( entry.getDn() );
 
         if ( isSchemaEnabled( schemaName ) )
         {
             schemaManager.unregisterObjectClass( oid );
             schemaManager.add( oc );
-            
+
             return SCHEMA_MODIFIED;
         }
-        
+
         return SCHEMA_UNCHANGED;
     }
 
@@ -99,47 +101,48 @@
         LdapDN dn = entry.getDn();
         LdapDN parentDn = ( LdapDN ) dn.clone();
         parentDn.remove( parentDn.size() - 1 );
-        
+
         // The parent DN must be ou=objectclasses,cn=<schemaName>,ou=schema
         checkParent( parentDn, schemaManager, SchemaConstants.OBJECT_CLASS );
-        
+
         // The new schemaObject's OID must not already exist
         checkOidIsUnique( entry );
-        
+
         // Build the new ObjectClass from the given entry
         String schemaName = getSchemaName( dn );
-        
-        ObjectClass objectClass = factory.getObjectClass( schemaManager, entry, schemaManager.getRegistries(), schemaName );
+
+        ObjectClass objectClass = factory.getObjectClass( schemaManager, entry, schemaManager.getRegistries(),
+            schemaName );
         List<Throwable> errors = new ArrayList<Throwable>();
 
         // At this point, the constructed ObjectClass has not been checked against the 
         // existing Registries. It may be broken (missing SUP, or such), it will be checked
         // there, if the schema and the ObjectClass are both enabled.
         Schema schema = schemaManager.getLoadedSchema( schemaName );
-        
+
         if ( schema.isEnabled() && objectClass.isEnabled() )
         {
             // As we may break the registries, work on a cloned registries
             Registries clonedRegistries = schemaManager.getRegistries().clone();
 
             clonedRegistries.add( errors, objectClass );
-            
+
             // Remove the cloned registries
             clonedRegistries.clear();
-            
+
             // If we didn't get any error, swap the registries
             if ( errors.isEmpty() )
             {
                 // Apply the addition to the real registries
-            	schemaManager.getRegistries().add( errors, objectClass );
+                schemaManager.getRegistries().add( errors, objectClass );
 
                 LOG.debug( "Added {} into the enabled schema {}", dn.getUpName(), schemaName );
             }
             else
             {
                 // We have some error : reject the addition and get out
-                String msg = "Cannot add the ObjectClass " + entry.getDn().getUpName() + " into the registries, "+
-                    "the resulting registries would be inconsistent :" + StringTools.listToString( errors );
+                String msg = "Cannot add the ObjectClass " + entry.getDn().getUpName() + " into the registries, "
+                    + "the resulting registries would be inconsistent :" + StringTools.listToString( errors );
                 LOG.info( msg );
                 throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM );
             }
@@ -148,7 +151,15 @@
         {
             // At least, we register the OID in the globalOidRegistry, and associates it with the
             // schema
-            schemaManager.getRegistries().associateWithSchema( objectClass );
+            schemaManager.getRegistries().associateWithSchema( errors, objectClass );
+
+            if ( !errors.isEmpty() )
+            {
+                String msg = "Cannot add the OjectClass " + entry.getDn().getUpName() + " into the registries, "
+                    + "we have got some errors :" + StringTools.listToString( errors );
+
+                throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM );
+            }
 
             LOG.debug( "Added {} into the disabled schema {}", dn.getUpName(), schemaName );
         }
@@ -163,13 +174,14 @@
         LdapDN dn = entry.getDn();
         LdapDN parentDn = ( LdapDN ) dn.clone();
         parentDn.remove( parentDn.size() - 1 );
-        
+
         // The parent DN must be ou=objectclasses,cn=<schemaName>,ou=schema
         checkParent( parentDn, schemaManager, SchemaConstants.OBJECT_CLASS );
-        
+
         // Get the ObjectClass from the given entry ( it has been grabbed from the server earlier)
         String schemaName = getSchemaName( entry.getDn() );
-        ObjectClass objectClass = factory.getObjectClass( schemaManager, entry, schemaManager.getRegistries(), schemaName );
+        ObjectClass objectClass = factory.getObjectClass( schemaManager, entry, schemaManager.getRegistries(),
+            schemaName );
 
         // Applies the Registries to this ObjectClass 
         Schema schema = schemaManager.getLoadedSchema( schemaName );
@@ -178,15 +190,15 @@
         {
             objectClass.applyRegistries( null, schemaManager.getRegistries() );
         }
-        
+
         String oid = objectClass.getOid();
 
         if ( isSchemaEnabled( schemaName ) )
         {
             if ( schemaManager.getRegistries().isReferenced( objectClass ) )
             {
-                String msg = "Cannot delete " + entry.getDn().getUpName() + ", as there are some " +
-                    " dependant SchemaObjects :\n" + getReferenced( objectClass );
+                String msg = "Cannot delete " + entry.getDn().getUpName() + ", as there are some "
+                    + " dependant SchemaObjects :\n" + getReferenced( objectClass );
                 LOG.warn( msg );
                 throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM );
             }
@@ -203,22 +215,22 @@
             {
                 schemaManager.getRegistries().delReference( objectClass, may );
             }
-            
+
             // The MUST AttributeTypes
             for ( AttributeType must : objectClass.getMayAttributeTypes() )
             {
                 schemaManager.getRegistries().delReference( objectClass, must );
             }
-            
+
             // The superiors
             for ( ObjectClass superior : objectClass.getSuperiors() )
             {
                 schemaManager.getRegistries().delReference( objectClass, superior );
             }
-            
+
             // Update the Registry
             schemaManager.unregisterObjectClass( objectClass.getOid() );
-            
+
             LOG.debug( "Removed {} from the enabled schema {}", objectClass, schemaName );
         }
         else
@@ -238,26 +250,26 @@
         ObjectClass oldOc = factory.getObjectClass( schemaManager, entry, schemaManager.getRegistries(), schemaName );
 
         // Dependency constraints are not managed by this class
-//        Set<ServerEntry> dependees = dao.listObjectClassDependents( oldOc );
-//        
-//        if ( dependees != null && dependees.size() > 0 )
-//        {
-//            throw new LdapOperationNotSupportedException( "The objectClass with OID " + oldOc.getOid()
-//                + " cannot be deleted until all entities" 
-//                + " using this objectClass have also been deleted.  The following dependees exist: " 
-//                + getOids( dependees ), 
-//                ResultCodeEnum.UNWILLING_TO_PERFORM );
-//        }
+        //        Set<ServerEntry> dependees = dao.listObjectClassDependents( oldOc );
+        //        
+        //        if ( dependees != null && dependees.size() > 0 )
+        //        {
+        //            throw new LdapOperationNotSupportedException( "The objectClass with OID " + oldOc.getOid()
+        //                + " cannot be deleted until all entities" 
+        //                + " using this objectClass have also been deleted.  The following dependees exist: " 
+        //                + getOids( dependees ), 
+        //                ResultCodeEnum.UNWILLING_TO_PERFORM );
+        //        }
 
         ServerEntry targetEntry = ( ServerEntry ) entry.clone();
         String newOid = ( String ) newRdn.getValue();
         targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
-        
+
         // Inject the new DN
         LdapDN newDn = new LdapDN( targetEntry.getDn() );
         newDn.remove( newDn.size() - 1 );
         newDn.add( newRdn );
-        
+
         checkOidIsUnique( newOid );
         ObjectClass oc = factory.getObjectClass( schemaManager, targetEntry, schemaManager.getRegistries(), schemaName );
 
@@ -266,12 +278,12 @@
             // Check that the entry has no descendant
             if ( schemaManager.getObjectClassRegistry().hasDescendants( oldOc.getOid() ) )
             {
-                String msg = "Cannot rename " + entry.getDn().getUpName() + " to " + newDn + 
-                    " as the later has descendants' ObjectClasses";
-                
+                String msg = "Cannot rename " + entry.getDn().getUpName() + " to " + newDn
+                    + " as the later has descendants' ObjectClasses";
+
                 throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM );
             }
-            
+
             schemaManager.unregisterObjectClass( oldOc.getOid() );
             schemaManager.add( oc );
         }
@@ -283,30 +295,31 @@
     }
 
 
-    public void moveAndRename( LdapDN oriChildName, LdapDN newParentName, Rdn newRdn, boolean deleteOldRn, ServerEntry entry, 
-        boolean cascade ) throws Exception
+    public void moveAndRename( LdapDN oriChildName, LdapDN newParentName, Rdn newRdn, boolean deleteOldRn,
+        ServerEntry entry, boolean cascade ) throws Exception
     {
         checkNewParent( newParentName );
         String oldSchemaName = getSchemaName( oriChildName );
         ObjectClass oldOc = factory.getObjectClass( schemaManager, entry, schemaManager.getRegistries(), oldSchemaName );
 
         // this class does not handle dependencies
-//        Set<ServerEntry> dependees = dao.listObjectClassDependents( oldOc );
-//        if ( dependees != null && dependees.size() > 0 )
-//        {
-//            throw new LdapOperationNotSupportedException( "The objectClass with OID " + oldOc.getOid()
-//                + " cannot be deleted until all entities" 
-//                + " using this objectClass have also been deleted.  The following dependees exist: " 
-//                + getOids( dependees ), 
-//                ResultCodeEnum.UNWILLING_TO_PERFORM );
-//        }
+        //        Set<ServerEntry> dependees = dao.listObjectClassDependents( oldOc );
+        //        if ( dependees != null && dependees.size() > 0 )
+        //        {
+        //            throw new LdapOperationNotSupportedException( "The objectClass with OID " + oldOc.getOid()
+        //                + " cannot be deleted until all entities" 
+        //                + " using this objectClass have also been deleted.  The following dependees exist: " 
+        //                + getOids( dependees ), 
+        //                ResultCodeEnum.UNWILLING_TO_PERFORM );
+        //        }
 
         String newSchemaName = getSchemaName( newParentName );
         ServerEntry targetEntry = ( ServerEntry ) entry.clone();
         String newOid = ( String ) newRdn.getValue();
         checkOidIsUnique( newOid );
         targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
-        ObjectClass oc = factory.getObjectClass( schemaManager, targetEntry, schemaManager.getRegistries(), newSchemaName );
+        ObjectClass oc = factory.getObjectClass( schemaManager, targetEntry, schemaManager.getRegistries(),
+            newSchemaName );
 
         if ( isSchemaEnabled( oldSchemaName ) )
         {
@@ -316,7 +329,7 @@
         {
             unregisterOids( oldOc );
         }
-        
+
         if ( isSchemaEnabled( newSchemaName ) )
         {
             schemaManager.add( oc );
@@ -328,8 +341,7 @@
     }
 
 
-    public void move( LdapDN oriChildName, LdapDN newParentName, ServerEntry entry, boolean cascade ) 
-        throws Exception
+    public void move( LdapDN oriChildName, LdapDN newParentName, ServerEntry entry, boolean cascade ) throws Exception
     {
         checkNewParent( newParentName );
         String oldSchemaName = getSchemaName( oriChildName );
@@ -337,18 +349,18 @@
         ObjectClass oldAt = factory.getObjectClass( schemaManager, entry, schemaManager.getRegistries(), oldSchemaName );
 
         // dependencies are not managed by this class
-//        Set<ServerEntry> dependees = dao.listObjectClassDependents( oldAt );
-//        if ( dependees != null && dependees.size() > 0 )
-//        {s
-//            throw new LdapOperationNotSupportedException( "The objectClass with OID " + oldAt.getOid() 
-//                + " cannot be deleted until all entities" 
-//                + " using this objectClass have also been deleted.  The following dependees exist: " 
-//                + getOids( dependees ), 
-//                ResultCodeEnum.UNWILLING_TO_PERFORM );
-//        }
+        //        Set<ServerEntry> dependees = dao.listObjectClassDependents( oldAt );
+        //        if ( dependees != null && dependees.size() > 0 )
+        //        {s
+        //            throw new LdapOperationNotSupportedException( "The objectClass with OID " + oldAt.getOid() 
+        //                + " cannot be deleted until all entities" 
+        //                + " using this objectClass have also been deleted.  The following dependees exist: " 
+        //                + getOids( dependees ), 
+        //                ResultCodeEnum.UNWILLING_TO_PERFORM );
+        //        }
 
         ObjectClass oc = factory.getObjectClass( schemaManager, entry, schemaManager.getRegistries(), newSchemaName );
-        
+
         if ( isSchemaEnabled( oldSchemaName ) )
         {
             schemaManager.unregisterObjectClass( oldAt.getOid() );
@@ -357,7 +369,7 @@
         {
             unregisterOids( oldAt );
         }
-        
+
         if ( isSchemaEnabled( newSchemaName ) )
         {
             schemaManager.add( oc );
@@ -373,23 +385,24 @@
     {
         if ( newParent.size() != 3 )
         {
-            throw new LdapInvalidNameException( 
-                "The parent dn of a objectClass should be at most 3 name components in length.", 
+            throw new LdapInvalidNameException(
+                "The parent dn of a objectClass should be at most 3 name components in length.",
                 ResultCodeEnum.NAMING_VIOLATION );
         }
-        
+
         Rdn rdn = newParent.getRdn();
-        
-        if ( ! schemaManager.getAttributeTypeRegistry().getOidByName( rdn.getNormType() ).equals( SchemaConstants.OU_AT_OID ) )
+
+        if ( !schemaManager.getAttributeTypeRegistry().getOidByName( rdn.getNormType() ).equals(
+            SchemaConstants.OU_AT_OID ) )
         {
-            throw new LdapInvalidNameException( "The parent entry of a objectClass should be an organizationalUnit.", 
+            throw new LdapInvalidNameException( "The parent entry of a objectClass should be an organizationalUnit.",
                 ResultCodeEnum.NAMING_VIOLATION );
         }
-        
-        if ( ! ( ( String ) rdn.getValue() ).equalsIgnoreCase( SchemaConstants.OBJECT_CLASSES_AT ) )
+
+        if ( !( ( String ) rdn.getValue() ).equalsIgnoreCase( SchemaConstants.OBJECT_CLASSES_AT ) )
         {
-            throw new LdapInvalidNameException( 
-                "The parent entry of a attributeType should have a relative name of ou=objectClasses.", 
+            throw new LdapInvalidNameException(
+                "The parent entry of a attributeType should have a relative name of ou=objectClasses.",
                 ResultCodeEnum.NAMING_VIOLATION );
         }
     }

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SyntaxCheckerSynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SyntaxCheckerSynchronizer.java?rev=887284&r1=887283&r2=887284&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SyntaxCheckerSynchronizer.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SyntaxCheckerSynchronizer.java Fri Dec  4 17:34:13 2009
@@ -56,6 +56,7 @@
     /** A logger for this class */
     private static final Logger LOG = LoggerFactory.getLogger( SyntaxCheckerSynchronizer.class );
 
+
     /**
      * Creates a new instance of SyntaxCheckerSynchronizer.
      *
@@ -71,24 +72,26 @@
     /**
      * {@inheritDoc}
      */
-    public boolean modify( ModifyOperationContext opContext, ServerEntry targetEntry, boolean cascade ) throws Exception
+    public boolean modify( ModifyOperationContext opContext, ServerEntry targetEntry, boolean cascade )
+        throws Exception
     {
         LdapDN name = opContext.getDn();
         ServerEntry entry = opContext.getEntry();
         String schemaName = getSchemaName( name );
         String oid = getOid( entry );
-        SyntaxChecker syntaxChecker = factory.getSyntaxChecker( schemaManager, targetEntry, schemaManager.getRegistries(), schemaName );
-        
+        SyntaxChecker syntaxChecker = factory.getSyntaxChecker( schemaManager, targetEntry, schemaManager
+            .getRegistries(), schemaName );
+
         if ( isSchemaEnabled( schemaName ) )
         {
             syntaxChecker.setSchemaName( schemaName );
 
             schemaManager.unregisterSyntaxChecker( oid );
             schemaManager.add( syntaxChecker );
-            
+
             return SCHEMA_MODIFIED;
         }
-        
+
         return SCHEMA_UNCHANGED;
     }
 
@@ -107,52 +110,61 @@
 
         // The new schemaObject's OID must not already exist
         checkOidIsUniqueForSyntaxChecker( entry );
-        
+
         // Build the new SyntaxChecker from the given entry
         String schemaName = getSchemaName( dn );
-        
-        SyntaxChecker syntaxChecker = factory.getSyntaxChecker( schemaManager, entry, schemaManager.getRegistries(), schemaName );
+
+        SyntaxChecker syntaxChecker = factory.getSyntaxChecker( schemaManager, entry, schemaManager.getRegistries(),
+            schemaName );
 
         // At this point, the constructed SyntaxChecker has not been checked against the 
         // existing Registries. It will be checked there, if the schema and the 
         // SyntaxChecker are both enabled.
         Schema schema = schemaManager.getLoadedSchema( schemaName );
         List<Throwable> errors = new ArrayList<Throwable>();
-        
+
         if ( schema.isEnabled() && syntaxChecker.isEnabled() )
         {
             // As we may break the registries, work on a cloned registries
             Registries clonedRegistries = schemaManager.getRegistries().clone();
-            
+
             // Inject the newly created SyntaxChecker in the cloned registries
             clonedRegistries.add( errors, syntaxChecker );
-            
+
             // Remove the cloned registries
             clonedRegistries.clear();
-            
+
             // If we didn't get any error, add the SyntaxChecker into the real registries
             if ( errors.isEmpty() )
             {
                 // Apply the addition to the real registries
-            	schemaManager.getRegistries().add( errors, syntaxChecker );
+                schemaManager.getRegistries().add( errors, syntaxChecker );
+
+                LOG.debug( "Added {} into the enabled schema {}", dn.getUpName(), schemaName );
             }
             else
             {
                 // We have some error : reject the addition and get out
-                String msg = "Cannot add the SyntaxChecker " + entry.getDn().getUpName() + " into the registries, "+
-                    "the resulting registries would be inconsistent :" + StringTools.listToString( errors );
+                String msg = "Cannot add the SyntaxChecker " + entry.getDn().getUpName() + " into the registries, "
+                    + "the resulting registries would be inconsistent :" + StringTools.listToString( errors );
                 LOG.info( msg );
                 throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM );
             }
-            
-            LOG.debug( "Added {} into the enabled schema {}", dn.getUpName(), schemaName );
         }
         else
         {
-            LOG.debug( "The syntaxChecker {} cannot be added in schema {}", dn.getUpName(), schemaName );
-
             // At least, we associates the syntaxChecker with the schema
-            schemaManager.getRegistries().associateWithSchema( syntaxChecker );
+            schemaManager.getRegistries().associateWithSchema( errors, syntaxChecker );
+
+            if ( !errors.isEmpty() )
+            {
+                String msg = "Cannot add the SyntaxChecker " + entry.getDn().getUpName() + " into the registries, "
+                    + "we have got some errors :" + StringTools.listToString( errors );
+
+                throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM );
+            }
+
+            LOG.debug( "The syntaxChecker {} cannot be added in schema {}", dn.getUpName(), schemaName );
         }
     }
 
@@ -165,22 +177,23 @@
         LdapDN dn = entry.getDn();
         LdapDN parentDn = ( LdapDN ) dn.clone();
         parentDn.remove( parentDn.size() - 1 );
-        
+
         // The parent DN must be ou=syntaxcheckers,cn=<schemaName>,ou=schema
         checkParent( parentDn, schemaManager, SchemaConstants.SYNTAX_CHECKER );
 
         // Get the SyntaxChecker's instance
         String schemaName = getSchemaName( entry.getDn() );
-        SyntaxChecker syntaxChecker = factory.getSyntaxChecker( schemaManager, entry, schemaManager.getRegistries(), schemaName );
-        
+        SyntaxChecker syntaxChecker = factory.getSyntaxChecker( schemaManager, entry, schemaManager.getRegistries(),
+            schemaName );
+
         String oid = syntaxChecker.getOid();
-        
+
         if ( isSchemaEnabled( schemaName ) )
         {
             if ( schemaManager.getRegistries().isReferenced( syntaxChecker ) )
             {
-                String msg = "Cannot delete " + entry.getDn().getUpName() + ", as there are some " +
-                    " dependant SchemaObjects :\n" + getReferenced( syntaxChecker );
+                String msg = "Cannot delete " + entry.getDn().getUpName() + ", as there are some "
+                    + " dependant SchemaObjects :\n" + getReferenced( syntaxChecker );
                 LOG.warn( msg );
                 throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM );
             }
@@ -189,7 +202,7 @@
             // be loaded into the schemaManager if it's disabled
             deleteFromSchema( syntaxChecker, schemaName );
         }
-        
+
         // Update the Registries now
         if ( schemaManager.getSyntaxCheckerRegistry().contains( oid ) )
         {
@@ -213,33 +226,33 @@
 
         if ( schemaManager.getLdapSyntaxRegistry().contains( oldOid ) )
         {
-            throw new LdapOperationNotSupportedException( "The syntaxChecker with OID " + oldOid 
-                + " cannot have it's OID changed until all " 
-                + "syntaxes using that syntaxChecker have been deleted.", 
+            throw new LdapOperationNotSupportedException( "The syntaxChecker with OID " + oldOid
+                + " cannot have it's OID changed until all " + "syntaxes using that syntaxChecker have been deleted.",
                 ResultCodeEnum.UNWILLING_TO_PERFORM );
         }
 
         ServerEntry targetEntry = ( ServerEntry ) entry.clone();
         String newOid = ( String ) newRdn.getValue();
-        
+
         if ( schemaManager.getSyntaxCheckerRegistry().contains( newOid ) )
         {
-            throw new LdapNamingException( "Oid " + newOid + " for new schema syntaxChecker is not unique.", 
+            throw new LdapNamingException( "Oid " + newOid + " for new schema syntaxChecker is not unique.",
                 ResultCodeEnum.OTHER );
         }
 
         targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
-        
+
         if ( isSchemaEnabled( schemaName ) )
         {
-            SyntaxChecker syntaxChecker = factory.getSyntaxChecker( schemaManager, targetEntry, schemaManager.getRegistries(), schemaName );
+            SyntaxChecker syntaxChecker = factory.getSyntaxChecker( schemaManager, targetEntry, schemaManager
+                .getRegistries(), schemaName );
             schemaManager.unregisterSyntaxChecker( oldOid );
             schemaManager.add( syntaxChecker );
         }
     }
 
 
-    public void moveAndRename( LdapDN oriChildName, LdapDN newParentName, Rdn newRdn, boolean deleteOldRn, 
+    public void moveAndRename( LdapDN oriChildName, LdapDN newParentName, Rdn newRdn, boolean deleteOldRn,
         ServerEntry entry, boolean cascade ) throws Exception
     {
         checkNewParent( newParentName );
@@ -249,24 +262,24 @@
 
         if ( schemaManager.getLdapSyntaxRegistry().contains( oldOid ) )
         {
-            throw new LdapOperationNotSupportedException( "The syntaxChecker with OID " + oldOid 
-                + " cannot have it's OID changed until all " 
-                + "syntaxes using that syntaxChecker have been deleted.", 
+            throw new LdapOperationNotSupportedException( "The syntaxChecker with OID " + oldOid
+                + " cannot have it's OID changed until all " + "syntaxes using that syntaxChecker have been deleted.",
                 ResultCodeEnum.UNWILLING_TO_PERFORM );
         }
 
         ServerEntry targetEntry = ( ServerEntry ) entry.clone();
-        
+
         String newOid = ( String ) newRdn.getValue();
-        
+
         if ( schemaManager.getSyntaxCheckerRegistry().contains( newOid ) )
         {
-            throw new LdapNamingException( "Oid " + newOid + " for new schema syntaxChecker is not unique.", 
+            throw new LdapNamingException( "Oid " + newOid + " for new schema syntaxChecker is not unique.",
                 ResultCodeEnum.OTHER );
         }
 
         targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
-        SyntaxChecker syntaxChecker = factory.getSyntaxChecker( schemaManager, targetEntry, schemaManager.getRegistries(), newSchemaName );
+        SyntaxChecker syntaxChecker = factory.getSyntaxChecker( schemaManager, targetEntry, schemaManager
+            .getRegistries(), newSchemaName );
 
         if ( isSchemaEnabled( oldSchemaName ) )
         {
@@ -280,8 +293,7 @@
     }
 
 
-    public void move( LdapDN oriChildName, LdapDN newParentName, ServerEntry entry, boolean cascade ) 
-        throws Exception
+    public void move( LdapDN oriChildName, LdapDN newParentName, ServerEntry entry, boolean cascade ) throws Exception
     {
         checkNewParent( newParentName );
         String oid = getOid( entry );
@@ -290,58 +302,59 @@
 
         if ( schemaManager.getLdapSyntaxRegistry().contains( oid ) )
         {
-            throw new LdapOperationNotSupportedException( "The syntaxChecker with OID " + oid 
-                + " cannot be moved to another schema until all " 
-                + "syntax using that syntaxChecker have been deleted.", 
-                ResultCodeEnum.UNWILLING_TO_PERFORM );
+            throw new LdapOperationNotSupportedException( "The syntaxChecker with OID " + oid
+                + " cannot be moved to another schema until all "
+                + "syntax using that syntaxChecker have been deleted.", ResultCodeEnum.UNWILLING_TO_PERFORM );
         }
 
-        SyntaxChecker syntaxChecker = factory.getSyntaxChecker( schemaManager, entry, schemaManager.getRegistries(), newSchemaName );
-        
+        SyntaxChecker syntaxChecker = factory.getSyntaxChecker( schemaManager, entry, schemaManager.getRegistries(),
+            newSchemaName );
+
         if ( isSchemaEnabled( oldSchemaName ) )
         {
             schemaManager.unregisterSyntaxChecker( oid );
         }
-        
+
         if ( isSchemaEnabled( newSchemaName ) )
         {
             schemaManager.add( syntaxChecker );
         }
     }
-    
-    
+
+
     private void checkOidIsUniqueForSyntaxChecker( ServerEntry entry ) throws Exception
     {
         String oid = getOid( entry );
-        
+
         if ( schemaManager.getNormalizerRegistry().contains( oid ) )
         {
-            throw new LdapNamingException( "Oid " + oid + " for new schema SyntaxChecker is not unique.", 
+            throw new LdapNamingException( "Oid " + oid + " for new schema SyntaxChecker is not unique.",
                 ResultCodeEnum.OTHER );
         }
     }
 
-    
+
     private void checkNewParent( LdapDN newParent ) throws NamingException
     {
         if ( newParent.size() != 3 )
         {
-            throw new LdapInvalidNameException( 
-                "The parent dn of a syntaxChecker should be at most 3 name components in length.", 
+            throw new LdapInvalidNameException(
+                "The parent dn of a syntaxChecker should be at most 3 name components in length.",
                 ResultCodeEnum.NAMING_VIOLATION );
         }
-        
+
         Rdn rdn = newParent.getRdn();
-        if ( ! schemaManager.getAttributeTypeRegistry().getOidByName( rdn.getNormType() ).equals( SchemaConstants.OU_AT_OID ) )
+        if ( !schemaManager.getAttributeTypeRegistry().getOidByName( rdn.getNormType() ).equals(
+            SchemaConstants.OU_AT_OID ) )
         {
-            throw new LdapInvalidNameException( "The parent entry of a syntaxChecker should be an organizationalUnit.", 
+            throw new LdapInvalidNameException( "The parent entry of a syntaxChecker should be an organizationalUnit.",
                 ResultCodeEnum.NAMING_VIOLATION );
         }
-        
-        if ( ! ( ( String ) rdn.getValue() ).equalsIgnoreCase( SchemaConstants.SYNTAX_CHECKERS_AT ) )
+
+        if ( !( ( String ) rdn.getValue() ).equalsIgnoreCase( SchemaConstants.SYNTAX_CHECKERS_AT ) )
         {
-            throw new LdapInvalidNameException( 
-                "The parent entry of a normalizer should have a relative name of ou=syntaxCheckers.", 
+            throw new LdapInvalidNameException(
+                "The parent entry of a normalizer should have a relative name of ou=syntaxCheckers.",
                 ResultCodeEnum.NAMING_VIOLATION );
         }
     }



Mime
View raw message