mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Jean-Noel Rouvignac
04.28.2014 b86eb9353bb1f8bc5a1ba62037bf29ef2d1cb4c2
OPENDJ-1308 Migrate schema support

Code cleanup.

SchemaBackend.java:
Factorized common code by extracting methods addNewSchemaElement() and replaceExistingSchemaElement().

SchemaConfigManager.java:
Factorized common code by extracting methods getAttributeType() and reportError().
2 files modified
534 ■■■■ changed files
opendj3-server-dev/src/server/org/opends/server/backends/SchemaBackend.java 294 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/core/SchemaConfigManager.java 240 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/backends/SchemaBackend.java
@@ -1413,8 +1413,7 @@
                    ResultCode.INVALID_ATTRIBUTE_SYNTAX, message, de);
              }
              removeDITContentRule(dcr, newSchema, mods, pos,
                  modifiedSchemaFiles);
              removeDITContentRule(dcr, newSchema, modifiedSchemaFiles);
            }
          }
          else if (at.equals(ditStructureRulesType))
@@ -1461,8 +1460,7 @@
                    ResultCode.INVALID_ATTRIBUTE_SYNTAX, message, de);
              }
              removeMatchingRuleUse(mru, newSchema, mods, pos,
                  modifiedSchemaFiles);
              removeMatchingRuleUse(mru, newSchema, modifiedSchemaFiles);
            }
          }
          else if (at.equals(ldapSyntaxesType))
@@ -1719,37 +1717,52 @@
    if (existingType == null)
    {
      schema.registerAttributeType(attributeType, false);
      String schemaFile = getSchemaFile(attributeType);
      if ((schemaFile == null) || (schemaFile.length() == 0))
      {
        schemaFile = FILE_USER_SCHEMA_ELEMENTS;
        setSchemaFile(attributeType, schemaFile);
      }
      modifiedSchemaFiles.add(schemaFile);
      addNewSchemaElement(modifiedSchemaFiles, attributeType);
    }
    else
    {
      schema.deregisterAttributeType(existingType);
      schema.registerAttributeType(attributeType, false);
      schema.rebuildDependentElements(existingType);
      replaceExistingSchemaElement(modifiedSchemaFiles, attributeType,
          existingType);
    }
  }
      if ((getSchemaFile(attributeType) == null)
          || (getSchemaFile(attributeType).length() == 0))
  private void addNewSchemaElement(Set<String> modifiedSchemaFiles,
      SchemaFileElement elem)
      {
        String schemaFile = getSchemaFile(existingType);
    String schemaFile = getSchemaFile(elem);
        if ((schemaFile == null) || (schemaFile.length() == 0))
        {
          schemaFile = FILE_USER_SCHEMA_ELEMENTS;
      setSchemaFile(elem, schemaFile);
        }
        setSchemaFile(attributeType, schemaFile);
        modifiedSchemaFiles.add(schemaFile);
      }
  private <T extends SchemaFileElement> void replaceExistingSchemaElement(
      Set<String> modifiedSchemaFiles, T newElem, T existingElem)
  {
    String newSchemaFile = getSchemaFile(newElem);
    String oldSchemaFile = getSchemaFile(existingElem);
    if (newSchemaFile == null || newSchemaFile.length() == 0)
    {
      if (oldSchemaFile == null || oldSchemaFile.length() == 0)
      {
        oldSchemaFile = FILE_USER_SCHEMA_ELEMENTS;
      }
      setSchemaFile(newElem, oldSchemaFile);
      modifiedSchemaFiles.add(oldSchemaFile);
    }
      else
      {
        String newSchemaFile = getSchemaFile(attributeType);
        String oldSchemaFile = getSchemaFile(existingType);
        if ((oldSchemaFile == null) || oldSchemaFile.equals(newSchemaFile))
        {
          modifiedSchemaFiles.add(newSchemaFile);
@@ -1761,7 +1774,6 @@
        }
      }
    }
  }
