From 7f4b4a50edd0b884ab8549ddd0338200811f81aa Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 06 Jun 2016 18:40:37 +0000
Subject: [PATCH] OPENDJ-3037 SchemaConfigManager.java: Use the LDIFEntryReader

---
 opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java |   36 ++++++++++++++++++++++++++++++++++--
 1 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java
index f80407b..0fced9d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java
@@ -757,9 +757,9 @@
             throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM,
                 ERR_SCHEMA_INVALID_MODIFICATION_TYPE.get(m.getModificationType()));
           }
-          else  if (SchemaConfigManager.isSchemaAttribute(a))
+          else  if (isSchemaAttribute(a))
           {
-          logger.error(ERR_SCHEMA_INVALID_REPLACE_MODIFICATION, a.getAttributeDescription());
+            logger.error(ERR_SCHEMA_INVALID_REPLACE_MODIFICATION, a.getAttributeDescription());
           }
           else
           {
@@ -957,6 +957,38 @@
   }
 
   /**
+   * This method checks if a given attribute is an attribute that is used by the definition of the
+   * schema.
+   *
+   * @param attribute
+   *          The attribute to be checked.
+   * @return true if the attribute is part of the schema definition, false if the attribute is not
+   *         part of the schema definition.
+   */
+  private static boolean isSchemaAttribute(Attribute attribute)
+  {
+    String attributeOid = attribute.getAttributeDescription().getAttributeType().getOID();
+    return attributeOid.equals("2.5.21.1") ||
+        attributeOid.equals("2.5.21.2") ||
+        attributeOid.equals("2.5.21.4") ||
+        attributeOid.equals("2.5.21.5") ||
+        attributeOid.equals("2.5.21.6") ||
+        attributeOid.equals("2.5.21.7") ||
+        attributeOid.equals("2.5.21.8") ||
+        attributeOid.equals("2.5.4.3") ||
+        attributeOid.equals("1.3.6.1.4.1.1466.101.120.16") ||
+        attributeOid.equals("cn-oid") ||
+        attributeOid.equals("attributetypes-oid") ||
+        attributeOid.equals("objectclasses-oid") ||
+        attributeOid.equals("matchingrules-oid") ||
+        attributeOid.equals("matchingruleuse-oid") ||
+        attributeOid.equals("nameformdescription-oid") ||
+        attributeOid.equals("ditcontentrules-oid") ||
+        attributeOid.equals("ditstructurerules-oid") ||
+        attributeOid.equals("ldapsyntaxes-oid");
+  }
+
+  /**
    * Re-write all schema files using the provided new Schema and list of
    * modified files.
    *

--
Gitblit v1.10.0