From eebe112fb9a05226379250e0773a43b219be18da Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Wed, 02 May 2007 19:22:13 +0000
Subject: [PATCH] mproves the amount of logging that is done in quicksetup applications. Much of what was simply relayed to the user as progress messages is not logged also.
---
opends/src/quicksetup/org/opends/quicksetup/upgrader/RemoteBuildManager.java | 26 ++++++++++++++++++++++++--
1 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/RemoteBuildManager.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/RemoteBuildManager.java
index 0933e11..195305b 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/RemoteBuildManager.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/upgrader/RemoteBuildManager.java
@@ -28,6 +28,7 @@
package org.opends.quicksetup.upgrader;
import org.opends.quicksetup.Application;
+import org.opends.quicksetup.i18n.ResourceProvider;
import org.opends.quicksetup.util.Utils;
import javax.swing.*;
@@ -187,17 +188,30 @@
try {
is = conn.getInputStream();
+ int length = conn.getContentLength();
fos = new FileOutputStream(destination);
int i = 0;
int bytesRead = 0;
byte[] buf = new byte[1024];
+ app.notifyListeners(0,
+ getMsg("build-manager-downloading-build"),
+ null);
while ((i = is.read(buf)) != -1) {
fos.write(buf, 0, i);
- bytesRead += i;
if (app != null) {
- app.notifyListeners(".");
+ bytesRead += i;
+ if (length > 0) {
+ int progress = (bytesRead * 100) / length;
+ app.notifyListeners(0,
+ getMsg("build-manager-downloading-build-progress",
+ String.valueOf(progress)),
+ null);
+ }
}
}
+ app.notifyListeners(0,
+ getMsg("build-manager-downloading-build-done"),
+ null);
} finally {
if (is != null) {
is.close();
@@ -379,6 +393,14 @@
}
}
+ private String getMsg(String key) {
+ return ResourceProvider.getInstance().getMsg(key);
+ }
+
+ private String getMsg(String key, String... args) {
+ return ResourceProvider.getInstance().getMsg(key, args);
+ }
+
/**
* For testing only.
* @param args command line arguments
--
Gitblit v1.10.0