@@ -2048,47 +2060,15 @@
    if (existingClass == null)
    {
      schema.registerObjectClass(objectClass, false);
      String schemaFile = getSchemaFile(objectClass);
      if ((schemaFile == null) || (schemaFile.length() == 0))
      {
        schemaFile = FILE_USER_SCHEMA_ELEMENTS;
        setSchemaFile(objectClass, schemaFile);
      }
      modifiedSchemaFiles.add(schemaFile);
      addNewSchemaElement(modifiedSchemaFiles, objectClass);
    }
    else
    {
      schema.deregisterObjectClass(existingClass);
      schema.registerObjectClass(objectClass, false);
      schema.rebuildDependentElements(existingClass);
      if ((getSchemaFile(objectClass) == null)
          || (getSchemaFile(objectClass).length() == 0))
      {
        String schemaFile = getSchemaFile(existingClass);
        if ((schemaFile == null) || (schemaFile.length() == 0))
        {
          schemaFile = FILE_USER_SCHEMA_ELEMENTS;
        }
        setSchemaFile(objectClass, schemaFile);
        modifiedSchemaFiles.add(schemaFile);
      }
      else
      {
        String newSchemaFile = getSchemaFile(objectClass);
        String oldSchemaFile = getSchemaFile(existingClass);
        if ((oldSchemaFile == null) || oldSchemaFile.equals(newSchemaFile))
        {
          modifiedSchemaFiles.add(newSchemaFile);
        }
        else
        {
          modifiedSchemaFiles.add(newSchemaFile);
          modifiedSchemaFiles.add(oldSchemaFile);
        }
      }
      replaceExistingSchemaElement(modifiedSchemaFiles, objectClass,
          existingClass);
    }
  }
@@ -2351,47 +2331,14 @@
    if (existingNF == null)
    {
      schema.registerNameForm(nameForm, false);
      String schemaFile = getSchemaFile(nameForm);
      if ((schemaFile == null) || (schemaFile.length() == 0))
      {
        schemaFile = FILE_USER_SCHEMA_ELEMENTS;
        setSchemaFile(nameForm, schemaFile);
      }
      modifiedSchemaFiles.add(schemaFile);
      addNewSchemaElement(modifiedSchemaFiles, nameForm);
    }
    else
    {
      schema.deregisterNameForm(existingNF);
      schema.registerNameForm(nameForm, false);
      schema.rebuildDependentElements(existingNF);
      if ((getSchemaFile(nameForm) == null) ||
          (getSchemaFile(nameForm).length() == 0))
      {
        String schemaFile = getSchemaFile(existingNF);
        if ((schemaFile == null) || (schemaFile.length() == 0))
        {
          schemaFile = FILE_USER_SCHEMA_ELEMENTS;
        }
        setSchemaFile(nameForm, schemaFile);
        modifiedSchemaFiles.add(schemaFile);
      }
      else
      {
        String newSchemaFile = getSchemaFile(nameForm);
        String oldSchemaFile = getSchemaFile(existingNF);
        if ((oldSchemaFile == null) || oldSchemaFile.equals(newSchemaFile))
        {
          modifiedSchemaFiles.add(newSchemaFile);
        }
        else
        {
          modifiedSchemaFiles.add(newSchemaFile);
          modifiedSchemaFiles.add(oldSchemaFile);
        }
      }
      replaceExistingSchemaElement(modifiedSchemaFiles, nameForm, existingNF);
    }
  }
@@ -2669,47 +2616,15 @@
    if (existingDCR == null)
    {
      schema.registerDITContentRule(ditContentRule, false);
      String schemaFile = getSchemaFile(ditContentRule);
      if ((schemaFile == null) || (schemaFile.length() == 0))
      {
        schemaFile = FILE_USER_SCHEMA_ELEMENTS;
        setSchemaFile(ditContentRule, schemaFile);
      }
      modifiedSchemaFiles.add(schemaFile);
      addNewSchemaElement(modifiedSchemaFiles, ditContentRule);
    }
    else
    {
      schema.deregisterDITContentRule(existingDCR);
      schema.registerDITContentRule(ditContentRule, false);
      schema.rebuildDependentElements(existingDCR);
      if ((getSchemaFile(ditContentRule) == null) ||
          (getSchemaFile(ditContentRule).length() == 0))
      {
        String schemaFile = getSchemaFile(existingDCR);
        if ((schemaFile == null) || (schemaFile.length() == 0))
        {
          schemaFile = FILE_USER_SCHEMA_ELEMENTS;
        }
        setSchemaFile(ditContentRule, schemaFile);
        modifiedSchemaFiles.add(schemaFile);
      }
      else
      {
        String newSchemaFile = getSchemaFile(ditContentRule);
        String oldSchemaFile = getSchemaFile(existingDCR);
        if ((oldSchemaFile == null) || oldSchemaFile.equals(newSchemaFile))
        {
          modifiedSchemaFiles.add(newSchemaFile);
        }
        else
        {
          modifiedSchemaFiles.add(newSchemaFile);
          modifiedSchemaFiles.add(oldSchemaFile);
        }
      }
      replaceExistingSchemaElement(modifiedSchemaFiles, ditContentRule,
          existingDCR);
    }
  }
