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

jvergara
07.43.2009 b471bc6b9f2a087e8bb8e3adc6e5d1b32e80db8d
opends/src/guitools/org/opends/guitools/controlpanel/datamodel/ServerDescriptor.java
@@ -28,6 +28,7 @@
package org.opends.guitools.controlpanel.datamodel;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -45,6 +46,7 @@
import org.opends.server.types.DN;
import org.opends.server.types.ObjectClass;
import org.opends.server.types.OpenDsException;
import org.opends.server.types.OperatingSystem;
import org.opends.server.types.Schema;
/**
@@ -60,8 +62,8 @@
    new HashSet<ConnectionHandlerDescriptor>();
  private ConnectionHandlerDescriptor adminConnector;
  private Set<DN> administrativeUsers = new HashSet<DN>();
  private File installPath;
  private File instancePath;
  private String installPath;
  private String instancePath;
  private String openDSVersion;
  private String javaVersion;
  private ArrayList<OpenDsException> exceptions =
@@ -185,7 +187,7 @@
   * @return the instance path where the server databases and configuration is
   * located
   */
  public File getInstancePath()
  public String getInstancePath()
  {
    return instancePath;
  }
@@ -196,7 +198,7 @@
   * @param instancePath the instance path where the server databases and
   * configuration is located.
   */
  public void setInstancePath(File instancePath)
  public void setInstancePath(String instancePath)
  {
    this.instancePath = instancePath;
  }
@@ -205,7 +207,7 @@
   * Return the install path where the server is installed.
   * @return the install path where the server is installed.
   */
  public File getInstallPath()
  public String getInstallPath()
  {
    return installPath;
  }
@@ -214,12 +216,49 @@
   * Sets the install path where the server is installed.
   * @param installPath the install path where the server is installed.
   */
  public void setInstallPath(File installPath)
  public void setInstallPath(String installPath)
  {
    this.installPath = installPath;
  }
  /**
   * Returns whether the install and the instance are on the same server
   * or not.
   * @return whether the install and the instance are on the same server
   * or not.
   */
  public boolean sameInstallAndInstance()
  {
    boolean sameInstallAndInstance;
    String instance = getInstancePath();
    String install = getInstallPath();
    try
    {
      if (instance != null)
      {
        sameInstallAndInstance = instance.equals(install);
        if (!sameInstallAndInstance &&
            (isLocal() || (isWindows() == Utilities.isWindows())))
        {
          File f1 = new File(instance);
          File f2 = new File(install);
          sameInstallAndInstance =
            f1.getCanonicalFile().equals(f2.getCanonicalFile());
        }
      }
      else
      {
        sameInstallAndInstance = install == null;
      }
    }
    catch (IOException ioe)
    {
      sameInstallAndInstance = false;
    }
    return sameInstallAndInstance;
  }
  /**
   * Return the java version used to run the server.
   * @return the java version used to run the server.
   */
@@ -615,6 +654,42 @@
  }
  /**
   * Returns whether the server is running under a windows system or not.
   * @return whether the server is running under a windows system or not.
   */
  public boolean isWindows()
  {
    boolean isWindows;
    if (isLocal())
    {
      isWindows = Utilities.isWindows();
    }
    else
    {
      CustomSearchResult sr = getSystemInformationMonitor();
      if (sr == null)
      {
        isWindows = false;
      }
      else
      {
        String os =
          (String)Utilities.getFirstMonitoringValue(sr, "operatingSystem");
        if (os == null)
        {
          isWindows = false;
        }
        else
        {
          OperatingSystem oSystem = OperatingSystem.forName(os);
          isWindows = OperatingSystem.WINDOWS == oSystem;
        }
      }
    }
    return isWindows;
  }
  /**
   * Method used to compare schemas.
   * Returns <CODE>true</CODE> if the two schemas are equal and
   * <CODE>false</CODE> otherwise.