directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r887926 [1/4] - 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...
Date Mon, 07 Dec 2009 14:06:57 GMT
Author: elecharny
Date: Mon Dec  7 14:06:56 2009
New Revision: 887926

URL: http://svn.apache.org/viewvc?rev=887926&view=rev
Log:
o Added a SchemaObject interface
o Renamed the applyRegistries() method to addRegistries and setRegistries
o Added preliminary tests for del() method in SchemaRegistries
o Some fixes in the way the registries are relaxed
o Fixed the Registries.clone() method, the schemaObjects data structure wasn't cloned correctly, so was the globalOidRegistry
o Some fixes is some tests, Syntax wasn't injcted in the schemaManager

Added:
    directory/shared/branches/shared-schema/ldap-schema-loader/src/test/java/org/apache/directory/server/schema/SchemaManagerDelTest.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AbstractSchemaObject.java
Modified:
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AttributeTypeSynchronizer.java
    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/ObjectClassSynchronizer.java
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SyntaxSynchronizer.java
    directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaComparatorHandlerIT.java
    directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
    directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
    directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/DefaultSchemaManager.java
    directory/shared/branches/shared-schema/ldap-schema-loader/src/test/java/org/apache/directory/server/schema/SchemaManagerAddTest.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AttributeType.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DITContentRule.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DITStructureRule.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LdapSyntax.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LoadableSchemaObject.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRule.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRuleUse.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/NameForm.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/Normalizer.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ObjectClass.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaManager.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaObject.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/normalizers/CachingDeepTrimNormalizer.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/normalizers/CachingDeepTrimToLowerNormalizer.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/normalizers/CachingDnNormalizer.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/normalizers/CachingNormalizer.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AttributeTypeRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultAttributeTypeRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultSchemaObjectRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableAttributeTypeRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableComparatorRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableDITContentRuleRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableDITStructureRuleRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableLdapSyntaxRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableMatchingRuleRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableMatchingRuleUseRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableNameFormRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableNormalizerRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableObjectClassRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableSyntaxCheckerRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/Registries.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SchemaObjectRegistry.java

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java?rev=887926&r1=887925&r2=887926&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java Mon Dec  7 14:06:56 2009
@@ -81,33 +81,22 @@
     private static final NameForm[] EMPTY_NAME_FORMS = new NameForm[0];
 
     private final SchemaManager schemaManager;
-    
-    private final LdapComparatorDescriptionSchemaParser comparatorParser =
-        new LdapComparatorDescriptionSchemaParser();
-    private final NormalizerDescriptionSchemaParser normalizerParser =
-        new NormalizerDescriptionSchemaParser();
-    private final SyntaxCheckerDescriptionSchemaParser syntaxCheckerParser =
-        new SyntaxCheckerDescriptionSchemaParser();
-    private final LdapSyntaxDescriptionSchemaParser syntaxParser =
-        new LdapSyntaxDescriptionSchemaParser();
-    private final MatchingRuleDescriptionSchemaParser matchingRuleParser =
-        new MatchingRuleDescriptionSchemaParser();
-    private final AttributeTypeDescriptionSchemaParser attributeTypeParser = 
-        new AttributeTypeDescriptionSchemaParser();
-    private final ObjectClassDescriptionSchemaParser objectClassParser = 
-        new ObjectClassDescriptionSchemaParser();
-    private final MatchingRuleUseDescriptionSchemaParser matchingRuleUseParser = 
-        new MatchingRuleUseDescriptionSchemaParser();
-    private final DITStructureRuleDescriptionSchemaParser ditStructureRuleParser =
-        new DITStructureRuleDescriptionSchemaParser();
-    private final DITContentRuleDescriptionSchemaParser ditContentRuleParser =
-        new DITContentRuleDescriptionSchemaParser();
-    private final NameFormDescriptionSchemaParser nameFormParser =
-        new NameFormDescriptionSchemaParser();
-    
+
+    private final LdapComparatorDescriptionSchemaParser comparatorParser = new LdapComparatorDescriptionSchemaParser();
+    private final NormalizerDescriptionSchemaParser normalizerParser = new NormalizerDescriptionSchemaParser();
+    private final SyntaxCheckerDescriptionSchemaParser syntaxCheckerParser = new SyntaxCheckerDescriptionSchemaParser();
+    private final LdapSyntaxDescriptionSchemaParser syntaxParser = new LdapSyntaxDescriptionSchemaParser();
+    private final MatchingRuleDescriptionSchemaParser matchingRuleParser = new MatchingRuleDescriptionSchemaParser();
+    private final AttributeTypeDescriptionSchemaParser attributeTypeParser = new AttributeTypeDescriptionSchemaParser();
+    private final ObjectClassDescriptionSchemaParser objectClassParser = new ObjectClassDescriptionSchemaParser();
+    private final MatchingRuleUseDescriptionSchemaParser matchingRuleUseParser = new MatchingRuleUseDescriptionSchemaParser();
+    private final DITStructureRuleDescriptionSchemaParser ditStructureRuleParser = new DITStructureRuleDescriptionSchemaParser();
+    private final DITContentRuleDescriptionSchemaParser ditContentRuleParser = new DITContentRuleDescriptionSchemaParser();
+    private final NameFormDescriptionSchemaParser nameFormParser = new NameFormDescriptionSchemaParser();
+
     private final SchemaPartitionDao dao;