@@ -2729,10 +2644,6 @@
   *                              schema.
   * @param  schema               The schema from which the DIT content rule
   *                              should be removed.
   * @param  modifications        The full set of modifications to be processed
   *                              against the server schema.
   * @param  currentPosition      The position of the modification currently
   *                              being performed.
   * @param  modifiedSchemaFiles  The names of the schema files containing
   *                              schema elements that have been updated as part
   *                              of the schema modification.
@@ -2742,11 +2653,7 @@
   *                              schema.
   */
  private void removeDITContentRule(DITContentRule ditContentRule,
                                    Schema schema,
                                    ArrayList<Modification> modifications,
                                    int currentPosition,
                                    Set<String> modifiedSchemaFiles)
          throws DirectoryException
      Schema schema, Set<String> modifiedSchemaFiles) throws DirectoryException
  {
    // See if the specified DIT content rule is actually defined in the server
    // schema.  If not, then fail.
@@ -2890,47 +2797,15 @@
    if (existingDSR == null)
    {
      schema.registerDITStructureRule(ditStructureRule, false);
      String schemaFile = getSchemaFile(ditStructureRule);
      if ((schemaFile == null) || (schemaFile.length() == 0))
      {
        schemaFile = FILE_USER_SCHEMA_ELEMENTS;
        setSchemaFile(ditStructureRule, schemaFile);
      }
      modifiedSchemaFiles.add(schemaFile);
      addNewSchemaElement(modifiedSchemaFiles, ditStructureRule);
    }
    else
    {
      schema.deregisterDITStructureRule(existingDSR);
      schema.registerDITStructureRule(ditStructureRule, false);
      schema.rebuildDependentElements(existingDSR);
      if ((getSchemaFile(ditStructureRule) == null) ||
          (getSchemaFile(ditStructureRule).length() == 0))
      {
        String schemaFile = getSchemaFile(existingDSR);
        if ((schemaFile == null) || (schemaFile.length() == 0))
        {
          schemaFile = FILE_USER_SCHEMA_ELEMENTS;
        }
        setSchemaFile(ditStructureRule, schemaFile);
        modifiedSchemaFiles.add(schemaFile);
      }
      else
      {
        String newSchemaFile = getSchemaFile(ditStructureRule);
        String oldSchemaFile = getSchemaFile(existingDSR);
        if ((oldSchemaFile == null) || oldSchemaFile.equals(newSchemaFile))
        {
          modifiedSchemaFiles.add(newSchemaFile);
        }
        else
        {
          modifiedSchemaFiles.add(newSchemaFile);
          modifiedSchemaFiles.add(oldSchemaFile);
        }
      }
      replaceExistingSchemaElement(modifiedSchemaFiles, ditStructureRule,
          existingDSR);
    }
  }
