mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

jvergara
12.03.2009 5bf6f768ae8b392564ac427810cac9790b1c7705
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.
6 files modified
96 ■■■■■ changed files
opends/src/guitools/org/opends/guitools/controlpanel/datamodel/ControlPanelInfo.java 2 ●●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/datamodel/ServerDescriptor.java 28 ●●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/ui/BackupListPanel.java 2 ●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/ui/JavaPropertiesPanel.java 2 ●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/ui/StatusPanel.java 30 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/status/StatusCli.java 32 ●●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/datamodel/ControlPanelInfo.java
@@ -432,6 +432,8 @@
    ServerDescriptor desc = createNewServerDescriptorInstance();
    InitialLdapContext ctx = getDirContext();
    desc.setInstallPath(Utilities.getServerRootDirectory());
    desc.setInstancePath(Utilities.getInstanceRootDirectory(
        Utilities.getServerRootDirectory().getAbsolutePath()));
    boolean windowsServiceEnabled = false;
    if (Utilities.isWindows())
    {
opends/src/guitools/org/opends/guitools/controlpanel/datamodel/ServerDescriptor.java
@@ -58,6 +58,7 @@
  private ConnectionHandlerDescriptor adminConnector;
  private Set<DN> administrativeUsers = new HashSet<DN>();
  private File installPath;
  private File instancePath;
  private String openDSVersion;
  private String javaVersion;
  private ArrayList<OpenDsException> exceptions =
@@ -154,6 +155,28 @@
  }
  /**
   * Return the instance path where the server databases and configuration is
   * located.
   * @return the instance path where the server databases and configuration is
   * located
   */
  public File getInstancePath()
  {
    return instancePath;
  }
  /**
   * Sets the instance path where the server databases and configuration is
   * located.
   * @param instancePath the instance path where the server databases and
   * configuration is located.
   */
  public void setInstancePath(File instancePath)
  {
    this.instancePath = instancePath;
  }
  /**
   * Return the install path where the server is installed.
   * @return the install path where the server is installed.
   */
@@ -273,6 +296,11 @@
        if (equals)
        {
          equals = desc.getInstancePath().equals(getInstancePath());
        }
        if (equals)
        {
          if (desc.getJavaVersion() == null)
          {
            equals = getJavaVersion() == null;
opends/src/guitools/org/opends/guitools/controlpanel/ui/BackupListPanel.java
@@ -523,7 +523,7 @@
    if (!backupDirectoryInitialized &&
        (parentDirectory.getText().length() == 0))
    {
      final String path = new File(desc.getInstallPath(),
      final String path = new File(desc.getInstancePath(),
          org.opends.quicksetup.Installation.BACKUPS_PATH_RELATIVE).
          getAbsolutePath();
      SwingUtilities.invokeLater(new Runnable()
opends/src/guitools/org/opends/guitools/controlpanel/ui/JavaPropertiesPanel.java
@@ -764,7 +764,7 @@
  private String getPropertiesFile()
  {
    String installPath = getInfo().getServerDescriptor().
      getInstallPath().getAbsolutePath();
      getInstancePath().getAbsolutePath();
    String propertiesFile =  Utils.getPath(
      Utilities.getInstanceRootDirectory(installPath).getAbsolutePath(),
      Installation.RELATIVE_JAVA_PROPERTIES_FILE);
opends/src/guitools/org/opends/guitools/controlpanel/ui/StatusPanel.java
@@ -35,6 +35,8 @@
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
@@ -82,11 +84,13 @@
  private JLabel hostName;
  private JLabel administrativeUsers;
  private JLabel installPath;
  private JLabel instancePath;
  private JLabel opendsVersion;
  private LabelWithHelpIcon javaVersion;
  private JLabel adminConnector;
  private JLabel dbTableEmpty;
  private JLabel connectionHandlerTableEmpty;
  private JLabel lInstancePath;
  private JButton stopButton;
  private JButton startButton;
  private JButton restartButton;
@@ -315,7 +319,25 @@
        administrativeUsers.getFont());
    administrativeUsers.setText(htmlString);
    installPath.setText(desc.getInstallPath().getAbsolutePath());
    File install = desc.getInstallPath();
    installPath.setText(install.getAbsolutePath());
    File instance = desc.getInstancePath();
    instancePath.setText(instance.getAbsolutePath());
    boolean sameInstallAndInstance;
    try
    {
      sameInstallAndInstance = instance.getCanonicalFile().equals(install);
    }
    catch (IOException ioe)
    {
      // Best effort
      sameInstallAndInstance = instance.getAbsoluteFile().equals(install);
    }
    instancePath.setVisible(!sameInstallAndInstance);
    lInstancePath.setVisible(!sameInstallAndInstance);
    opendsVersion.setText(desc.getOpenDSVersion());
@@ -546,23 +568,27 @@
        Utilities.createPrimaryLabel(
            INFO_CTRL_PANEL_INSTALLATION_PATH_LABEL.get()),
        Utilities.createPrimaryLabel(
            INFO_CTRL_PANEL_INSTANCE_PATH_LABEL.get()),
        Utilities.createPrimaryLabel(
            INFO_CTRL_PANEL_OPENDS_VERSION_LABEL.get()),
        Utilities.createPrimaryLabel(
            INFO_CTRL_PANEL_JAVA_VERSION_LABEL.get()),
        Utilities.createPrimaryLabel(
            INFO_CTRL_PANEL_ADMIN_CONNECTOR_LABEL.get())
      };
    lInstancePath = leftLabels[3];
    hostName = Utilities.createDefaultLabel();
    administrativeUsers = Utilities.createDefaultLabel();
    installPath = Utilities.createDefaultLabel();
    instancePath = Utilities.createDefaultLabel();
    opendsVersion = Utilities.createDefaultLabel();
    javaVersion = new LabelWithHelpIcon(Message.EMPTY, null);
    adminConnector = Utilities.createDefaultLabel();
    JComponent[] rightLabels =
      {
        hostName, administrativeUsers, installPath, opendsVersion,
        hostName, administrativeUsers, installPath, instancePath, opendsVersion,
        javaVersion, adminConnector
      };
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.