From 5bf6f768ae8b392564ac427810cac9790b1c7705 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Mon, 12 Jan 2009 01:03:11 +0000
Subject: [PATCH] Fix for issue 3709 (control-panel: value of "Backup Path" field should be the instance path and not the installation path in the Backup/Restore panels) The code has been update to use the instance path instead of the install path in different places (the default backup directory, the path to be used to retrieve the java properties file, etc.). If we are dealing with a package installation (install and instance paths are different), the control panel and the status command-line will display two paths: one for the install and the other for the instance.

---
 opends/src/server/org/opends/server/tools/status/StatusCli.java |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/opends/src/server/org/opends/server/tools/status/StatusCli.java b/opends/src/server/org/opends/server/tools/status/StatusCli.java
index 272108f..fdba154 100644
--- a/opends/src/server/org/opends/server/tools/status/StatusCli.java
+++ b/opends/src/server/org/opends/server/tools/status/StatusCli.java
@@ -28,6 +28,7 @@
 package org.opends.server.tools.status;
 
 import java.io.File;
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.PrintStream;
@@ -486,6 +487,22 @@
     writeHostnameContents(desc, labelWidth);
     writeAdministrativeUserContents(desc, labelWidth);
     writeInstallPathContents(desc, labelWidth);
+    boolean sameInstallAndInstance = true;
+    try
+    {
+      sameInstallAndInstance = desc.getInstancePath().getCanonicalFile().equals(
+          desc.getInstallPath().getCanonicalFile());
+    }
+    catch (IOException ioe)
+    {
+      // Best effort
+      sameInstallAndInstance = desc.getInstancePath().getAbsoluteFile().equals(
+          desc.getInstallPath().getAbsoluteFile());
+    }
+    if (!sameInstallAndInstance)
+    {
+      writeInstancePathContents(desc, labelWidth);
+    }
     writeVersionContents(desc, labelWidth);
     writeJavaVersionContents(desc, labelWidth);
     writeAdminConnectorContents(desc, labelWidth);
@@ -680,6 +697,21 @@
   }
 
   /**
+   * Writes the instance path contents displaying with what is specified in the
+   * provided ServerDescriptor object.
+   * @param desc the ServerDescriptor object.
+   * @param maxLabelWidth the maximum label width of the left label.
+   */
+  private void writeInstancePathContents(ServerDescriptor desc,
+      int maxLabelWidth)
+  {
+    File path = desc.getInstallPath();
+    writeLabelValue(INFO_CTRL_PANEL_INSTANCE_PATH_LABEL.get(),
+            Message.raw(path.toString()),
+            maxLabelWidth);
+  }
+
+  /**
    * Updates the server version contents displaying with what is specified in
    * the provided ServerDescriptor object.
    * This method must be called from the event thread.

--
Gitblit v1.10.0