@@ -3150,47 +3025,15 @@
    if (existingMRU == null)
    {
      schema.registerMatchingRuleUse(matchingRuleUse, false);
      String schemaFile = getSchemaFile(matchingRuleUse);
      if ((schemaFile == null) || (schemaFile.length() == 0))
      {
        schemaFile = FILE_USER_SCHEMA_ELEMENTS;
        setSchemaFile(matchingRuleUse, schemaFile);
      }
      modifiedSchemaFiles.add(schemaFile);
      addNewSchemaElement(modifiedSchemaFiles, matchingRuleUse);
    }
    else
    {
      schema.deregisterMatchingRuleUse(existingMRU);
      schema.registerMatchingRuleUse(matchingRuleUse, false);
      schema.rebuildDependentElements(existingMRU);
      if ((getSchemaFile(matchingRuleUse) == null) ||
          (getSchemaFile(matchingRuleUse).length() == 0))
      {
        String schemaFile = getSchemaFile(existingMRU);
        if ((schemaFile == null) || (schemaFile.length() == 0))
        {
          schemaFile = FILE_USER_SCHEMA_ELEMENTS;
        }
        setSchemaFile(matchingRuleUse, schemaFile);
        modifiedSchemaFiles.add(schemaFile);
      }
      else
      {
        String newSchemaFile = getSchemaFile(matchingRuleUse);
        String oldSchemaFile = getSchemaFile(existingMRU);
        if ((oldSchemaFile == null) || oldSchemaFile.equals(newSchemaFile))
        {
          modifiedSchemaFiles.add(newSchemaFile);
        }
        else
        {
          modifiedSchemaFiles.add(newSchemaFile);
          modifiedSchemaFiles.add(oldSchemaFile);
        }
      }
      replaceExistingSchemaElement(modifiedSchemaFiles, matchingRuleUse,
          existingMRU);
    }
  }
@@ -3211,22 +3054,15 @@
   *                              server schema.
   * @param  schema               The schema from which the matching rule use
   *                              should be removed.
   * @param  modifications        The full set of modifications to be processed
   *                              against the server schema.
   * @param  currentPosition      The position of the modification currently
   *                              being performed.
   * @param  modifiedSchemaFiles  The names of the schema files containing
   *                              schema elements that have been updated as part
   *                              of the schema modification.
   *
   * @throws  DirectoryException  If a problem occurs while attempting to remove
   *                              the provided matching rule use from the server
   *                              schema.
   */
  private void removeMatchingRuleUse(MatchingRuleUse matchingRuleUse,
                                     Schema schema,
                                     ArrayList<Modification> modifications,
                                     int currentPosition,
                                     Set<String> modifiedSchemaFiles)
          throws DirectoryException
  {
@@ -3299,47 +3135,15 @@
    if (existingLSD == null)
    {
      schema.registerLdapSyntaxDescription(ldapSyntaxDesc, false);
      String schemaFile = getSchemaFile(ldapSyntaxDesc);
      if ((schemaFile == null) || (schemaFile.length() == 0))
      {
        schemaFile = FILE_USER_SCHEMA_ELEMENTS;
        setSchemaFile(ldapSyntaxDesc, schemaFile);
      }
      modifiedSchemaFiles.add(schemaFile);
      addNewSchemaElement(modifiedSchemaFiles, ldapSyntaxDesc);
    }
    else
    {
      schema.deregisterLdapSyntaxDescription(existingLSD);
      schema.registerLdapSyntaxDescription(ldapSyntaxDesc, false);
      schema.rebuildDependentElements(existingLSD);
      if ((getSchemaFile(ldapSyntaxDesc) == null) ||
          (getSchemaFile(ldapSyntaxDesc).length() == 0))
      {
        String schemaFile = getSchemaFile(ldapSyntaxDesc);
        if ((schemaFile == null) || (schemaFile.length() == 0))
        {
          schemaFile = FILE_USER_SCHEMA_ELEMENTS;
        }
        setSchemaFile(ldapSyntaxDesc, schemaFile);
        modifiedSchemaFiles.add(schemaFile);
      }
      else
      {
        String newSchemaFile = getSchemaFile(ldapSyntaxDesc);
        String oldSchemaFile = getSchemaFile(existingLSD);
        if ((oldSchemaFile == null) || oldSchemaFile.equals(newSchemaFile))
        {
          modifiedSchemaFiles.add(newSchemaFile);
        }
        else
        {
          modifiedSchemaFiles.add(newSchemaFile);
          modifiedSchemaFiles.add(oldSchemaFile);
        }
      }
      replaceExistingSchemaElement(modifiedSchemaFiles, ldapSyntaxDesc,
          existingLSD);
    }
  }
opendj3-server-dev/src/server/org/opends/server/core/SchemaConfigManager.java
@@ -36,6 +36,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.ModificationType;
import org.opends.server.api.AttributeSyntax;
import org.opends.server.config.ConfigException;
import org.opends.server.schema.*;
import org.opends.server.types.*;
@@ -89,13 +90,11 @@
  public static String getSchemaDirectoryPath()
  {
    File schemaDir =
              DirectoryServer.getEnvironmentConfig().
                getSchemaDirectory();
        DirectoryServer.getEnvironmentConfig().getSchemaDirectory();
    if (schemaDir != null) {
      return schemaDir.getAbsolutePath();
    } else {
      return null;
    }
    return null;
  }
