From 0ea193c303a1553fbde5a1637d40bfb46c8e5b73 Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Fri, 16 Sep 2016 12:49:16 +0000
Subject: [PATCH] OPENDJ-3302 Do not replicate changes in schema elements related to configuration

---
 opendj-server-legacy/src/main/java/org/opends/server/util/SchemaUtils.java |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/SchemaUtils.java b/opendj-server-legacy/src/main/java/org/opends/server/util/SchemaUtils.java
index 18289c4..30a9581 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/SchemaUtils.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/util/SchemaUtils.java
@@ -54,6 +54,8 @@
     // No implementation required.
   }
 
+  private static final String CONFIG_SCHEMA_ELEMENTS_FILE = "02-config.ldif";
+
   /** Represents a password type, including a "not a password" value. */
   public enum PasswordType
   {
@@ -124,7 +126,7 @@
   public static String getElementDefinitionWithFileName(SchemaElement element)
   {
     final String definition = element.toString();
-    return addSchemaFileToElementDefinitionIfAbsent(definition, SchemaUtils.getElementSchemaFile(element));
+    return addSchemaFileToElementDefinitionIfAbsent(definition, getElementSchemaFile(element));
   }
 
   /**
@@ -489,4 +491,21 @@
       throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX, parsingErrorMsg.get(definition), e);
     }
   }
+
+  /**
+   * Indicates if the provided schema file corresponds to the configuration schema.
+   * <p>
+   * The file containing the definitions of the schema elements used for configuration must not be
+   * imported nor propagated to other servers because these definitions may vary between versions of
+   * OpenDJ.
+   *
+   * @param schemaFile
+   *            The name of a file defining schema elements
+   * @return {@code true} if the file defines configuration elements,
+   *         {@code false} otherwise
+   */
+  public static boolean is02ConfigLdif(String schemaFile)
+  {
+    return CONFIG_SCHEMA_ELEMENTS_FILE.equals(schemaFile);
+  }
 }

--
Gitblit v1.10.0