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

lutoff
06.29.2009 699358fae01d6ab1c7f80b02f8749c46767198d6
When opends is delivered in the enterprise Sun OpenDS Standard Edition
product, it is required that the user approves the license to be able to
use it. The place where this approval takes place is in the quicksetup
application.
On the other hand, for now, there is no license approval to be done for
the opensource version.
The modifications here try to address both requirements.
A new step is now added to the setup cli mode to allow the display of a
license for the user to approve.
This step only shows up if a license exists in a specific location in
the layout (Legal/license_to_accept.txt).
Thus in the opensource version, no license will be in the delivery
whereas the enterprise product will include one.
The setup tool will display the license text whenever applicable.
Note: in the absence of the Legal/license_to_accept.txt file, setup
behaves the same way as before When the license file exists, the new
step "license accept" shows up.
2 files modified
63 ■■■■■ changed files
opends/src/messages/messages/quicksetup.properties 6 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/InstallDS.java 57 ●●●●● patch | view | raw | blame | history
opends/src/messages/messages/quicksetup.properties
@@ -20,7 +20,7 @@
#
# CDDL HEADER END
#
#      Copyright 2006-2008 Sun Microsystems, Inc.
#      Copyright 2006-2009 Sun Microsystems, Inc.
@@ -1336,6 +1336,10 @@
INFO_LICENSE_DETAILS_LABEL=Please read the following License Agreement.\n\
 You must accept the terms of the agreement before continuing with the installation.
INFO_LICENSE_CLICK_LABEL=Click to accept
INFO_LICENSE_CLI_ACCEPT_QUESTION=Accept the license (%s/%s) [%s]:
INFO_LICENSE_CLI_ACCEPT_YES=Yes
INFO_LICENSE_CLI_ACCEPT_NO=No
INFO_LICENSE_CLI_ACCEPT_INVALID_RESPONSE=Invalid response
INFO_CONFIRM_UNINSTALL_STEP=Uninstall Options
INFO_ZIP_FILES_DESCRIPTION=OpenDS Installation Package (.zip)
SEVERE_ERR_COULD_NOT_FIND_REPLICATIONID=Could not find a remote peer to \
opends/src/server/org/opends/server/tools/InstallDS.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 */
package org.opends.server.tools;
@@ -32,7 +32,9 @@
import static org.opends.messages.ToolMessages.*;
import static org.opends.messages.UtilityMessages.*;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
@@ -48,6 +50,7 @@
import org.opends.quicksetup.Constants;
import org.opends.quicksetup.CurrentInstallStatus;
import org.opends.quicksetup.Installation;
import org.opends.quicksetup.LicenseFile;
import org.opends.quicksetup.QuickSetupLog;
import org.opends.quicksetup.ReturnCode;
import org.opends.quicksetup.SecurityOptions;
@@ -139,7 +142,11 @@
    /**
     * The user cancelled the setup.
     */
    ERROR_USER_CANCELLED(6);
    ERROR_USER_CANCELLED(6),
    /**
     * The user doesn't accept the license.
     */
    ERROR_LICENSE_NOT_ACCEPTED(7);
    private int returnCode;
    private ErrorReturnCode(int returnCode)
@@ -403,6 +410,52 @@
      return ErrorReturnCode.ERROR_SERVER_ALREADY_INSTALLED.getReturnCode();
    }
    // Check license
    if (LicenseFile.exists())
    {
      PrintStream printStreamOut = getOutputStream();
      String licenseString = LicenseFile.getText();
      printStreamOut.println(licenseString);
      if (! argParser.noPromptArg.isPresent())
      {
        // If the user asks for no-prompt. We just display the license text.
        // User doesn't asks for no-prompt. We just display the license text
        // and force to accept it.
        String yes = INFO_LICENSE_CLI_ACCEPT_YES.get().toString();
        String no = INFO_LICENSE_CLI_ACCEPT_NO.get().toString();
        println(INFO_LICENSE_DETAILS_LABEL.get());
        BufferedReader in = getInputStream();
        while (true)
        {
          print(INFO_LICENSE_CLI_ACCEPT_QUESTION.get(yes,no,no));
          try
          {
            String response = in.readLine();
            if ((response == null)
                || (response.toLowerCase().equals(no.toLowerCase()))
                || (response.length() == 0))
            {
              return ErrorReturnCode.ERROR_LICENSE_NOT_ACCEPTED.getReturnCode();
            }
            else
            if (response.toLowerCase().equals(yes.toLowerCase()))
            {
              break ;
            }
            else
            {
              println(INFO_LICENSE_CLI_ACCEPT_INVALID_RESPONSE.get());
            }
          }
          catch (IOException e)
          {
            println(INFO_LICENSE_CLI_ACCEPT_INVALID_RESPONSE.get());
          }
        }
      }
    }
    if (initializeServer)
    {
      try