@@ -501,15 +500,8 @@
      ldapSyntax.initializeSyntax(null);
    }
    AttributeType ldapSyntaxAttrType =
         schema.getAttributeType(ATTR_LDAP_SYNTAXES_LC);
    if (ldapSyntaxAttrType == null)
    {
      ldapSyntaxAttrType =
           DirectoryServer.getDefaultAttributeType(ATTR_LDAP_SYNTAXES,
                                                   ldapSyntax);
    }
    AttributeType ldapSyntaxAttrType = getAttributeType(
        schema, ATTR_LDAP_SYNTAXES, ATTR_LDAP_SYNTAXES_LC, ldapSyntax);
    return createAddModifications(entry, mods, ldapSyntaxAttrType);
  }
@@ -536,15 +528,8 @@
      attrTypeSyntax.initializeSyntax(null);
    }
    AttributeType attributeAttrType =
         schema.getAttributeType(ATTR_ATTRIBUTE_TYPES_LC);
    if (attributeAttrType == null)
    {
      attributeAttrType =
           DirectoryServer.getDefaultAttributeType(ATTR_ATTRIBUTE_TYPES,
                                                   attrTypeSyntax);
    }
    AttributeType attributeAttrType = getAttributeType(
        schema, ATTR_ATTRIBUTE_TYPES, ATTR_ATTRIBUTE_TYPES_LC, attrTypeSyntax);
    return createAddModifications(entry, mods, attributeAttrType);
  }
@@ -571,15 +556,8 @@
      ocSyntax.initializeSyntax(null);
    }
    AttributeType objectclassAttrType =
         schema.getAttributeType(ATTR_OBJECTCLASSES_LC);
    if (objectclassAttrType == null)
    {
      objectclassAttrType =
           DirectoryServer.getDefaultAttributeType(ATTR_OBJECTCLASSES,
                                                   ocSyntax);
    }
    AttributeType objectclassAttrType = getAttributeType(
        schema, ATTR_OBJECTCLASSES, ATTR_OBJECTCLASSES_LC, ocSyntax);
    return createAddModifications(entry, mods, objectclassAttrType);
  }
@@ -606,14 +584,8 @@
      nfSyntax.initializeSyntax(null);
    }
    AttributeType nameFormAttrType =
         schema.getAttributeType(ATTR_NAME_FORMS_LC);
    if (nameFormAttrType == null)
    {
      nameFormAttrType =
           DirectoryServer.getDefaultAttributeType(ATTR_NAME_FORMS, nfSyntax);
    }
    AttributeType nameFormAttrType = getAttributeType(
        schema, ATTR_NAME_FORMS, ATTR_NAME_FORMS_LC, nfSyntax);
    return createAddModifications(entry, mods, nameFormAttrType);
  }
@@ -641,15 +613,8 @@
      dcrSyntax.initializeSyntax(null);
    }
    AttributeType dcrAttrType =
         schema.getAttributeType(ATTR_DIT_CONTENT_RULES_LC);
    if (dcrAttrType == null)
    {
      dcrAttrType =
           DirectoryServer.getDefaultAttributeType(ATTR_DIT_CONTENT_RULES,
                                                   dcrSyntax);
    }
    AttributeType dcrAttrType = getAttributeType(
        schema, ATTR_DIT_CONTENT_RULES, ATTR_DIT_CONTENT_RULES_LC, dcrSyntax);
    return createAddModifications(entry, mods, dcrAttrType);
  }
@@ -677,15 +642,8 @@
      dsrSyntax.initializeSyntax(null);
    }
    AttributeType dsrAttrType =
         schema.getAttributeType(ATTR_DIT_STRUCTURE_RULES_LC);
    if (dsrAttrType == null)
    {
      dsrAttrType =
           DirectoryServer.getDefaultAttributeType(ATTR_DIT_STRUCTURE_RULES,
                                                   dsrSyntax);
    }
    AttributeType dsrAttrType = getAttributeType(
        schema, ATTR_DIT_STRUCTURE_RULES, ATTR_DIT_STRUCTURE_RULES_LC, dsrSyntax);
    return createAddModifications(entry, mods, dsrAttrType);
  }
