From 699358fae01d6ab1c7f80b02f8749c46767198d6 Mon Sep 17 00:00:00 2001
From: lutoff <lutoff@localhost>
Date: Tue, 06 Jan 2009 11:29:17 +0000
Subject: [PATCH] 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.
---
opends/src/server/org/opends/server/tools/InstallDS.java | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 55 insertions(+), 2 deletions(-)
diff --git a/opends/src/server/org/opends/server/tools/InstallDS.java b/opends/src/server/org/opends/server/tools/InstallDS.java
index 9a142ea..287ee96 100644
--- a/opends/src/server/org/opends/server/tools/InstallDS.java
+++ b/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
--
Gitblit v1.10.0