directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r891373 - /directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AttributeTypeSynchronizer.java
Date Wed, 16 Dec 2009 18:41:56 GMT
Author: elecharny
Date: Wed Dec 16 18:41:55 2009
New Revision: 891373

URL: http://svn.apache.org/viewvc?rev=891373&view=rev
Log:
Replace all the crippled code by a direct call to schemaManager.add() and schemaManager.delete()
for AT

Modified:
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AttributeTypeSynchronizer.java

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AttributeTypeSynchronizer.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/AttributeTypeSynchronizer.java?rev=891373&r1=891372&r2=891373&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AttributeTypeSynchronizer.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AttributeTypeSynchronizer.java
Wed Dec 16 18:41:55 2009
@@ -94,28 +94,15 @@
 
         if ( schema.isEnabled() && attributeType.isEnabled() )
         {
-            // As we may break the registries, work on a cloned registries
-            Registries clonedRegistries = schemaManager.getRegistries().clone();
-
-            // Inject the newly created AttributeType in the cloned registries
-            clonedRegistries.add( errors, attributeType );
-
-            // Remove the cloned registries
-            clonedRegistries.clear();
-
-            // If we didn't get any error, apply the addition to the real retistries
-            if ( errors.isEmpty() )
+            if ( schemaManager.add( attributeType ) )
             {
-                // Apply the addition to the real registries
-                schemaManager.getRegistries().add( errors, attributeType );
-
                 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 AttributeType " + entry.getDn().getUpName()
+ " into the registries, "
-                    + "the resulting registries would be inconsistent :" + StringTools.listToString(
errors );
+                    + "the resulting registries would be inconsistent :" + StringTools.listToString(
schemaManager.getErrors() );
                 LOG.info( msg );
                 throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM
);
             }



Mime
View raw message