From ee3ee4a68c18097dcb3c712dce402ba8147dcdf1 Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Thu, 21 Jun 2007 15:21:25 +0000
Subject: [PATCH] recursively copy any content from the older installation's config directory after upgrading the bits during an upgrade

---
 opends/src/quicksetup/org/opends/quicksetup/util/FileManager.java |   50 +++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 49 insertions(+), 1 deletions(-)

diff --git a/opends/src/quicksetup/org/opends/quicksetup/util/FileManager.java b/opends/src/quicksetup/org/opends/quicksetup/util/FileManager.java
index 5a8aaba..f578716 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/util/FileManager.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/util/FileManager.java
@@ -87,6 +87,43 @@
   }
 
   /**
+   * Recursively copies any files or directories appearing in
+   * <code>source</code> or a subdirectory of <code>source</code>
+   * to the corresponding directory under <code>target</code>.  Files
+   * in under <code>source</code> are not copied to <code>target</code>
+   * if a file by the same name already exists in <code>target</code>.
+   *
+   * @param source source directory
+   * @param target target directory
+   * @throws ApplicationException if there is a problem copying files
+   */
+  public void synchronize(File source, File target)
+          throws ApplicationException
+  {
+    if (source != null && target != null) {
+      String[] sourceFileNames = source.list();
+      if (sourceFileNames != null) {
+        for (String sourceFileName : sourceFileNames) {
+          File sourceFile = new File(source, sourceFileName);
+          copyRecursively(sourceFile, target, null, false);
+        }
+      }
+    }
+  }
+
+  /**
+   * Move a file.
+   * @param object File to move
+   * @param newParent File representing new parent directory
+   * @throws ApplicationException if something goes wrong
+   */
+  public void move(File object, File newParent)
+          throws ApplicationException
+  {
+    move(object, newParent, null);
+  }
+
+  /**
    * Move a file.
    * @param object File to move
    * @param newParent File representing new parent directory
@@ -106,6 +143,17 @@
   /**
    * Deletes a single file or directory.
    * @param object File to delete
+   * @throws ApplicationException if something goes wrong
+   */
+  public void delete(File object)
+          throws ApplicationException
+  {
+    delete(object, null);
+  }
+
+  /**
+   * Deletes a single file or directory.
+   * @param object File to delete
    * @param filter that will be asked whether or not the operation should be
    *        performed
    * @throws ApplicationException if something goes wrong
@@ -364,7 +412,7 @@
 
               if (destination.exists()) {
                 // TODO:  set the file's permissions.  This is made easier in
-                // Java 1.6 but until then use the Utils methods
+                // Java 1.6 but until then use the TestUtilities methods
                 if (Utils.isUnix()) {
                   String permissions =
                           Utils.getFileSystemPermissions(objectFile);

--
Gitblit v1.10.0