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

svn commit: r1244136 - in /directory/shared/trunk/ldap: model/src/main/java/org/apache/directory/shared/ldap/model/schema/ model/src/main/java/org/apache/directory/shared/ldap/model/schema/normalizers/ model/src/main/java/org/apache/directory/shared/ld...

Author: elecharny
Date: Tue Feb 14 17:51:25 2012
New Revision: 1244136

URL: http://svn.apache.org/viewvc?rev=1244136&view=rev
Log:
Moved the addToRegistries method from AttributeType to Registries (it's more a proof of concept than anything else, the next step is probably to create an AttributeTypeHelper class to handle the specific methods we want to remove from the SchemaObject, to avoid having a giant Registries class).

Added:
    directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/shared/ldap/schemaloader/EntityFactory.java
      - copied, changed from r1243909, directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/EntityFactory.java
Removed:
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/EntityFactory.java
Modified:
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/AttributeType.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/normalizers/CachingNormalizer.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/registries/Registries.java
    directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/shared/ldap/schemaloader/SchemaEntityFactory.java
    directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/shared/ldap/schemamanager/impl/DefaultSchemaManager.java
    directory/shared/trunk/ldap/schema/data/src/test/java/org/apache/directory/shared/ldap/schemaloader/SchemaManagerAddTest.java

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/AttributeType.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/AttributeType.java?rev=1244136&r1=1244135&r2=1244136&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/AttributeType.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/AttributeType.java Tue Feb 14 17:51:25 2012
@@ -20,14 +20,9 @@
 package org.apache.directory.shared.ldap.model.schema;
 
 
-import java.util.HashSet;
 import java.util.List;
-import java.util.Set;
-
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
-import org.apache.directory.shared.ldap.model.exception.LdapSchemaException;
-import org.apache.directory.shared.ldap.model.exception.LdapSchemaExceptionCodes;
 import org.apache.directory.shared.ldap.model.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.shared.ldap.model.schema.registries.Registries;
 import org.slf4j.Logger;
@@ -202,521 +197,6 @@ public class AttributeType extends Abstr
 
 
     /**
-     * Build the Superior AttributeType reference for an AttributeType
-     */
-    private boolean buildSuperior( List<Throwable> errors, Registries registries )
-    {
-        AttributeType currentSuperior = null;
-        AttributeTypeRegistry attributeTypeRegistry = registries.getAttributeTypeRegistry();
-
-        if ( superiorOid != null )
-        {
-            // This AT has a superior
-            try
-            {
-                currentSuperior = attributeTypeRegistry.lookup( superiorOid );
-            }
-            catch ( Exception e )
-            {
-                // Not allowed.
-                String msg = I18n.err( I18n.ERR_04303, superiorOid, getName() );
-
-                LdapSchemaException ldapSchemaException = new LdapSchemaException(
-                    LdapSchemaExceptionCodes.AT_NONEXISTENT_SUPERIOR, msg, e );
-                ldapSchemaException.setSourceObject( this );
-                ldapSchemaException.setRelatedId( superiorOid );
-                errors.add( ldapSchemaException );
-                LOG.info( msg );
-
-                // Get out now
-                return false;
-            }
-
-            if ( currentSuperior != null )
-            {
-                // a special case : if the superior is collective, this is an error
-                if ( currentSuperior.isCollective )
-                {
-                    String msg = I18n.err( I18n.ERR_04482_CANNOT_SUBTYPE_COLLECTIVE, currentSuperior, getName() );
-
-                    LdapSchemaException ldapSchemaException = new LdapSchemaException(
-                        LdapSchemaExceptionCodes.AT_CANNOT_SUBTYPE_COLLECTIVE_AT, msg );
-                    ldapSchemaException.setSourceObject( this );
-                    errors.add( ldapSchemaException );
-                    LOG.info( msg );
-                    return false;
-                }
-
-                this.superior = currentSuperior;
-
-                // Recursively update the superior if not already done. We don't recurse
-                // if the superior's superior is not null, as it means it has already been
-                // handled.
-                if ( currentSuperior.getSuperior() == null )
-                {
-                    registries.buildReference( errors, currentSuperior );
-                }
-
-                // Update the descendant MAP
-                try
-                {
-                    attributeTypeRegistry.registerDescendants( this, currentSuperior );
-                }
-                catch ( LdapException ne )
-                {
-                    errors.add( ne );
-                    LOG.info( ne.getMessage() );
-                    return false;
-                }
-
-                // Check for cycles now
-                Set<String> superiors = new HashSet<String>();
-                superiors.add( oid );
-                AttributeType tmp = currentSuperior;
-                boolean isOk = true;
-
-                while ( tmp != null )
-                {
-                    if ( superiors.contains( tmp.getOid() ) )
-                    {
-                        // There is a cycle : bad bad bad !
-                        // Not allowed.
-                        String msg = I18n.err( I18n.ERR_04304, getName() );
-
-                        LdapSchemaException ldapSchemaException = new LdapSchemaException(
-                            LdapSchemaExceptionCodes.AT_CYCLE_TYPE_HIERARCHY, msg );
-                        ldapSchemaException.setSourceObject( this );
-                        errors.add( ldapSchemaException );
-                        LOG.info( msg );
-                        isOk = false;
-
-                        break;
-                    }
-                    else
-                    {
-                        superiors.add( tmp.getOid() );
-                        tmp = tmp.getSuperior();
-                    }
-                }
-
-                superiors.clear();
-
-                return isOk;
-            }
-            else
-            {
-                // Not allowed.
-                String msg = I18n.err( I18n.ERR_04305, superiorOid, getName() );
-
-                LdapSchemaException ldapSchemaException = new LdapSchemaException(
-                    LdapSchemaExceptionCodes.AT_NONEXISTENT_SUPERIOR, msg );
-                ldapSchemaException.setSourceObject( this );
-                ldapSchemaException.setRelatedId( superiorOid );
-                errors.add( ldapSchemaException );
-                LOG.info( msg );
-
-                // Get out now
-                return false;
-            }
-        }
-        else
-        {
-            // No superior, just return
-            return true;
-        }
-    }
-
-
-    /**
-     * Build the SYNTAX reference for an AttributeType
-     */
-    private void buildSyntax( List<Throwable> errors, Registries registries )
-    {
-        if ( syntaxOid != null )
-        {
-            LdapSyntax currentSyntax = null;
-
-            try
-            {
-                currentSyntax = registries.getLdapSyntaxRegistry().lookup( syntaxOid );
-            }
-            catch ( LdapException ne )
-            {
-                // Not allowed.
-                String msg = I18n.err( I18n.ERR_04306, syntaxOid, getName() );
-
-                LdapSchemaException ldapSchemaException = new LdapSchemaException(
-                    LdapSchemaExceptionCodes.AT_NONEXISTENT_SYNTAX, msg, ne );
-                ldapSchemaException.setSourceObject( this );
-                ldapSchemaException.setRelatedId( syntaxOid );
-                errors.add( ldapSchemaException );
-                LOG.info( msg );
-                return;
-            }
-
-            if ( currentSyntax != null )
-            {
-                // Update the Syntax reference
-                this.syntax = currentSyntax;
-            }
-            else
-            {
-                // Not allowed.
-                String msg = I18n.err( I18n.ERR_04306, syntaxOid, getName() );
-
-                LdapSchemaException ldapSchemaException = new LdapSchemaException(
-                    LdapSchemaExceptionCodes.AT_NONEXISTENT_SYNTAX, msg );
-                ldapSchemaException.setSourceObject( this );
-                ldapSchemaException.setRelatedId( syntaxOid );
-                errors.add( ldapSchemaException );
-                LOG.info( msg );
-                return;
-            }
-        }
-        else
-        {
-            // We inherit from the superior's syntax, if any
-            if ( superior != null )
-            {
-                this.syntax = superior.getSyntax();
-                this.syntaxOid = this.syntax.getOid();
-            }
-            else
-            {
-                // Not allowed.
-                String msg = I18n.err( I18n.ERR_04307, getName() );
-
-                LdapSchemaException ldapSchemaException = new LdapSchemaException(
-                    LdapSchemaExceptionCodes.AT_SYNTAX_OR_SUPERIOR_REQUIRED, msg );
-                ldapSchemaException.setSourceObject( this );
-                errors.add( ldapSchemaException );
-                LOG.info( msg );
-                return;
-            }
-        }
-    }
-
-
-    /**
-     * Build the EQUALITY MR reference for an AttributeType
-     */
-    private void buildEquality( List<Throwable> errors, Registries registries )
-    {
-        // The equality MR. It can be null
-        if ( equalityOid != null )
-        {
-            MatchingRule currentEquality = null;
-
-            try
-            {
-                currentEquality = registries.getMatchingRuleRegistry().lookup( equalityOid );
-            }
-            catch ( LdapException ne )
-            {
-                // Not allowed.
-                String msg = I18n.err( I18n.ERR_04308, equalityOid, getName() );
-
-                LdapSchemaException ldapSchemaException = new LdapSchemaException(
-                    LdapSchemaExceptionCodes.AT_NONEXISTENT_EQUALITY_MATCHING_RULE, msg, ne );
-                ldapSchemaException.setSourceObject( this );
-                ldapSchemaException.setRelatedId( equalityOid );
-                errors.add( ldapSchemaException );
-                LOG.info( msg );
-                return;
-            }
-
-            if ( currentEquality != null )
-            {
-                this.equality = currentEquality;
-            }
-            else
-            {
-                // Not allowed.
-                String msg = I18n.err( I18n.ERR_04309, equalityOid, getName() );
-
-                LdapSchemaException ldapSchemaException = new LdapSchemaException(
-                    LdapSchemaExceptionCodes.AT_NONEXISTENT_EQUALITY_MATCHING_RULE, msg );
-                ldapSchemaException.setSourceObject( this );
-                ldapSchemaException.setRelatedId( equalityOid );
-                errors.add( ldapSchemaException );
-                LOG.info( msg );
-            }
-        }
-        else
-        {
-            // If the AT has a superior, take its Equality MR if any
-            if ( ( superior != null ) && ( superior.getEquality() != null ) )
-            {
-                this.equality = superior.getEquality();
-                this.equalityOid = this.equality.getOid();
-            }
-        }
-    }
-
-
-    /**
-     * Build the ORDERING MR reference for an AttributeType
-     */
-    private void buildOrdering( List<Throwable> errors, Registries registries )
-    {
-        if ( orderingOid != null )
-        {
-            MatchingRule currentOrdering = null;
-
-            try
-            {
-                currentOrdering = registries.getMatchingRuleRegistry().lookup( orderingOid );
-            }
-            catch ( LdapException ne )
-            {
-                // Not allowed.
-                String msg = I18n.err( I18n.ERR_04310, orderingOid, getName() );
-
-                LdapSchemaException ldapSchemaException = new LdapSchemaException(
-                    LdapSchemaExceptionCodes.AT_NONEXISTENT_ORDERING_MATCHING_RULE, msg, ne );
-                ldapSchemaException.setSourceObject( this );
-                ldapSchemaException.setRelatedId( orderingOid );
-                errors.add( ldapSchemaException );
-                LOG.info( msg );
-                return;
-            }
-
-            if ( currentOrdering != null )
-            {
-                this.ordering = currentOrdering;
-            }
-            else
-            {
-                // Not allowed.
-                String msg = I18n.err( I18n.ERR_04311, orderingOid, getName() );
-
-                LdapSchemaException ldapSchemaException = new LdapSchemaException(
-                    LdapSchemaExceptionCodes.AT_NONEXISTENT_ORDERING_MATCHING_RULE, msg );
-                ldapSchemaException.setSourceObject( this );
-                ldapSchemaException.setRelatedId( orderingOid );
-                errors.add( ldapSchemaException );
-                LOG.info( msg );
-            }
-        }
-        else
-        {
-            // If the AT has a superior, take its Ordering MR if any
-            if ( ( superior != null ) && ( superior.getOrdering() != null ) )
-            {
-                this.ordering = superior.getOrdering();
-                this.orderingOid = this.ordering.getOid();
-            }
-        }
-    }
-
-
-    /**
-     * Build the SUBSTR MR reference for an AttributeType
-     */
-    private void buildSubstring( List<Throwable> errors, Registries registries )
-    {
-        // The Substring MR. It can be null
-        if ( substringOid != null )
-        {
-            MatchingRule currentSubstring = null;
-
-            try
-            {
-                currentSubstring = registries.getMatchingRuleRegistry().lookup( substringOid );
-            }
-            catch ( LdapException ne )
-            {
-                // Not allowed.
-                String msg = I18n.err( I18n.ERR_04312, substringOid, getName() );
-
-                LdapSchemaException ldapSchemaException = new LdapSchemaException(
-                    LdapSchemaExceptionCodes.AT_NONEXISTENT_SUBSTRING_MATCHING_RULE, msg, ne );
-                ldapSchemaException.setSourceObject( this );
-                ldapSchemaException.setRelatedId( substringOid );
-                errors.add( ldapSchemaException );
-                LOG.info( msg );
-                return;
-            }
-
-            if ( currentSubstring != null )
-            {
-                this.substring = currentSubstring;
-            }
-            else
-            {
-                // Not allowed.
-                String msg = I18n.err( I18n.ERR_04313, substringOid, getName() );
-
-                LdapSchemaException ldapSchemaException = new LdapSchemaException(
-                    LdapSchemaExceptionCodes.AT_NONEXISTENT_SUBSTRING_MATCHING_RULE, msg );
-                ldapSchemaException.setSourceObject( this );
-                ldapSchemaException.setRelatedId( substringOid );
-                errors.add( ldapSchemaException );
-                LOG.info( msg );
-                return;
-            }
-        }
-        else
-        {
-            // If the AT has a superior, take its Substring MR if any
-            if ( ( superior != null ) && ( superior.getSubstring() != null ) )
-            {
-                this.substring = superior.getSubstring();
-                this.substringOid = this.substring.getOid();
-            }
-        }
-    }
-
-
-    /**
-     * Check the constraints for the Usage field.
-     */
-    private void checkUsage( List<Throwable> errors )
-    {
-        // Check that the AT usage is the same that its superior
-        if ( ( superior != null ) && ( usage != superior.getUsage() ) )
-        {
-            // This is an error
-            String msg = I18n.err( I18n.ERR_04314, getName() );
-
-            LdapSchemaException ldapSchemaException = new LdapSchemaException(
-                LdapSchemaExceptionCodes.AT_MUST_HAVE_SAME_USAGE_THAN_SUPERIOR, msg );
-            ldapSchemaException.setSourceObject( this );
-            errors.add( ldapSchemaException );
-            LOG.info( msg );
-            return;
-        }
-
-        // Now, check that the AttributeType's USAGE does not conflict
-        if ( !isUserModifiable() && ( usage == UsageEnum.USER_APPLICATIONS ) )
-        {
-            // Cannot have a not user modifiable AT which is not an operational AT
-            String msg = I18n.err( I18n.ERR_04315, getName() );
-
-            LdapSchemaException ldapSchemaException = new LdapSchemaException(
-                LdapSchemaExceptionCodes.AT_USER_APPLICATIONS_USAGE_MUST_BE_USER_MODIFIABLE, msg );
-            ldapSchemaException.setSourceObject( this );
-            errors.add( ldapSchemaException );
-            LOG.info( msg );
-        }
-    }
-
-
-    /**
-     * Check the constraints for the Collective field.
-     */
-    private void checkCollective( List<Throwable> errors )
-    {
-        if ( ( superior != null ) && superior.isCollective() )
-        {
-            // An AttributeType will be collective if its superior is collective
-            this.isCollective = true;
-        }
-
-        if ( isCollective() && ( usage != UsageEnum.USER_APPLICATIONS ) )
-        {
-            // An AttributeType which is collective must be a USER attributeType
-            String msg = I18n.err( I18n.ERR_04316, getName() );
-
-            LdapSchemaException ldapSchemaException = new LdapSchemaException(
-                LdapSchemaExceptionCodes.AT_COLLECTIVE_MUST_HAVE_USER_APPLICATIONS_USAGE, msg );
-            ldapSchemaException.setSourceObject( this );
-            errors.add( ldapSchemaException );
-            LOG.info( msg );
-        }
-
-        if ( isCollective() && isSingleValued() )
-        {
-            // A collective attribute must be multi-valued
-            String msg = I18n.err( I18n.ERR_04483_COLLECTIVE_NOT_MULTI_VALUED, getName() );
-
-            LdapSchemaException ldapSchemaException = new LdapSchemaException(
-                LdapSchemaExceptionCodes.AT_COLLECTIVE_CANNOT_BE_SINGLE_VALUED, msg );
-            ldapSchemaException.setSourceObject( this );
-            errors.add( ldapSchemaException );
-            LOG.info( msg );
-        }
-    }
-
-
-    /**
-     * {@inheritDoc}
-     *
-     * If one of the referenced SchemaObject does not exist (SUP, EQUALITY, ORDERING, SUBSTR, SYNTAX),
-     * an exception is thrown.
-     */
-    public void addToRegistries( List<Throwable> errors, Registries registries ) throws LdapException
-    {
-        if ( registries != null )
-        {
-            AttributeTypeRegistry attributeTypeRegistry = registries.getAttributeTypeRegistry();
-
-            // The superior
-            if ( !buildSuperior( errors, registries ) )
-            {
-                // We have had errors, let's stop here as we need a correct superior to continue
-                return;
-            }
-
-            // The Syntax
-            buildSyntax( errors, registries );
-
-            // The EQUALITY matching rule
-            buildEquality( errors, registries );
-
-            // The ORDERING matching rule
-            buildOrdering( errors, registries );
-
-            // The SUBSTR matching rule
-            buildSubstring( errors, registries );
-
-            // Check the USAGE
-            checkUsage( errors );
-
-            // Check the COLLECTIVE element
-            checkCollective( errors );
-
-            // Inject the attributeType into the oid/normalizer map
-            attributeTypeRegistry.addMappingFor( this );
-
-            // Register this AttributeType into the Descendant map
-            attributeTypeRegistry.registerDescendants( this, superior );
-
-            /**
-             * Add the AT references (using and usedBy) :
-             * AT -> MR (for EQUALITY, ORDERING and SUBSTR)
-             * AT -> S
-             * AT -> AT
-             */
-            if ( equality != null )
-            {
-                registries.addReference( this, equality );
-            }
-
-            if ( ordering != null )
-            {
-                registries.addReference( this, ordering );
-            }
-
-            if ( substring != null )
-            {
-                registries.addReference( this, substring );
-            }
-
-            if ( syntax != null )
-            {
-                registries.addReference( this, syntax );
-            }
-
-            if ( superior != null )
-            {
-                registries.addReference( this, superior );
-            }
-        }
-    }
-
-
-    /**
      * {@inheritDoc}
      *
      * If one of the referenced SchemaObject does not exist (SUP, EQUALITY, ORDERING, SUBSTR, SYNTAX),
@@ -1751,4 +1231,10 @@ public class AttributeType extends Abstr
             return false;
         }
     }
+    
+    
+    public void unlock()
+    {
+        locked = false;
+    }
 }

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/normalizers/CachingNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/normalizers/CachingNormalizer.java?rev=1244136&r1=1244135&r2=1244136&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/normalizers/CachingNormalizer.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/normalizers/CachingNormalizer.java Tue Feb 14 17:51:25 2012
@@ -6,16 +6,16 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- *  
+ * 
  *    http://www.apache.org/licenses/LICENSE-2.0
- *  
+ * 
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
- *  under the License. 
- *  
+ *  under the License.
+ * 
  */
 package org.apache.directory.shared.ldap.model.schema.normalizers;
 
@@ -24,7 +24,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.apache.directory.shared.ldap.model.schema.Normalizer;
 import org.apache.directory.shared.ldap.model.schema.SchemaManager;
-import org.apache.directory.shared.ldap.model.schema.registries.Registries;
 
 
 /**
@@ -48,7 +47,7 @@ public class CachingNormalizer extends N
 
     /**
      * Creates a CachingNormalizer that decorates another normalizer using a
-     * default cache size.  This Normalizer delegates 
+     * default cache size.  This Normalizer delegates
      * 
      * @param normalizer the underlying Normalizer being decorated
      */
@@ -73,7 +72,7 @@ public class CachingNormalizer extends N
 
 
     /**
-     * Overrides default behavior by returning the OID of the wrapped 
+     * Overrides default behavior by returning the OID of the wrapped
      * Normalizer.
      */
     @Override
@@ -129,15 +128,6 @@ public class CachingNormalizer extends N
 
 
     /**
-     * {@inheritDoc}
-     */
-    public void setRegistries( Registries registries )
-    {
-        normalizer.setRegistries( registries );
-    }
-
-
-    /**
      * Sets the SchemaManager
      * 
      * @param schemaManager The SchemaManager

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/registries/Registries.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/registries/Registries.java?rev=1244136&r1=1244135&r2=1244136&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/registries/Registries.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/registries/Registries.java Tue Feb 14 17:51:25 2012
@@ -52,6 +52,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.schema.SchemaObject;
 import org.apache.directory.shared.ldap.model.schema.SchemaObjectWrapper;
 import org.apache.directory.shared.ldap.model.schema.SyntaxChecker;
+import org.apache.directory.shared.ldap.model.schema.UsageEnum;
 import org.apache.directory.shared.util.Strings;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -729,7 +730,14 @@ public class Registries implements Schem
     {
         try
         {
-            schemaObject.addToRegistries( errors, this );
+            if ( schemaObject instanceof AttributeType )
+            {
+                addToRegistries( (AttributeType)schemaObject, errors, this );
+            }
+            else
+            {
+                schemaObject.addToRegistries( errors, this );
+            }
         }
         catch ( LdapException ne )
         {
@@ -2845,6 +2853,548 @@ public class Registries implements Schem
 
 
     /**
+     * {@inheritDoc}
+     *
+     * If one of the referenced SchemaObject does not exist (SUP, EQUALITY, ORDERING, SUBSTR, SYNTAX),
+     * an exception is thrown.
+     */
+    public void addToRegistries( AttributeType attributeType, List<Throwable> errors, Registries registries ) throws LdapException
+    {
+        if ( registries != null )
+        {
+            attributeType.unlock();
+            AttributeTypeRegistry attributeTypeRegistry = registries.getAttributeTypeRegistry();
+
+            // The superior
+            if ( !buildSuperior( attributeType, errors, registries ) )
+            {
+                // We have had errors, let's stop here as we need a correct superior to continue
+                attributeType.lock();
+                return;
+            }
+
+            // The Syntax
+            buildSyntax( attributeType, errors, registries );
+
+            // The EQUALITY matching rule
+            buildEquality( attributeType, errors, registries );
+
+            // The ORDERING matching rule
+            buildOrdering( attributeType, errors, registries );
+
+            // The SUBSTR matching rule
+            buildSubstring( attributeType, errors, registries );
+
+            // Check the USAGE
+            checkUsage( attributeType, errors );
+
+            // Check the COLLECTIVE element
+            checkCollective( attributeType, errors );
+
+            // Inject the attributeType into the oid/normalizer map
+            attributeTypeRegistry.addMappingFor( attributeType );
+
+            // Register this AttributeType into the Descendant map
+            attributeTypeRegistry.registerDescendants( attributeType, attributeType.getSuperior() );
+
+            /**
+             * Add the AT references (using and usedBy) :
+             * AT -> MR (for EQUALITY, ORDERING and SUBSTR)
+             * AT -> S
+             * AT -> AT
+             */
+            if ( attributeType.getEquality() != null )
+            {
+                registries.addReference( attributeType, attributeType.getEquality() );
+            }
+
+            if ( attributeType.getOrdering() != null )
+            {
+                registries.addReference( attributeType, attributeType.getOrdering() );
+            }
+
+            if ( attributeType.getSubstring() != null )
+            {
+                registries.addReference( attributeType, attributeType.getSubstring() );
+            }
+
+            if ( attributeType.getSyntax() != null )
+            {
+                registries.addReference( attributeType, attributeType.getSyntax() );
+            }
+
+            if ( attributeType.getSuperior() != null )
+            {
+                registries.addReference( attributeType, attributeType.getSuperior() );
+            }
+            
+            attributeType.lock();
+        }
+    }
+
+
+    /**
+     * Build the Superior AttributeType reference for an AttributeType
+     */
+    private boolean buildSuperior( AttributeType attributeType, List<Throwable> errors, Registries registries )
+    {
+        AttributeType currentSuperior = null;
+        AttributeTypeRegistry attributeTypeRegistry = registries.getAttributeTypeRegistry();
+        
+        String superiorOid = attributeType.getSuperiorOid();
+
+        if ( superiorOid != null )
+        {
+            // This AT has a superior
+            try
+            {
+                currentSuperior = attributeTypeRegistry.lookup( superiorOid );
+            }
+            catch ( Exception e )
+            {
+                // Not allowed.
+                String msg = I18n.err( I18n.ERR_04303, superiorOid, attributeType.getName() );
+
+                LdapSchemaException ldapSchemaException = new LdapSchemaException(
+                    LdapSchemaExceptionCodes.AT_NONEXISTENT_SUPERIOR, msg, e );
+                ldapSchemaException.setSourceObject( attributeType );
+                ldapSchemaException.setRelatedId( superiorOid );
+                errors.add( ldapSchemaException );
+                LOG.info( msg );
+
+                // Get out now
+                return false;
+            }
+
+            if ( currentSuperior != null )
+            {
+                // a special case : if the superior is collective, this is an error
+                if ( currentSuperior.isCollective() )
+                {
+                    String msg = I18n.err( I18n.ERR_04482_CANNOT_SUBTYPE_COLLECTIVE,
+                        currentSuperior, attributeType.getName() );
+
+                    LdapSchemaException ldapSchemaException = new LdapSchemaException(
+                        LdapSchemaExceptionCodes.AT_CANNOT_SUBTYPE_COLLECTIVE_AT, msg );
+                    ldapSchemaException.setSourceObject( attributeType );
+                    errors.add( ldapSchemaException );
+                    LOG.info( msg );
+                    return false;
+                }
+
+                attributeType.setSuperior( currentSuperior );
+
+                // Recursively update the superior if not already done. We don't recurse
+                // if the superior's superior is not null, as it means it has already been
+                // handled.
+                if ( currentSuperior.getSuperior() == null )
+                {
+                    registries.buildReference( errors, currentSuperior );
+                }
+
+                // Update the descendant MAP
+                try
+                {
+                    attributeTypeRegistry.registerDescendants( attributeType, currentSuperior );
+                }
+                catch ( LdapException ne )
+                {
+                    errors.add( ne );
+                    LOG.info( ne.getMessage() );
+                    return false;
+                }
+
+                // Check for cycles now
+                Set<String> superiors = new HashSet<String>();
+                superiors.add( attributeType.getOid() );
+                AttributeType tmp = currentSuperior;
+                boolean isOk = true;
+
+                while ( tmp != null )
+                {
+                    if ( superiors.contains( tmp.getOid() ) )
+                    {
+                        // There is a cycle : bad bad bad !
+                        // Not allowed.
+                        String msg = I18n.err( I18n.ERR_04304, attributeType.getName() );
+
+                        LdapSchemaException ldapSchemaException = new LdapSchemaException(
+                            LdapSchemaExceptionCodes.AT_CYCLE_TYPE_HIERARCHY, msg );
+                        ldapSchemaException.setSourceObject( attributeType );
+                        errors.add( ldapSchemaException );
+                        LOG.info( msg );
+                        isOk = false;
+
+                        break;
+                    }
+                    else
+                    {
+                        superiors.add( tmp.getOid() );
+                        tmp = tmp.getSuperior();
+                    }
+                }
+
+                superiors.clear();
+
+                return isOk;
+            }
+            else
+            {
+                // Not allowed.
+                String msg = I18n.err( I18n.ERR_04305, superiorOid, attributeType.getName() );
+
+                LdapSchemaException ldapSchemaException = new LdapSchemaException(
+                    LdapSchemaExceptionCodes.AT_NONEXISTENT_SUPERIOR, msg );
+                ldapSchemaException.setSourceObject( attributeType );
+                ldapSchemaException.setRelatedId( superiorOid );
+                errors.add( ldapSchemaException );
+                LOG.info( msg );
+
+                // Get out now
+                return false;
+            }
+        }
+        else
+        {
+            // No superior, just return
+            return true;
+        }
+    }
+
+
+    /**
+     * Build the SYNTAX reference for an AttributeType
+     */
+    private void buildSyntax( AttributeType attributeType, List<Throwable> errors, Registries registries )
+    {
+        String syntaxOid = attributeType.getSyntaxOid();
+        
+        if ( syntaxOid != null )
+        {
+            LdapSyntax currentSyntax = null;
+
+            try
+            {
+                currentSyntax = registries.getLdapSyntaxRegistry().lookup( syntaxOid );
+            }
+            catch ( LdapException ne )
+            {
+                // Not allowed.
+                String msg = I18n.err( I18n.ERR_04306, syntaxOid, attributeType.getName() );
+
+                LdapSchemaException ldapSchemaException = new LdapSchemaException(
+                    LdapSchemaExceptionCodes.AT_NONEXISTENT_SYNTAX, msg, ne );
+                ldapSchemaException.setSourceObject( attributeType );
+                ldapSchemaException.setRelatedId( syntaxOid );
+                errors.add( ldapSchemaException );
+                LOG.info( msg );
+                return;
+            }
+
+            if ( currentSyntax != null )
+            {
+                // Update the Syntax reference
+                attributeType.setSyntax( currentSyntax );
+            }
+            else
+            {
+                // Not allowed.
+                String msg = I18n.err( I18n.ERR_04306, syntaxOid, attributeType.getName() );
+
+                LdapSchemaException ldapSchemaException = new LdapSchemaException(
+                    LdapSchemaExceptionCodes.AT_NONEXISTENT_SYNTAX, msg );
+                ldapSchemaException.setSourceObject( attributeType );
+                ldapSchemaException.setRelatedId( syntaxOid );
+                errors.add( ldapSchemaException );
+                LOG.info( msg );
+                return;
+            }
+        }
+        else
+        {
+            // We inherit from the superior's syntax, if any
+            if ( attributeType.getSuperior() != null )
+            {
+                attributeType.setSyntax( attributeType.getSuperior().getSyntax() );
+            }
+            else
+            {
+                // Not allowed.
+                String msg = I18n.err( I18n.ERR_04307, attributeType.getName() );
+
+                LdapSchemaException ldapSchemaException = new LdapSchemaException(
+                    LdapSchemaExceptionCodes.AT_SYNTAX_OR_SUPERIOR_REQUIRED, msg );
+                ldapSchemaException.setSourceObject( attributeType );
+                errors.add( ldapSchemaException );
+                LOG.info( msg );
+                return;
+            }
+        }
+    }
+    
+    
+
+
+    /**
+     * Build the EQUALITY MR reference for an AttributeType
+     */
+    private void buildEquality( AttributeType attributeType, List<Throwable> errors, Registries registries )
+    {
+        String equalityOid = attributeType.getEqualityOid();
+        
+        // The equality MR. It can be null
+        if ( equalityOid != null )
+        {
+            MatchingRule currentEquality = null;
+
+            try
+            {
+                currentEquality = registries.getMatchingRuleRegistry().lookup( equalityOid );
+            }
+            catch ( LdapException ne )
+            {
+                // Not allowed.
+                String msg = I18n.err( I18n.ERR_04308, equalityOid, attributeType.getName() );
+
+                LdapSchemaException ldapSchemaException = new LdapSchemaException(
+                    LdapSchemaExceptionCodes.AT_NONEXISTENT_EQUALITY_MATCHING_RULE, msg, ne );
+                ldapSchemaException.setSourceObject( attributeType );
+                ldapSchemaException.setRelatedId( equalityOid );
+                errors.add( ldapSchemaException );
+                LOG.info( msg );
+                return;
+            }
+
+            if ( currentEquality != null )
+            {
+                attributeType.setEquality( currentEquality );
+            }
+            else
+            {
+                // Not allowed.
+                String msg = I18n.err( I18n.ERR_04309, equalityOid, attributeType.getName() );
+
+                LdapSchemaException ldapSchemaException = new LdapSchemaException(
+                    LdapSchemaExceptionCodes.AT_NONEXISTENT_EQUALITY_MATCHING_RULE, msg );
+                ldapSchemaException.setSourceObject( attributeType );
+                ldapSchemaException.setRelatedId( equalityOid );
+                errors.add( ldapSchemaException );
+                LOG.info( msg );
+            }
+        }
+        else
+        {
+            AttributeType superior = attributeType.getSuperior();
+            
+            // If the AT has a superior, take its Equality MR if any
+            if ( ( superior != null ) && ( superior.getEquality() != null ) )
+            {
+                attributeType.setEquality( superior.getEquality() );
+            }
+        }
+    }
+
+
+    /**
+     * Build the SUBSTR MR reference for an AttributeType
+     */
+    private void buildSubstring( AttributeType attributeType, List<Throwable> errors, Registries registries )
+    {
+        String substringOid = attributeType.getSubstringOid();
+        
+        // The Substring MR. It can be null
+        if ( substringOid != null )
+        {
+            MatchingRule currentSubstring = null;
+
+            try
+            {
+                currentSubstring = registries.getMatchingRuleRegistry().lookup( substringOid );
+            }
+            catch ( LdapException ne )
+            {
+                // Not allowed.
+                String msg = I18n.err( I18n.ERR_04312, substringOid, attributeType.getName() );
+
+                LdapSchemaException ldapSchemaException = new LdapSchemaException(
+                    LdapSchemaExceptionCodes.AT_NONEXISTENT_SUBSTRING_MATCHING_RULE, msg, ne );
+                ldapSchemaException.setSourceObject( attributeType );
+                ldapSchemaException.setRelatedId( substringOid );
+                errors.add( ldapSchemaException );
+                LOG.info( msg );
+                return;
+            }
+
+            if ( currentSubstring != null )
+            {
+                attributeType.setSubstring( currentSubstring );
+            }
+            else
+            {
+                // Not allowed.
+                String msg = I18n.err( I18n.ERR_04313, substringOid, attributeType.getName() );
+
+                LdapSchemaException ldapSchemaException = new LdapSchemaException(
+                    LdapSchemaExceptionCodes.AT_NONEXISTENT_SUBSTRING_MATCHING_RULE, msg );
+                ldapSchemaException.setSourceObject( attributeType );
+                ldapSchemaException.setRelatedId( substringOid );
+                errors.add( ldapSchemaException );
+                LOG.info( msg );
+                return;
+            }
+        }
+        else
+        {
+            AttributeType superior = attributeType.getSuperior();
+            
+            // If the AT has a superior, take its Substring MR if any
+            if ( ( superior != null ) && ( superior.getSubstring() != null ) )
+            {
+                attributeType.setSubstring( superior.getSubstring() );
+            }
+        }
+    }
+    
+    
+
+
+
+
+    /**
+     * Build the ORDERING MR reference for an AttributeType
+     */
+    private void buildOrdering( AttributeType attributeType, List<Throwable> errors, Registries registries )
+    {
+        String orderingOid = attributeType.getOrderingOid();
+        
+        if ( orderingOid != null )
+        {
+            MatchingRule currentOrdering = null;
+
+            try
+            {
+                currentOrdering = registries.getMatchingRuleRegistry().lookup( orderingOid );
+            }
+            catch ( LdapException ne )
+            {
+                // Not allowed.
+                String msg = I18n.err( I18n.ERR_04310, orderingOid, attributeType.getName() );
+
+                LdapSchemaException ldapSchemaException = new LdapSchemaException(
+                    LdapSchemaExceptionCodes.AT_NONEXISTENT_ORDERING_MATCHING_RULE, msg, ne );
+                ldapSchemaException.setSourceObject( attributeType );
+                ldapSchemaException.setRelatedId( orderingOid );
+                errors.add( ldapSchemaException );
+                LOG.info( msg );
+                return;
+            }
+
+            if ( currentOrdering != null )
+            {
+                attributeType.setOrdering( currentOrdering );
+            }
+            else
+            {
+                // Not allowed.
+                String msg = I18n.err( I18n.ERR_04311, orderingOid, attributeType.getName() );
+
+                LdapSchemaException ldapSchemaException = new LdapSchemaException(
+                    LdapSchemaExceptionCodes.AT_NONEXISTENT_ORDERING_MATCHING_RULE, msg );
+                ldapSchemaException.setSourceObject( attributeType );
+                ldapSchemaException.setRelatedId( orderingOid );
+                errors.add( ldapSchemaException );
+                LOG.info( msg );
+            }
+        }
+        else
+        {
+            AttributeType superior = attributeType.getSuperior();
+            
+            // If the AT has a superior, take its Ordering MR if any
+            if ( ( superior != null ) && ( superior.getOrdering() != null ) )
+            {
+                attributeType.setOrdering( superior.getOrdering() );
+            }
+        }
+    }
+
+    
+    /**
+     * Check the constraints for the Usage field.
+     */
+    private void checkUsage( AttributeType attributeType, List<Throwable> errors )
+    {
+        AttributeType superior = attributeType.getSuperior();
+        
+        // Check that the AT usage is the same that its superior
+        if ( ( superior != null ) && ( attributeType.getUsage() != superior.getUsage() ) )
+        {
+            // This is an error
+            String msg = I18n.err( I18n.ERR_04314, attributeType.getName() );
+
+            LdapSchemaException ldapSchemaException = new LdapSchemaException(
+                LdapSchemaExceptionCodes.AT_MUST_HAVE_SAME_USAGE_THAN_SUPERIOR, msg );
+            ldapSchemaException.setSourceObject( attributeType );
+            errors.add( ldapSchemaException );
+            LOG.info( msg );
+            return;
+        }
+
+        // Now, check that the AttributeType's USAGE does not conflict
+        if ( !attributeType.isUserModifiable() && ( attributeType.getUsage() == UsageEnum.USER_APPLICATIONS ) )
+        {
+            // Cannot have a not user modifiable AT which is not an operational AT
+            String msg = I18n.err( I18n.ERR_04315, attributeType.getName() );
+
+            LdapSchemaException ldapSchemaException = new LdapSchemaException(
+                LdapSchemaExceptionCodes.AT_USER_APPLICATIONS_USAGE_MUST_BE_USER_MODIFIABLE, msg );
+            ldapSchemaException.setSourceObject( attributeType );
+            errors.add( ldapSchemaException );
+            LOG.info( msg );
+        }
+    }
+
+
+    /**
+     * Check the constraints for the Collective field.
+     */
+    private void checkCollective( AttributeType attributeType, List<Throwable> errors )
+    {
+        AttributeType superior = attributeType.getSuperior();
+
+        if ( ( superior != null ) && superior.isCollective() )
+        {
+            // An AttributeType will be collective if its superior is collective
+            attributeType.setCollective( true );
+        }
+
+        if ( attributeType.isCollective() && ( attributeType.getUsage() != UsageEnum.USER_APPLICATIONS ) )
+        {
+            // An AttributeType which is collective must be a USER attributeType
+            String msg = I18n.err( I18n.ERR_04316, attributeType.getName() );
+
+            LdapSchemaException ldapSchemaException = new LdapSchemaException(
+                LdapSchemaExceptionCodes.AT_COLLECTIVE_MUST_HAVE_USER_APPLICATIONS_USAGE, msg );
+            ldapSchemaException.setSourceObject( attributeType );
+            errors.add( ldapSchemaException );
+            LOG.info( msg );
+        }
+
+        if ( attributeType.isCollective() && attributeType.isSingleValued() )
+        {
+            // A collective attribute must be multi-valued
+            String msg = I18n.err( I18n.ERR_04483_COLLECTIVE_NOT_MULTI_VALUED, attributeType.getName() );
+
+            LdapSchemaException ldapSchemaException = new LdapSchemaException(
+                LdapSchemaExceptionCodes.AT_COLLECTIVE_CANNOT_BE_SINGLE_VALUED, msg );
+            ldapSchemaException.setSourceObject( attributeType );
+            errors.add( ldapSchemaException );
+            LOG.info( msg );
+        }
+    }
+
+
+    /**
      * @see Object#toString()
      */
     public String toString()

Copied: directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/shared/ldap/schemaloader/EntityFactory.java (from r1243909, directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/EntityFactory.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/shared/ldap/schemaloader/EntityFactory.java?p2=directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/shared/ldap/schemaloader/EntityFactory.java&p1=directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/EntityFactory.java&r1=1243909&r2=1244136&rev=1244136&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/EntityFactory.java (original)
+++ directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/shared/ldap/schemaloader/EntityFactory.java Tue Feb 14 17:51:25 2012
@@ -17,11 +17,19 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.model.schema;
+package org.apache.directory.shared.ldap.schemaloader;
 
 
 import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
+import org.apache.directory.shared.ldap.model.schema.AttributeType;
+import org.apache.directory.shared.ldap.model.schema.LdapComparator;
+import org.apache.directory.shared.ldap.model.schema.LdapSyntax;
+import org.apache.directory.shared.ldap.model.schema.MatchingRule;
+import org.apache.directory.shared.ldap.model.schema.Normalizer;
+import org.apache.directory.shared.ldap.model.schema.ObjectClass;
+import org.apache.directory.shared.ldap.model.schema.SchemaManager;
+import org.apache.directory.shared.ldap.model.schema.SyntaxChecker;
 import org.apache.directory.shared.ldap.model.schema.parsers.LdapComparatorDescription;
 import org.apache.directory.shared.ldap.model.schema.parsers.NormalizerDescription;
 import org.apache.directory.shared.ldap.model.schema.registries.Schema;

Modified: directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/shared/ldap/schemaloader/SchemaEntityFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/shared/ldap/schemaloader/SchemaEntityFactory.java?rev=1244136&r1=1244135&r2=1244136&view=diff
==============================================================================
--- directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/shared/ldap/schemaloader/SchemaEntityFactory.java (original)
+++ directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/shared/ldap/schemaloader/SchemaEntityFactory.java Tue Feb 14 17:51:25 2012
@@ -39,7 +39,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.exception.LdapUnwillingToPerformException;
 import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.model.schema.AttributeType;
-import org.apache.directory.shared.ldap.model.schema.EntityFactory;
 import org.apache.directory.shared.ldap.model.schema.LdapComparator;
 import org.apache.directory.shared.ldap.model.schema.LdapSyntax;
 import org.apache.directory.shared.ldap.model.schema.LoadableSchemaObject;

Modified: directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/shared/ldap/schemamanager/impl/DefaultSchemaManager.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/shared/ldap/schemamanager/impl/DefaultSchemaManager.java?rev=1244136&r1=1244135&r2=1244136&view=diff
==============================================================================
--- directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/shared/ldap/schemamanager/impl/DefaultSchemaManager.java (original)
+++ directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/shared/ldap/schemamanager/impl/DefaultSchemaManager.java Tue Feb 14 17:51:25 2012
@@ -42,7 +42,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.apache.directory.shared.ldap.model.schema.AttributeType;
-import org.apache.directory.shared.ldap.model.schema.EntityFactory;
 import org.apache.directory.shared.ldap.model.schema.LdapComparator;
 import org.apache.directory.shared.ldap.model.schema.LdapSyntax;
 import org.apache.directory.shared.ldap.model.schema.LoadableSchemaObject;
@@ -80,6 +79,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.schema.registries.Schema;
 import org.apache.directory.shared.ldap.model.schema.registries.SchemaLoader;
 import org.apache.directory.shared.ldap.model.schema.registries.SyntaxCheckerRegistry;
+import org.apache.directory.shared.ldap.schemaloader.EntityFactory;
 import org.apache.directory.shared.ldap.schemaloader.JarLdifSchemaLoader;
 import org.apache.directory.shared.ldap.schemaloader.SchemaEntityFactory;
 import org.apache.directory.shared.util.Strings;

Modified: directory/shared/trunk/ldap/schema/data/src/test/java/org/apache/directory/shared/ldap/schemaloader/SchemaManagerAddTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/schema/data/src/test/java/org/apache/directory/shared/ldap/schemaloader/SchemaManagerAddTest.java?rev=1244136&r1=1244135&r2=1244136&view=diff
==============================================================================
--- directory/shared/trunk/ldap/schema/data/src/test/java/org/apache/directory/shared/ldap/schemaloader/SchemaManagerAddTest.java (original)
+++ directory/shared/trunk/ldap/schema/data/src/test/java/org/apache/directory/shared/ldap/schemaloader/SchemaManagerAddTest.java Tue Feb 14 17:51:25 2012
@@ -612,7 +612,7 @@ public class SchemaManagerAddTest
 
         // Check that it hasen't changed
         AttributeType original = schemaManager.lookupAttributeTypeRegistry( "2.5.18.4" );
-        assertEquals( "distinguishedNameMatch", original.getEqualityOid() );
+        assertEquals( "distinguishedNameMatch", original.getEquality().getName() );
         assertEquals( atrSize, schemaManager.getAttributeTypeRegistry().size() );
         assertEquals( goidSize, schemaManager.getGlobalOidRegistry().size() );
     }