-    
-    
+
+
     /**
      * Creates a description parser.
      * 
@@ -119,51 +108,51 @@
         this.dao = dao;
     }
 
-    
+
     public SyntaxCheckerDescription[] parseSyntaxCheckers( EntryAttribute attr ) throws NamingException
     {
         if ( attr == null || attr.size() == 0 )
         {
             return EMPTY_SYNTAX_CHECKERS;
         }
-        
+
         SyntaxCheckerDescription[] syntaxCheckerDescriptions = new SyntaxCheckerDescription[attr.size()];
-        
+
         int pos = 0;
-        
-        for ( Value<?> value:attr )
+
+        for ( Value<?> value : attr )
         {
             try
             {
-                syntaxCheckerDescriptions[pos++] = 
-                    syntaxCheckerParser.parseSyntaxCheckerDescription( value.getString() );
+                syntaxCheckerDescriptions[pos++] = syntaxCheckerParser
+                    .parseSyntaxCheckerDescription( value.getString() );
             }
             catch ( ParseException e )
             {
-                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException( 
-                    "The following does not conform to the syntaxCheckerDescription syntax: " + value, 
+                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException(
+                    "The following does not conform to the syntaxCheckerDescription syntax: " + value,
                     ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
                 iave.setRootCause( e );
                 throw iave;
             }
         }
-        
+
         return syntaxCheckerDescriptions;
     }
-    
-    
+
+
     public NormalizerDescription[] parseNormalizers( EntryAttribute attr ) throws NamingException
     {
         if ( attr == null || attr.size() == 0 )
         {
             return EMPTY_NORMALIZERS;
         }
-        
+
         NormalizerDescription[] normalizerDescriptions = new NormalizerDescription[attr.size()];
-        
+
         int pos = 0;
-        
-        for ( Value<?> value:attr )
+
+        for ( Value<?> value : attr )
         {
             try
             {
@@ -171,17 +160,17 @@
             }
             catch ( ParseException e )
             {
-                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException( 
-                    "The following does not conform to the normalizerDescription syntax: " + value.getString(), 
+                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException(
+                    "The following does not conform to the normalizerDescription syntax: " + value.getString(),
                     ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
                 iave.setRootCause( e );
                 throw iave;
             }
         }
-        
+
         return normalizerDescriptions;
     }
-    
+
 
     public LdapComparatorDescription[] parseComparators( EntryAttribute attr ) throws NamingException
     {
@@ -189,12 +178,12 @@
         {
             return EMPTY_COMPARATORS;
         }
-        
+
         LdapComparatorDescription[] comparatorDescriptions = new LdapComparatorDescription[attr.size()];
-        
+
         int pos = 0;
-        
-        for ( Value<?> value:attr )
+
+        for ( Value<?> value : attr )
         {
             try
             {
@@ -202,17 +191,17 @@
             }
             catch ( ParseException e )
             {
-                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException( 
-                    "The following does not conform to the comparatorDescription syntax: " + value.getString(), 
+                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException(
+                    "The following does not conform to the comparatorDescription syntax: " + value.getString(),
                     ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
                 iave.setRootCause( e );
                 throw iave;
             }
         }
-        
+
         return comparatorDescriptions;
     }
-    
+
 
     /**
      * Parses a set of attributeTypeDescriptions held within an attribute into 
@@ -228,71 +217,66 @@
         {
             return EMPTY_ATTRIBUTE_TYPES;
         }
-        
+
         AttributeType[] attributeTypes = new AttributeType[attr.size()];
-        
+
         int pos = 0;
-        
-        for ( Value<?> value:attr )
+
+        for ( Value<?> value : attr )
         {
             AttributeType attributeType = null;
-            
+
             try
             {
                 attributeType = attributeTypeParser.parseAttributeTypeDescription( value.getString() );
             }
             catch ( ParseException e )
             {
-                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException( 
-                    "The following does not conform to the attributeTypeDescription syntax: " + value.getString(), 
+                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException(
+                    "The following does not conform to the attributeTypeDescription syntax: " + value.getString(),
                     ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
                 iave.setRootCause( e );
                 throw iave;
             }
 
             // if the supertype is provided make sure it exists in some schema
-            if ( attributeType.getSuperiorOid() != null && ! dao.hasAttributeType( attributeType.getSuperiorOid() ) )
+            if ( attributeType.getSuperiorOid() != null && !dao.hasAttributeType( attributeType.getSuperiorOid() ) )
             {
                 throw new LdapOperationNotSupportedException(
-                    "Cannot permit the addition of an attributeType with an invalid super type: " 
-                        + attributeType.getSuperiorOid(), 
-                    ResultCodeEnum.UNWILLING_TO_PERFORM );
+                    "Cannot permit the addition of an attributeType with an invalid super type: "
+                        + attributeType.getSuperiorOid(), ResultCodeEnum.UNWILLING_TO_PERFORM );
             }
 
             // if the syntax is provided by the description make sure it exists in some schema
-            if ( attributeType.getSyntaxOid() != null && ! dao.hasSyntax( attributeType.getSyntaxOid() ) )
+            if ( attributeType.getSyntaxOid() != null && !dao.hasSyntax( attributeType.getSyntaxOid() ) )
             {
                 throw new LdapOperationNotSupportedException(
-                    "Cannot permit the addition of an attributeType with an invalid syntax: " + 
-                    attributeType.getSyntaxOid(), 
-                    ResultCodeEnum.UNWILLING_TO_PERFORM );
+                    "Cannot permit the addition of an attributeType with an invalid syntax: "
+                        + attributeType.getSyntaxOid(), ResultCodeEnum.UNWILLING_TO_PERFORM );
             }
-            
+
             // if the matchingRule is provided make sure it exists in some schema
-            if ( attributeType.getEqualityOid() != null && ! dao.hasMatchingRule( attributeType.getEqualityOid() ) )
+            if ( attributeType.getEqualityOid() != null && !dao.hasMatchingRule( attributeType.getEqualityOid() ) )
             {
                 throw new LdapOperationNotSupportedException(
-                    "Cannot permit the addition of an attributeType with an invalid EQUALITY matchingRule: " 
-                        + attributeType.getEqualityOid(), 
-                    ResultCodeEnum.UNWILLING_TO_PERFORM );
+                    "Cannot permit the addition of an attributeType with an invalid EQUALITY matchingRule: "
+                        + attributeType.getEqualityOid(), ResultCodeEnum.UNWILLING_TO_PERFORM );
             }
 
             // if the matchingRule is provided make sure it exists in some schema
-            if ( attributeType.getOrderingOid() != null && ! dao.hasMatchingRule( attributeType.getOrderingOid() ) )
+            if ( attributeType.getOrderingOid() != null && !dao.hasMatchingRule( attributeType.getOrderingOid() ) )
             {
                 throw new LdapOperationNotSupportedException(
-                    "Cannot permit the addition of an attributeType with an invalid ORDERING matchingRule: " 
-                        + attributeType.getOrderingOid(), 
-                    ResultCodeEnum.UNWILLING_TO_PERFORM );
+                    "Cannot permit the addition of an attributeType with an invalid ORDERING matchingRule: "
+                        + attributeType.getOrderingOid(), ResultCodeEnum.UNWILLING_TO_PERFORM );
             }
 
             // if the matchingRule is provided make sure it exists in some schema
-            if ( attributeType.getSubstringOid() != null && ! dao.hasMatchingRule( attributeType.getSubstringOid() ) )
+            if ( attributeType.getSubstringOid() != null && !dao.hasMatchingRule( attributeType.getSubstringOid() ) )
             {
                 throw new LdapOperationNotSupportedException(
-                    "Cannot permit the addition of an attributeType with an invalid SUBSTRINGS matchingRule: " 
-                        + attributeType.getSubstringOid(), 
-                    ResultCodeEnum.UNWILLING_TO_PERFORM );
+                    "Cannot permit the addition of an attributeType with an invalid SUBSTRINGS matchingRule: "
+                        + attributeType.getSubstringOid(), ResultCodeEnum.UNWILLING_TO_PERFORM );
             }
 
             // if the equality matching rule is null and no super type is specified then there is
@@ -303,24 +287,24 @@
                 if ( attributeType.getSuperiorOid() == null )
                 {
                     throw new LdapOperationNotSupportedException(
-                        "Cannot permit the addition of an attributeType with an no EQUALITY matchingRule " +
-                        "\nand no super type from which to derive an EQUALITY matchingRule.", 
+                        "Cannot permit the addition of an attributeType with an no EQUALITY matchingRule "
+                            + "\nand no super type from which to derive an EQUALITY matchingRule.",
                         ResultCodeEnum.UNWILLING_TO_PERFORM );
                 }
                 else
                 {
-                    AttributeType superType = schemaManager.lookupAttributeTypeRegistry( attributeType.getSuperiorOid() );
+                    AttributeType superType = schemaManager
+                        .lookupAttributeTypeRegistry( attributeType.getSuperiorOid() );
 
                     if ( superType == null )
                     {
                         throw new LdapOperationNotSupportedException(
-                            "Cannot permit the addition of an attributeType with which cannot resolve an " +
-                            "EQUALITY matchingRule from it's super type.", 
-                            ResultCodeEnum.UNWILLING_TO_PERFORM );
+                            "Cannot permit the addition of an attributeType with which cannot resolve an "
+                                + "EQUALITY matchingRule from it's super type.", ResultCodeEnum.UNWILLING_TO_PERFORM );
                     }
                 }
             }
-            
+
             // a syntax is mandatory for an attributeType and if not provided by the description 
             // must be provided from some ancestor in the attributeType hierarchy; without either
             // of these the description definitely cannot resolve a syntax and cannot be allowed.
@@ -328,34 +312,33 @@
             if ( attributeType.getSyntaxOid() == null && attributeType.getSuperiorOid() == null )
             {
                 throw new LdapOperationNotSupportedException(
-                    "Cannot permit the addition of an attributeType with no syntax " +
-                    "\nand no super type from which to derive a syntax.", 
-                    ResultCodeEnum.UNWILLING_TO_PERFORM );
+                    "Cannot permit the addition of an attributeType with no syntax "
+                        + "\nand no super type from which to derive a syntax.", ResultCodeEnum.UNWILLING_TO_PERFORM );
             }
-            
+
             List<Throwable> errors = new ArrayList<Throwable>();
-            
-            attributeType.applyRegistries( errors, schemaManager.getRegistries() );
-            
+
+            attributeType.setRegistries( schemaManager.getRegistries() );
+
             // Inject the schema
-            if ( ( attributeType.getExtensions() == null ) || 
-                 ( attributeType.getExtensions().get( MetaSchemaConstants.X_SCHEMA ) == null ) )
+            if ( ( attributeType.getExtensions() == null )
+                || ( attributeType.getExtensions().get( MetaSchemaConstants.X_SCHEMA ) == null ) )
             {
                 throw new LdapOperationNotSupportedException(
                     "Cannot permit the addition of an attributeType not associated with a schema ",
                     ResultCodeEnum.UNWILLING_TO_PERFORM );
             }
-            
+
             String schemaName = attributeType.getExtensions().get( MetaSchemaConstants.X_SCHEMA ).get( 0 );
             attributeType.setSchemaName( schemaName );
-            
+
             attributeTypes[pos++] = attributeType;
         }
-        
+
         return attributeTypes;
     }
-    
-    
+
+
     /**
      * Parses a set of objectClassDescriptions held within an attribute into 
      * schema entities.
@@ -370,86 +353,83 @@
         {
             return EMPTY_OBJECT_CLASSES;
         }
-        
+
         ObjectClass[] objectClasses = new ObjectClass[attr.size()];
-        
+
         int pos = 0;
-        
-        for ( Value<?> value:attr )
+
+        for ( Value<?> value : attr )
         {
             ObjectClass objectClass = null;
-            
+
             try
             {
                 objectClass = objectClassParser.parseObjectClassDescription( value.getString() );
             }
             catch ( ParseException e )
             {
-                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException( 
-                    "The following does not conform to the objectClassDescription syntax: " + value.getString(), 
+                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException(
+                    "The following does not conform to the objectClassDescription syntax: " + value.getString(),
                     ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
                 iave.setRootCause( e );
                 throw iave;
             }
-            
+
             // if the super objectClasses are provided make sure it exists in some schema
             if ( objectClass.getSuperiorOids() != null && objectClass.getSuperiorOids().size() > 0 )
             {
                 for ( String superior : objectClass.getSuperiorOids() )
                 {
-                    if ( superior.equals( SchemaConstants.TOP_OC_OID ) || 
-                        superior.equalsIgnoreCase( SchemaConstants.TOP_OC ) )
+                    if ( superior.equals( SchemaConstants.TOP_OC_OID )
+                        || superior.equalsIgnoreCase( SchemaConstants.TOP_OC ) )
                     {
                         continue;
                     }
-                    
-                    if ( ! dao.hasObjectClass( superior ) )
+
+                    if ( !dao.hasObjectClass( superior ) )
                     {
                         throw new LdapOperationNotSupportedException(
-                            "Cannot permit the addition of an objectClass with an invalid superior objectClass: " 
-                                + superior, 
-                            ResultCodeEnum.UNWILLING_TO_PERFORM );
+                            "Cannot permit the addition of an objectClass with an invalid superior objectClass: "
+                                + superior, ResultCodeEnum.UNWILLING_TO_PERFORM );
                     }
                 }
             }
-            
+
             // if the may list is provided make sure attributes exists in some schema
             if ( objectClass.getMayAttributeTypeOids() != null && objectClass.getMayAttributeTypeOids().size() > 0 )
             {
                 for ( String mayAttr : objectClass.getMayAttributeTypeOids() )
                 {
-                    if ( ! dao.hasAttributeType( mayAttr ) )
+                    if ( !dao.hasAttributeType( mayAttr ) )
                     {
                         throw new LdapOperationNotSupportedException(
-                            "Cannot permit the addition of an objectClass with an invalid " +
-                            "attributeType in the mayList: " + mayAttr, 
-                            ResultCodeEnum.UNWILLING_TO_PERFORM );
+                            "Cannot permit the addition of an objectClass with an invalid "
+                                + "attributeType in the mayList: " + mayAttr, ResultCodeEnum.UNWILLING_TO_PERFORM );
                     }
                 }
             }
-            
+
             // if the must list is provided make sure attributes exists in some schema
             if ( objectClass.getMustAttributeTypeOids() != null && objectClass.getMustAttributeTypeOids().size() > 0 )
             {
                 for ( String mustAttr : objectClass.getMustAttributeTypeOids() )
                 {
-                    if ( ! dao.hasAttributeType( mustAttr ) )
+                    if ( !dao.hasAttributeType( mustAttr ) )
                     {
                         throw new LdapOperationNotSupportedException(
-                            "Cannot permit the addition of an objectClass with an invalid " +
-                            "attributeType in the mustList: " + mustAttr, 
-                            ResultCodeEnum.UNWILLING_TO_PERFORM );
+                            "Cannot permit the addition of an objectClass with an invalid "
+                                + "attributeType in the mustList: " + mustAttr, ResultCodeEnum.UNWILLING_TO_PERFORM );
                     }
                 }
             }
-            
+
             ObjectClass oc = new ObjectClass( objectClass.getOid() );
             List<Throwable> errors = new ArrayList<Throwable>();
-            oc.applyRegistries( errors, schemaManager.getRegistries() );
-            
+            oc.setRegistries( schemaManager.getRegistries() );
+
             objectClasses[pos++] = oc;
         }
-        
+
         return objectClasses;
     }
 
@@ -468,15 +448,15 @@
         {
             return EMPTY_MATCHING_RULE_USES;
         }
-        
+
         MatchingRuleUse[] matchingRuleUses = new MatchingRuleUse[attr.size()];
-        
+
         int pos = 0;
-        
-        for ( Value<?> value:attr )
+
+        for ( Value<?> value : attr )
         {
             MatchingRuleUse matchingRuleUse = null;
-            
+
             try
             {
                 matchingRuleUse = matchingRuleUseParser.parseMatchingRuleUseDescription( value.getString() );
@@ -484,13 +464,13 @@
             }
             catch ( ParseException e )
             {
-                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException( 
-                    "The following does not conform to the matchingRuleUseDescription syntax: " + value.getString(), 
+                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException(
+                    "The following does not conform to the matchingRuleUseDescription syntax: " + value.getString(),
                     ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
                 iave.setRootCause( e );
                 throw iave;
             }
-            
+
             matchingRuleUses[pos++] = matchingRuleUse;
         }
 
@@ -512,15 +492,15 @@
         {
             return EMPTY_SYNTAXES;
         }
-        
+
         LdapSyntax[] syntaxes = new LdapSyntax[attr.size()];
 
         int pos = 0;
-        
-        for ( Value<?> value:attr )
+
+        for ( Value<?> value : attr )
         {
             LdapSyntax ldapSyntax = null;
-            
+
             try
             {
                 ldapSyntax = syntaxParser.parseLdapSyntaxDescription( value.getString() );
@@ -528,25 +508,25 @@
             }
             catch ( ParseException e )
             {
-                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException( 
-                    "The following does not conform to the ldapSyntax description syntax: " + value.getString(), 
+                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException(
+                    "The following does not conform to the ldapSyntax description syntax: " + value.getString(),
                     ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
                 iave.setRootCause( e );
                 throw iave;
             }
-            
-            if ( ! dao.hasSyntaxChecker( ldapSyntax.getOid() ) )
+
+            if ( !dao.hasSyntaxChecker( ldapSyntax.getOid() ) )
             {
                 throw new LdapOperationNotSupportedException(
-                    "Cannot permit the addition of a syntax without the prior creation of a " +
-                    "\nsyntaxChecker with the same object identifier of the syntax!",
+                    "Cannot permit the addition of a syntax without the prior creation of a "
+                        + "\nsyntaxChecker with the same object identifier of the syntax!",
                     ResultCodeEnum.UNWILLING_TO_PERFORM );
             }
 
             ldapSyntax.setHumanReadable( isHumanReadable( ldapSyntax ) );
             syntaxes[pos++] = ldapSyntax;
         }
-        
+
         return syntaxes;
     }
 
@@ -565,12 +545,12 @@
         {
             return EMPTY_MATCHING_RULES;
         }
-        
+
         MatchingRule[] matchingRules = new MatchingRule[attr.size()];
 
         int pos = 0;
-        
-        for ( Value<?> value:attr )
+
+        for ( Value<?> value : attr )
         {
             MatchingRule matchingRule = null;
 
@@ -581,27 +561,26 @@
             }
             catch ( ParseException e )
             {
-                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException( 
-                    "The following does not conform to the matchingRuleDescription syntax: " + value.getString(), 
+                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException(
+                    "The following does not conform to the matchingRuleDescription syntax: " + value.getString(),
                     ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
                 iave.setRootCause( e );
                 throw iave;
             }
-            
-            if ( ! dao.hasSyntax( matchingRule.getSyntaxOid() )  )
+
+            if ( !dao.hasSyntax( matchingRule.getSyntaxOid() ) )
             {
                 throw new LdapOperationNotSupportedException(
-                    "Cannot create a matchingRule that depends on non-existant syntax: " + 
-                    matchingRule.getSyntaxOid(),
+                    "Cannot create a matchingRule that depends on non-existant syntax: " + matchingRule.getSyntaxOid(),
                     ResultCodeEnum.UNWILLING_TO_PERFORM );
             }
-            
+
             matchingRules[pos++] = matchingRule;
         }
-        
+
         return matchingRules;
     }
-    
+
 
     /**
      * Parses a set of dITStructureRuleDescriptions held within an attribute into 
@@ -617,15 +596,15 @@
         {
             return EMPTY_DIT_STRUCTURE_RULES;
         }
-        
+
         DITStructureRule[] ditStructureRules = new DITStructureRule[attr.size()];
-        
+
         int pos = 0;
-        
-        for ( Value<?> value:attr )
+
+        for ( Value<?> value : attr )
         {
             DITStructureRule ditStructureRule = null;
-     
+
             try
             {
                 ditStructureRule = ditStructureRuleParser.parseDITStructureRuleDescription( value.getString() );
@@ -633,20 +612,20 @@
             }
             catch ( ParseException e )
             {
-                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException( 
-                    "The following does not conform to the ditStructureRuleDescription syntax: " + value.getString(), 
+                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException(
+                    "The following does not conform to the ditStructureRuleDescription syntax: " + value.getString(),
                     ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
                 iave.setRootCause( e );
                 throw iave;
             }
-            
+
             ditStructureRules[pos++] = ditStructureRule;
         }
-        
+
         return ditStructureRules;
     }
 
-    
+
     /**
      * Parses a set of dITContentRuleDescriptions held within an attribute into 
      * schema entities.
@@ -661,15 +640,15 @@
         {
             return EMPTY_DIT_CONTENT_RULES;
         }
-        
+
         DITContentRule[] ditContentRules = new DITContentRule[attr.size()];
 
         int pos = 0;
-        
-        for ( Value<?> value:attr )
+
+        for ( Value<?> value : attr )
         {
             DITContentRule ditContentRule = null;
-     
+
             try
             {
                 ditContentRule = ditContentRuleParser.parseDITContentRuleDescription( value.getString() );
@@ -677,20 +656,20 @@
             }
             catch ( ParseException e )
             {
-                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException( 
-                    "The following does not conform to the ditContentRuleDescription syntax: " + value.getString(), 
+                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException(
+                    "The following does not conform to the ditContentRuleDescription syntax: " + value.getString(),
                     ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
                 iave.setRootCause( e );
                 throw iave;
             }
-            
+
             ditContentRules[pos++] = ditContentRule;
         }
-        
+
         return ditContentRules;
     }
 
-    
+
     /**
      * Parses a set of nameFormDescriptions held within an attribute into 
      * schema entities.
@@ -705,15 +684,15 @@
         {
             return EMPTY_NAME_FORMS;
         }
-        
+
         NameForm[] nameForms = new NameForm[attr.size()];
 
         int pos = 0;
-        
-        for ( Value<?> value:attr )
+
+        for ( Value<?> value : attr )
         {
             NameForm nameForm = null;
-            
+
             try
             {
                 nameForm = nameFormParser.parseNameFormDescription( value.getString() );
@@ -721,20 +700,20 @@
             }
             catch ( ParseException e )
             {
-                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException( 
-                    "The following does not conform to the nameFormDescription syntax: " + value.getString(), 
+                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException(
+                    "The following does not conform to the nameFormDescription syntax: " + value.getString(),
                     ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
                 iave.setRootCause( e );
                 throw iave;
             }
-            
+
             nameForms[pos++] = nameForm;
         }
-        
+
         return nameForms;
     }
-    
-    
+
+
     /**
      * Checks to see if the syntax description is human readable by checking 
      * for the presence of the X-IS-HUMAN_READABLE schema extension.
@@ -745,7 +724,7 @@
     private boolean isHumanReadable( LdapSyntax ldapSyntax )
     {
         List<String> values = ldapSyntax.getExtensions().get( MetaSchemaConstants.X_IS_HUMAN_READABLE );
-        
+
         if ( values == null || values.size() == 0 )
         {
             return false;

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=887926&r1=887925&r2=887926&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 Mon Dec  7 14:06:56 2009
@@ -188,6 +188,7 @@
 
         // Get the schema 
         Schema schema = schemaManager.getLoadedSchema( schemaName );
+        List<Throwable> errors = new ArrayList<Throwable>();
 
         if ( schema.isEnabled() && attributeType.isEnabled() )
         {
@@ -198,7 +199,7 @@
             clonedRegistries.setRelaxed();
 
             // Remove this AttributeType from the Registries
-            clonedRegistries.unregister( attributeType );
+            clonedRegistries.delete( errors, attributeType );
 
             // Remove the AttributeType from the schema/SchemaObject Map
             clonedRegistries.dissociateFromSchema( attributeType );
@@ -207,10 +208,10 @@
             clonedRegistries.delCrossReferences( attributeType );
 
             // Check the registries now
-            List<Throwable> errors = clonedRegistries.checkRefInteg();
+            errors = clonedRegistries.checkRefInteg();
 
             // If we didn't get any error, swap the registries
-            if ( errors.size() == 0 )
+            if ( errors.isEmpty() )
             {
                 clonedRegistries.setStrict();
                 schemaManager.swapRegistries( clonedRegistries );

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=887926&r1=887925&r2=887926&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 Mon Dec  7 14:06:56 2009
@@ -220,6 +220,7 @@
 
         // Get the Schema
         Schema schema = schemaManager.getLoadedSchema( schemaName );
+        List<Throwable> errors = new ArrayList<Throwable>();
 
         if ( schema.isEnabled() && comparator.isEnabled() )
         {
@@ -245,13 +246,13 @@
             }
 
             // Remove this Comparator from the Registries
-            clonedRegistries.unregister( comparator );
+            clonedRegistries.delete( errors, comparator );
 
             // Remove the Comparator from the schema/SchemaObject Map
             clonedRegistries.dissociateFromSchema( comparator );
 
             // Check the registries now
-            List<Throwable> errors = clonedRegistries.checkRefInteg();
+            errors = clonedRegistries.checkRefInteg();
 
             // If we didn't get any error, swap the registries
             if ( errors.size() == 0 )

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=887926&r1=887925&r2=887926&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 Mon Dec  7 14:06:56 2009
@@ -189,6 +189,7 @@
 
         // Get the schema 
         Schema schema = schemaManager.getLoadedSchema( schemaName );
+        List<Throwable> errors = new ArrayList<Throwable>();
 
         if ( schema.isEnabled() && matchingRule.isEnabled() )
         {
@@ -199,7 +200,7 @@
             clonedRegistries.setRelaxed();
 
             // Remove this MatchingRule from the Registries
-            clonedRegistries.unregister( matchingRule );
+            clonedRegistries.delete( errors, matchingRule );
 
             // Remove the MatchingRule from the schema/SchemaObject Map
             clonedRegistries.dissociateFromSchema( matchingRule );
@@ -208,7 +209,7 @@
             clonedRegistries.delCrossReferences( matchingRule );
 
             // Check the registries now
-            List<Throwable> errors = clonedRegistries.checkRefInteg();
+            errors = clonedRegistries.checkRefInteg();
 
             // If we didn't get any error, swap the registries
             if ( errors.size() == 0 )

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=887926&r1=887925&r2=887926&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 Mon Dec  7 14:06:56 2009
@@ -188,7 +188,7 @@
 
         if ( schema.isEnabled() && objectClass.isEnabled() )
         {
-            objectClass.applyRegistries( null, schemaManager.getRegistries() );
+            objectClass.removeFromRegistries( null, schemaManager.getRegistries() );
         }
 
         String oid = objectClass.getOid();

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SyntaxSynchronizer.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/SyntaxSynchronizer.java?rev=887926&r1=887925&r2=887926&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SyntaxSynchronizer.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SyntaxSynchronizer.java Mon Dec  7 14:06:56 2009
@@ -243,7 +243,7 @@
 
         if ( schema.isEnabled() && syntax.isEnabled() )
         {
-            syntax.applyRegistries( null, schemaManager.getRegistries() );
+            syntax.removeFromRegistries( null, schemaManager.getRegistries() );
         }
 
         String oid = syntax.getOid();

Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaComparatorHandlerIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaComparatorHandlerIT.java?rev=887926&r1=887925&r2=887926&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaComparatorHandlerIT.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaComparatorHandlerIT.java Mon Dec  7 14:06:56 2009
@@ -64,17 +64,16 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-@RunWith ( CiRunner.class )
-@CleanupLevel( Level.CLASS )
+@RunWith(CiRunner.class)
+@CleanupLevel(Level.CLASS)
 public class MetaComparatorHandlerIT extends AbstractMetaSchemaObjectHandlerIT
 {
     private static final String OID = "1.3.6.1.4.1.18060.0.4.0.1.100000";
     private static final String NEW_OID = "1.3.6.1.4.1.18060.0.4.0.1.100001";
 
-
     public static DirectoryService service;
     public static SchemaManager schemaManager;
-    
+
     class DummyMR extends MatchingRule
     {
         public DummyMR()
@@ -85,8 +84,8 @@
 
         private static final long serialVersionUID = 1L;
     }
-    
-    
+
+
     @Before
     public void setup()
     {
@@ -105,7 +104,8 @@
     {
         return new LdapDN( "ou=comparators,cn=" + schemaName );
     }
-    
+
+
     // ----------------------------------------------------------------------
     // Test all core methods with normal operational pathways
     // ----------------------------------------------------------------------
@@ -114,24 +114,20 @@
     @Test
     public void testAddComparatorToEnabledSchema() throws Exception
     {
-        Attributes attrs = AttributeUtils.createAttributes( 
-            "objectClass: top",
-            "objectClass: metaTop",
-            "objectClass: metaComparator",
-            "m-fqcn: " + StringComparator.class.getName(),
-            "m-oid: " + OID,
+        Attributes attrs = AttributeUtils.createAttributes( "objectClass: top", "objectClass: metaTop",
+            "objectClass: metaComparator", "m-fqcn: " + StringComparator.class.getName(), "m-oid: " + OID,
             "m-description: A test comparator" );
-        
+
         LdapDN dn = getComparatorContainer( "apachemeta" );
         dn.add( "m-oid" + "=" + OID );
-        
+
         // Pre-checks
         assertFalse( isOnDisk( dn ) );
         assertFalse( service.getSchemaManager().getComparatorRegistry().contains( OID ) );
 
         // Addition
         getSchemaContext( service ).createSubcontext( dn, attrs );
-        
+
         // Post-checks
         assertTrue( schemaManager.getComparatorRegistry().contains( OID ) );
         assertEquals( schemaManager.getComparatorRegistry().getSchemaName( OID ), "apachemeta" );
@@ -139,32 +135,28 @@
         assertEquals( clazz, StringComparator.class );
         assertTrue( isOnDisk( dn ) );
     }
-    
+
 
     @Test
     public void testAddComparatorToDisabledSchema() throws Exception
     {
-        Attributes attrs = AttributeUtils.createAttributes( 
-            "objectClass: top",
-            "objectClass: metaTop",
-            "objectClass: metaComparator",
-            "m-fqcn: " + StringComparator.class.getName(),
-            "m-oid: " + OID,
+        Attributes attrs = AttributeUtils.createAttributes( "objectClass: top", "objectClass: metaTop",
+            "objectClass: metaComparator", "m-fqcn: " + StringComparator.class.getName(), "m-oid: " + OID,
             "m-description: A test comparator" );
-        
+
         // nis is by default inactive
         LdapDN dn = getComparatorContainer( "nis" );
         dn.add( "m-oid" + "=" + OID );
-        
+
         // Pre-checks
         assertFalse( isOnDisk( dn ) );
         assertFalse( service.getSchemaManager().getComparatorRegistry().contains( OID ) );
 
         // Addition
         getSchemaContext( service ).createSubcontext( dn, attrs );
-        
+
         // Post-checks
-        assertFalse( "adding new comparator to disabled schema should not register it into the registries", 
+        assertFalse( "adding new comparator to disabled schema should not register it into the registries",
             schemaManager.getComparatorRegistry().contains( OID ) );
         assertTrue( isOnDisk( dn ) );
     }
@@ -173,18 +165,14 @@
     @Test
     public void testAddComparatorToUnloadedSchema() throws Exception
     {
-        Attributes attrs = AttributeUtils.createAttributes( 
-            "objectClass: top",
-            "objectClass: metaTop",
-            "objectClass: metaComparator",
-            "m-fqcn: " + StringComparator.class.getName(),
-            "m-oid: " + OID,
+        Attributes attrs = AttributeUtils.createAttributes( "objectClass: top", "objectClass: metaTop",
+            "objectClass: metaComparator", "m-fqcn: " + StringComparator.class.getName(), "m-oid: " + OID,
             "m-description: A test comparator" );
-        
+
         // nis is by default inactive
         LdapDN dn = getComparatorContainer( "notloaded" );
         dn.add( "m-oid" + "=" + OID );
-        
+
         // Pre-checks
         assertFalse( isOnDisk( dn ) );
         assertFalse( service.getSchemaManager().getComparatorRegistry().contains( OID ) );
@@ -195,13 +183,13 @@
             getSchemaContext( service ).createSubcontext( dn, attrs );
             fail( "Should not be there" );
         }
-        catch( NameNotFoundException nnfe )
+        catch ( NameNotFoundException nnfe )
         {
             // Expected result.
         }
-        
+
         // Post-checks
-        assertFalse( "adding new comparator to disabled schema should not register it into the registries", 
+        assertFalse( "adding new comparator to disabled schema should not register it into the registries",
             schemaManager.getComparatorRegistry().contains( OID ) );
         assertFalse( isOnDisk( dn ) );
     }
@@ -212,31 +200,27 @@
     {
         InputStream in = getClass().getResourceAsStream( "DummyComparator.bytecode" );
         ByteArrayOutputStream out = new ByteArrayOutputStream();
-        
+
         while ( in.available() > 0 )
         {
             out.write( in.read() );
         }
-        
-        Attributes attrs = AttributeUtils.createAttributes( 
-            "objectClass: top",
-            "objectClass: metaTop",
+
+        Attributes attrs = AttributeUtils.createAttributes( "objectClass: top", "objectClass: metaTop",
             "objectClass: metaComparator",
-            "m-fqcn: org.apache.directory.shared.ldap.schema.comparators.DummyComparator",
-            "m-bytecode", out.toByteArray(),
-            "m-oid", OID,
-            "m-description: A test comparator" );
-        
+            "m-fqcn: org.apache.directory.shared.ldap.schema.comparators.DummyComparator", "m-bytecode", out
+                .toByteArray(), "m-oid", OID, "m-description: A test comparator" );
+
         LdapDN dn = getComparatorContainer( "apachemeta" );
         dn.add( "m-oid" + "=" + OID );
-        
+
         // Pre-checks
         assertFalse( isOnDisk( dn ) );
         assertFalse( service.getSchemaManager().getComparatorRegistry().contains( OID ) );
 
         // Addition
         getSchemaContext( service ).createSubcontext( dn, attrs );
-        
+
         // Post-checks
         assertTrue( schemaManager.getComparatorRegistry().contains( OID ) );
         assertEquals( schemaManager.getComparatorRegistry().getSchemaName( OID ), "apachemeta" );
@@ -244,28 +228,24 @@
         assertEquals( clazz.getName(), "org.apache.directory.shared.ldap.schema.comparators.DummyComparator" );
         assertTrue( isOnDisk( dn ) );
     }
-    
+
 
     @Test
     public void testAddComparatorWithByteCodeToDisabledSchema() throws Exception
     {
         InputStream in = getClass().getResourceAsStream( "DummyComparator.bytecode" );
         ByteArrayOutputStream out = new ByteArrayOutputStream();
-        
+
         while ( in.available() > 0 )
         {
             out.write( in.read() );
         }
-        
-        Attributes attrs = AttributeUtils.createAttributes( 
-            "objectClass: top",
-            "objectClass: metaTop",
+
+        Attributes attrs = AttributeUtils.createAttributes( "objectClass: top", "objectClass: metaTop",
             "objectClass: metaComparator",
-            "m-fqcn: org.apache.directory.shared.ldap.schema.comparators.DummyComparator",
-            "m-bytecode", out.toByteArray(),
-            "m-oid", OID,
-            "m-description: A test comparator" );
-        
+            "m-fqcn: org.apache.directory.shared.ldap.schema.comparators.DummyComparator", "m-bytecode", out
+                .toByteArray(), "m-oid", OID, "m-description: A test comparator" );
+
         // nis is by default inactive
         LdapDN dn = getComparatorContainer( "nis" );
         dn.add( "m-oid" + "=" + OID );
@@ -276,14 +256,14 @@
 
         // Addition
         getSchemaContext( service ).createSubcontext( dn, attrs );
-        
+
         // Post-checks
-        assertFalse( "adding new comparator to disabled schema should not register it into the registries", 
+        assertFalse( "adding new comparator to disabled schema should not register it into the registries",
             schemaManager.getComparatorRegistry().contains( OID ) );
 
         assertTrue( isOnDisk( dn ) );
     }
-    
+
 
     // ----------------------------------------------------------------------
     // Test Delete operation
@@ -293,29 +273,29 @@
     {
         LdapDN dn = getComparatorContainer( "apachemeta" );
         dn.add( "m-oid" + "=" + OID );
-        
+
         testAddComparatorToEnabledSchema();
-        
+
         // Pre-checks
         assertTrue( schemaManager.getComparatorRegistry().contains( OID ) );
         assertTrue( isOnDisk( dn ) );
-        
+
         // Deletion
         getSchemaContext( service ).destroySubcontext( dn );
 
         // Post-checks
-        assertFalse( "comparator should be removed from the registry after being deleted", 
-            schemaManager.getComparatorRegistry().contains( OID ) );
-        
+        assertFalse( "comparator should be removed from the registry after being deleted", schemaManager
+            .getComparatorRegistry().contains( OID ) );
+
         try
         {
             schemaManager.getComparatorRegistry().lookup( OID );
             fail( "comparator lookup should fail after deleting the comparator" );
         }
-        catch( NamingException e )
+        catch ( NamingException e )
         {
         }
-        
+
         assertFalse( isOnDisk( dn ) );
     }
 
@@ -328,26 +308,26 @@
         testAddComparatorToDisabledSchema();
 
         // Pre-checks
-        assertFalse( "comparator should be removed from the registry after being deleted", 
-            schemaManager.getComparatorRegistry().contains( OID ) );
+        assertFalse( "comparator should be removed from the registry after being deleted", schemaManager
+            .getComparatorRegistry().contains( OID ) );
         assertTrue( isOnDisk( dn ) );
-        
+
         // Deletion
         getSchemaContext( service ).destroySubcontext( dn );
 
         // Post-checks
-        assertFalse( "comparator should be removed from the registry after being deleted", 
-            schemaManager.getComparatorRegistry().contains( OID ) );
-        
+        assertFalse( "comparator should be removed from the registry after being deleted", schemaManager
+            .getComparatorRegistry().contains( OID ) );
+
         try
         {
             schemaManager.getComparatorRegistry().lookup( OID );
             fail( "comparator lookup should fail after deleting the comparator" );
         }
-        catch( NamingException e )
+        catch ( NamingException e )
         {
         }
-        
+
         assertFalse( isOnDisk( dn ) );
     }
 
@@ -357,33 +337,33 @@
     {
         LdapDN dn = getComparatorContainer( "apachemeta" );
         dn.add( "m-oid" + "=" + OID );
-        
+
         testAddComparatorToEnabledSchema();
-        
+
         MatchingRule mr = new DummyMR();
         schemaManager.add( mr );
-        
+
         // Pre-checks
         assertTrue( isOnDisk( dn ) );
         assertTrue( service.getSchemaManager().getComparatorRegistry().contains( OID ) );
         assertTrue( service.getSchemaManager().getMatchingRuleRegistry().contains( mr.getOid() ) );
-        
+
         try
         {
             getSchemaContext( service ).destroySubcontext( dn );
             fail( "should not be able to delete a comparator in use" );
         }
-        catch( LdapOperationNotSupportedException e ) 
+        catch ( LdapOperationNotSupportedException e )
         {
             assertEquals( e.getResultCode(), ResultCodeEnum.UNWILLING_TO_PERFORM );
         }
 
-        assertTrue( "comparator should still be in the registry after delete failure", 
-            schemaManager.getComparatorRegistry().contains( OID ) );
-        schemaManager.unregister( mr );
+        assertTrue( "comparator should still be in the registry after delete failure", schemaManager
+            .getComparatorRegistry().contains( OID ) );
+        schemaManager.delete( mr );
     }
-    
-    
+
+
     // ----------------------------------------------------------------------
     // Test Modify operation
     // ----------------------------------------------------------------------
@@ -391,20 +371,19 @@
     public void testModifyComparatorWithModificationItems() throws Exception
     {
         testAddComparatorToEnabledSchema();
-        
+
         LdapDN dn = getComparatorContainer( "apachemeta" );
         dn.add( "m-oid" + "=" + OID );
-        
+
         ModificationItem[] mods = new ModificationItem[1];
         Attribute attr = new BasicAttribute( "m-fqcn", BooleanComparator.class.getName() );
         mods[0] = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, attr );
         getSchemaContext( service ).modifyAttributes( dn, mods );
 
-        assertTrue( "comparator OID should still be present", 
-            schemaManager.getComparatorRegistry().contains( OID ) );
-        
-        assertEquals( "comparator schema should be set to apachemeta", 
-            schemaManager.getComparatorRegistry().getSchemaName( OID ), "apachemeta" );
+        assertTrue( "comparator OID should still be present", schemaManager.getComparatorRegistry().contains( OID ) );
+
+        assertEquals( "comparator schema should be set to apachemeta", schemaManager.getComparatorRegistry()
+            .getSchemaName( OID ), "apachemeta" );
 
         Class<?> clazz = schemaManager.getComparatorRegistry().lookup( OID ).getClass();
         assertEquals( clazz, BooleanComparator.class );
@@ -415,24 +394,24 @@
     public void testModifyComparatorWithAttributes() throws Exception
     {
         testAddComparatorToEnabledSchema();
-        
+
         LdapDN dn = getComparatorContainer( "apachemeta" );
         dn.add( "m-oid" + "=" + OID );
-        
+
         Attributes mods = new BasicAttributes( true );
         mods.put( "m-fqcn", BooleanComparator.class.getName() );
         getSchemaContext( service ).modifyAttributes( dn, DirContext.REPLACE_ATTRIBUTE, mods );
 
-        assertTrue( "comparator OID should still be present", 
-            schemaManager.getComparatorRegistry().contains( OID ) );
-        
-        assertEquals( "comparator schema should be set to apachemeta", 
-            schemaManager.getComparatorRegistry().getSchemaName( OID ), "apachemeta" );
+        assertTrue( "comparator OID should still be present", schemaManager.getComparatorRegistry().contains( OID ) );
+
+        assertEquals( "comparator schema should be set to apachemeta", schemaManager.getComparatorRegistry()
+            .getSchemaName( OID ), "apachemeta" );
 
         Class<?> clazz = schemaManager.getComparatorRegistry().lookup( OID ).getClass();
         assertEquals( clazz, BooleanComparator.class );
     }
-    
+
+
     // ----------------------------------------------------------------------
     // Test Rename operation
     // ----------------------------------------------------------------------
@@ -442,20 +421,20 @@
         LdapDN dn = getComparatorContainer( "apachemeta" );
         dn.add( "m-oid" + "=" + OID );
         testAddComparatorToEnabledSchema();
-        
+
         LdapDN newdn = getComparatorContainer( "apachemeta" );
         newdn.add( "m-oid" + "=" + NEW_OID );
         getSchemaContext( service ).rename( dn, newdn );
 
-        assertFalse( "old comparator OID should be removed from the registry after being renamed", 
-            schemaManager.getComparatorRegistry().contains( OID ) );
-        
+        assertFalse( "old comparator OID should be removed from the registry after being renamed", schemaManager
+            .getComparatorRegistry().contains( OID ) );
+
         try
         {
             schemaManager.getComparatorRegistry().lookup( OID );
             fail( "comparator lookup should fail after deleting the comparator" );
         }
-        catch( NamingException e )
+        catch ( NamingException e )
         {
         }
 
@@ -472,22 +451,22 @@
         dn.add( "m-oid" + "=" + OID );
         testAddComparatorToEnabledSchema();
         schemaManager.getMatchingRuleRegistry().register( new DummyMR() );
-        
+
         LdapDN newdn = getComparatorContainer( "apachemeta" );
         newdn.add( "m-oid" + "=" + NEW_OID );
-        
+
         try
         {
             getSchemaContext( service ).rename( dn, newdn );
             fail( "should not be able to rename a comparator in use" );
         }
-        catch( LdapOperationNotSupportedException e ) 
+        catch ( LdapOperationNotSupportedException e )
         {
             assertEquals( e.getResultCode(), ResultCodeEnum.UNWILLING_TO_PERFORM );
         }
 
-        assertTrue( "comparator should still be in the registry after rename failure", 
-            schemaManager.getComparatorRegistry().contains( OID ) );
+        assertTrue( "comparator should still be in the registry after rename failure", schemaManager
+            .getComparatorRegistry().contains( OID ) );
         schemaManager.getMatchingRuleRegistry().unregister( OID );
         service.getSchemaManager().getOidRegistry().unregister( OID );
     }
@@ -501,20 +480,19 @@
     public void testMoveComparator() throws Exception
     {
         testAddComparatorToEnabledSchema();
-        
+
         LdapDN dn = getComparatorContainer( "apachemeta" );
         dn.add( "m-oid" + "=" + OID );
 
         LdapDN newdn = getComparatorContainer( "apache" );
         newdn.add( "m-oid" + "=" + OID );
-        
+
         getSchemaContext( service ).rename( dn, newdn );
 
-        assertTrue( "comparator OID should still be present", 
-            schemaManager.getComparatorRegistry().contains( OID ) );
-        
-        assertEquals( "comparator schema should be set to apache not apachemeta", 
-            schemaManager.getComparatorRegistry().getSchemaName( OID ), "apache" );
+        assertTrue( "comparator OID should still be present", schemaManager.getComparatorRegistry().contains( OID ) );
+
+        assertEquals( "comparator schema should be set to apache not apachemeta", schemaManager.getComparatorRegistry()
+            .getSchemaName( OID ), "apache" );
 
         Class<?> clazz = schemaManager.getComparatorRegistry().lookup( OID ).getClass();
         assertEquals( clazz, StringComparator.class );
@@ -526,23 +504,21 @@
     public void testMoveComparatorAndChangeRdn() throws Exception
     {
         testAddComparatorToEnabledSchema();
-        
+
         LdapDN dn = getComparatorContainer( "apachemeta" );
         dn.add( "m-oid" + "=" + OID );
 
         LdapDN newdn = getComparatorContainer( "apache" );
         newdn.add( "m-oid" + "=" + NEW_OID );
-        
+
         getSchemaContext( service ).rename( dn, newdn );
 
-        assertFalse( "old comparator OID should NOT be present", 
-            schemaManager.getComparatorRegistry().contains( OID ) );
-        
-        assertTrue( "new comparator OID should be present", 
-            schemaManager.getComparatorRegistry().contains( NEW_OID ) );
-        
-        assertEquals( "comparator with new oid should have schema set to apache NOT apachemeta", 
-            schemaManager.getComparatorRegistry().getSchemaName( NEW_OID ), "apache" );
+        assertFalse( "old comparator OID should NOT be present", schemaManager.getComparatorRegistry().contains( OID ) );
+
+        assertTrue( "new comparator OID should be present", schemaManager.getComparatorRegistry().contains( NEW_OID ) );
+
+        assertEquals( "comparator with new oid should have schema set to apache NOT apachemeta", schemaManager
+            .getComparatorRegistry().getSchemaName( NEW_OID ), "apache" );
 
         Class<?> clazz = schemaManager.getComparatorRegistry().lookup( NEW_OID ).getClass();
         assertEquals( clazz, StringComparator.class );
@@ -558,25 +534,25 @@
     {
         testAddComparatorToEnabledSchema();
         schemaManager.getMatchingRuleRegistry().register( new DummyMR() );
-        
+
         LdapDN dn = getComparatorContainer( "apachemeta" );
         dn.add( "m-oid" + "=" + OID );
 
         LdapDN newdn = getComparatorContainer( "apache" );
         newdn.add( "m-oid" + "=" + OID );
-        
+
         try
         {
             getSchemaContext( service ).rename( dn, newdn );
             fail( "should not be able to move a comparator in use" );
         }
-        catch( LdapOperationNotSupportedException e ) 
+        catch ( LdapOperationNotSupportedException e )
         {
             assertEquals( e.getResultCode(), ResultCodeEnum.UNWILLING_TO_PERFORM );
         }
 
-        assertTrue( "comparator should still be in the registry after move failure", 
-            schemaManager.getComparatorRegistry().contains( OID ) );
+        assertTrue( "comparator should still be in the registry after move failure", schemaManager
+            .getComparatorRegistry().contains( OID ) );
         schemaManager.getMatchingRuleRegistry().unregister( OID );
         service.getSchemaManager().getOidRegistry().unregister( OID );
     }
@@ -588,59 +564,58 @@
     {
         testAddComparatorToEnabledSchema();
         schemaManager.getMatchingRuleRegistry().register( new DummyMR() );
-        
+
         LdapDN dn = getComparatorContainer( "apachemeta" );
         dn.add( "m-oid" + "=" + OID );
 
         LdapDN newdn = getComparatorContainer( "apache" );
         newdn.add( "m-oid" + "=" + NEW_OID );
-        
+
         try
         {
             getSchemaContext( service ).rename( dn, newdn );
             fail( "should not be able to move a comparator in use" );
         }
-        catch( LdapOperationNotSupportedException e ) 
+        catch ( LdapOperationNotSupportedException e )
         {
             assertEquals( e.getResultCode(), ResultCodeEnum.UNWILLING_TO_PERFORM );
         }
 
-        assertTrue( "comparator should still be in the registry after move failure", 
-            schemaManager.getComparatorRegistry().contains( OID ) );
+        assertTrue( "comparator should still be in the registry after move failure", schemaManager
+            .getComparatorRegistry().contains( OID ) );
         schemaManager.getMatchingRuleRegistry().unregister( OID );
         service.getSchemaManager().getOidRegistry().unregister( OID );
     }
 
-    
+
     // ----------------------------------------------------------------------
     // Let's try some freaky stuff
     // ----------------------------------------------------------------------
 
-
     @Test
     @Ignore
     public void testMoveComparatorToTop() throws Exception
     {
         testAddComparatorToEnabledSchema();
-        
+
         LdapDN dn = getComparatorContainer( "apachemeta" );
         dn.add( "m-oid" + "=" + OID );
 
         LdapDN top = new LdapDN();
         top.add( "m-oid" + "=" + OID );
-        
+
         try
         {
             getSchemaContext( service ).rename( dn, top );
             fail( "should not be able to move a comparator up to ou=schema" );
         }
-        catch( LdapInvalidNameException e ) 
+        catch ( LdapInvalidNameException e )
         {
             assertEquals( e.getResultCode(), ResultCodeEnum.NAMING_VIOLATION );
         }
 
-        assertTrue( "comparator should still be in the registry after move failure", 
-            schemaManager.getComparatorRegistry().contains( OID ) );
+        assertTrue( "comparator should still be in the registry after move failure", schemaManager
+            .getComparatorRegistry().contains( OID ) );
     }
 
 
@@ -649,45 +624,44 @@
     public void testMoveComparatorToNormalizers() throws Exception
     {
         testAddComparatorToEnabledSchema();
-        
+
         LdapDN dn = getComparatorContainer( "apachemeta" );
         dn.add( "m-oid" + "=" + OID );
 
         LdapDN newdn = new LdapDN( "ou=normalizers,cn=apachemeta" );
         newdn.add( "m-oid" + "=" + OID );
-        
+
         try
         {
             getSchemaContext( service ).rename( dn, newdn );
             fail( "should not be able to move a comparator up to normalizers container" );
         }
-        catch( LdapInvalidNameException e ) 
+        catch ( LdapInvalidNameException e )
         {
             assertEquals( e.getResultCode(), ResultCodeEnum.NAMING_VIOLATION );
         }
 
-        assertTrue( "comparator should still be in the registry after move failure", 
-            schemaManager.getComparatorRegistry().contains( OID ) );
+        assertTrue( "comparator should still be in the registry after move failure", schemaManager
+            .getComparatorRegistry().contains( OID ) );
     }
-    
-    
+
+
     @Test
     @Ignore
     public void testMoveComparatorToDisabledSchema() throws Exception
     {
         testAddComparatorToEnabledSchema();
-        
+
         LdapDN dn = getComparatorContainer( "apachemeta" );
         dn.add( "m-oid" + "=" + OID );
 
         // nis is inactive by default
         LdapDN newdn = getComparatorContainer( "nis" );
         newdn.add( "m-oid" + "=" + OID );
-        
+
         getSchemaContext( service ).rename( dn, newdn );
 
-        assertFalse( "comparator OID should no longer be present", 
-            schemaManager.getComparatorRegistry().contains( OID ) );
+        assertFalse( "comparator OID should no longer be present", schemaManager.getComparatorRegistry().contains( OID ) );
     }
 
 
@@ -696,23 +670,23 @@
     public void testMoveComparatorToEnabledSchema() throws Exception
     {
         testAddComparatorToDisabledSchema();
-        
+
         // nis is inactive by default
         LdapDN dn = getComparatorContainer( "nis" );
         dn.add( "m-oid" + "=" + OID );
 
-        assertFalse( "comparator OID should NOT be present when added to disabled nis schema", 
-            schemaManager.getComparatorRegistry().contains( OID ) );
+        assertFalse( "comparator OID should NOT be present when added to disabled nis schema", schemaManager
+            .getComparatorRegistry().contains( OID ) );
 
         LdapDN newdn = getComparatorContainer( "apachemeta" );
         newdn.add( "m-oid" + "=" + OID );
-        
+
         getSchemaContext( service ).rename( dn, newdn );
 
-        assertTrue( "comparator OID should be present when moved to enabled schema", 
-            schemaManager.getComparatorRegistry().contains( OID ) );
-        
-        assertEquals( "comparator should be in apachemeta schema after move", 
-            schemaManager.getComparatorRegistry().getSchemaName( OID ), "apachemeta" );
+        assertTrue( "comparator OID should be present when moved to enabled schema", schemaManager
+            .getComparatorRegistry().contains( OID ) );
+
+        assertEquals( "comparator should be in apachemeta schema after move", schemaManager.getComparatorRegistry()
+            .getSchemaName( OID ), "apachemeta" );
     }
 }

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=887926&r1=887925&r2=887926&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 Mon Dec  7 14:06:56 2009
@@ -721,7 +721,7 @@
 
         GreaterEqNode node = new GreaterEqNode( at.getOid(), new ServerStringValue( at, "3" ) );
         new GreaterEqEvaluator( node, store, schemaManager );
-        schemaManager.unregister( at );
+        schemaManager.delete( at );
     }
 
 
@@ -753,6 +753,6 @@
 
         GreaterEqNode node = new GreaterEqNode( at.getOid(), new ServerStringValue( at, "3" ) );
         new GreaterEqEvaluator( node, store, schemaManager );
-        schemaManager.unregister( at );
+        schemaManager.delete( at );
     }
 }
\ No newline at end of file

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=887926&r1=887925&r2=887926&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 Mon Dec  7 14:06:56 2009
@@ -764,26 +764,28 @@
         LessEqNode node = new LessEqNode( at.getOid(), new ServerStringValue( at, "3" ) );
 
         new LessEqEvaluator( node, store, schemaManager );
-        schemaManager.unregister( at );
+        schemaManager.delete( at );
     }
 
 
     @Test
     public void testEvaluatorAttributeOrderingMatchingRule() throws Exception
     {
+        LdapSyntax syntax = new BogusSyntax( 2 );
+
         MatchingRule mr = new MatchingRule( "1.1" );
-        mr.setSyntax( new BogusSyntax( 2 ) );
+        mr.setSyntax( syntax );
         mr.setLdapComparator( new StringComparator( "1.1" ) );
 
         AttributeType at = new AttributeType( SchemaConstants.ATTRIBUTE_TYPES_AT_OID + ".3000" );
         at.addName( "bogus" );
         at.setSchemaName( "other" );
-        at.setSyntax( new BogusSyntax( 3 ) );
+        at.setSyntax( syntax );
         at.setOrdering( mr );
 
-        schemaManager.add( at.getSyntax() );
-        schemaManager.add( mr );
-        schemaManager.add( at );
+        assertTrue( schemaManager.add( syntax ) );
+        assertTrue( schemaManager.add( mr ) );
+        assertTrue( schemaManager.add( at ) );
 
         SyntaxCheckerDescription desc = new SyntaxCheckerDescription( at.getSyntax().getOid() );
         desc.setDescription( "bogus" );
@@ -795,6 +797,6 @@
 
         LessEqNode node = new LessEqNode( at.getOid(), new ServerStringValue( at, "3" ) );
         new LessEqEvaluator( node, store, schemaManager );
-        schemaManager.unregister( at );
+        schemaManager.delete( at );
     }
 }

Modified: directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/DefaultSchemaManager.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/DefaultSchemaManager.java?rev=887926&r1=887925&r2=887926&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/DefaultSchemaManager.java (original)
+++ directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/DefaultSchemaManager.java Mon Dec  7 14:06:56 2009
@@ -1166,19 +1166,11 @@
 
 
     /**
-     * Check that the given OID does not already exist in the globalOidRegistry.
+     * Check that the given OID exists in the globalOidRegistry.
      */
