From 80c58327faaa4873369f6bb949e62792c2f708e0 Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Wed, 15 Aug 2007 21:34:53 +0000
Subject: [PATCH] This commit is a step toward getting OpenDS internationalized. There are still issues to be resolved before we can declare that we are internationalized but this commit covers the bulk of changes needed at this time.
---
opends/src/quicksetup/org/opends/quicksetup/webstart/WebStartDownloader.java | 50 ++++++++++++++------------------------------------
1 files changed, 14 insertions(+), 36 deletions(-)
diff --git a/opends/src/quicksetup/org/opends/quicksetup/webstart/WebStartDownloader.java b/opends/src/quicksetup/org/opends/quicksetup/webstart/WebStartDownloader.java
index 27cbe84..0e2f1c3 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/webstart/WebStartDownloader.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/webstart/WebStartDownloader.java
@@ -26,6 +26,7 @@
*/
package org.opends.quicksetup.webstart;
+import org.opends.messages.Message;
import java.io.IOException;
import java.net.MalformedURLException;
@@ -36,10 +37,11 @@
import javax.jnlp.ServiceManager;
import javax.jnlp.UnavailableServiceException;
-import org.opends.quicksetup.i18n.ResourceProvider;
+
import org.opends.quicksetup.ApplicationException;
import org.opends.quicksetup.ApplicationReturnCode;
-import org.opends.quicksetup.util.Utils;
+import static org.opends.quicksetup.util.Utils.*;
+import static org.opends.messages.QuickSetupMessages.*;
/**
* This class is used to download the files that have been marked as lazy
@@ -82,7 +84,7 @@
private Status status = Status.DOWNLOADING;
- private String summary = null;
+ private Message summary = null;
/**
* This enumeration contains the different Status on which
@@ -109,7 +111,7 @@
* Creates a default instance.
*/
public WebStartDownloader() {
- this.summary = getMsg("downloading");
+ this.summary = INFO_DOWNLOADING.get();
}
/**
@@ -136,8 +138,7 @@
// This is a bug
ex =
new ApplicationException(ApplicationReturnCode.ReturnCode.BUG,
- getExceptionMsg(
- "bug-msg", mfe), mfe);
+ getThrowableMsg(INFO_BUG_MSG.get(),mfe), mfe);
} catch (IOException ioe)
{
StringBuilder buf = new StringBuilder();
@@ -150,19 +151,17 @@
}
buf.append(jars[i]);
}
- String[] arg =
- { buf.toString() };
ex =
new ApplicationException(
ApplicationReturnCode.ReturnCode.DOWNLOAD_ERROR,
- getExceptionMsg("downloading-error", arg, ioe), ioe);
+ getThrowableMsg(
+ INFO_DOWNLOADING_ERROR.get(buf.toString()), ioe), ioe);
} catch (Throwable t)
{
// This is a bug
ex =
new ApplicationException(ApplicationReturnCode.ReturnCode.BUG,
- getExceptionMsg(
- "bug-msg", t), t);
+ getThrowableMsg(INFO_BUG_MSG.get(), t), t);
}
}
});
@@ -173,7 +172,7 @@
* Gets a summary message of the downloader's current progress.
* @return String for showing the user progress
*/
- public String getSummary() {
+ public Message getSummary() {
return this.summary;
}
@@ -181,7 +180,7 @@
* Sets a summary message of the downloader's current progress.
* @param summary String for showing the user progress
*/
- public void setSummary(String summary) {
+ public void setSummary(Message summary) {
this.summary = summary;
}
@@ -366,8 +365,8 @@
{
ex =
new ApplicationException(
- ApplicationReturnCode.ReturnCode.DOWNLOAD_ERROR, getMsg(
- "downloading-error", new String[] { url.toString() }), null);
+ ApplicationReturnCode.ReturnCode.DOWNLOAD_ERROR,
+ INFO_DOWNLOADING_ERROR.get(url.toString()), null);
}
/**
@@ -445,25 +444,4 @@
return new String[getJarUrls().length];
}
- /* Some commodity methods to get localized messages */
- private String getExceptionMsg(String key, Throwable t)
- {
- return getExceptionMsg(key, null, t);
- }
-
- private String getExceptionMsg(String key, String[] args, Throwable t)
- {
- return Utils.getThrowableMsg(ResourceProvider.getInstance(), key, args, t);
- }
-
- private String getMsg(String key, String[] args)
- {
- return ResourceProvider.getInstance().getMsg(key, args);
- }
-
- private String getMsg(String key)
- {
- return ResourceProvider.getInstance().getMsg(key);
- }
-
}
--
Gitblit v1.10.0