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

Violette Roche-Montane
05.07.2013 9dae9033e8e485cea0b24b48cfe22f7b1a0f5463
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/LicenseFile.java
@@ -42,9 +42,8 @@
import org.opends.server.util.StaticUtils;
/**
 * Represents information about the license file.
 *
 * NOTE: the license file location must be kept in sync with build.xml and
 * Represents information about the license file. NOTE: the license file
 * location must be kept in sync with build.xml and
 * org.opends.server.tools.upgrade.LicenseFile.
 */
public class LicenseFile
@@ -68,28 +67,6 @@
  /**
   * Get the directory in which legal files are stored.
   */
  private static String getLegalDirectory()
  {
    String installRootFromSystem = System.getProperty("INSTALL_ROOT");
    if (installRootFromSystem == null)
    {
      installRootFromSystem = System.getenv("INSTALL_ROOT");
    }
    if (installRootFromSystem == null)
    {
      installRootFromSystem = "";
    }
    return installRootFromSystem + File.separatorChar + LEGAL_FOLDER_NAME;
  }
  /**
   * Get the directory in which legal files are stored.
   */
  private static String getInstanceLegalDirectory()
  {
    String instanceLegalDirName;
@@ -131,7 +108,8 @@
   */
  static private String getName()
  {
    return getLegalDirectory() + File.separatorChar + LICENSE_FILE_NAME;
    return getInstanceLegalDirectory() + File.separatorChar
        + LICENSE_FILE_NAME;
  }
  /**
@@ -152,8 +130,8 @@
   */
  static private URL getWebStartLicenseFile()
  {
    final String licenseResource = LEGAL_FOLDER_NAME + File.separatorChar
        + LICENSE_FILE_NAME;
    final String licenseResource =
        LEGAL_FOLDER_NAME + File.separatorChar + LICENSE_FILE_NAME;
    return Thread.currentThread().getContextClassLoader().getResource(
        licenseResource);
  }
@@ -161,9 +139,9 @@
  /**
   * Checks if the license file exists.
   *
   * @return <CODE>true</CODE> if the license file exists
   *         in the Legal directory in the top level installation directory
   *         <CODE>false</CODE> otherwise.
   * @return <CODE>true</CODE> if the license file exists in the Legal directory
   *         in the top level installation directory <CODE>false</CODE>
   *         otherwise.
   */
  static public boolean exists()
  {
@@ -267,16 +245,20 @@
  }
  /**
   * Create a file which indicates that the license has been approved.
   * Creates a file - in the legal folder from the specified directory; which
   * indicates that the license has been approved.
   *
   * @param installationPath
   *          The server installation's path.
   */
  static public void createFileLicenseApproved()
  static public void createFileLicenseApproved(final String installationPath)
  {
    if (getApproval())
    if (getApproval() && installationPath != null)
    {
      try
      {
        new File(getInstanceLegalDirectory() + File.separatorChar
            + ACCEPTED_LICENSE_FILE_NAME).createNewFile();
        new File(installationPath + File.separatorChar + LEGAL_FOLDER_NAME
            + File.separatorChar + ACCEPTED_LICENSE_FILE_NAME).createNewFile();
      }
      catch (IOException e)
      {