@@ -713,16 +671,20 @@
      mruSyntax.initializeSyntax(null);
    }
    AttributeType mruAttrType =
         schema.getAttributeType(ATTR_MATCHING_RULE_USE_LC);
    if (mruAttrType == null)
    {
      mruAttrType =
           DirectoryServer.getDefaultAttributeType(ATTR_MATCHING_RULE_USE,
                                                   mruSyntax);
    AttributeType mruAttrType = getAttributeType(
        schema, ATTR_MATCHING_RULE_USE, ATTR_MATCHING_RULE_USE_LC, mruSyntax);
    return createAddModifications(entry, mods, mruAttrType);
    }
    return createAddModifications(entry, mods, mruAttrType);
  private static AttributeType getAttributeType(Schema schema, String attrName,
      String attrLowerName, AttributeSyntax<?> syntax)
  {
    final AttributeType attrType = schema.getAttributeType(attrLowerName);
    if (attrType != null)
    {
      return attrType;
    }
    return DirectoryServer.getDefaultAttributeType(attrName, syntax);
  }
  private static List<Attribute> createAddModifications(Entry entry,
@@ -765,17 +727,9 @@
            LocalizableMessage message = WARN_CONFIG_SCHEMA_CANNOT_PARSE_LDAP_SYNTAX.get(
                    schemaFile,
                    de.getMessageObject());
            if (failOnError)
            {
              throw new ConfigException(message, de);
            }
            else
            {
              logger.error(message);
            reportError(failOnError, de, message);
              continue;
            }
          }
          catch (Exception e)
          {
            logger.traceException(e);
@@ -783,17 +737,9 @@
            LocalizableMessage message = WARN_CONFIG_SCHEMA_CANNOT_PARSE_LDAP_SYNTAX.get(
                    schemaFile,
                    v.getValue() + ":  " + getExceptionMessage(e));
            if (failOnError)
            {
              throw new ConfigException(message, e);
            }
            else
            {
              logger.error(message);
            reportError(failOnError, e, message);
              continue;
            }
          }
           // Register it with the schema.  We will allow duplicates, with the
          // later definition overriding any earlier definition, but we want
@@ -850,33 +796,18 @@
            LocalizableMessage message = WARN_CONFIG_SCHEMA_CANNOT_PARSE_ATTR_TYPE.get(
                    schemaFile, de.getMessageObject());
            if (failOnError)
            {
              throw new ConfigException(message, de);
            }
            else
            {
              logger.error(message);
            reportError(failOnError, de, message);
              continue;
            }
          }
          catch (Exception e)
          {
            logger.traceException(e);
            LocalizableMessage message = WARN_CONFIG_SCHEMA_CANNOT_PARSE_ATTR_TYPE.get(
                    schemaFile, v.getValue() + ":  " + getExceptionMessage(e));
            if (failOnError)
            {
              throw new ConfigException(message, e);
            }
            else
            {
              logger.error(message);
            reportError(failOnError, e, message);
              continue;
            }
          }
          // Register it with the schema.  We will allow duplicates, with the
          // later definition overriding any earlier definition, but we want
@@ -933,17 +864,9 @@
            LocalizableMessage message = WARN_CONFIG_SCHEMA_CANNOT_PARSE_OC.get(
                    schemaFile,
                    de.getMessageObject());
            if (failOnError)
            {
              throw new ConfigException(message, de);
            }
            else
            {
              logger.error(message);
            reportError(failOnError, de, message);
              continue;
            }
          }
          catch (Exception e)
          {
            logger.traceException(e);
@@ -951,17 +874,9 @@
            LocalizableMessage message = WARN_CONFIG_SCHEMA_CANNOT_PARSE_OC.get(
                    schemaFile,
                    v.getValue() + ":  " + getExceptionMessage(e));
            if (failOnError)
            {
              throw new ConfigException(message, e);
            }
            else
            {
              logger.error(message);
            reportError(failOnError, e, message);
              continue;
            }
          }
          // Register it with the schema.  We will allow duplicates, with the
          // later definition overriding any earlier definition, but we want
