From acf65aa8b9ef55da1408010667ff8d1b7a0c6ce6 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Tue, 18 Dec 2007 11:24:28 +0000
Subject: [PATCH] Fix for issue 1862 (verbosity options for quicksetup tools)

---
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java |  109 +++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 94 insertions(+), 15 deletions(-)

diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
index 1f871fc..dda6908 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
@@ -105,27 +105,47 @@
 
       checkAbort();
 
-      writeOpenDSJavaHome();
-
       if (Utils.isWindows() && getUserData().getEnableWindowsService())
       {
+        if (isVerbose())
+        {
           notifyListeners(getTaskSeparator());
-          setCurrentProgressStep(InstallProgressStep.ENABLING_WINDOWS_SERVICE);
-          enableWindowsService();
-          checkAbort();
+        }
+        setCurrentProgressStep(InstallProgressStep.ENABLING_WINDOWS_SERVICE);
+        enableWindowsService();
+        checkAbort();
       }
 
       if (mustStart())
       {
-        notifyListeners(getTaskSeparator());
+        if (isVerbose())
+        {
+          notifyListeners(getTaskSeparator());
+        }
         setCurrentProgressStep(InstallProgressStep.STARTING_SERVER);
-        new ServerController(this).startServer();
+        if (!isVerbose())
+        {
+          notifyListeners(getFormattedWithPoints(
+              INFO_PROGRESS_STARTING_NON_VERBOSE.get()));
+        }
+        new ServerController(this).startServer(!isVerbose());
+        if (!isVerbose())
+        {
+          notifyListeners(getFormattedDoneWithLineBreak());
+        }
+        else
+        {
+          notifyListeners(getLineBreak());
+        }
         checkAbort();
       }
 
       if (mustCreateAds())
       {
-        notifyListeners(getTaskSeparator());
+        if (isVerbose())
+        {
+          notifyListeners(getTaskSeparator());
+        }
         setCurrentProgressStep(InstallProgressStep.CONFIGURING_ADS);
         updateADS();
         checkAbort();
@@ -133,7 +153,10 @@
 
       if (mustConfigureReplication())
       {
-        notifyListeners(getTaskSeparator());
+        if (isVerbose())
+        {
+          notifyListeners(getTaskSeparator());
+        }
         setCurrentProgressStep(InstallProgressStep.CONFIGURING_REPLICATION);
         configureReplication();
         checkAbort();
@@ -141,7 +164,10 @@
 
       if (mustInitializeSuffixes())
       {
-        notifyListeners(getTaskSeparator());
+        if (isVerbose())
+        {
+          notifyListeners(getTaskSeparator());
+        }
         setCurrentProgressStep(
             InstallProgressStep.INITIALIZE_REPLICATED_SUFFIXES);
         initializeSuffixes();
@@ -150,9 +176,21 @@
 
       if (mustStop())
       {
-        notifyListeners(getTaskSeparator());
+        if (isVerbose())
+        {
+          notifyListeners(getTaskSeparator());
+        }
         setCurrentProgressStep(InstallProgressStep.STOPPING_SERVER);
-        new ServerController(this).stopServer();
+        if (!isVerbose())
+        {
+          notifyListeners(getFormattedWithPoints(
+              INFO_PROGRESS_STOPPING_NON_VERBOSE.get()));
+        }
+        new ServerController(this).stopServer(!isVerbose());
+        if (!isVerbose())
+        {
+          notifyListeners(getFormattedDoneWithLineBreak());
+        }
       }
 
       checkAbort();
@@ -172,7 +210,16 @@
         Installation installation = getInstallation();
         if (installation.getStatus().isServerRunning()) {
           try {
-            new ServerController(installation).stopServer(true);
+            if (!isVerbose())
+            {
+              notifyListeners(getFormattedWithPoints(
+                  INFO_PROGRESS_STOPPING_NON_VERBOSE.get()));
+            }
+            new ServerController(installation).stopServer(!isVerbose());
+            if (!isVerbose())
+            {
+              notifyListeners(getFormattedDoneWithLineBreak());
+            }
           } catch (Throwable t) {
             LOG.log(Level.INFO, "error stopping server", t);
           }
@@ -193,7 +240,16 @@
       Installation installation = getInstallation();
       if (installation.getStatus().isServerRunning()) {
         try {
-          new ServerController(installation).stopServer(true);
+          if (!isVerbose())
+          {
+            notifyListeners(getFormattedWithPoints(
+                INFO_PROGRESS_STOPPING_NON_VERBOSE.get()));
+          }
+          new ServerController(installation).stopServer(!isVerbose());
+          if (!isVerbose())
+          {
+            notifyListeners(getFormattedDoneWithLineBreak());
+          }
         } catch (Throwable t2) {
           LOG.log(Level.INFO, "error stopping server", t2);
         }
@@ -247,13 +303,31 @@
   protected void uninstall() {
 
     notifyListeners(getTaskSeparator());
+    if (!isVerbose())
+    {
+      notifyListeners(getFormattedWithPoints(INFO_PROGRESS_CANCELING.get()));
+    }
+    else
+    {
+      notifyListeners(
+          getFormattedProgressWithLineBreak(INFO_SUMMARY_CANCELING.get()));
+    }
     Installation installation = getInstallation();
     FileManager fm = new FileManager(this);
 
     // Stop the server if necessary
     if (installation.getStatus().isServerRunning()) {
       try {
-        new ServerController(installation).stopServer(true);
+        if (!isVerbose())
+        {
+          notifyListeners(getFormattedWithPoints(
+              INFO_PROGRESS_STOPPING_NON_VERBOSE.get()));
+        }
+        new ServerController(installation).stopServer(!isVerbose());
+        if (!isVerbose())
+        {
+          notifyListeners(getFormattedDoneWithLineBreak());
+        }
       } catch (ApplicationException e) {
         LOG.log(Level.INFO, "error stopping server", e);
       }
@@ -326,6 +400,11 @@
       LOG.log(Level.INFO, "Error deleting databases", e);
     }
 
+    if (!isVerbose())
+    {
+      notifyListeners(getFormattedDoneWithLineBreak());
+    }
+
   }
 
   /**

--
Gitblit v1.10.0