From b7eaa6fa023b868aa8154610c05801a94ed0afea Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Fri, 05 Jan 2007 14:04:45 +0000
Subject: [PATCH] 

---
 opends/src/quicksetup/org/opends/quicksetup/CurrentInstallStatus.java |   34 ++++++++++++++++++++++++----------
 1 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/opends/src/quicksetup/org/opends/quicksetup/CurrentInstallStatus.java b/opends/src/quicksetup/org/opends/quicksetup/CurrentInstallStatus.java
index 22d74b5..d3ea554 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/CurrentInstallStatus.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/CurrentInstallStatus.java
@@ -52,6 +52,8 @@
 {
   private boolean isInstalled;
 
+  private boolean canOverwriteCurrentInstall;
+
   private String installationMsg;
 
   private String configFileContents;
@@ -77,24 +79,18 @@
       isInstalled = false;
     } else
     {
+      boolean dbFileExists = false;
       ArrayList<String> msgs = new ArrayList<String>();
 
       if (isServerRunning())
       {
-        if (isConfigFileModified() || (getPort() != 389))
-        {
-          /*
-           * If the config file is not modified and the port is 389 the common
-           * case is that there is already a server running on the default port,
-           * so it does not correspond to this install.
-           */
-          msgs.add(getMsg("installstatus-serverrunning", new String[]
+        msgs.add(getMsg("installstatus-serverrunning", new String[]
             { String.valueOf(getPort()) }));
-        }
       }
 
       if (dbFilesExist())
       {
+        dbFileExists = true;
         msgs.add(getMsg("installstatus-dbfileexist"));
       }
 
@@ -102,8 +98,14 @@
       {
         msgs.add(getMsg("installstatus-configfilemodified"));
       }
+      canOverwriteCurrentInstall = (msgs.size() == 1) && dbFileExists;
       isInstalled = msgs.size() > 0;
-      if (isInstalled)
+      if (canOverwriteCurrentInstall)
+      {
+        installationMsg =
+          getMsg("installstatus-canoverwritecurrentinstall-msg");
+      }
+      else if (isInstalled)
       {
         StringBuffer buf = new StringBuffer();
         buf.append("<ul>");
@@ -134,6 +136,18 @@
   }
 
   /**
+   * Indicates can overwrite current install.
+   *
+   * @return <CODE>true</CODE> if there is something installed under the
+   *         binaries that we are running and we can overwrite it and
+   *         <CODE>false</CODE> if not.
+   */
+  public boolean canOverwriteCurrentInstall()
+  {
+    return canOverwriteCurrentInstall;
+  }
+
+  /**
    * Provides a localized message to be displayed to the user in HTML format
    * informing of the installation status.
    *

--
Gitblit v1.10.0