@@ -1016,33 +931,18 @@
            LocalizableMessage message = WARN_CONFIG_SCHEMA_CANNOT_PARSE_NAME_FORM.get(
                    schemaFile, de.getMessageObject());
            if (failOnError)
            {
              throw new ConfigException(message, de);
            }
            else
            {
              logger.error(message);
            reportError(failOnError, de, message);
              continue;
            }
          }
          catch (Exception e)
          {
            logger.traceException(e);
            LocalizableMessage message = WARN_CONFIG_SCHEMA_CANNOT_PARSE_NAME_FORM.get(
                    schemaFile,  v.getValue() + ":  " + getExceptionMessage(e));
            if (failOnError)
            {
              throw new ConfigException(message, e);
            }
            else
            {
              logger.error(message);
            reportError(failOnError, e, message);
              continue;
            }
          }
          // Register it with the schema.  We will allow duplicates, with the
          // later definition overriding any earlier definition, but we want
@@ -1098,34 +998,18 @@
            LocalizableMessage message = WARN_CONFIG_SCHEMA_CANNOT_PARSE_DCR.get(
                    schemaFile, de.getMessageObject());
            if (failOnError)
            {
              throw new ConfigException(message, de);
            }
            else
            {
              logger.error(message);
            reportError(failOnError, de, message);
              continue;
            }
          }
          catch (Exception e)
          {
            logger.traceException(e);
            LocalizableMessage message = WARN_CONFIG_SCHEMA_CANNOT_PARSE_DCR.get(
                    schemaFile,v.getValue() + ":  " + getExceptionMessage(e));
            if (failOnError)
            {
              throw new ConfigException(message, e);
            }
            else
            {
              logger.error(message);
            reportError(failOnError, e, message);
              continue;
            }
          }
          // Register it with the schema.  We will allow duplicates, with the
          // later definition overriding any earlier definition, but we want
@@ -1155,6 +1039,16 @@
    }
  }
  private static void reportError(boolean failOnError, Exception e,
      LocalizableMessage message) throws ConfigException
  {
    if (failOnError)
    {
      throw new ConfigException(message, e);
    }
    logger.error(message);
  }
  /** Parse the DIT structure rule definitions if there are any. */
  private static void parseDITStructureRuleDefinitions(Schema schema,
      String schemaFile, boolean failOnError, List<Attribute> dsrList)
@@ -1181,34 +1075,18 @@
            LocalizableMessage message = WARN_CONFIG_SCHEMA_CANNOT_PARSE_DSR.get(
                    schemaFile, de.getMessageObject());
            if (failOnError)
            {
              throw new ConfigException(message, de);
            }
            else
            {
              logger.error(message);
            reportError(failOnError, de, message);
              continue;
            }
          }
          catch (Exception e)
          {
            logger.traceException(e);
            LocalizableMessage message = WARN_CONFIG_SCHEMA_CANNOT_PARSE_DSR.get(
                    schemaFile, v.getValue() + ":  " + getExceptionMessage(e));
            if (failOnError)
            {
              throw new ConfigException(message, e);
            }
            else
            {
              logger.error(message);
            reportError(failOnError, e, message);
              continue;
            }
          }
          // Register it with the schema.  We will allow duplicates, with the
          // later definition overriding any earlier definition, but we want
@@ -1264,17 +1142,9 @@
            LocalizableMessage message = WARN_CONFIG_SCHEMA_CANNOT_PARSE_MRU.get(
                    schemaFile, de.getMessageObject());
            if (failOnError)
            {
              throw new ConfigException(message, de);
            }
            else
            {
              logger.error(message);
            reportError(failOnError, de, message);
              continue;
            }
          }
          catch (Exception e)
          {
            logger.traceException(e);
@@ -1282,17 +1152,9 @@
            LocalizableMessage message = WARN_CONFIG_SCHEMA_CANNOT_PARSE_MRU.get(
                    schemaFile,
                    v.getValue() + ":  " + getExceptionMessage(e));
            if (failOnError)
            {
              throw new ConfigException(message, e);
            }
            else
            {
              logger.error(message);
            reportError(failOnError, e, message);
              continue;
            }
          }
          // Register it with the schema.  We will allow duplicates, with the
          // later definition overriding any earlier definition, but we want