-    private boolean checkOidIsUnique( SchemaObject schemaObject )
+    private boolean checkOidExist( SchemaObject schemaObject )
     {
-        if ( registries.getGlobalOidRegistry().hasOid( schemaObject.getOid() ) )
-        {
-            Throwable error = new LdapSchemaViolationException( "Oid " + schemaObject.getOid()
-                + " for new schema entity is not unique.", ResultCodeEnum.OTHER );
-            errors.add( error );
-            return false;
-        }
-
-        return true;
+        return registries.getGlobalOidRegistry().hasOid( schemaObject.getOid() );
     }
 
 
@@ -1225,8 +1217,12 @@
         {
             // Clone, apply, check, then apply again if ok
             // The new schemaObject's OID must not already exist
-            if ( !checkOidIsUnique( copy ) )
+            if ( checkOidExist( copy ) )
             {
+                Throwable error = new LdapSchemaViolationException( "Oid " + schemaObject.getOid()
+                    + " for new schema entity is not unique.", ResultCodeEnum.OTHER );
+                errors.add( error );
+
                 return false;
             }
 
@@ -1296,9 +1292,90 @@
     /**
      * {@inheritDoc}
      */
-    public SchemaObject unregister( SchemaObject schemaObject ) throws NamingException
+    public boolean delete( SchemaObject schemaObject ) throws Exception
     {
-        return registries.unregister( schemaObject );
+        // First, clear the errors
+        errors.clear();
+
+        if ( registries.isRelaxed() )
+        {
+            // Apply the addition right away
+            registries.delete( errors, schemaObject );
+
+            return errors.isEmpty();
+        }
+        else
+        {
+            // Clone, apply, check, then apply again if ok
+            // The new schemaObject's OID must exist
+            if ( !checkOidExist( schemaObject ) )
+            {
+                Throwable error = new LdapSchemaViolationException( "Oid " + schemaObject.getOid()
+                    + " for new schema entity does not exist.", ResultCodeEnum.OTHER );
+                errors.add( error );
+                return false;
+            }
+
+            // Build the new AttributeType from the given entry
+            SchemaObject toDelete = registries.getGlobalOidRegistry().getSchemaObject( schemaObject.getOid() );
+            String schemaName = getSchemaName( toDelete );
+
+            // At this point, the deleted AttributeType may be referenced, it will be checked
+            // there, if the schema and the AttributeType are both enabled.
+            Schema schema = getLoadedSchema( schemaName );
+
+            if ( schema == null )
+            {
+                // The SchemaObject must be associated with an existing schema
+                String msg = "Cannot delete the SchemaObject " + schemaObject.getOid()
+                    + " as it's not associated with a schema";
+                LOG.info( msg );
+                Throwable error = new LdapSchemaViolationException( msg, ResultCodeEnum.OTHER );
+                errors.add( error );
+                return false;
+            }
+
+            if ( schema.isEnabled() && schemaObject.isEnabled() )
+            {
+                // As we may break the registries, work on a cloned registries
+                Registries clonedRegistries = registries.clone();
+
+                // Delete the SchemaObject from the cloned registries
+                clonedRegistries.delete( errors, toDelete );
+
+                // Remove the cloned registries
+                clonedRegistries.clear();
+
+                // If we didn't get any error, apply the deletion to the real retistries
+                if ( errors.isEmpty() )
+                {
+                    // Apply the deletion to the real registries
+                    registries.delete( errors, toDelete );
+
+                    LOG.debug( "Removed {} from the enabled schema {}", toDelete.getName(), schemaName );
+
+                    return true;
+                }
+                else
+                {
+                    // We have some error : reject the deletion and get out
+                    String msg = "Cannot deete the SchemaObject " + schemaObject.getOid() + " from the registries, "
+                        + "the resulting registries would be inconsistent :" + StringTools.listToString( errors );
+                    LOG.info( msg );
+
+                    return false;
+                }
+            }
+            else
+            {
+                // At least, we register the OID in the globalOidRegistry, and associates it with the
+                // schema
+                registries.associateWithSchema( errors, schemaObject );
+
+                LOG.debug( "Removed {} from the disabled schema {}", schemaObject.getName(), schemaName );
+                return errors.isEmpty();
+            }
+        }
     }
 
 

Modified: directory/shared/branches/shared-schema/ldap-schema-loader/src/test/java/org/apache/directory/server/schema/SchemaManagerAddTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap-schema-loader/src/test/java/org/apache/directory/server/schema/SchemaManagerAddTest.java?rev=887926&r1=887925&r2=887926&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap-schema-loader/src/test/java/org/apache/directory/server/schema/SchemaManagerAddTest.java (original)
+++ directory/shared/branches/shared-schema/ldap-schema-loader/src/test/java/org/apache/directory/server/schema/SchemaManagerAddTest.java Mon Dec  7 14:06:56 2009
@@ -45,7 +45,7 @@
 
 
 /**
- * A test class for SchemaManager.
+ * A test class for SchemaManager, testig the addition of a SchemaObject.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
@@ -125,7 +125,7 @@
     // For each test, we will check many different things.
     // If the test is successful, we want to know if the SchemaObject
     // Registry has grown : its size must be one bigger. If the SchemaObject
-    // is not loadable, then the GlobalOidRegistry must also have grwon.
+    // is not loadable, then the GlobalOidRegistry must also have grown.
     //=========================================================================
     // AttributeType addition tests
     //-------------------------------------------------------------------------



Mime
View raw message