From f6beccdd93ff6c7fee022805c8390ca51bd03511 Mon Sep 17 00:00:00 2001
From: Chris Ridd <chris.ridd@forgerock.com>
Date: Mon, 29 Feb 2016 13:32:08 +0000
Subject: [PATCH] OPENDJ-2716 update the changelog schema in-place instead of overwriting entire file

---
 opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeTasks.java |   42 ++++++++++++++++++++++--------------------
 1 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeTasks.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeTasks.java
index e78e571..03b6fbf 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeTasks.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeTasks.java
@@ -229,14 +229,16 @@
   }
 
   /**
-   * This task adds a new attribute type (must exists in the original file) to
-   * the specified file placed in parameter. The destination must be a file
-   * contained in the config/schema folder. E.g : This example adds a new
-   * attribute type named 'etag' in the 00.core.ldif. The 'etag' attribute
-   * already exists in the 00-core.ldif template schema file.
+   * This task adds or updates an attribute type (must exist in the original file)
+   * to the file specified in {@code fileName}. The destination must be a file
+   * contained in the config/schema folder. The attribute type is updated if an
+   * attribute with the same OID exists.
+   *
+   * e.g : This example adds a new attribute type named 'etag' in the 00-core.ldif.
+   * The 'etag' attribute already exists in the 00-core.ldif template schema file.
    *
    * <pre>
-   * register(&quot;2.5.0.7192&quot;,
+   * register(&quot;2.5.0&quot;,
    *   newAttributeTypes(LocalizableMessage.raw(&quot;New attribute etag&quot;),
    *   false, &quot;00-core.ldif&quot;,
    *   &quot;1.3.6.1.4.1.36733.2.1.1.59&quot;));
@@ -245,13 +247,13 @@
    * @param summary
    *          The summary of the task.
    * @param fileName
-   *          The file where to add the new attribute types. This file must be
+   *          The file where to add the new definitions. This file must be
    *          contained in the configuration/schema folder.
    * @param attributeOids
-   *          The OIDs of the new attributes to add to.
-   * @return An upgrade task which adds new attribute types, defined previously
-   *         in the configuration template files, reads the definition
-   *         and adds it onto the specified file in parameter.
+   *          The OIDs of the attributes to add or update.
+   * @return An upgrade task which adds or updates attribute types, defined
+   *         previously in the configuration template files, reads the
+   *         definition and adds it onto the file specified in {@code fileName}
    */
   public static UpgradeTask newAttributeTypes(final LocalizableMessage summary,
       final String fileName, final String... attributeOids)
@@ -296,21 +298,21 @@
   }
 
   /**
-   * This task adds a new object class (must exists in the original file) to the
-   * specified file placed in parameter. The destination must be a file
-   * contained in the config/schema folder.
+   * This task adds or updates an object class (must exist in the original file)
+   * to the file specified in {@code fileName}. The destination must be a file
+   * contained in the config/schema folder. The object class will be updated if
+   * a definition with the same OID exists, and added otherwise.
    *
    * @param summary
    *          The summary of the task.
    * @param fileName
-   *          The file where to add the new object classes. This file must be
+   *          The file where to add the new definitions. This file must be
    *          contained in the configuration/schema folder.
    * @param objectClassesOids
-   *          The OIDs of the new object classes to add to.
-   * @return An upgrade task which adds new object classes, defined previously
-   *         in the configuration template files,
-   *         reads the definition and adds it onto the specified file in
-   *         parameter.
+   *          The OIDs of the object classes to add or update.
+   * @return An upgrade task which adds or updates object classes, defined
+   *         previously in the configuration template files, reads the
+   *         definition and adds it onto the file specified in {@code fileName}
    */
   public static UpgradeTask newObjectClasses(final LocalizableMessage summary,
       final String fileName, final String... objectClassesOids)

--
Gitblit v1.10.0