changeset 696:1c430d80ed06

Remove duplicate Translate classes The class Translate is duplicated in a number of times. Remove duplicates and make all code use the canonical implementation. Reviewed-by: jerboaa, vanaltj Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2012-October/003624.html
author Omair Majid <omajid@redhat.com>
date Tue, 16 Oct 2012 14:23:29 -0400
parents 687dc5d9beb2
children d552470b531b
files agent/cli/src/main/java/com/redhat/thermostat/agent/cli/ServiceCommand.java agent/cli/src/main/java/com/redhat/thermostat/agent/cli/db/DBOptionParser.java agent/cli/src/main/java/com/redhat/thermostat/agent/cli/db/MongoProcessRunner.java agent/cli/src/main/java/com/redhat/thermostat/agent/cli/db/StalePidFileException.java agent/cli/src/main/java/com/redhat/thermostat/agent/cli/impl/locale/LocaleResources.java agent/cli/src/main/java/com/redhat/thermostat/agent/cli/impl/locale/Translate.java client/core/src/main/java/com/redhat/thermostat/client/internal/Main.java client/core/src/main/java/com/redhat/thermostat/client/internal/ui/swing/AboutDialog.java client/core/src/main/java/com/redhat/thermostat/client/locale/LocaleResources.java client/core/src/main/java/com/redhat/thermostat/client/locale/Translate.java client/core/src/main/java/com/redhat/thermostat/client/ui/AgentInformationDisplayController.java client/core/src/main/java/com/redhat/thermostat/client/ui/AgentInformationDisplayFrame.java client/core/src/main/java/com/redhat/thermostat/client/ui/ClientConfigurationPanel.java client/core/src/main/java/com/redhat/thermostat/client/ui/ClientConfigurationSwing.java client/core/src/main/java/com/redhat/thermostat/client/ui/HostCpuController.java client/core/src/main/java/com/redhat/thermostat/client/ui/HostCpuPanel.java client/core/src/main/java/com/redhat/thermostat/client/ui/HostInformationController.java client/core/src/main/java/com/redhat/thermostat/client/ui/HostMemoryController.java client/core/src/main/java/com/redhat/thermostat/client/ui/HostMemoryPanel.java client/core/src/main/java/com/redhat/thermostat/client/ui/HostOverviewController.java client/core/src/main/java/com/redhat/thermostat/client/ui/HostOverviewPanel.java client/core/src/main/java/com/redhat/thermostat/client/ui/HostPanel.java client/core/src/main/java/com/redhat/thermostat/client/ui/MainWindow.java client/core/src/main/java/com/redhat/thermostat/client/ui/RecentTimeSeriesChartPanel.java client/core/src/main/java/com/redhat/thermostat/client/ui/SearchFieldSwingView.java client/core/src/main/java/com/redhat/thermostat/client/ui/SummaryPanel.java client/core/src/main/java/com/redhat/thermostat/client/ui/VmCpuPanel.java client/core/src/main/java/com/redhat/thermostat/client/ui/VmGcController.java client/core/src/main/java/com/redhat/thermostat/client/ui/VmGcPanel.java client/core/src/main/java/com/redhat/thermostat/client/ui/VmInformationController.java client/core/src/main/java/com/redhat/thermostat/client/ui/VmOverviewController.java client/core/src/main/java/com/redhat/thermostat/client/ui/VmOverviewPanel.java client/core/src/main/resources/com/redhat/thermostat/client/locale/strings.properties client/core/src/test/java/com/redhat/thermostat/client/locale/LocaleResourcesTest.java client/core/src/test/java/com/redhat/thermostat/client/locale/TranslateTest.java client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/HeapDumpController.java client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/HeapDumpDetailsController.java client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/LocaleResources.java client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/ObjectRootsController.java client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/Translate.java client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/DumpHeapCommand.java client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/FindObjectsCommand.java client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/FindRootCommand.java client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/ListHeapDumpsCommand.java client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/ObjectCommandHelper.java client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/ObjectInfoCommand.java client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/SaveHeapDumpToFileCommand.java client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/ShowHeapHistogramCommand.java client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/swing/HeapSwingView.java client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/swing/HistogramPanel.java client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/swing/ObjectDetailsPanel.java client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/swing/ObjectRootsFrame.java client/heapdumper/src/test/java/com/redhat/thermostat/client/heap/LocaleResourcesTest.java client/heapdumper/src/test/java/com/redhat/thermostat/client/heap/TranslateTest.java client/memory-stats-panel/pom.xml client/vmclassstat/src/main/java/com/redhat/thermostat/client/vmclassstat/LocaleResources.java client/vmclassstat/src/main/java/com/redhat/thermostat/client/vmclassstat/VmClassStatController.java client/vmclassstat/src/main/java/com/redhat/thermostat/client/vmclassstat/VmClassStatPanel.java client/vmclassstat/src/main/resources/com/redhat/thermostat/client/vmclassstat/strings.properties client/vmclassstat/src/test/java/com/redhat/thermostat/client/vmclassstat/LocaleResourcesTest.java common/command/src/main/java/com/redhat/thermostat/common/command/internal/locale/LocaleResources.java common/command/src/main/java/com/redhat/thermostat/common/command/internal/locale/Translate.java common/command/src/main/resources/com/redhat/thermostat/common/command/internal/strings.properties common/core/src/main/java/com/redhat/thermostat/common/locale/Translate.java common/core/src/test/java/com/redhat/thermostat/common/locale/LocaleResourcesTest.java common/core/src/test/java/com/redhat/thermostat/common/locale/TranslateTest.java tools/src/main/java/com/redhat/thermostat/tools/LocaleResources.java tools/src/main/java/com/redhat/thermostat/tools/Translate.java tools/src/main/java/com/redhat/thermostat/tools/cli/ConnectCommand.java tools/src/main/java/com/redhat/thermostat/tools/cli/DisconnectCommand.java tools/src/main/java/com/redhat/thermostat/tools/cli/ListVMsCommand.java tools/src/main/java/com/redhat/thermostat/tools/cli/VMInfoCommand.java tools/src/main/java/com/redhat/thermostat/tools/cli/VMListFormatter.java tools/src/main/java/com/redhat/thermostat/tools/cli/VMStatCommand.java tools/src/main/java/com/redhat/thermostat/tools/cli/VMStatPrinter.java tools/src/test/java/com/redhat/thermostat/tools/LocaleResourcesTest.java tools/src/test/java/com/redhat/thermostat/tools/TranslateTest.java tools/src/test/java/com/redhat/thermostat/tools/cli/ConnectCommandTest.java tools/src/test/java/com/redhat/thermostat/tools/cli/DisconnectCommandTest.java
diffstat 79 files changed, 841 insertions(+), 950 deletions(-) [+]
line wrap: on
line diff
--- a/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/ServiceCommand.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/ServiceCommand.java	Tue Oct 16 14:23:29 2012 -0400
@@ -42,12 +42,12 @@
 
 import com.redhat.thermostat.agent.cli.db.StorageAlreadyRunningException;
 import com.redhat.thermostat.agent.cli.impl.locale.LocaleResources;
-import com.redhat.thermostat.agent.cli.impl.locale.Translate;
 import com.redhat.thermostat.common.ActionEvent;
 import com.redhat.thermostat.common.ActionListener;
 import com.redhat.thermostat.common.cli.CommandContext;
 import com.redhat.thermostat.common.cli.CommandException;
 import com.redhat.thermostat.common.cli.SimpleCommand;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.tools.ApplicationState;
 import com.redhat.thermostat.common.utils.OSGIUtils;
 import com.redhat.thermostat.launcher.Launcher;
@@ -58,6 +58,8 @@
  */
 public class ServiceCommand extends SimpleCommand implements ActionListener<ApplicationState> {
     
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private static final String NAME = "service";
 
     private List<ActionListener<ApplicationState>> listeners;
@@ -94,16 +96,16 @@
                 String dbUrl = storage.getConfiguration().getDBConnectionString();
                 Launcher launcher = getLauncher();
                 String[] agentArgs =  new String[] {"agent", "-d", dbUrl};
-                System.err.println(Translate.localize(LocaleResources.STARTING_AGENT));
+                System.err.println(translator.localize(LocaleResources.STARTING_AGENT));
                 launcher.setArgs(agentArgs);
                 launcher.run();
                 agentBarrier.release();
                 break;
             case FAIL:
-                System.err.println(Translate.localize(LocaleResources.ERROR_STARTING_DB));
+                System.err.println(translator.localize(LocaleResources.ERROR_STARTING_DB));
                 Object payload = actionEvent.getPayload();
                 if (payload instanceof StorageAlreadyRunningException) {
-                    System.err.println(Translate.localize(LocaleResources.STORAGE_ALREADY_RUNNING));
+                    System.err.println(translator.localize(LocaleResources.STORAGE_ALREADY_RUNNING));
                 }
                 break;
             }
--- a/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/db/DBOptionParser.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/db/DBOptionParser.java	Tue Oct 16 14:23:29 2012 -0400
@@ -38,13 +38,15 @@
 
 import com.redhat.thermostat.common.cli.Arguments;
 import com.redhat.thermostat.agent.cli.impl.locale.LocaleResources;
-import com.redhat.thermostat.agent.cli.impl.locale.Translate;
 import com.redhat.thermostat.common.config.InvalidConfigurationException;
 import com.redhat.thermostat.common.config.ThermostatOptionParser;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.tools.ApplicationState;
 
 public class DBOptionParser implements ThermostatOptionParser {
     
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private boolean quiet;
     
     private DBStartupConfiguration configuration;
@@ -68,7 +70,7 @@
         } else if (args.hasArgument(DBArgs.STOP.option)) {
             serviceAction = DBArgs.STOP;
         } else {
-            throw new InvalidConfigurationException(Translate.localize(LocaleResources.COMMAND_STORAGE_ARGUMENT_REQUIRED));
+            throw new InvalidConfigurationException(translator.localize(LocaleResources.COMMAND_STORAGE_ARGUMENT_REQUIRED));
         }
 
         if (args.hasArgument(DBArgs.DRY.option)) {
--- a/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/db/MongoProcessRunner.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/db/MongoProcessRunner.java	Tue Oct 16 14:23:29 2012 -0400
@@ -50,8 +50,8 @@
 import java.util.logging.Logger;
 
 import com.redhat.thermostat.agent.cli.impl.locale.LocaleResources;
-import com.redhat.thermostat.agent.cli.impl.locale.Translate;
 import com.redhat.thermostat.common.config.InvalidConfigurationException;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.tools.ApplicationException;
 import com.redhat.thermostat.common.utils.LoggedExternalProcess;
 import com.redhat.thermostat.common.utils.LoggingUtils;
@@ -59,6 +59,7 @@
 
 public class MongoProcessRunner {
     
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
     private static final Logger logger = LoggingUtils.getLogger(MongoProcessRunner.class);
 
     private static final String MONGO_PROCESS = "mongod";
@@ -111,12 +112,12 @@
         LoggedExternalProcess process = new LoggedExternalProcess(commands);
         int status = process.runAndReturnResult();
         if (status == 0) {
-            display(Translate.localize(LocaleResources.SERVER_SHUTDOWN_COMPLETE, configuration.getDBPath().toString()));
-            display(Translate.localize(LocaleResources.LOG_FILE_AT, configuration.getLogFile().toString()));
+            display(translator.localize(LocaleResources.SERVER_SHUTDOWN_COMPLETE, configuration.getDBPath().toString()));
+            display(translator.localize(LocaleResources.LOG_FILE_AT, configuration.getLogFile().toString()));
             
         } else {
             
-            String message = Translate.localize(LocaleResources.CANNOT_SHUTDOWN_SERVER,
+            String message = translator.localize(LocaleResources.CANNOT_SHUTDOWN_SERVER,
                     configuration.getDBPath().toString(),
                     String.valueOf(status));
             display(message);
@@ -141,10 +142,10 @@
             String message = null;
             ApplicationException ex = null;
             if (!checkExistingProcess()) {
-                message = Translate.localize(LocaleResources.STALE_PID_FILE_NO_MATCHING_PROCESS, configuration.getPidFile().toString(), MONGO_PROCESS);
+                message = translator.localize(LocaleResources.STALE_PID_FILE_NO_MATCHING_PROCESS, configuration.getPidFile().toString(), MONGO_PROCESS);
                 ex = new StalePidFileException(configuration.getPidFile());
             } else {
-                message = Translate.localize(LocaleResources.STORAGE_ALREADY_RUNNING_WITH_PID, String.valueOf(pid));
+                message = translator.localize(LocaleResources.STORAGE_ALREADY_RUNNING_WITH_PID, String.valueOf(pid));
                 ex = new StorageAlreadyRunningException(Integer.valueOf(pid), message);
             }
             
@@ -159,7 +160,7 @@
         }
 
         // check that the db directory exist
-        display(Translate.localize(LocaleResources.STARTING_STORAGE_SERVER));
+        display(translator.localize(LocaleResources.STARTING_STORAGE_SERVER));
 
         commands.add(configuration.getBindIP());
 
@@ -180,7 +181,7 @@
         try {
             status = process.runAndReturnResult();
         } catch (ApplicationException ae) {
-            String message = Translate.localize(LocaleResources.CANNOT_EXECUTE_PROCESS, MONGO_PROCESS);
+            String message = translator.localize(LocaleResources.CANNOT_EXECUTE_PROCESS, MONGO_PROCESS);
             display(message);
             throw ae;
         }
@@ -193,13 +194,13 @@
         }
         
         if (status == 0) {
-            display(Translate.localize(LocaleResources.SERVER_LISTENING_ON, configuration.getDBConnectionString()));
-            display(Translate.localize(LocaleResources.LOG_FILE_AT, configuration.getLogFile().toString()));
-            display(Translate.localize(LocaleResources.PID_IS,  String.valueOf(pid)));
+            display(translator.localize(LocaleResources.SERVER_LISTENING_ON, configuration.getDBConnectionString()));
+            display(translator.localize(LocaleResources.LOG_FILE_AT, configuration.getLogFile().toString()));
+            display(translator.localize(LocaleResources.PID_IS,  String.valueOf(pid)));
             
         } else {
             
-            String message = Translate.localize(LocaleResources.CANNOT_START_SERVER,
+            String message = translator.localize(LocaleResources.CANNOT_START_SERVER,
                              configuration.getDBPath().toString(),
                              String.valueOf(status));
             display(message);
@@ -213,7 +214,7 @@
             process = new ProcessBuilder(Arrays.asList("mongod", "--version"))
                     .start();
         } catch (IOException e) {
-            String message = Translate.localize(
+            String message = translator.localize(
                     LocaleResources.CANNOT_EXECUTE_PROCESS, MONGO_PROCESS);
             display(message);
             throw e;
--- a/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/db/StalePidFileException.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/db/StalePidFileException.java	Tue Oct 16 14:23:29 2012 -0400
@@ -38,16 +38,17 @@
 import java.io.File;
 
 import com.redhat.thermostat.agent.cli.impl.locale.LocaleResources;
-import com.redhat.thermostat.agent.cli.impl.locale.Translate;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.tools.ApplicationException;
 
+public class StalePidFileException extends ApplicationException {
 
-public class StalePidFileException extends ApplicationException {
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
 
     private final File pidFile;
 
     public StalePidFileException(File pidFile) {
-        super(Translate.localize(LocaleResources.STALE_PID_FILE, pidFile.toString()));
+        super(translator.localize(LocaleResources.STALE_PID_FILE, pidFile.toString()));
         this.pidFile = pidFile;
     }
 
--- a/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/impl/locale/LocaleResources.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/impl/locale/LocaleResources.java	Tue Oct 16 14:23:29 2012 -0400
@@ -36,6 +36,8 @@
 
 package com.redhat.thermostat.agent.cli.impl.locale;
 
+import com.redhat.thermostat.common.locale.Translate;
+
 public enum LocaleResources {
 
     STARTING_AGENT,
@@ -57,4 +59,9 @@
     PID_IS;
 
     static final String RESOURCE_BUNDLE = "com.redhat.thermostat.agent.cli.impl.strings";
+
+    public static Translate<LocaleResources> createLocalizer() {
+        return new Translate<>(RESOURCE_BUNDLE, LocaleResources.class);
+    }
+
 }
--- a/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/impl/locale/Translate.java	Wed Oct 10 18:52:45 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- * Copyright 2012 Red Hat, Inc.
- *
- * This file is part of Thermostat.
- *
- * Thermostat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Thermostat is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Thermostat; see the file COPYING.  If not see
- * <http://www.gnu.org/licenses/>.
- *
- * Linking this code with other modules is making a combined work
- * based on this code.  Thus, the terms and conditions of the GNU
- * General Public License cover the whole combination.
- *
- * As a special exception, the copyright holders of this code give
- * you permission to link this code with independent modules to
- * produce an executable, regardless of the license terms of these
- * independent modules, and to copy and distribute the resulting
- * executable under terms of your choice, provided that you also
- * meet, for each linked independent module, the terms and conditions
- * of the license of that module.  An independent module is a module
- * which is not derived from or based on this code.  If you modify
- * this code, you may extend this exception to your version of the
- * library, but you are not obligated to do so.  If you do not wish
- * to do so, delete this exception statement from your version.
- */
-
-package com.redhat.thermostat.agent.cli.impl.locale;
-
-import java.text.MessageFormat;
-import java.util.ResourceBundle;
-
-public class Translate {
-
-    private static ResourceBundle resourceBundle = null;
-
-    static {
-        resourceBundle = ResourceBundle.getBundle(LocaleResources.RESOURCE_BUNDLE);
-    }
-
-    public static String localize(LocaleResources toTranslate) {
-        return resourceBundle.getString(toTranslate.name());
-    }
-
-    public static String localize(LocaleResources toTranslate, String... params) {
-        return MessageFormat.format(localize(toTranslate), (Object[]) params);
-    }
-}
--- a/client/core/src/main/java/com/redhat/thermostat/client/internal/Main.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/core/src/main/java/com/redhat/thermostat/client/internal/Main.java	Tue Oct 16 14:23:29 2012 -0400
@@ -36,8 +36,6 @@
 
 package com.redhat.thermostat.client.internal;
 
-import static com.redhat.thermostat.client.locale.Translate.localize;
-
 import java.awt.EventQueue;
 import java.util.concurrent.ExecutorService;
 import java.util.logging.Level;
@@ -69,6 +67,7 @@
 import com.redhat.thermostat.common.config.StartupConfiguration;
 import com.redhat.thermostat.common.dao.DAOFactory;
 import com.redhat.thermostat.common.dao.MongoDAOFactory;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.storage.Connection;
 import com.redhat.thermostat.common.storage.Connection.ConnectionListener;
 import com.redhat.thermostat.common.storage.Connection.ConnectionStatus;
@@ -81,6 +80,8 @@
 
 public class Main {
     
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private static final Logger logger = LoggingUtils.getLogger(Main.class);
 
     private UiFacadeFactory uiFacadeFactory;
@@ -193,14 +194,14 @@
         @Override
         public void run() {
             Object[] options = {
-                    localize(LocaleResources.CONNECTION_WIZARD),
-                    localize(LocaleResources.CONNECTION_QUIT),
+                    translator.localize(LocaleResources.CONNECTION_WIZARD),
+                    translator.localize(LocaleResources.CONNECTION_QUIT),
             };
             int n = JOptionPane
                     .showOptionDialog(
                             null,
-                            localize(LocaleResources.CONNECTION_FAILED_TO_CONNECT_DESCRIPTION),
-                            localize(LocaleResources.CONNECTION_FAILED_TO_CONNECT_TITLE),
+                            translator.localize(LocaleResources.CONNECTION_FAILED_TO_CONNECT_DESCRIPTION),
+                            translator.localize(LocaleResources.CONNECTION_FAILED_TO_CONNECT_TITLE),
                             JOptionPane.OK_CANCEL_OPTION,
                             JOptionPane.ERROR_MESSAGE, null, options,
                             options[0]);
@@ -300,8 +301,8 @@
                 } else {
                     JOptionPane.showMessageDialog(
                             null,
-                            localize(LocaleResources.CONNECTION_FAILED_TO_CONNECT_DESCRIPTION),
-                            localize(LocaleResources.CONNECTION_FAILED_TO_CONNECT_TITLE),
+                            translator.localize(LocaleResources.CONNECTION_FAILED_TO_CONNECT_DESCRIPTION),
+                            translator.localize(LocaleResources.CONNECTION_FAILED_TO_CONNECT_TITLE),
                             JOptionPane.ERROR_MESSAGE);
                     uiFacadeFactory.shutdown(Constants.EXIT_UNABLE_TO_CONNECT_TO_DATABASE);
                 }
--- a/client/core/src/main/java/com/redhat/thermostat/client/internal/ui/swing/AboutDialog.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/core/src/main/java/com/redhat/thermostat/client/internal/ui/swing/AboutDialog.java	Tue Oct 16 14:23:29 2012 -0400
@@ -36,8 +36,6 @@
 
 package com.redhat.thermostat.client.internal.ui.swing;
 
-import static com.redhat.thermostat.client.locale.Translate.localize;
-
 import java.awt.Cursor;
 import java.awt.Desktop;
 import java.awt.event.ActionEvent;
@@ -65,10 +63,12 @@
 import com.redhat.thermostat.client.ui.IconResource;
 import com.redhat.thermostat.client.ui.UIResources;
 import com.redhat.thermostat.common.ApplicationInfo;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.utils.LoggingUtils;
 
 public class AboutDialog extends JDialog {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
     private static final long serialVersionUID = -7611616871710076514L;
 
     private static final Logger logger = LoggingUtils.getLogger(AboutDialog.class);
@@ -110,7 +110,7 @@
         JPanel panel = new JPanel();
         panel.setBorder(new TitledBorder(""));
         
-        JButton closeButton = new JButton(localize(LocaleResources.BUTTON_CLOSE));
+        JButton closeButton = new JButton(translator.localize(LocaleResources.BUTTON_CLOSE));
         closeButton.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent e) {
                 AboutDialog.this.setVisible(false);
--- a/client/core/src/main/java/com/redhat/thermostat/client/locale/LocaleResources.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/core/src/main/java/com/redhat/thermostat/client/locale/LocaleResources.java	Tue Oct 16 14:23:29 2012 -0400
@@ -36,6 +36,8 @@
 
 package com.redhat.thermostat.client.locale;
 
+import com.redhat.thermostat.common.locale.Translate;
+
 public enum LocaleResources {
 
     MISSING_INFO,
@@ -170,10 +172,6 @@
     VM_CPU_CHART_TIME_LABEL,
 
     VM_GC_TITLE,
-    VM_MEMORY_SPACE_TITLE,
-    VM_MEMORY_SPACE_USED,
-    VM_MEMORY_SPACE_FREE,
-    VM_MEMORY_SPACE_ADDITIONAL,
 
     VM_GC_COLLECTOR_OVER_GENERATION,
     VM_GC_COLLECTOR_CHART_REAL_TIME_LABEL,
@@ -205,4 +203,8 @@
 
     static final String RESOURCE_BUNDLE =
             "com.redhat.thermostat.client.locale.strings";
+
+    public static Translate<LocaleResources> createLocalizer() {
+        return new Translate<>(RESOURCE_BUNDLE, LocaleResources.class);
+    }
 }
--- a/client/core/src/main/java/com/redhat/thermostat/client/locale/Translate.java	Wed Oct 10 18:52:45 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- * Copyright 2012 Red Hat, Inc.
- *
- * This file is part of Thermostat.
- *
- * Thermostat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Thermostat is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Thermostat; see the file COPYING.  If not see
- * <http://www.gnu.org/licenses/>.
- *
- * Linking this code with other modules is making a combined work
- * based on this code.  Thus, the terms and conditions of the GNU
- * General Public License cover the whole combination.
- *
- * As a special exception, the copyright holders of this code give
- * you permission to link this code with independent modules to
- * produce an executable, regardless of the license terms of these
- * independent modules, and to copy and distribute the resulting
- * executable under terms of your choice, provided that you also
- * meet, for each linked independent module, the terms and conditions
- * of the license of that module.  An independent module is a module
- * which is not derived from or based on this code.  If you modify
- * this code, you may extend this exception to your version of the
- * library, but you are not obligated to do so.  If you do not wish
- * to do so, delete this exception statement from your version.
- */
-
-package com.redhat.thermostat.client.locale;
-
-import java.text.MessageFormat;
-import java.util.ResourceBundle;
-
-public class Translate {
-
-    private static ResourceBundle resourceBundle = null;
-
-    static {
-        resourceBundle = ResourceBundle.getBundle(LocaleResources.RESOURCE_BUNDLE);
-    }
-
-    public static String localize(LocaleResources toTranslate) {
-        return resourceBundle.getString(toTranslate.name());
-    }
-
-    public static String localize(LocaleResources toTranslate, String... params) {
-        return MessageFormat.format(localize(toTranslate), (Object[]) params);
-    }
-}
--- a/client/core/src/main/java/com/redhat/thermostat/client/ui/AgentInformationDisplayController.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/core/src/main/java/com/redhat/thermostat/client/ui/AgentInformationDisplayController.java	Tue Oct 16 14:23:29 2012 -0400
@@ -36,8 +36,6 @@
 
 package com.redhat.thermostat.client.ui;
 
-import static com.redhat.thermostat.client.locale.Translate.localize;
-
 import java.text.DateFormat;
 import java.util.Collection;
 import java.util.Date;
@@ -49,11 +47,14 @@
 import com.redhat.thermostat.client.locale.LocaleResources;
 import com.redhat.thermostat.common.ActionEvent;
 import com.redhat.thermostat.common.ActionListener;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.model.AgentInformation;
 import com.redhat.thermostat.common.model.BackendInformation;
 
 public class AgentInformationDisplayController implements ActionListener<ConfigurationAction> {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private final AgentInformationDisplayView view;
     private final AgentInformationDisplayModel model;
 
@@ -133,13 +134,14 @@
         if (stopTime >= startTime) {
             view.setSelectedAgentStopTime(dateTimeFormat.format(new Date(stopTime)));
         } else {
-            view.setSelectedAgentStopTime(localize(LocaleResources.AGENT_INFO_AGENT_RUNNING));
+            view.setSelectedAgentStopTime(translator.localize(LocaleResources.AGENT_INFO_AGENT_RUNNING));
         }
 
         Map<String, String> map = new HashMap<>();
         for (BackendInformation backendInfo : model.getBackends(agentId)) {
             String status = backendInfo.isActive() ?
-                    localize(LocaleResources.AGENT_INFO_BACKEND_STATUS_ACTIVE) : localize(LocaleResources.AGENT_INFO_BACKEND_STATUS_INACTIVE);
+                    translator.localize(LocaleResources.AGENT_INFO_BACKEND_STATUS_ACTIVE)
+                    : translator.localize(LocaleResources.AGENT_INFO_BACKEND_STATUS_INACTIVE);
             map.put(backendInfo.getName(), status);
         }
         view.setSelectedAgentBackendStatus(map);
--- a/client/core/src/main/java/com/redhat/thermostat/client/ui/AgentInformationDisplayFrame.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/core/src/main/java/com/redhat/thermostat/client/ui/AgentInformationDisplayFrame.java	Tue Oct 16 14:23:29 2012 -0400
@@ -36,8 +36,6 @@
 
 package com.redhat.thermostat.client.ui;
 
-import static com.redhat.thermostat.client.locale.Translate.localize;
-
 import java.awt.BorderLayout;
 import java.awt.event.WindowAdapter;
 import java.awt.event.WindowEvent;
@@ -67,12 +65,15 @@
 import com.redhat.thermostat.client.locale.LocaleResources;
 import com.redhat.thermostat.common.ActionEvent;
 import com.redhat.thermostat.common.ActionListener;
+import com.redhat.thermostat.common.locale.Translate;
 
 public class AgentInformationDisplayFrame extends AgentInformationDisplayView {
 
+    private static final Translate<LocaleResources> translate = LocaleResources.createLocalizer();
+
     private static final String[] BACKEND_TABLE_COLUMN_NAMES = new String[] {
-        localize(LocaleResources.AGENT_INFO_BACKEND_NAME_COLUMN),
-        localize(LocaleResources.AGENT_INFO_BACKEND_STATUS_COLUMN),
+        translate.localize(LocaleResources.AGENT_INFO_BACKEND_NAME_COLUMN),
+        translate.localize(LocaleResources.AGENT_INFO_BACKEND_STATUS_COLUMN),
     };
 
     private final CopyOnWriteArrayList<ActionListener<ConfigurationAction>> listeners = new CopyOnWriteArrayList<>();
@@ -106,10 +107,10 @@
         windowListener = new WindowClosingListener();
 
         frame = new JFrame();
-        frame.setTitle(localize(LocaleResources.AGENT_INFO_WINDOW_TITLE));
+        frame.setTitle(translate.localize(LocaleResources.AGENT_INFO_WINDOW_TITLE));
         frame.addWindowListener(windowListener);
 
-        closeButton = new JButton(localize(LocaleResources.BUTTON_CLOSE));
+        closeButton = new JButton(translate.localize(LocaleResources.BUTTON_CLOSE));
         closeButton.addActionListener(configurationComplete);
         closeButton.setName("close");
 
@@ -138,7 +139,7 @@
         JPanel agentListPanel = new JPanel();
         splitPane.setLeftComponent(agentListPanel);
 
-        JLabel agentLabel = new JLabel(localize(LocaleResources.AGENT_INFO_AGENTS_LIST));
+        JLabel agentLabel = new JLabel(translate.localize(LocaleResources.AGENT_INFO_AGENTS_LIST));
 
         JScrollPane scrollPane = new JScrollPane();
 
@@ -155,15 +156,15 @@
         JPanel agentConfigurationPanel = new JPanel();
         splitPane.setRightComponent(agentConfigurationPanel);
 
-        SectionHeader agentSectionTitle = new SectionHeader(localize(LocaleResources.AGENT_INFO_AGENT_SECTION_TITLE));
+        SectionHeader agentSectionTitle = new SectionHeader(translate.localize(LocaleResources.AGENT_INFO_AGENT_SECTION_TITLE));
 
-        LabelField agentNameLabel = new LabelField(localize(LocaleResources.AGENT_INFO_AGENT_NAME_LABEL));
-        LabelField agentIdLabel = new LabelField(localize(LocaleResources.AGENT_INFO_AGENT_ID_LABEL));
-        LabelField agentConfigurationAddressLabel = new LabelField(localize(LocaleResources.AGENT_INFO_AGENT_COMMAND_ADDRESS_LABEL));
-        LabelField agentStartTimeLabel = new LabelField(localize(LocaleResources.AGENT_INFO_AGENT_START_TIME_LABEL));
-        LabelField agentStopTimeLabel = new LabelField(localize(LocaleResources.AGENT_INFO_AGENT_STOP_TIME_LABEL));
+        LabelField agentNameLabel = new LabelField(translate.localize(LocaleResources.AGENT_INFO_AGENT_NAME_LABEL));
+        LabelField agentIdLabel = new LabelField(translate.localize(LocaleResources.AGENT_INFO_AGENT_ID_LABEL));
+        LabelField agentConfigurationAddressLabel = new LabelField(translate.localize(LocaleResources.AGENT_INFO_AGENT_COMMAND_ADDRESS_LABEL));
+        LabelField agentStartTimeLabel = new LabelField(translate.localize(LocaleResources.AGENT_INFO_AGENT_START_TIME_LABEL));
+        LabelField agentStopTimeLabel = new LabelField(translate.localize(LocaleResources.AGENT_INFO_AGENT_STOP_TIME_LABEL));
 
-        String notAvailable = localize(LocaleResources.INFORMATION_NOT_AVAILABLE);
+        String notAvailable = translate.localize(LocaleResources.INFORMATION_NOT_AVAILABLE);
 
         currentAgentName = new ValueField(notAvailable);
         currentAgentName.setName("agentName");
@@ -176,7 +177,7 @@
         currentAgentStopTime = new ValueField(notAvailable);
         currentAgentStopTime.setName("stopTime");
 
-        SectionHeader backendSectionTitle = new SectionHeader(localize(LocaleResources.AGENT_INFO_BACKENDS_SECTION_TITLE));
+        SectionHeader backendSectionTitle = new SectionHeader(translate.localize(LocaleResources.AGENT_INFO_BACKENDS_SECTION_TITLE));
 
         backendsTableModel = new DefaultTableModel();
         backendsTableModel.setColumnIdentifiers(BACKEND_TABLE_COLUMN_NAMES);
@@ -191,7 +192,7 @@
 
         JScrollPane backendsTableScollPane = new JScrollPane(backendsTable);
 
-        JLabel backendDescriptionLabel = new JLabel(localize(LocaleResources.AGENT_INFO_BACKEND_DESCRIPTION_LABEL));
+        JLabel backendDescriptionLabel = new JLabel(translate.localize(LocaleResources.AGENT_INFO_BACKEND_DESCRIPTION_LABEL));
         backendDescription = new ValueField(notAvailable);
         backendDescription.setName("backendDescription");
 
--- a/client/core/src/main/java/com/redhat/thermostat/client/ui/ClientConfigurationPanel.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/core/src/main/java/com/redhat/thermostat/client/ui/ClientConfigurationPanel.java	Tue Oct 16 14:23:29 2012 -0400
@@ -36,8 +36,6 @@
 
 package com.redhat.thermostat.client.ui;
 
-import static com.redhat.thermostat.client.locale.Translate.localize;
-
 import javax.swing.GroupLayout;
 import javax.swing.JLabel;
 import javax.swing.JPanel;
@@ -47,12 +45,16 @@
 import javax.swing.LayoutStyle.ComponentPlacement;
 
 import com.redhat.thermostat.client.locale.LocaleResources;
+import com.redhat.thermostat.common.locale.Translate;
+
 import javax.swing.border.TitledBorder;
 import javax.swing.JCheckBox;
 
 @SuppressWarnings("serial")
 class ClientConfigurationPanel extends JPanel {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     final JTextField storageUrl = new JTextField();
     final JTextField userName = new JTextField();
     final JPasswordField password = new JPasswordField();
@@ -61,16 +63,16 @@
     
     public ClientConfigurationPanel() {
         setBorder(new TitledBorder(null,
-                  localize(LocaleResources.CLIENT_PREFS_CONNECTION),
+                  translator.localize(LocaleResources.CLIENT_PREFS_CONNECTION),
                   TitledBorder.LEFT, TitledBorder.TOP, null, null));
 
-        JLabel storageURLText = new JLabel(localize(LocaleResources.CLIENT_PREFS_STORAGE_URL));
+        JLabel storageURLText = new JLabel(translator.localize(LocaleResources.CLIENT_PREFS_STORAGE_URL));
         storageURLText.setName("");
         
         storageUrl.setColumns(10);
         storageUrl.setName("connectionUrl");
         
-        JLabel userNameText = new JLabel(localize(LocaleResources.CLIENT_PREFS_STORAGE_USERNAME));
+        JLabel userNameText = new JLabel(translator.localize(LocaleResources.CLIENT_PREFS_STORAGE_USERNAME));
         userNameText.setName("userNameText");
         
         userName.setName("username");
@@ -82,7 +84,7 @@
         password.setName("password");
         password.setColumns(10);
         
-        saveEntitlements = new JCheckBox(localize(LocaleResources.CLIENT_PREFS_STORAGE_SAVE_ENTITLEMENTS));
+        saveEntitlements = new JCheckBox(translator.localize(LocaleResources.CLIENT_PREFS_STORAGE_SAVE_ENTITLEMENTS));
         saveEntitlements.setName("saveEntitlements");
         saveEntitlements.setSelected(false);
 
--- a/client/core/src/main/java/com/redhat/thermostat/client/ui/ClientConfigurationSwing.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/core/src/main/java/com/redhat/thermostat/client/ui/ClientConfigurationSwing.java	Tue Oct 16 14:23:29 2012 -0400
@@ -52,13 +52,15 @@
 
 import com.redhat.thermostat.client.core.views.ClientConfigurationView;
 import com.redhat.thermostat.client.locale.LocaleResources;
-import com.redhat.thermostat.client.locale.Translate;
 import com.redhat.thermostat.common.ActionEvent;
 import com.redhat.thermostat.common.ActionListener;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.swing.EdtHelper;
 
 public class ClientConfigurationSwing implements ClientConfigurationView {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private final WindowClosingListener windowClosingListener;
 
     private final ClientConfigurationPanel configurationPanel;
@@ -92,7 +94,7 @@
             }
         });
 
-        dialog = new JDialog((Frame) null, Translate.localize(LocaleResources.CLIENT_PREFS_WINDOW_TITLE));
+        dialog = new JDialog((Frame) null, translator.localize(LocaleResources.CLIENT_PREFS_WINDOW_TITLE));
         dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
         dialog.setContentPane(optionPane);
         dialog.addWindowListener(windowClosingListener);
--- a/client/core/src/main/java/com/redhat/thermostat/client/ui/HostCpuController.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/core/src/main/java/com/redhat/thermostat/client/ui/HostCpuController.java	Tue Oct 16 14:23:29 2012 -0400
@@ -45,7 +45,6 @@
 import com.redhat.thermostat.client.core.views.HostCpuViewProvider;
 import com.redhat.thermostat.client.core.views.BasicView.Action;
 import com.redhat.thermostat.client.locale.LocaleResources;
-import com.redhat.thermostat.client.locale.Translate;
 import com.redhat.thermostat.common.ActionEvent;
 import com.redhat.thermostat.common.ActionListener;
 import com.redhat.thermostat.common.NotImplementedException;
@@ -56,12 +55,15 @@
 import com.redhat.thermostat.common.dao.DAOFactory;
 import com.redhat.thermostat.common.dao.HostInfoDAO;
 import com.redhat.thermostat.common.dao.HostRef;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.model.CpuStat;
 import com.redhat.thermostat.common.model.DiscreteTimeData;
 import com.redhat.thermostat.common.model.HostInfo;
 
 public class HostCpuController {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private final HostCpuView view;
     private final Timer backgroundUpdateTimer;
 
@@ -146,7 +148,7 @@
 
         for (int i = 0; i < results.size(); i++) {
             if (i == chartsAdded) {
-                view.addCpuUsageChart(i, Translate.localize(LocaleResources.HOST_CPU_ID, String.valueOf(i)));
+                view.addCpuUsageChart(i, translator.localize(LocaleResources.HOST_CPU_ID, String.valueOf(i)));
                 chartsAdded++;
             }
             view.addCpuUsageData(i, results.get(i));
--- a/client/core/src/main/java/com/redhat/thermostat/client/ui/HostCpuPanel.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/core/src/main/java/com/redhat/thermostat/client/ui/HostCpuPanel.java	Tue Oct 16 14:23:29 2012 -0400
@@ -36,8 +36,6 @@
 
 package com.redhat.thermostat.client.ui;
 
-import static com.redhat.thermostat.client.locale.Translate.localize;
-
 import java.awt.Color;
 import java.awt.Component;
 import java.awt.FlowLayout;
@@ -67,10 +65,13 @@
 import com.redhat.thermostat.client.internal.ui.swing.WrapLayout;
 import com.redhat.thermostat.client.locale.LocaleResources;
 import com.redhat.thermostat.common.ActionListener;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.model.DiscreteTimeData;
 
 public class HostCpuPanel extends HostCpuView implements SwingComponent {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private JPanel visiblePanel;
 
     private final JTextComponent cpuModel = new ValueField("${CPU_MODEL}");
@@ -199,16 +200,16 @@
 
         visiblePanel = new JPanel();
 
-        JLabel summaryLabel = new SectionHeader(localize(LocaleResources.HOST_CPU_SECTION_OVERVIEW));
+        JLabel summaryLabel = new SectionHeader(translator.localize(LocaleResources.HOST_CPU_SECTION_OVERVIEW));
 
-        JLabel cpuModelLabel = new LabelField(localize(LocaleResources.HOST_INFO_CPU_MODEL));
+        JLabel cpuModelLabel = new LabelField(translator.localize(LocaleResources.HOST_INFO_CPU_MODEL));
 
-        JLabel cpuCountLabel = new LabelField(localize(LocaleResources.HOST_INFO_CPU_COUNT));
+        JLabel cpuCountLabel = new LabelField(translator.localize(LocaleResources.HOST_INFO_CPU_COUNT));
 
         chart = ChartFactory.createTimeSeriesChart(
                 null,
-                localize(LocaleResources.HOST_CPU_USAGE_CHART_TIME_LABEL),
-                localize(LocaleResources.HOST_CPU_USAGE_CHART_VALUE_LABEL),
+                translator.localize(LocaleResources.HOST_CPU_USAGE_CHART_TIME_LABEL),
+                translator.localize(LocaleResources.HOST_CPU_USAGE_CHART_VALUE_LABEL),
                 datasetCollection,
                 false, false, false);
 
--- a/client/core/src/main/java/com/redhat/thermostat/client/ui/HostInformationController.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/core/src/main/java/com/redhat/thermostat/client/ui/HostInformationController.java	Tue Oct 16 14:23:29 2012 -0400
@@ -36,8 +36,6 @@
 
 package com.redhat.thermostat.client.ui;
 
-import static com.redhat.thermostat.client.locale.Translate.localize;
-
 import com.redhat.thermostat.client.core.views.BasicView;
 import com.redhat.thermostat.client.core.views.HostCpuViewProvider;
 import com.redhat.thermostat.client.core.views.HostInformationView;
@@ -50,10 +48,13 @@
 import com.redhat.thermostat.common.dao.HostRef;
 import com.redhat.thermostat.common.dao.MemoryStatDAO;
 import com.redhat.thermostat.common.dao.NetworkInterfaceInfoDAO;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.utils.OSGIUtils;
 
 public class HostInformationController {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private final HostOverviewController overviewController;
     private final HostCpuController cpuController;
     private final HostMemoryController memoryController;
@@ -71,9 +72,9 @@
 
         view = provider.createView();
 
-        view.addChildView(localize(LocaleResources.HOST_INFO_TAB_OVERVIEW), getOverviewController().getView());
-        view.addChildView(localize(LocaleResources.HOST_INFO_TAB_CPU), getCpuController().getView());
-        view.addChildView(localize(LocaleResources.HOST_INFO_TAB_MEMORY), getMemoryController().getView());
+        view.addChildView(translator.localize(LocaleResources.HOST_INFO_TAB_OVERVIEW), getOverviewController().getView());
+        view.addChildView(translator.localize(LocaleResources.HOST_INFO_TAB_CPU), getCpuController().getView());
+        view.addChildView(translator.localize(LocaleResources.HOST_INFO_TAB_MEMORY), getMemoryController().getView());
 
     }
 
--- a/client/core/src/main/java/com/redhat/thermostat/client/ui/HostMemoryController.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/core/src/main/java/com/redhat/thermostat/client/ui/HostMemoryController.java	Tue Oct 16 14:23:29 2012 -0400
@@ -36,8 +36,6 @@
 
 package com.redhat.thermostat.client.ui;
 
-import static com.redhat.thermostat.client.locale.Translate.localize;
-
 import java.util.LinkedList;
 import java.util.List;
 import java.util.concurrent.TimeUnit;
@@ -54,10 +52,10 @@
 import com.redhat.thermostat.common.Timer;
 import com.redhat.thermostat.common.Timer.SchedulingType;
 import com.redhat.thermostat.common.appctx.ApplicationContext;
-import com.redhat.thermostat.common.dao.DAOFactory;
 import com.redhat.thermostat.common.dao.HostInfoDAO;
 import com.redhat.thermostat.common.dao.HostRef;
 import com.redhat.thermostat.common.dao.MemoryStatDAO;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.model.DiscreteTimeData;
 import com.redhat.thermostat.common.model.MemoryStat;
 import com.redhat.thermostat.common.model.MemoryType;
@@ -65,6 +63,8 @@
 
 public class HostMemoryController {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private final HostMemoryView view;
 
     private final HostInfoDAO hostInfoDAO;
@@ -83,12 +83,12 @@
 
         view = provider.createView();
 
-        view.addMemoryChart(MemoryType.MEMORY_TOTAL.name(), localize(LocaleResources.HOST_MEMORY_TOTAL));
-        view.addMemoryChart(MemoryType.MEMORY_FREE.name(), localize(LocaleResources.HOST_MEMORY_FREE));
-        view.addMemoryChart(MemoryType.MEMORY_USED.name(), localize(LocaleResources.HOST_MEMORY_USED));
-        view.addMemoryChart(MemoryType.SWAP_TOTAL.name(), localize(LocaleResources.HOST_SWAP_TOTAL));
-        view.addMemoryChart(MemoryType.SWAP_FREE.name(), localize(LocaleResources.HOST_SWAP_FREE));
-        view.addMemoryChart(MemoryType.BUFFERS.name(), localize(LocaleResources.HOST_BUFFERS));
+        view.addMemoryChart(MemoryType.MEMORY_TOTAL.name(), translator.localize(LocaleResources.HOST_MEMORY_TOTAL));
+        view.addMemoryChart(MemoryType.MEMORY_FREE.name(), translator.localize(LocaleResources.HOST_MEMORY_FREE));
+        view.addMemoryChart(MemoryType.MEMORY_USED.name(), translator.localize(LocaleResources.HOST_MEMORY_USED));
+        view.addMemoryChart(MemoryType.SWAP_TOTAL.name(), translator.localize(LocaleResources.HOST_SWAP_TOTAL));
+        view.addMemoryChart(MemoryType.SWAP_FREE.name(), translator.localize(LocaleResources.HOST_SWAP_FREE));
+        view.addMemoryChart(MemoryType.BUFFERS.name(), translator.localize(LocaleResources.HOST_BUFFERS));
 
         view.addGraphVisibilityListener(listener);
         view.addActionListener(new ActionListener<HostMemoryView.Action>() {
@@ -113,7 +113,7 @@
             public void run() {
                 long memorySize = HostMemoryController.this.hostInfoDAO.getHostInfo(ref).getTotalMemory();
                 String[] memorySizeParts = DisplayableValues.bytes(memorySize);
-                view.setTotalMemory(localize(LocaleResources.NUMBER_AND_UNIT, memorySizeParts[0], memorySizeParts[1]));
+                view.setTotalMemory(translator.localize(LocaleResources.NUMBER_AND_UNIT, memorySizeParts[0], memorySizeParts[1]));
                 doMemoryChartUpdate();
             }
         });
--- a/client/core/src/main/java/com/redhat/thermostat/client/ui/HostMemoryPanel.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/core/src/main/java/com/redhat/thermostat/client/ui/HostMemoryPanel.java	Tue Oct 16 14:23:29 2012 -0400
@@ -36,8 +36,6 @@
 
 package com.redhat.thermostat.client.ui;
 
-import static com.redhat.thermostat.client.locale.Translate.localize;
-
 import java.awt.Color;
 import java.awt.Component;
 import java.awt.FlowLayout;
@@ -69,12 +67,15 @@
 import com.redhat.thermostat.client.internal.ui.swing.WrapLayout;
 import com.redhat.thermostat.client.locale.LocaleResources;
 import com.redhat.thermostat.common.ActionListener;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.model.DiscreteTimeData;
 import com.redhat.thermostat.common.utils.DisplayableValues;
 import com.redhat.thermostat.common.utils.DisplayableValues.Scale;
 
 public class HostMemoryPanel extends HostMemoryView implements SwingComponent {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private JPanel visiblePanel;
 
     private final MemoryCheckboxListener memoryCheckboxListener = new MemoryCheckboxListener();
@@ -250,9 +251,9 @@
         JPanel chartPanel = new RecentTimeSeriesChartPanel(new RecentTimeSeriesChartController(chart));
         chartPanel.setOpaque(false);
 
-        JLabel lblMemory = Components.header(localize(LocaleResources.HOST_MEMORY_SECTION_OVERVIEW));
+        JLabel lblMemory = Components.header(translator.localize(LocaleResources.HOST_MEMORY_SECTION_OVERVIEW));
 
-        JLabel totalMemoryLabel = Components.label(localize(LocaleResources.HOST_INFO_MEMORY_TOTAL));
+        JLabel totalMemoryLabel = Components.label(translator.localize(LocaleResources.HOST_INFO_MEMORY_TOTAL));
 
         memoryCheckBoxPanel.setOpaque(false);
 
@@ -292,9 +293,9 @@
 
     private JFreeChart createMemoryChart() {
         JFreeChart chart = ChartFactory.createTimeSeriesChart(
-                localize(LocaleResources.HOST_MEMORY_CHART_TITLE), // Title
-                localize(LocaleResources.HOST_MEMORY_CHART_TIME_LABEL), // x-axis Label
-                localize(LocaleResources.HOST_MEMORY_CHART_SIZE_LABEL, Scale.MiB.name()), // y-axis Label
+                translator.localize(LocaleResources.HOST_MEMORY_CHART_TITLE), // Title
+                translator.localize(LocaleResources.HOST_MEMORY_CHART_TIME_LABEL), // x-axis Label
+                translator.localize(LocaleResources.HOST_MEMORY_CHART_SIZE_LABEL, Scale.MiB.name()), // y-axis Label
                 memoryCollection, // Dataset
                 false, // Show Legend
                 false, // Use tooltips
--- a/client/core/src/main/java/com/redhat/thermostat/client/ui/HostOverviewController.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/core/src/main/java/com/redhat/thermostat/client/ui/HostOverviewController.java	Tue Oct 16 14:23:29 2012 -0400
@@ -36,8 +36,6 @@
 
 package com.redhat.thermostat.client.ui;
 
-import static com.redhat.thermostat.client.locale.Translate.localize;
-
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Vector;
@@ -58,6 +56,7 @@
 import com.redhat.thermostat.common.dao.HostInfoDAO;
 import com.redhat.thermostat.common.dao.HostRef;
 import com.redhat.thermostat.common.dao.NetworkInterfaceInfoDAO;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.model.HostInfo;
 import com.redhat.thermostat.common.model.NetworkInterfaceInfo;
 import com.redhat.thermostat.common.utils.DisplayableValues;
@@ -65,6 +64,8 @@
 
 public class HostOverviewController {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private static final Logger logger = LoggingUtils.getLogger(HostOverviewController.class);
 
     private final HostRef ref;
@@ -83,9 +84,9 @@
 
         final Vector<String> networkTableColumnVector;
         networkTableColumnVector = new Vector<String>();
-        networkTableColumnVector.add(localize(LocaleResources.NETWORK_INTERFACE_COLUMN));
-        networkTableColumnVector.add(localize(LocaleResources.NETWORK_IPV4_COLUMN));
-        networkTableColumnVector.add(localize(LocaleResources.NETWORK_IPV6_COLUMN));
+        networkTableColumnVector.add(translator.localize(LocaleResources.NETWORK_INTERFACE_COLUMN));
+        networkTableColumnVector.add(translator.localize(LocaleResources.NETWORK_IPV4_COLUMN));
+        networkTableColumnVector.add(translator.localize(LocaleResources.NETWORK_IPV6_COLUMN));
 
         backgroundUpdateTimer = ApplicationContext.getInstance().getTimerFactory().createTimer();
         backgroundUpdateTimer.setAction(new Runnable() {
@@ -99,7 +100,7 @@
                 view.setCpuCount(String.valueOf(hostInfo.getCpuCount()));
 
                 String[] parts = DisplayableValues.bytes(hostInfo.getTotalMemory());
-                String readableTotalMemory = localize(LocaleResources.NUMBER_AND_UNIT, parts[0], parts[1]);
+                String readableTotalMemory = translator.localize(LocaleResources.NUMBER_AND_UNIT, parts[0], parts[1]);
                 view.setTotalMemory(readableTotalMemory);
 
                 List<NetworkInterfaceInfo> networkInfo =
--- a/client/core/src/main/java/com/redhat/thermostat/client/ui/HostOverviewPanel.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/core/src/main/java/com/redhat/thermostat/client/ui/HostOverviewPanel.java	Tue Oct 16 14:23:29 2012 -0400
@@ -36,8 +36,6 @@
 
 package com.redhat.thermostat.client.ui;
 
-import static com.redhat.thermostat.client.locale.Translate.localize;
-
 import java.awt.Component;
 
 import javax.swing.JPanel;
@@ -50,6 +48,8 @@
 import com.redhat.thermostat.client.core.views.HostOverviewView;
 import com.redhat.thermostat.client.locale.LocaleResources;
 import com.redhat.thermostat.common.ActionListener;
+import com.redhat.thermostat.common.locale.Translate;
+
 import javax.swing.GroupLayout;
 import javax.swing.GroupLayout.Alignment;
 import javax.swing.LayoutStyle.ComponentPlacement;
@@ -57,6 +57,8 @@
 
 public class HostOverviewPanel extends HostOverviewView implements SwingComponent {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private JPanel visiblePanel;
 
     private final ValueField hostname = new ValueField("${hostname}");
@@ -202,16 +204,16 @@
 
     private void initializePanel() {
         visiblePanel = new JPanel();
-        SectionHeader overviewSection = new SectionHeader(localize(LocaleResources.HOST_OVERVIEW_SECTION_BASICS));
-        LabelField hostnameLabel = new LabelField(localize(LocaleResources.HOST_INFO_HOSTNAME));
-        SectionHeader hardwareSection = new SectionHeader(localize(LocaleResources.HOST_OVERVIEW_SECTION_HARDWARE));
-        LabelField cpuModelLabel = new LabelField(localize(LocaleResources.HOST_INFO_CPU_MODEL));
-        LabelField cpuCountLabel = new LabelField(localize(LocaleResources.HOST_INFO_CPU_COUNT));
-        LabelField memoryTotalLabel = new LabelField(localize(LocaleResources.HOST_INFO_MEMORY_TOTAL));
-        LabelField networkLabel = new LabelField(localize(LocaleResources.HOST_INFO_NETWORK));
-        SectionHeader softwareSection = new SectionHeader(localize(LocaleResources.HOST_OVERVIEW_SECTION_SOFTWARE));
-        LabelField osNameLabel = new LabelField(localize(LocaleResources.HOST_INFO_OS_NAME));
-        LabelField osKernelLabel = new LabelField(localize(LocaleResources.HOST_INFO_OS_KERNEL));
+        SectionHeader overviewSection = new SectionHeader(translator.localize(LocaleResources.HOST_OVERVIEW_SECTION_BASICS));
+        LabelField hostnameLabel = new LabelField(translator.localize(LocaleResources.HOST_INFO_HOSTNAME));
+        SectionHeader hardwareSection = new SectionHeader(translator.localize(LocaleResources.HOST_OVERVIEW_SECTION_HARDWARE));
+        LabelField cpuModelLabel = new LabelField(translator.localize(LocaleResources.HOST_INFO_CPU_MODEL));
+        LabelField cpuCountLabel = new LabelField(translator.localize(LocaleResources.HOST_INFO_CPU_COUNT));
+        LabelField memoryTotalLabel = new LabelField(translator.localize(LocaleResources.HOST_INFO_MEMORY_TOTAL));
+        LabelField networkLabel = new LabelField(translator.localize(LocaleResources.HOST_INFO_NETWORK));
+        SectionHeader softwareSection = new SectionHeader(translator.localize(LocaleResources.HOST_OVERVIEW_SECTION_SOFTWARE));
+        LabelField osNameLabel = new LabelField(translator.localize(LocaleResources.HOST_INFO_OS_NAME));
+        LabelField osKernelLabel = new LabelField(translator.localize(LocaleResources.HOST_INFO_OS_KERNEL));
 
         JPanel panel = new JPanel();
 
--- a/client/core/src/main/java/com/redhat/thermostat/client/ui/HostPanel.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/core/src/main/java/com/redhat/thermostat/client/ui/HostPanel.java	Tue Oct 16 14:23:29 2012 -0400
@@ -36,8 +36,6 @@
 
 package com.redhat.thermostat.client.ui;
 
-import static com.redhat.thermostat.client.locale.Translate.localize;
-
 import java.awt.BorderLayout;
 
 import javax.swing.JPanel;
@@ -45,9 +43,12 @@
 
 import com.redhat.thermostat.client.internal.HostPanelFacade;
 import com.redhat.thermostat.client.locale.LocaleResources;
+import com.redhat.thermostat.common.locale.Translate;
 
 public class HostPanel extends JPanel {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     /*
      * This entire class needs to be more dynamic. We should try to avoid
      * creating objects and should just update them when necessary
@@ -69,9 +70,9 @@
         JTabbedPane tabPane = new JTabbedPane();
 
         // FIXME: Fix how we get old of the view impl specific UI component.
-        tabPane.insertTab(localize(LocaleResources.HOST_INFO_TAB_OVERVIEW), null, ((HostOverviewPanel)facade.getOverviewController().getView()).getUiComponent(), null, 0);
-        tabPane.insertTab(localize(LocaleResources.HOST_INFO_TAB_CPU), null, ((HostCpuPanel)facade.getCpuController().getView()).getUiComponent(), null, 1);
-        tabPane.insertTab(localize(LocaleResources.HOST_INFO_TAB_MEMORY), null, ((HostMemoryPanel)facade.getMemoryController().getView()).getUiComponent(), null, 2);
+        tabPane.insertTab(translator.localize(LocaleResources.HOST_INFO_TAB_OVERVIEW), null, ((HostOverviewPanel)facade.getOverviewController().getView()).getUiComponent(), null, 0);
+        tabPane.insertTab(translator.localize(LocaleResources.HOST_INFO_TAB_CPU), null, ((HostCpuPanel)facade.getCpuController().getView()).getUiComponent(), null, 1);
+        tabPane.insertTab(translator.localize(LocaleResources.HOST_INFO_TAB_MEMORY), null, ((HostMemoryPanel)facade.getMemoryController().getView()).getUiComponent(), null, 2);
 
         // TODO additional tabs provided by plugins
         // tabPane.insertTab(title, icon, component, tip, 3)
--- a/client/core/src/main/java/com/redhat/thermostat/client/ui/MainWindow.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/core/src/main/java/com/redhat/thermostat/client/ui/MainWindow.java	Tue Oct 16 14:23:29 2012 -0400
@@ -36,8 +36,6 @@
 
 package com.redhat.thermostat.client.ui;
 
-import static com.redhat.thermostat.client.locale.Translate.localize;
-
 import java.awt.BorderLayout;
 import java.awt.Color;
 import java.awt.Component;
@@ -110,12 +108,15 @@
 import com.redhat.thermostat.common.dao.HostRef;
 import com.redhat.thermostat.common.dao.Ref;
 import com.redhat.thermostat.common.dao.VmRef;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.utils.StringUtils;
 import com.redhat.thermostat.swing.EdtHelper;
 import com.redhat.thermostat.swing.StatusBar;
 
 public class MainWindow extends JFrame implements MainView {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     /**
      * Updates a TreeModel in the background in an Swing EDT-safe manner.
      */
@@ -324,7 +325,7 @@
     private StatusBar statusBar;
     
     private final DefaultMutableTreeNode publishedRoot =
-            new DefaultMutableTreeNode(localize(LocaleResources.MAIN_WINDOW_TREE_ROOT_NAME));
+            new DefaultMutableTreeNode(translator.localize(LocaleResources.MAIN_WINDOW_TREE_ROOT_NAME));
     private final DefaultTreeModel publishedTreeModel = new DefaultTreeModel(publishedRoot);
 
     @SuppressWarnings("restriction")
@@ -400,19 +401,19 @@
 
     private void setupMenus() {
 
-        JMenu fileMenu = new JMenu(localize(LocaleResources.MENU_FILE));
+        JMenu fileMenu = new JMenu(translator.localize(LocaleResources.MENU_FILE));
         fileMenu.getPopupMenu().setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 1));
         mainMenuBar.add(fileMenu);
 
-        JMenuItem fileExitMenu = new JMenuItem(localize(LocaleResources.MENU_FILE_EXIT));
+        JMenuItem fileExitMenu = new JMenuItem(translator.localize(LocaleResources.MENU_FILE_EXIT));
         fileExitMenu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, InputEvent.CTRL_DOWN_MASK));
         fileExitMenu.addActionListener(shutdownAction);
         fileMenu.add(fileExitMenu);
 
-        JMenu editMenu = new JMenu(localize(LocaleResources.MENU_EDIT));
+        JMenu editMenu = new JMenu(translator.localize(LocaleResources.MENU_EDIT));
         mainMenuBar.add(editMenu);
 
-        JMenuItem configureClientMenuItem = new JMenuItem(localize(LocaleResources.MENU_EDIT_CONFIGURE_CLIENT));
+        JMenuItem configureClientMenuItem = new JMenuItem(translator.localize(LocaleResources.MENU_EDIT_CONFIGURE_CLIENT));
         configureClientMenuItem.setName("showClientConfig");
         configureClientMenuItem.addActionListener(new java.awt.event.ActionListener() {
             @Override
@@ -423,7 +424,7 @@
         editMenu.add(configureClientMenuItem);
 
         editMenu.addSeparator();
-        JMenuItem historyModeMenuItem = new JCheckBoxMenuItem(localize(LocaleResources.MENU_EDIT_ENABLE_HISTORY_MODE));
+        JMenuItem historyModeMenuItem = new JCheckBoxMenuItem(translator.localize(LocaleResources.MENU_EDIT_ENABLE_HISTORY_MODE));
         historyModeMenuItem.setName("historyModeSwitch");
         historyModeMenuItem.setSelected(false);
         historyModeMenuItem.addActionListener(new java.awt.event.ActionListener() {
@@ -434,9 +435,9 @@
         });
         editMenu.add(historyModeMenuItem);
 
-        JMenu viewMenu = new JMenu(localize(LocaleResources.MENU_VIEW));
+        JMenu viewMenu = new JMenu(translator.localize(LocaleResources.MENU_VIEW));
         mainMenuBar.add(viewMenu);
-        JMenuItem configureAgentMenuItem = new JMenuItem(localize(LocaleResources.MENU_VIEW_AGENTS));
+        JMenuItem configureAgentMenuItem = new JMenuItem(translator.localize(LocaleResources.MENU_VIEW_AGENTS));
         configureAgentMenuItem.setName("showAgentConfig");
         configureAgentMenuItem.addActionListener(new java.awt.event.ActionListener() {
             @Override
@@ -446,11 +447,11 @@
         });
         viewMenu.add(configureAgentMenuItem);
 
-        JMenu helpMenu = new JMenu(localize(LocaleResources.MENU_HELP));
+        JMenu helpMenu = new JMenu(translator.localize(LocaleResources.MENU_HELP));
         helpMenu.getPopupMenu().setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 1));
         mainMenuBar.add(helpMenu);
 
-        JMenuItem helpAboutMenu = new JMenuItem(localize(LocaleResources.MENU_HELP_ABOUT));
+        JMenuItem helpAboutMenu = new JMenuItem(translator.localize(LocaleResources.MENU_HELP_ABOUT));
         helpAboutMenu.addActionListener(new java.awt.event.ActionListener() {
             @Override
             public void actionPerformed(java.awt.event.ActionEvent e) {
@@ -648,18 +649,18 @@
                 String hostNameHtml = new HtmlTextBuilder().bold(hostRef.getHostName()).toPartialHtml();
                 String agentIdHtml = new HtmlTextBuilder().bold(hostRef.getAgentId()).toPartialHtml();
                 HtmlTextBuilder builder = new HtmlTextBuilder()
-                    .appendRaw(localize(LocaleResources.TREE_HOST_TOOLTIP_HOST_NAME, hostNameHtml))
+                    .appendRaw(translator.localize(LocaleResources.TREE_HOST_TOOLTIP_HOST_NAME, hostNameHtml))
                     .newLine()
-                    .appendRaw(localize(LocaleResources.TREE_HOST_TOOLTIP_AGENT_ID, agentIdHtml));
+                    .appendRaw(translator.localize(LocaleResources.TREE_HOST_TOOLTIP_AGENT_ID, agentIdHtml));
                 return builder.toHtml();
             } else if (value instanceof VmRef) {
                 VmRef vmRef = (VmRef) value;
                 String vmNameHtml= new HtmlTextBuilder().bold(vmRef.getName()).toPartialHtml();
                 String vmIdHtml = new HtmlTextBuilder().bold(vmRef.getIdString()).toPartialHtml();
                 HtmlTextBuilder builder = new HtmlTextBuilder()
-                    .appendRaw(localize(LocaleResources.TREE_HOST_TOOLTIP_VM_NAME, vmNameHtml))
+                    .appendRaw(translator.localize(LocaleResources.TREE_HOST_TOOLTIP_VM_NAME, vmNameHtml))
                     .newLine()
-                    .appendRaw(localize(LocaleResources.TREE_HOST_TOOLTIP_VM_ID, vmIdHtml));
+                    .appendRaw(translator.localize(LocaleResources.TREE_HOST_TOOLTIP_VM_ID, vmIdHtml));
                 return builder.toHtml();
             } else {
                 return null;
--- a/client/core/src/main/java/com/redhat/thermostat/client/ui/RecentTimeSeriesChartPanel.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/core/src/main/java/com/redhat/thermostat/client/ui/RecentTimeSeriesChartPanel.java	Tue Oct 16 14:23:29 2012 -0400
@@ -59,10 +59,12 @@
 import org.jfree.chart.ChartPanel;
 
 import com.redhat.thermostat.client.locale.LocaleResources;
-import com.redhat.thermostat.client.locale.Translate;
+import com.redhat.thermostat.common.locale.Translate;
 
 public class RecentTimeSeriesChartPanel extends JPanel {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private static final long serialVersionUID = -1733906800911900456L;
     private static final int MINIMUM_DRAW_SIZE = 100;
 
@@ -130,7 +132,7 @@
         durationSelector.setText(String.valueOf(defaultValue));
         unitSelector.setSelectedItem(defaultUnit);
 
-        container.add(new JLabel(Translate.localize(LocaleResources.CHART_DURATION_SELECTOR_LABEL)));
+        container.add(new JLabel(translator.localize(LocaleResources.CHART_DURATION_SELECTOR_LABEL)));
         container.add(durationSelector);
         container.add(unitSelector);
 
--- a/client/core/src/main/java/com/redhat/thermostat/client/ui/SearchFieldSwingView.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/core/src/main/java/com/redhat/thermostat/client/ui/SearchFieldSwingView.java	Tue Oct 16 14:23:29 2012 -0400
@@ -58,18 +58,20 @@
 import javax.swing.text.Document;
 
 import com.redhat.thermostat.client.locale.LocaleResources;
-import com.redhat.thermostat.client.locale.Translate;
 import com.redhat.thermostat.common.ActionListener;
 import com.redhat.thermostat.common.ActionNotifier;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.swing.EdtHelper;
 
 public class SearchFieldSwingView extends JPanel implements SearchFieldView {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private final ActionNotifier<SearchAction> notifier = new ActionNotifier<>(this);
     private final JTextField searchField = new JTextField();
 
     private final AtomicReference<String> searchText = new AtomicReference<String>("");
-    private final AtomicReference<String> label = new AtomicReference<>(Translate.localize(LocaleResources.SEARCH_HINT));
+    private final AtomicReference<String> label = new AtomicReference<>(translator.localize(LocaleResources.SEARCH_HINT));
     private final AtomicBoolean labelDisplayed = new AtomicBoolean(true);
 
     public SearchFieldSwingView() {
--- a/client/core/src/main/java/com/redhat/thermostat/client/ui/SummaryPanel.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/core/src/main/java/com/redhat/thermostat/client/ui/SummaryPanel.java	Tue Oct 16 14:23:29 2012 -0400
@@ -36,8 +36,6 @@
 
 package com.redhat.thermostat.client.ui;
 
-import static com.redhat.thermostat.client.locale.Translate.localize;
-
 import java.awt.Component;
 import java.util.ArrayList;
 import java.util.List;
@@ -57,9 +55,12 @@
 import com.redhat.thermostat.client.core.views.SummaryView;
 import com.redhat.thermostat.client.locale.LocaleResources;
 import com.redhat.thermostat.common.ActionListener;
+import com.redhat.thermostat.common.locale.Translate;
 
 public class SummaryPanel extends SummaryView implements SwingComponent {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private JPanel visiblePanel;
     
     private final JTextComponent totalMonitoredHosts;
@@ -70,17 +71,17 @@
     public SummaryPanel() {
         super();
         visiblePanel = new JPanel();
-        JLabel lblHomepanel = Components.header(localize(LocaleResources.HOME_PANEL_SECTION_SUMMARY));
+        JLabel lblHomepanel = Components.header(translator.localize(LocaleResources.HOME_PANEL_SECTION_SUMMARY));
 
-        JLabel lblTotalHosts = new JLabel(localize(LocaleResources.HOME_PANEL_TOTAL_MACHINES));
+        JLabel lblTotalHosts = new JLabel(translator.localize(LocaleResources.HOME_PANEL_TOTAL_MACHINES));
 
         totalMonitoredHosts = new ValueField("${TOTAL_MONITORED_HOSTS}");
 
-        JLabel lblTotal = new JLabel(localize(LocaleResources.HOME_PANEL_TOTAL_JVMS));
+        JLabel lblTotal = new JLabel(translator.localize(LocaleResources.HOME_PANEL_TOTAL_JVMS));
 
         totalMonitoredVms = new ValueField("${TOTAL_MONITORED_VMS}");
 
-        JLabel lblIssues = Components.header(localize(LocaleResources.HOME_PANEL_SECTION_ISSUES));
+        JLabel lblIssues = Components.header(translator.localize(LocaleResources.HOME_PANEL_SECTION_ISSUES));
 
         JScrollPane scrollPane = new JScrollPane();
 
@@ -189,7 +190,7 @@
 
         private List<? extends Object> delegate;
 
-        private String emptyElement = localize(LocaleResources.HOME_PANEL_NO_ISSUES);
+        private String emptyElement = translator.localize(LocaleResources.HOME_PANEL_NO_ISSUES);
 
         public IssuesListModel(List<? extends Object> actualList) {
             this.delegate = actualList;
--- a/client/core/src/main/java/com/redhat/thermostat/client/ui/VmCpuPanel.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/core/src/main/java/com/redhat/thermostat/client/ui/VmCpuPanel.java	Tue Oct 16 14:23:29 2012 -0400
@@ -36,8 +36,6 @@
 
 package com.redhat.thermostat.client.ui;
 
-import static com.redhat.thermostat.client.locale.Translate.localize;
-
 import java.awt.Component;
 import java.util.ArrayList;
 import java.util.List;
@@ -56,11 +54,14 @@
 import com.redhat.thermostat.client.core.views.VmCpuView;
 import com.redhat.thermostat.client.locale.LocaleResources;
 import com.redhat.thermostat.common.ActionListener;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.model.DiscreteTimeData;
 import com.redhat.thermostat.swing.HeaderPanel;
 
 public class VmCpuPanel extends VmCpuView implements SwingComponent {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private HeaderPanel visiblePanel;
     
     private final TimeSeriesCollection data = new TimeSeriesCollection();
@@ -102,12 +103,12 @@
 
     private void initializePanel() {
         visiblePanel = new HeaderPanel();
-        visiblePanel.setHeader(localize(LocaleResources.VM_CPU_TITLE));
+        visiblePanel.setHeader(translator.localize(LocaleResources.VM_CPU_TITLE));
 
         JFreeChart chart = ChartFactory.createTimeSeriesChart(
                 null,
-                localize(LocaleResources.VM_CPU_CHART_TIME_LABEL),
-                localize(LocaleResources.VM_CPU_CHART_LOAD_LABEL),
+                translator.localize(LocaleResources.VM_CPU_CHART_TIME_LABEL),
+                translator.localize(LocaleResources.VM_CPU_CHART_LOAD_LABEL),
                 data,
                 false, false, false);
 
--- a/client/core/src/main/java/com/redhat/thermostat/client/ui/VmGcController.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/core/src/main/java/com/redhat/thermostat/client/ui/VmGcController.java	Tue Oct 16 14:23:29 2012 -0400
@@ -36,8 +36,6 @@
 
 package com.redhat.thermostat.client.ui;
 
-import static com.redhat.thermostat.client.locale.Translate.localize;
-
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -62,6 +60,7 @@
 import com.redhat.thermostat.common.dao.VmGcStatDAO;
 import com.redhat.thermostat.common.dao.VmMemoryStatDAO;
 import com.redhat.thermostat.common.dao.VmRef;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.model.IntervalTimeData;
 import com.redhat.thermostat.common.model.TimeStampedPojoComparator;
 import com.redhat.thermostat.common.model.VmGcStat;
@@ -70,6 +69,8 @@
 
 class VmGcController {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private final VmRef ref;
     private final VmGcView view;
 
@@ -135,7 +136,7 @@
 
     // FIXME
     private String chartName(String collectorName, String generationName) {
-        return localize(LocaleResources.VM_GC_COLLECTOR_OVER_GENERATION,
+        return translator.localize(LocaleResources.VM_GC_COLLECTOR_OVER_GENERATION,
                 collectorName, generationName);
     }
 
@@ -186,7 +187,7 @@
                 return g.name;
             }
         }
-        return localize(LocaleResources.UNKNOWN_GEN);
+        return translator.localize(LocaleResources.UNKNOWN_GEN);
     }
 
     public UIComponent getView() {
--- a/client/core/src/main/java/com/redhat/thermostat/client/ui/VmGcPanel.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/core/src/main/java/com/redhat/thermostat/client/ui/VmGcPanel.java	Tue Oct 16 14:23:29 2012 -0400
@@ -36,8 +36,6 @@
 
 package com.redhat.thermostat.client.ui;
 
-import static com.redhat.thermostat.client.locale.Translate.localize;
-
 import java.awt.BorderLayout;
 import java.awt.Component;
 import java.awt.GridBagConstraints;
@@ -67,11 +65,14 @@
 import com.redhat.thermostat.client.core.views.VmGcView;
 import com.redhat.thermostat.client.locale.LocaleResources;
 import com.redhat.thermostat.common.ActionListener;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.model.IntervalTimeData;
 import com.redhat.thermostat.swing.HeaderPanel;
 
 public class VmGcPanel extends VmGcView implements SwingComponent {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private HeaderPanel visiblePanel = new HeaderPanel();
     private JPanel realPanel = new JPanel();
 
@@ -121,7 +122,7 @@
 
     private void initializePanel() {
         visiblePanel.setContent(realPanel);
-        visiblePanel.setHeader(localize(LocaleResources.VM_GC_TITLE));
+        visiblePanel.setHeader(translator.localize(LocaleResources.VM_GC_TITLE));
         realPanel.setLayout(new GridBagLayout());
     }
 
@@ -134,8 +135,8 @@
 
         JFreeChart chart = ChartFactory.createHistogram(
             null,
-            localize(LocaleResources.VM_GC_COLLECTOR_CHART_REAL_TIME_LABEL),
-            localize(LocaleResources.VM_GC_COLLECTOR_CHART_GC_TIME_LABEL, units),
+            translator.localize(LocaleResources.VM_GC_COLLECTOR_CHART_REAL_TIME_LABEL),
+            translator.localize(LocaleResources.VM_GC_COLLECTOR_CHART_GC_TIME_LABEL, units),
             collectorData,
             PlotOrientation.VERTICAL,
             false,
--- a/client/core/src/main/java/com/redhat/thermostat/client/ui/VmInformationController.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/core/src/main/java/com/redhat/thermostat/client/ui/VmInformationController.java	Tue Oct 16 14:23:29 2012 -0400
@@ -36,8 +36,6 @@
 
 package com.redhat.thermostat.client.ui;
 
-import static com.redhat.thermostat.client.locale.Translate.localize;
-
 import java.util.Collection;
 
 import com.redhat.thermostat.client.core.VmInformationService;
@@ -54,10 +52,13 @@
 import com.redhat.thermostat.common.dao.VmInfoDAO;
 import com.redhat.thermostat.common.dao.VmMemoryStatDAO;
 import com.redhat.thermostat.common.dao.VmRef;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.utils.OSGIUtils;
 
 public class VmInformationController {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private final VmInformationView view;
 
     private final VmOverviewController overviewController;
@@ -77,9 +78,9 @@
         gcController = new VmGcController(vmMemoryStatDao, vmGcStatDao, vmRef, vmGCProvider);
 
         view = provider.createView();
-        view.addChildView(localize(LocaleResources.VM_INFO_TAB_OVERVIEW), overviewController.getView());
-        view.addChildView(localize(LocaleResources.VM_INFO_TAB_CPU), cpuController.getView());
-        view.addChildView(localize(LocaleResources.VM_INFO_TAB_GC), gcController.getView());
+        view.addChildView(translator.localize(LocaleResources.VM_INFO_TAB_OVERVIEW), overviewController.getView());
+        view.addChildView(translator.localize(LocaleResources.VM_INFO_TAB_CPU), cpuController.getView());
+        view.addChildView(translator.localize(LocaleResources.VM_INFO_TAB_GC), gcController.getView());
 
         Collection<VmInformationService> vmInfoServices = uiFacadeFactory.getVmInformationServices();
         for (VmInformationService vmInfoService : vmInfoServices) {
--- a/client/core/src/main/java/com/redhat/thermostat/client/ui/VmOverviewController.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/core/src/main/java/com/redhat/thermostat/client/ui/VmOverviewController.java	Tue Oct 16 14:23:29 2012 -0400
@@ -36,8 +36,6 @@
 
 package com.redhat.thermostat.client.ui;
 
-import static com.redhat.thermostat.client.locale.Translate.localize;
-
 import java.text.DateFormat;
 import java.util.Date;
 import java.util.concurrent.TimeUnit;
@@ -56,10 +54,13 @@
 import com.redhat.thermostat.common.appctx.ApplicationContext;
 import com.redhat.thermostat.common.dao.VmInfoDAO;
 import com.redhat.thermostat.common.dao.VmRef;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.model.VmInfo;
 
 class VmOverviewController {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private final VmRef ref;
     private final VmInfoDAO dao;
     private final DateFormat vmRunningTimeFormat;
@@ -106,7 +107,7 @@
                     // Only show a stop time if we have actually stopped.
                     view.setVmStopTimeStamp(vmRunningTimeFormat.format(new Date(actualStopTime)));
                 } else {
-                    view.setVmStopTimeStamp(localize(LocaleResources.VM_INFO_RUNNING));
+                    view.setVmStopTimeStamp(translator.localize(LocaleResources.VM_INFO_RUNNING));
                 }
                 view.setJavaVersion(info.getJavaVersion());
                 view.setJavaHome(info.getJavaHome());
@@ -115,7 +116,7 @@
                 String actualVmName = info.getVmName();
                 view.setVmInfo(info.getVmInfo());
                 String actualVmVersion = info.getVmInfo();
-                view.setVmNameAndVersion(localize(LocaleResources.VM_INFO_VM_NAME_AND_VERSION,
+                view.setVmNameAndVersion(translator.localize(LocaleResources.VM_INFO_VM_NAME_AND_VERSION,
                         actualVmName, actualVmVersion));
                 view.setVmArguments(info.getVmArguments());
             }
--- a/client/core/src/main/java/com/redhat/thermostat/client/ui/VmOverviewPanel.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/core/src/main/java/com/redhat/thermostat/client/ui/VmOverviewPanel.java	Tue Oct 16 14:23:29 2012 -0400
@@ -36,8 +36,6 @@
 
 package com.redhat.thermostat.client.ui;
 
-import static com.redhat.thermostat.client.locale.Translate.localize;
-
 import java.awt.Component;
 import java.util.ArrayList;
 import java.util.List;
@@ -50,9 +48,12 @@
 import com.redhat.thermostat.client.ui.SimpleTable.Section;
 import com.redhat.thermostat.client.ui.SimpleTable.TableEntry;
 import com.redhat.thermostat.common.ActionListener;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.swing.HeaderPanel;
 
 public class VmOverviewPanel extends VmOverviewView implements SwingComponent {
+
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
     
     private HeaderPanel visiblePanel;
 
@@ -151,33 +152,33 @@
     private void initializePanel() {
         visiblePanel = new HeaderPanel();
 
-        visiblePanel.setHeader(localize(LocaleResources.VM_INFO_TITLE));
+        visiblePanel.setHeader(translator.localize(LocaleResources.VM_INFO_TITLE));
 
         TableEntry entry;
         List<Section> allSections = new ArrayList<Section>();
 
-        Section processSection = new Section(localize(LocaleResources.VM_INFO_SECTION_PROCESS));
+        Section processSection = new Section(translator.localize(LocaleResources.VM_INFO_SECTION_PROCESS));
         allSections.add(processSection);
 
-        entry = new TableEntry(localize(LocaleResources.VM_INFO_PROCESS_ID), pid);
+        entry = new TableEntry(translator.localize(LocaleResources.VM_INFO_PROCESS_ID), pid);
         processSection.add(entry);
-        entry = new TableEntry(localize(LocaleResources.VM_INFO_START_TIME), startTimeStamp);
+        entry = new TableEntry(translator.localize(LocaleResources.VM_INFO_START_TIME), startTimeStamp);
         processSection.add(entry);
-        entry = new TableEntry(localize(LocaleResources.VM_INFO_STOP_TIME), stopTimeStamp);
+        entry = new TableEntry(translator.localize(LocaleResources.VM_INFO_STOP_TIME), stopTimeStamp);
         processSection.add(entry);
 
-        Section javaSection = new Section(localize(LocaleResources.VM_INFO_SECTION_JAVA));
+        Section javaSection = new Section(translator.localize(LocaleResources.VM_INFO_SECTION_JAVA));
         allSections.add(javaSection);
 
-        entry = new TableEntry(localize(LocaleResources.VM_INFO_MAIN_CLASS), mainClass);
+        entry = new TableEntry(translator.localize(LocaleResources.VM_INFO_MAIN_CLASS), mainClass);
         javaSection.add(entry);
-        entry = new TableEntry(localize(LocaleResources.VM_INFO_COMMAND_LINE), javaCommandLine);
+        entry = new TableEntry(translator.localize(LocaleResources.VM_INFO_COMMAND_LINE), javaCommandLine);
         javaSection.add(entry);
-        entry = new TableEntry(localize(LocaleResources.VM_INFO_JAVA_VERSION), javaVersion);
+        entry = new TableEntry(translator.localize(LocaleResources.VM_INFO_JAVA_VERSION), javaVersion);
         javaSection.add(entry);
-        entry = new TableEntry(localize(LocaleResources.VM_INFO_VM), vmNameAndVersion);
+        entry = new TableEntry(translator.localize(LocaleResources.VM_INFO_VM), vmNameAndVersion);
         javaSection.add(entry);
-        entry = new TableEntry(localize(LocaleResources.VM_INFO_VM_ARGUMENTS), vmArguments);
+        entry = new TableEntry(translator.localize(LocaleResources.VM_INFO_VM_ARGUMENTS), vmArguments);
         javaSection.add(entry);
 
         SimpleTable simpleTable = new SimpleTable();
--- a/client/core/src/main/resources/com/redhat/thermostat/client/locale/strings.properties	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/core/src/main/resources/com/redhat/thermostat/client/locale/strings.properties	Tue Oct 16 14:23:29 2012 -0400
@@ -67,8 +67,8 @@
 HOME_PANEL_NO_ISSUES = No Issues
 
 HOST_INFO_TAB_OVERVIEW = Overview
+HOST_INFO_TAB_CPU = Processor
 HOST_INFO_TAB_MEMORY = Memory
-HOST_INFO_TAB_CPU = Processor
 HOST_INFO_TAB_IO = IO
 
 HOST_OVERVIEW_SECTION_BASICS = Basics
@@ -130,11 +130,6 @@
 VM_CPU_CHART_LOAD_LABEL = % CPU
 VM_CPU_CHART_TIME_LABEL = Time
 
-VM_MEMORY_SPACE_TITLE = Memory Region Sizes
-VM_MEMORY_SPACE_USED = {0} {1} used
-VM_MEMORY_SPACE_FREE = {0} {1} unused
-VM_MEMORY_SPACE_ADDITIONAL = An additional {0} {1} can be allocated
-
 VM_GC_TITLE = Garbage Collection in the VM
 VM_GC_COLLECTOR_OVER_GENERATION = Collector {0} running on {1}
 VM_GC_COLLECTOR_CHART_REAL_TIME_LABEL = Time
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/core/src/test/java/com/redhat/thermostat/client/locale/LocaleResourcesTest.java	Tue Oct 16 14:23:29 2012 -0400
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2012 Red Hat, Inc.
+ *
+ * This file is part of Thermostat.
+ *
+ * Thermostat is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2, or (at your
+ * option) any later version.
+ *
+ * Thermostat is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Thermostat; see the file COPYING.  If not see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Linking this code with other modules is making a combined work
+ * based on this code.  Thus, the terms and conditions of the GNU
+ * General Public License cover the whole combination.
+ *
+ * As a special exception, the copyright holders of this code give
+ * you permission to link this code with independent modules to
+ * produce an executable, regardless of the license terms of these
+ * independent modules, and to copy and distribute the resulting
+ * executable under terms of your choice, provided that you also
+ * meet, for each linked independent module, the terms and conditions
+ * of the license of that module.  An independent module is a module
+ * which is not derived from or based on this code.  If you modify
+ * this code, you may extend this exception to your version of the
+ * library, but you are not obligated to do so.  If you do not wish
+ * to do so, delete this exception statement from your version.
+ */
+
+package com.redhat.thermostat.client.locale;
+
+import java.io.IOException;
+import java.util.Properties;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class LocaleResourcesTest {
+
+    @Test
+    public void testLocalizedStringsArePresent() throws IOException {
+        
+        String stringsResource = "/" + LocaleResources.RESOURCE_BUNDLE.replace(".", "/") + ".properties";
+        
+        Properties props = new Properties();
+        props.load(getClass().getResourceAsStream(stringsResource));
+        
+        Assert.assertEquals(LocaleResources.values().length, props.values().size());
+        for (LocaleResources resource : LocaleResources.values()) {
+            Assert.assertTrue("missing property from resource bound file: " + resource,
+                              props.containsKey(resource.name()));
+        }
+    }
+}
--- a/client/core/src/test/java/com/redhat/thermostat/client/locale/TranslateTest.java	Wed Oct 10 18:52:45 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-/*
- * Copyright 2012 Red Hat, Inc.
- *
- * This file is part of Thermostat.
- *
- * Thermostat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Thermostat is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Thermostat; see the file COPYING.  If not see
- * <http://www.gnu.org/licenses/>.
- *
- * Linking this code with other modules is making a combined work
- * based on this code.  Thus, the terms and conditions of the GNU
- * General Public License cover the whole combination.
- *
- * As a special exception, the copyright holders of this code give
- * you permission to link this code with independent modules to
- * produce an executable, regardless of the license terms of these
- * independent modules, and to copy and distribute the resulting
- * executable under terms of your choice, provided that you also
- * meet, for each linked independent module, the terms and conditions
- * of the license of that module.  An independent module is a module
- * which is not derived from or based on this code.  If you modify
- * this code, you may extend this exception to your version of the
- * library, but you are not obligated to do so.  If you do not wish
- * to do so, delete this exception statement from your version.
- */
-
-package com.redhat.thermostat.client.locale;
-
-import java.io.IOException;
-import java.util.Locale;
-import java.util.Properties;
-
-import junit.framework.Assert;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import static com.redhat.thermostat.client.locale.Translate.localize;
-
-public class TranslateTest {
-
-    private Locale lang;
-    
-    @Before
-    public void setUp() {
-        this.lang = Locale.getDefault();
-        Locale.setDefault(Locale.US);
-    }
-    
-    @After
-    public void tearDown() {
-        Locale.setDefault(lang);
-    }
-    
-    @Test
-    public void testLocalizeWithoutArguments() {
-        String testString = localize(LocaleResources.MISSING_INFO);
-        Assert.assertEquals("Missing Information", testString);
-    }
-    
-    @Test
-    public void testLocalizedStringsArePresent() throws IOException {
-        
-        String stringsResource = "/" + LocaleResources.RESOURCE_BUNDLE.replace(".", "/") + ".properties";
-        
-        Properties props = new Properties();
-        props.load(getClass().getResourceAsStream(stringsResource));
-        
-        Assert.assertEquals(LocaleResources.values().length, props.values().size());
-        for (LocaleResources resource : LocaleResources.values()) {
-            Assert.assertTrue("missing property from resource bound file: " + resource,
-                              props.containsKey(resource.name()));
-        }
-    }
-}
--- a/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/HeapDumpController.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/HeapDumpController.java	Tue Oct 16 14:23:29 2012 -0400
@@ -61,6 +61,7 @@
 import com.redhat.thermostat.common.dao.VmMemoryStatDAO;
 import com.redhat.thermostat.common.dao.VmRef;
 import com.redhat.thermostat.common.heap.HeapDump;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.model.HeapInfo;
 import com.redhat.thermostat.common.model.VmMemoryStat;
 import com.redhat.thermostat.common.model.VmMemoryStat.Generation;
@@ -69,6 +70,8 @@
 
 public class HeapDumpController implements VmInformationServiceController {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private final VmMemoryStatDAO vmDao;
     private final VmRef ref;
     
@@ -100,11 +103,11 @@
         this.heapDAO = heapDao;
         
         model = new OverviewChart(
-                    Translate.localize(LocaleResources.HEAP_CHART_TITLE),
-                    Translate.localize(LocaleResources.HEAP_CHART_TIME_AXIS),
-                    Translate.localize(LocaleResources.HEAP_CHART_HEAP_AXIS),
-                    Translate.localize(LocaleResources.HEAP_CHART_CAPACITY),
-                    Translate.localize(LocaleResources.HEAP_CHART_USED));
+                    translator.localize(LocaleResources.HEAP_CHART_TITLE),
+                    translator.localize(LocaleResources.HEAP_CHART_TIME_AXIS),
+                    translator.localize(LocaleResources.HEAP_CHART_HEAP_AXIS),
+                    translator.localize(LocaleResources.HEAP_CHART_CAPACITY),
+                    translator.localize(LocaleResources.HEAP_CHART_USED));
         
         timer = ApplicationContext.getInstance().getTimerFactory().createTimer();
         timer.setAction(new HeapOverviewDataCollector());
@@ -199,7 +202,7 @@
 
     @Override
     public String getLocalizedName() {
-        return Translate.localize(LocaleResources.HEAP_SECTION_TITLE);
+        return translator.localize(LocaleResources.HEAP_SECTION_TITLE);
     }
 
     class HeapOverviewDataCollector implements Runnable {
--- a/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/HeapDumpDetailsController.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/HeapDumpDetailsController.java	Tue Oct 16 14:23:29 2012 -0400
@@ -43,10 +43,13 @@
 import com.redhat.thermostat.client.core.views.BasicView;
 import com.redhat.thermostat.client.osgi.service.ApplicationService;
 import com.redhat.thermostat.common.heap.HeapDump;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.utils.LoggingUtils;
 
 public class HeapDumpDetailsController {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private static final Logger log = LoggingUtils.getLogger(HeapDumpDetailsController.class);
 
     private final ApplicationService appService;
@@ -70,7 +73,7 @@
         try {
             HeapHistogramView heapHistogramView = histogramViewProvider.createView();
             heapHistogramView.display(heapDump.getHistogram());
-            String title = Translate.localize(LocaleResources.HEAP_DUMP_SECTION_HISTOGRAM);
+            String title = translator.localize(LocaleResources.HEAP_DUMP_SECTION_HISTOGRAM);
             view.addSubView(title, heapHistogramView);
         } catch (IOException e) {
             log.log(Level.SEVERE, "unexpected error while reading heap dump", e);
@@ -78,7 +81,7 @@
 
         ObjectDetailsController controller = new ObjectDetailsController(appService, dump, objectDetailsViewProvider, objectRootsViewProvider);
         ObjectDetailsView detailsView = controller.getView();
-        view.addSubView(Translate.localize(LocaleResources.HEAP_DUMP_SECTION_OBJECT_BROWSER), detailsView);
+        view.addSubView(translator.localize(LocaleResources.HEAP_DUMP_SECTION_OBJECT_BROWSER), detailsView);
 
         // do a dummy search right now to prep the index
         heapDump.searchObjects("A_RANDOM_PATTERN", 1);
--- a/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/LocaleResources.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/LocaleResources.java	Tue Oct 16 14:23:29 2012 -0400
@@ -36,6 +36,8 @@
 
 package com.redhat.thermostat.client.heap;
 
+import com.redhat.thermostat.common.locale.Translate;
+
 public enum LocaleResources {
 
     MISSING_INFO,
@@ -98,4 +100,8 @@
     ;
 
     static final String RESOURCE_BUNDLE = "com.redhat.thermostat.client.heap.strings";
+
+    public static Translate<LocaleResources> createLocalizer() {
+        return new Translate<>(RESOURCE_BUNDLE, LocaleResources.class);
+    }
 }
--- a/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/ObjectRootsController.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/ObjectRootsController.java	Tue Oct 16 14:23:29 2012 -0400
@@ -48,10 +48,13 @@
 import com.redhat.thermostat.common.ActionListener;
 import com.redhat.thermostat.common.NotImplementedException;
 import com.redhat.thermostat.common.heap.HeapDump;
+import com.redhat.thermostat.common.locale.Translate;
 import com.sun.tools.hat.internal.model.JavaHeapObject;
 
 public class ObjectRootsController {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private final ObjectRootsView view;
 
     private final HeapDump heapDump;
@@ -95,10 +98,10 @@
 
     private void showObjectDetails(HeapObjectUI uiObject) {
         JavaHeapObject obj = heapDump.findObject(uiObject.objectId);
-        String text = Translate.localize(LocaleResources.COMMAND_OBJECT_INFO_OBJECT_ID) + " " + obj.getIdString() + "\n" +
-                Translate.localize(LocaleResources.COMMAND_OBJECT_INFO_TYPE) + " " + obj.getClazz().getName() + "\n" +
-                Translate.localize(LocaleResources.COMMAND_OBJECT_INFO_SIZE) + " " + String.valueOf(obj.getSize()) + " bytes" + "\n" +
-                Translate.localize(LocaleResources.COMMAND_OBJECT_INFO_HEAP_ALLOCATED) + " " + String.valueOf(obj.isHeapAllocated()) + "\n";
+        String text = translator.localize(LocaleResources.COMMAND_OBJECT_INFO_OBJECT_ID) + " " + obj.getIdString() + "\n" +
+                translator.localize(LocaleResources.COMMAND_OBJECT_INFO_TYPE) + " " + obj.getClazz().getName() + "\n" +
+                translator.localize(LocaleResources.COMMAND_OBJECT_INFO_SIZE) + " " + String.valueOf(obj.getSize()) + " bytes" + "\n" +
+                translator.localize(LocaleResources.COMMAND_OBJECT_INFO_HEAP_ALLOCATED) + " " + String.valueOf(obj.isHeapAllocated()) + "\n";
 
         if (obj.getRoot() != null) {
             text = text + obj.getRoot().getDescription();
--- a/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/Translate.java	Wed Oct 10 18:52:45 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- * Copyright 2012 Red Hat, Inc.
- *
- * This file is part of Thermostat.
- *
- * Thermostat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Thermostat is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Thermostat; see the file COPYING.  If not see
- * <http://www.gnu.org/licenses/>.
- *
- * Linking this code with other modules is making a combined work
- * based on this code.  Thus, the terms and conditions of the GNU
- * General Public License cover the whole combination.
- *
- * As a special exception, the copyright holders of this code give
- * you permission to link this code with independent modules to
- * produce an executable, regardless of the license terms of these
- * independent modules, and to copy and distribute the resulting
- * executable under terms of your choice, provided that you also
- * meet, for each linked independent module, the terms and conditions
- * of the license of that module.  An independent module is a module
- * which is not derived from or based on this code.  If you modify
- * this code, you may extend this exception to your version of the
- * library, but you are not obligated to do so.  If you do not wish
- * to do so, delete this exception statement from your version.
- */
-
-package com.redhat.thermostat.client.heap;
-
-import java.text.MessageFormat;
-import java.util.ResourceBundle;
-
-public class Translate {
-
-    private static ResourceBundle resourceBundle = null;
-
-    static {
-        resourceBundle = ResourceBundle.getBundle(LocaleResources.RESOURCE_BUNDLE);
-    }
-
-    public static String localize(LocaleResources toTranslate) {
-        return resourceBundle.getString(toTranslate.name());
-    }
-
-    public static String localize(LocaleResources toTranslate, String... params) {
-        return MessageFormat.format(localize(toTranslate), (Object[]) params);
-    }
-}
--- a/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/DumpHeapCommand.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/DumpHeapCommand.java	Tue Oct 16 14:23:29 2012 -0400
@@ -38,19 +38,19 @@
 
 import java.util.concurrent.Semaphore;
 
-import org.apache.commons.cli.Options;
-
 import com.redhat.thermostat.client.heap.LocaleResources;
-import com.redhat.thermostat.client.heap.Translate;
 import com.redhat.thermostat.common.cli.CommandContext;
 import com.redhat.thermostat.common.cli.CommandException;
 import com.redhat.thermostat.common.cli.HostVMArguments;
 import com.redhat.thermostat.common.cli.SimpleCommand;
 import com.redhat.thermostat.common.dao.AgentInfoDAO;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.utils.OSGIUtils;
 
 
 public class DumpHeapCommand extends SimpleCommand {
+
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
     private static final String NAME = "dump-heap";
 
     private final OSGIUtils serviceProvider;
@@ -91,7 +91,7 @@
 
         try {
             s.acquire();
-            ctx.getConsole().getOutput().print(Translate.localize(LocaleResources.COMMAND_HEAP_DUMP_DONE));
+            ctx.getConsole().getOutput().print(translator.localize(LocaleResources.COMMAND_HEAP_DUMP_DONE));
             ctx.getConsole().getOutput().print("\n");
         } catch (InterruptedException ex) {
             // Nothing to do here, just return ASAP.
--- a/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/FindObjectsCommand.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/FindObjectsCommand.java	Tue Oct 16 14:23:29 2012 -0400
@@ -40,24 +40,26 @@
 import java.util.List;
 
 import com.redhat.thermostat.client.heap.LocaleResources;
-import com.redhat.thermostat.client.heap.Translate;
 import com.redhat.thermostat.common.cli.CommandContext;
 import com.redhat.thermostat.common.cli.CommandException;
 import com.redhat.thermostat.common.cli.SimpleCommand;
 import com.redhat.thermostat.common.cli.TableRenderer;
 import com.redhat.thermostat.common.dao.HeapDAO;
 import com.redhat.thermostat.common.heap.HeapDump;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.model.HeapInfo;
 import com.redhat.thermostat.common.utils.OSGIUtils;
 import com.sun.tools.hat.internal.model.JavaHeapObject;
 
 public class FindObjectsCommand extends SimpleCommand {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private static final String HEAP_ID_ARG = "heapId";
     private static final String LIMIT_ARG = "limit";
     private static final String NAME = "find-objects";
-    private static final String HEADER_OBJECT_ID = Translate.localize(LocaleResources.HEADER_OBJECT_ID);
-    private static final String HEADER_TYPE = Translate.localize(LocaleResources.HEADER_OBJECT_TYPE);
+    private static final String HEADER_OBJECT_ID = translator.localize(LocaleResources.HEADER_OBJECT_ID);
+    private static final String HEADER_TYPE = translator.localize(LocaleResources.HEADER_OBJECT_TYPE);
     private static final int DEFAULT_LIMIT = 10;
 
     private OSGIUtils serviceProvider;
@@ -75,7 +77,7 @@
 
         HeapDAO heapDAO = serviceProvider.getServiceAllowNull(HeapDAO.class);
         if (heapDAO == null) {
-            throw new CommandException(Translate.localize(LocaleResources.HEAP_SERVICE_UNAVAILABLE));
+            throw new CommandException(translator.localize(LocaleResources.HEAP_SERVICE_UNAVAILABLE));
         }
         try {
             run(ctx, heapDAO);
@@ -89,23 +91,23 @@
         String heapId = ctx.getArguments().getArgument(HEAP_ID_ARG);
         HeapInfo heapInfo = heapDAO.getHeapInfo(heapId);
         if (heapInfo == null) {
-            ctx.getConsole().getOutput().println(Translate.localize(LocaleResources.HEAP_ID_NOT_FOUND, heapId));
+            ctx.getConsole().getOutput().println(translator.localize(LocaleResources.HEAP_ID_NOT_FOUND, heapId));
             return;
         }
         HeapDump heapDump = heapDAO.getHeapDump(heapInfo);
         if (heapDump == null) {
-            ctx.getConsole().getOutput().println(Translate.localize(LocaleResources.HEAP_ID_NOT_FOUND, heapId));
+            ctx.getConsole().getOutput().println(translator.localize(LocaleResources.HEAP_ID_NOT_FOUND, heapId));
             return;
         }
 
         List<String> terms = ctx.getArguments().getNonOptionArguments();
         if (terms.size() == 0) {
-            ctx.getConsole().getOutput().println(Translate.localize(LocaleResources.SEARCH_TERM_REQUIRED));
+            ctx.getConsole().getOutput().println(translator.localize(LocaleResources.SEARCH_TERM_REQUIRED));
             return;
         }
         String searchTerm = terms.get(0);
         if (searchTerm.trim().length() == 0) {
-            ctx.getConsole().getOutput().println(Translate.localize(LocaleResources.SEARCH_TERM_REQUIRED));
+            ctx.getConsole().getOutput().println(translator.localize(LocaleResources.SEARCH_TERM_REQUIRED));
             return;
         }
 
@@ -129,7 +131,7 @@
             try {
                 limit = Integer.parseInt(limitArg);
             } catch (NumberFormatException ex) {
-                throw new CommandException(Translate.localize(LocaleResources.INVALID_LIMIT, limitArg));
+                throw new CommandException(translator.localize(LocaleResources.INVALID_LIMIT, limitArg));
             }
         }
         return limit;
--- a/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/FindRootCommand.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/FindRootCommand.java	Tue Oct 16 14:23:29 2012 -0400
@@ -42,12 +42,12 @@
 
 import com.redhat.thermostat.client.heap.LocaleResources;
 import com.redhat.thermostat.client.heap.PrintObjectUtils;
-import com.redhat.thermostat.client.heap.Translate;
 import com.redhat.thermostat.common.cli.CommandContext;
 import com.redhat.thermostat.common.cli.CommandException;
 import com.redhat.thermostat.common.cli.SimpleCommand;
 import com.redhat.thermostat.common.dao.HeapDAO;
 import com.redhat.thermostat.common.heap.HeapDump;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.utils.OSGIUtils;
 import com.sun.tools.hat.internal.model.JavaHeapObject;
 import com.sun.tools.hat.internal.model.Root;
@@ -55,6 +55,8 @@
 
 public class FindRootCommand extends SimpleCommand {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private static final String ALL_ARG = "all";
     private static final String NAME = "find-root";
 
@@ -72,7 +74,7 @@
     public void run(CommandContext ctx) throws CommandException {
         HeapDAO heapDao = serviceProvider.getServiceAllowNull(HeapDAO.class);
         if (heapDao == null) {
-            throw new CommandException(Translate.localize(LocaleResources.HEAP_SERVICE_UNAVAILABLE));
+            throw new CommandException(translator.localize(LocaleResources.HEAP_SERVICE_UNAVAILABLE));
         }
 
         try {
@@ -92,7 +94,7 @@
         Collection<HeapPath<JavaHeapObject>> pathsToRoot = findRoot.findShortestPathsToRoot(obj, findAll);
         PrintStream out = ctx.getConsole().getOutput();
         if (pathsToRoot.isEmpty()) {
-            out.println(Translate.localize(LocaleResources.COMMAND_FIND_ROOT_NO_ROOT_FOUND, PrintObjectUtils.objectToString(obj)));
+            out.println(translator.localize(LocaleResources.COMMAND_FIND_ROOT_NO_ROOT_FOUND, PrintObjectUtils.objectToString(obj)));
         } else {
             printPathsToRoot(snapshot, pathsToRoot, out);
         }
--- a/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/ListHeapDumpsCommand.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/ListHeapDumpsCommand.java	Tue Oct 16 14:23:29 2012 -0400
@@ -41,7 +41,6 @@
 import java.util.Date;
 
 import com.redhat.thermostat.client.heap.LocaleResources;
-import com.redhat.thermostat.client.heap.Translate;
 import com.redhat.thermostat.common.cli.CommandContext;
 import com.redhat.thermostat.common.cli.CommandException;
 import com.redhat.thermostat.common.cli.HostVMArguments;
@@ -52,18 +51,21 @@
 import com.redhat.thermostat.common.dao.HostRef;
 import com.redhat.thermostat.common.dao.VmInfoDAO;
 import com.redhat.thermostat.common.dao.VmRef;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.model.HeapInfo;
 import com.redhat.thermostat.common.utils.OSGIUtils;
 
 public class ListHeapDumpsCommand extends SimpleCommand {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private static final String NAME = "list-heap-dumps";
 
     private static final String[] COLUMN_NAMES = {
-        Translate.localize(LocaleResources.HEADER_HOST_ID),
-        Translate.localize(LocaleResources.HEADER_VM_ID),
-        Translate.localize(LocaleResources.HEADER_HEAP_ID),
-        Translate.localize(LocaleResources.HEADER_TIMESTAMP),
+        translator.localize(LocaleResources.HEADER_HOST_ID),
+        translator.localize(LocaleResources.HEADER_VM_ID),
+        translator.localize(LocaleResources.HEADER_HEAP_ID),
+        translator.localize(LocaleResources.HEADER_TIMESTAMP),
     };
 
     private final OSGIUtils serviceProvider;
@@ -92,17 +94,17 @@
 
         HostInfoDAO hostDAO = serviceProvider.getServiceAllowNull(HostInfoDAO.class);
         if (hostDAO == null) {
-            throw new CommandException(Translate.localize(LocaleResources.HOST_SERVICE_UNAVAILABLE));
+            throw new CommandException(translator.localize(LocaleResources.HOST_SERVICE_UNAVAILABLE));
         }
 
         VmInfoDAO vmDAO = serviceProvider.getServiceAllowNull(VmInfoDAO.class);
         if (vmDAO == null) {
-            throw new CommandException(Translate.localize(LocaleResources.VM_SERVICE_UNAVAILABLE));
+            throw new CommandException(translator.localize(LocaleResources.VM_SERVICE_UNAVAILABLE));
         }
 
         HeapDAO heapDAO = serviceProvider.getServiceAllowNull(HeapDAO.class);
         if (heapDAO == null) {
-            throw new CommandException(Translate.localize(LocaleResources.HEAP_SERVICE_UNAVAILABLE));
+            throw new CommandException(translator.localize(LocaleResources.HEAP_SERVICE_UNAVAILABLE));
         }
 
         Collection<HostRef> hosts = args.getHost() != null ? Arrays.asList(args.getHost()) : hostDAO.getHosts();
--- a/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/ObjectCommandHelper.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/ObjectCommandHelper.java	Tue Oct 16 14:23:29 2012 -0400
@@ -37,17 +37,19 @@
 package com.redhat.thermostat.client.heap.cli;
 
 import com.redhat.thermostat.client.heap.LocaleResources;
-import com.redhat.thermostat.client.heap.Translate;
 import com.redhat.thermostat.common.cli.Arguments;
 import com.redhat.thermostat.common.cli.CommandContext;
 import com.redhat.thermostat.common.cli.CommandException;
 import com.redhat.thermostat.common.dao.HeapDAO;
 import com.redhat.thermostat.common.heap.HeapDump;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.model.HeapInfo;
 import com.sun.tools.hat.internal.model.JavaHeapObject;
 
 class ObjectCommandHelper {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private static final String OBJECT_ID_ARG = "objectId";
     private static final String HEAP_ID_ARG = "heapId";
 
@@ -72,7 +74,7 @@
         String heapId = args.getArgument(HEAP_ID_ARG);
         HeapInfo heapInfo = dao.getHeapInfo(heapId);
         if (heapInfo == null) {
-            throw new CommandException(Translate.localize(LocaleResources.HEAP_ID_NOT_FOUND, heapId));
+            throw new CommandException(translator.localize(LocaleResources.HEAP_ID_NOT_FOUND, heapId));
         }
         heapDump = dao.getHeapDump(heapInfo);
     }
--- a/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/ObjectInfoCommand.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/ObjectInfoCommand.java	Tue Oct 16 14:23:29 2012 -0400
@@ -41,13 +41,13 @@
 
 import com.redhat.thermostat.client.heap.LocaleResources;
 import com.redhat.thermostat.client.heap.PrintObjectUtils;
-import com.redhat.thermostat.client.heap.Translate;
 import com.redhat.thermostat.common.cli.CommandContext;
 import com.redhat.thermostat.common.cli.CommandException;
 import com.redhat.thermostat.common.cli.SimpleCommand;
 import com.redhat.thermostat.common.cli.TableRenderer;
 import com.redhat.thermostat.common.dao.HeapDAO;
 import com.redhat.thermostat.common.heap.HeapDump;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.utils.OSGIUtils;
 import com.sun.tools.hat.internal.model.JavaClass;
 import com.sun.tools.hat.internal.model.JavaField;
@@ -57,6 +57,8 @@
 
 public class ObjectInfoCommand extends SimpleCommand {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private static final String NAME = "object-info";
 
     private OSGIUtils serviceProvider;
@@ -74,7 +76,7 @@
     public void run(CommandContext ctx) throws CommandException {
         HeapDAO heapDao = serviceProvider.getServiceAllowNull(HeapDAO.class);
         if (heapDao == null) {
-            throw new CommandException(Translate.localize(LocaleResources.HEAP_SERVICE_UNAVAILABLE));
+            throw new CommandException(translator.localize(LocaleResources.HEAP_SERVICE_UNAVAILABLE));
         }
 
         try {
@@ -90,13 +92,13 @@
         snapshot = heapDump.getSnapshot();
         JavaHeapObject obj = objCmdHelper.getJavaHeapObject();
         TableRenderer table = new TableRenderer(2);
-        table.printLine(Translate.localize(LocaleResources.COMMAND_OBJECT_INFO_OBJECT_ID), obj.getIdString());
-        table.printLine(Translate.localize(LocaleResources.COMMAND_OBJECT_INFO_TYPE), obj.getClazz().getName());
-        table.printLine(Translate.localize(LocaleResources.COMMAND_OBJECT_INFO_SIZE), String.valueOf(obj.getSize()) + " bytes");
-        table.printLine(Translate.localize(LocaleResources.COMMAND_OBJECT_INFO_HEAP_ALLOCATED), String.valueOf(obj.isHeapAllocated()));
-        table.printLine(Translate.localize(LocaleResources.COMMAND_OBJECT_INFO_REFERENCES), "");
+        table.printLine(translator.localize(LocaleResources.COMMAND_OBJECT_INFO_OBJECT_ID), obj.getIdString());
+        table.printLine(translator.localize(LocaleResources.COMMAND_OBJECT_INFO_TYPE), obj.getClazz().getName());
+        table.printLine(translator.localize(LocaleResources.COMMAND_OBJECT_INFO_SIZE), String.valueOf(obj.getSize()) + " bytes");
+        table.printLine(translator.localize(LocaleResources.COMMAND_OBJECT_INFO_HEAP_ALLOCATED), String.valueOf(obj.isHeapAllocated()));
+        table.printLine(translator.localize(LocaleResources.COMMAND_OBJECT_INFO_REFERENCES), "");
         printReferences(table, obj);
-        table.printLine(Translate.localize(LocaleResources.COMMAND_OBJECT_INFO_REFERRERS), "");
+        table.printLine(translator.localize(LocaleResources.COMMAND_OBJECT_INFO_REFERRERS), "");
         printReferrers(table, obj);
 
         PrintStream out = ctx.getConsole().getOutput();
--- a/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/SaveHeapDumpToFileCommand.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/SaveHeapDumpToFileCommand.java	Tue Oct 16 14:23:29 2012 -0400
@@ -45,18 +45,20 @@
 import java.io.OutputStream;
 
 import com.redhat.thermostat.client.heap.LocaleResources;
-import com.redhat.thermostat.client.heap.Translate;
 import com.redhat.thermostat.common.cli.Arguments;
 import com.redhat.thermostat.common.cli.CommandContext;
 import com.redhat.thermostat.common.cli.CommandException;
 import com.redhat.thermostat.common.cli.SimpleCommand;
 import com.redhat.thermostat.common.dao.HeapDAO;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.model.HeapInfo;
 import com.redhat.thermostat.common.utils.OSGIUtils;
 import com.redhat.thermostat.common.utils.StreamUtils;
 
 public class SaveHeapDumpToFileCommand extends SimpleCommand {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private static final String NAME = "save-heap-dump-to-file";
 
     private static final String HEAP_ID_ARGUMENT = "heapId";
@@ -95,11 +97,11 @@
         Arguments args = ctx.getArguments();
         String heapId = args.getArgument(HEAP_ID_ARGUMENT);
         if (heapId == null) {
-            throw new CommandException(Translate.localize(LocaleResources.HEAP_ID_REQUIRED));
+            throw new CommandException(translator.localize(LocaleResources.HEAP_ID_REQUIRED));
         }
         String filename = args.getArgument(FILE_NAME_ARGUMENT);
         if (filename == null) {
-            throw new CommandException(Translate.localize(LocaleResources.FILE_REQUIRED));
+            throw new CommandException(translator.localize(LocaleResources.FILE_REQUIRED));
         }
 
         HeapInfo heapInfo = heapDAO.getHeapInfo(heapId);
@@ -107,15 +109,15 @@
             if (heapStream != null) {
                 try {
                     saveHeapDump(heapStream, filename);
-                    ctx.getConsole().getOutput().println(Translate.localize(LocaleResources.COMMAND_SAVE_HEAP_DUMP_SAVED_TO_FILE, filename));
+                    ctx.getConsole().getOutput().println(translator.localize(LocaleResources.COMMAND_SAVE_HEAP_DUMP_SAVED_TO_FILE, filename));
                 } catch (IOException e) {
-                    ctx.getConsole().getOutput().println(Translate.localize(LocaleResources.COMMAND_SAVE_HEAP_DUMP_ERROR_SAVING, e.getMessage()));
+                    ctx.getConsole().getOutput().println(translator.localize(LocaleResources.COMMAND_SAVE_HEAP_DUMP_ERROR_SAVING, e.getMessage()));
                 }
             } else {
-                ctx.getConsole().getOutput().println(Translate.localize(LocaleResources.HEAP_ID_NOT_FOUND, heapId));
+                ctx.getConsole().getOutput().println(translator.localize(LocaleResources.HEAP_ID_NOT_FOUND, heapId));
             }
         } catch (IOException e) {
-            throw new CommandException(Translate.localize(LocaleResources.COMMAND_SAVE_HEAP_DUMP_ERROR_CLOSING_STREAM, e.getMessage()));
+            throw new CommandException(translator.localize(LocaleResources.COMMAND_SAVE_HEAP_DUMP_ERROR_CLOSING_STREAM, e.getMessage()));
         }
     }
 
--- a/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/ShowHeapHistogramCommand.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/ShowHeapHistogramCommand.java	Tue Oct 16 14:23:29 2012 -0400
@@ -39,7 +39,6 @@
 import java.io.PrintStream;
 
 import com.redhat.thermostat.client.heap.LocaleResources;
-import com.redhat.thermostat.client.heap.Translate;
 import com.redhat.thermostat.common.cli.Arguments;
 import com.redhat.thermostat.common.cli.CommandContext;
 import com.redhat.thermostat.common.cli.CommandException;
@@ -48,11 +47,14 @@
 import com.redhat.thermostat.common.dao.HeapDAO;
 import com.redhat.thermostat.common.heap.HistogramRecord;
 import com.redhat.thermostat.common.heap.ObjectHistogram;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.model.HeapInfo;
 import com.redhat.thermostat.common.utils.OSGIUtils;
 
 public class ShowHeapHistogramCommand extends SimpleCommand {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private static final String NAME = "show-heap-histogram";
 
     private OSGIUtils serviceProvider;
@@ -74,7 +76,7 @@
     public void run(CommandContext ctx) throws CommandException {
         HeapDAO heapDAO = serviceProvider.getServiceAllowNull(HeapDAO.class);
         if (heapDAO == null) {
-            throw new CommandException(Translate.localize(LocaleResources.HEAP_SERVICE_UNAVAILABLE));
+            throw new CommandException(translator.localize(LocaleResources.HEAP_SERVICE_UNAVAILABLE));
         }
 
         try {
@@ -90,13 +92,13 @@
 
         HeapInfo heapInfo = heapDAO.getHeapInfo(heapId);
         if (heapInfo == null) {
-            ctx.getConsole().getOutput().println(Translate.localize(LocaleResources.HEAP_ID_NOT_FOUND, heapId));
+            ctx.getConsole().getOutput().println(translator.localize(LocaleResources.HEAP_ID_NOT_FOUND, heapId));
             return;
         }
 
         ObjectHistogram histogram = heapDAO.getHistogram(heapInfo);
         if (histogram == null) {
-            ctx.getConsole().getOutput().println(Translate.localize(LocaleResources.HEAP_ID_NOT_FOUND, heapId));
+            ctx.getConsole().getOutput().println(translator.localize(LocaleResources.HEAP_ID_NOT_FOUND, heapId));
             return;
         } else {
             printHeapHistogram(histogram, ctx.getConsole().getOutput());
--- a/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/swing/HeapSwingView.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/swing/HeapSwingView.java	Tue Oct 16 14:23:29 2012 -0400
@@ -53,15 +53,17 @@
 import com.redhat.thermostat.client.core.views.BasicView;
 import com.redhat.thermostat.client.heap.HeapView;
 import com.redhat.thermostat.client.heap.LocaleResources;
-import com.redhat.thermostat.client.heap.Translate;
 import com.redhat.thermostat.client.heap.chart.OverviewChart;
 import com.redhat.thermostat.client.ui.ComponentVisibleListener;
 import com.redhat.thermostat.client.ui.SwingComponent;
 import com.redhat.thermostat.common.heap.HeapDump;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.swing.HeaderPanel;
 
 public class HeapSwingView extends HeapView implements SwingComponent {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private StatsPanel stats;
 
     private HeapPanel heapDetailPanel;
@@ -94,7 +96,7 @@
         
         heapDetailPanel = new HeapPanel();
         
-        overview = new HeaderPanel(Translate.localize(LocaleResources.HEAP_OVERVIEW_TITLE));
+        overview = new HeaderPanel(translator.localize(LocaleResources.HEAP_OVERVIEW_TITLE));
         overview.setContent(stats);
         overview.addHierarchyListener(new ViewVisibleListener());
 
--- a/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/swing/HistogramPanel.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/swing/HistogramPanel.java	Tue Oct 16 14:23:29 2012 -0400
@@ -48,10 +48,10 @@
 
 import com.redhat.thermostat.client.heap.HeapHistogramView;
 import com.redhat.thermostat.client.heap.LocaleResources;
-import com.redhat.thermostat.client.heap.Translate;
 import com.redhat.thermostat.client.ui.SwingComponent;
 import com.redhat.thermostat.common.heap.HistogramRecord;
 import com.redhat.thermostat.common.heap.ObjectHistogram;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.utils.DescriptorConverter;
 import com.redhat.thermostat.swing.HeaderPanel;
 import com.redhat.thermostat.swing.ThermostatTable;
@@ -60,6 +60,8 @@
 @SuppressWarnings("serial")
 public class HistogramPanel extends HeapHistogramView implements SwingComponent {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private final JPanel panel;
 
     private HeaderPanel headerPanel;
@@ -68,7 +70,7 @@
         panel = new JPanel();
         panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
 
-        headerPanel = new HeaderPanel(Translate.localize(LocaleResources.HEAP_DUMP_CLASS_USAGE));
+        headerPanel = new HeaderPanel(translator.localize(LocaleResources.HEAP_DUMP_CLASS_USAGE));
         panel.add(headerPanel);
     }
 
@@ -97,9 +99,9 @@
     private class HistogramTableModel extends DefaultTableModel {
 
         private final String[] columnNames = new String[] {
-            Translate.localize(LocaleResources.HEAP_DUMP_HISTOGRAM_COLUMN_CLASS),
-            Translate.localize(LocaleResources.HEAP_DUMP_HISTOGRAM_COLUMN_INSTANCES),
-            Translate.localize(LocaleResources.HEAP_DUMP_HISTOGRAM_COLUMN_SIZE),
+            translator.localize(LocaleResources.HEAP_DUMP_HISTOGRAM_COLUMN_CLASS),
+            translator.localize(LocaleResources.HEAP_DUMP_HISTOGRAM_COLUMN_INSTANCES),
+            translator.localize(LocaleResources.HEAP_DUMP_HISTOGRAM_COLUMN_SIZE),
         };
 
         private List<HistogramRecord> histogram;
--- a/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/swing/ObjectDetailsPanel.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/swing/ObjectDetailsPanel.java	Tue Oct 16 14:23:29 2012 -0400
@@ -57,13 +57,13 @@
 import com.redhat.thermostat.client.heap.HeapObjectUI;
 import com.redhat.thermostat.client.heap.LocaleResources;
 import com.redhat.thermostat.client.heap.ObjectDetailsView;
-import com.redhat.thermostat.client.heap.Translate;
 import com.redhat.thermostat.client.ui.SearchFieldSwingView;
 import com.redhat.thermostat.client.ui.SearchFieldView.SearchAction;
 import com.redhat.thermostat.client.ui.SwingComponent;
 import com.redhat.thermostat.common.ActionListener;
 import com.redhat.thermostat.common.ActionEvent;
 import com.redhat.thermostat.common.ActionNotifier;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.swing.EdtHelper;
 import com.sun.tools.hat.internal.model.JavaHeapObject;
 
@@ -92,6 +92,8 @@
  */
 public class ObjectDetailsPanel extends ObjectDetailsView implements SwingComponent {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     /** For TESTING ONLY! */
     static final String TREE_NAME = "ref-tree";
     /** For TESTING ONLY! */
@@ -120,19 +122,19 @@
 
         panel = new JPanel();
 
-        JLabel searchLabel = new JLabel(Translate.localize(LocaleResources.HEAP_DUMP_OBJECT_BROWSE_SEARCH_LABEL));
+        JLabel searchLabel = new JLabel(translator.localize(LocaleResources.HEAP_DUMP_OBJECT_BROWSE_SEARCH_LABEL));
 
         searchField = new SearchFieldSwingView();
-        searchField.setTooltip(Translate.localize(LocaleResources.HEAP_DUMP_OBJECT_BROWSE_SEARCH_PATTERN_HELP));
+        searchField.setTooltip(translator.localize(LocaleResources.HEAP_DUMP_OBJECT_BROWSE_SEARCH_PATTERN_HELP));
 
         JSplitPane splitPane = new JSplitPane();
         splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
         splitPane.setDividerLocation(0.8 /* 80% */);
 
-        toggleReferrersButton = new JToggleButton(Translate.localize(LocaleResources.HEAP_DUMP_OBJECT_BROWSE_REFERRERS));
+        toggleReferrersButton = new JToggleButton(translator.localize(LocaleResources.HEAP_DUMP_OBJECT_BROWSE_REFERRERS));
         refGroup.add(toggleReferrersButton);
 
-        toggleReferencesButton = new JToggleButton(Translate.localize(LocaleResources.HEAP_DUMP_OBJECT_BROWSE_REFERENCES));
+        toggleReferencesButton = new JToggleButton(translator.localize(LocaleResources.HEAP_DUMP_OBJECT_BROWSE_REFERENCES));
         refGroup.add(toggleReferencesButton);
 
         toggleReferrersButton.setSelected(true);
@@ -181,7 +183,7 @@
                 }
             }
         });
-        searchField.setLabel(Translate.localize(LocaleResources.HEAP_DUMP_OBJECT_BROWSE_SEARCH_HINT));
+        searchField.setLabel(translator.localize(LocaleResources.HEAP_DUMP_OBJECT_BROWSE_SEARCH_HINT));
 
         java.awt.event.ActionListener treeToggleListener = new java.awt.event.ActionListener() {
             @Override
@@ -269,7 +271,7 @@
                     TreePath path = objectTree.getPathForRow(row);
                     final HeapObjectUI heapObject = (HeapObjectUI) ((LazyMutableTreeNode)path.getLastPathComponent()).getUserObject();
                     JPopupMenu popup = new JPopupMenu();
-                    JMenuItem findRootItem = new JMenuItem(Translate.localize(LocaleResources.HEAP_DUMP_OBJECT_FIND_ROOT));
+                    JMenuItem findRootItem = new JMenuItem(translator.localize(LocaleResources.HEAP_DUMP_OBJECT_FIND_ROOT));
                     findRootItem.addActionListener(new java.awt.event.ActionListener() {
                         @Override
                         public void actionPerformed(java.awt.event.ActionEvent e) {
@@ -399,10 +401,10 @@
             @Override
             public void run() {
                 // TODO use some other gui control for this rather than a plain text box
-                String text = Translate.localize(LocaleResources.COMMAND_OBJECT_INFO_OBJECT_ID) + obj.getIdString() + "\n" +
-                              Translate.localize(LocaleResources.COMMAND_OBJECT_INFO_TYPE) + obj.getClazz().getName() + "\n" +
-                              Translate.localize(LocaleResources.COMMAND_OBJECT_INFO_SIZE) + String.valueOf(obj.getSize()) + " bytes" + "\n" +
-                              Translate.localize(LocaleResources.COMMAND_OBJECT_INFO_HEAP_ALLOCATED) + String.valueOf(obj.isHeapAllocated()) + "\n";
+                String text = translator.localize(LocaleResources.COMMAND_OBJECT_INFO_OBJECT_ID) + obj.getIdString() + "\n" +
+                              translator.localize(LocaleResources.COMMAND_OBJECT_INFO_TYPE) + obj.getClazz().getName() + "\n" +
+                              translator.localize(LocaleResources.COMMAND_OBJECT_INFO_SIZE) + String.valueOf(obj.getSize()) + " bytes" + "\n" +
+                              translator.localize(LocaleResources.COMMAND_OBJECT_INFO_HEAP_ALLOCATED) + String.valueOf(obj.isHeapAllocated()) + "\n";
                 objectDetailsPane.setText(text);
             }
         });
--- a/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/swing/ObjectRootsFrame.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/swing/ObjectRootsFrame.java	Tue Oct 16 14:23:29 2012 -0400
@@ -61,14 +61,16 @@
 import com.redhat.thermostat.client.heap.HeapObjectUI;
 import com.redhat.thermostat.client.heap.LocaleResources;
 import com.redhat.thermostat.client.heap.ObjectRootsView;
-import com.redhat.thermostat.client.heap.Translate;
 import com.redhat.thermostat.common.ActionListener;
 import com.redhat.thermostat.common.ActionNotifier;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.swing.EdtHelper;
 
 @SuppressWarnings("serial")
 public class ObjectRootsFrame extends JFrame implements ObjectRootsView {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     /** For TESTING ONLY! */
     static final String TREE_NAME = "roots-tree";
 
@@ -83,13 +85,13 @@
     private final JTextPane objectDetails;
 
     public ObjectRootsFrame() {
-        setTitle(Translate.localize(LocaleResources.OBJECT_ROOTS_VIEW_TITLE));
+        setTitle(translator.localize(LocaleResources.OBJECT_ROOTS_VIEW_TITLE));
 
         dataModel = new DefaultTreeModel(ROOT);
         pathToRootTree = new JTree(dataModel);
         pathToRootTree.setName(TREE_NAME);
 
-        JLabel lblNewLabel = new JLabel(Translate.localize(LocaleResources.OBJECT_ROOTS_VIEW_TITLE));
+        JLabel lblNewLabel = new JLabel(translator.localize(LocaleResources.OBJECT_ROOTS_VIEW_TITLE));
 
         JScrollPane scrollPane = new JScrollPane(pathToRootTree);
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/heapdumper/src/test/java/com/redhat/thermostat/client/heap/LocaleResourcesTest.java	Tue Oct 16 14:23:29 2012 -0400
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2012 Red Hat, Inc.
+ *
+ * This file is part of Thermostat.
+ *
+ * Thermostat is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2, or (at your
+ * option) any later version.
+ *
+ * Thermostat is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Thermostat; see the file COPYING.  If not see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Linking this code with other modules is making a combined work
+ * based on this code.  Thus, the terms and conditions of the GNU
+ * General Public License cover the whole combination.
+ *
+ * As a special exception, the copyright holders of this code give
+ * you permission to link this code with independent modules to
+ * produce an executable, regardless of the license terms of these
+ * independent modules, and to copy and distribute the resulting
+ * executable under terms of your choice, provided that you also
+ * meet, for each linked independent module, the terms and conditions
+ * of the license of that module.  An independent module is a module
+ * which is not derived from or based on this code.  If you modify
+ * this code, you may extend this exception to your version of the
+ * library, but you are not obligated to do so.  If you do not wish
+ * to do so, delete this exception statement from your version.
+ */
+
+package com.redhat.thermostat.client.heap;
+
+import java.io.IOException;
+import java.util.Properties;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+
+public class LocaleResourcesTest {
+
+    @Test
+    public void testLocalizedStringsArePresent() throws IOException {
+
+        String stringsResource = "/" + LocaleResources.RESOURCE_BUNDLE.replace(".", "/") + ".properties";
+
+        Properties props = new Properties();
+        props.load(getClass().getResourceAsStream(stringsResource));
+
+        Assert.assertEquals(LocaleResources.values().length, props.values().size());
+        for (LocaleResources resource : LocaleResources.values()) {
+            Assert.assertTrue("missing property from resource bound file: " + resource,
+                              props.containsKey(resource.name()));
+        }
+    }
+}
--- a/client/heapdumper/src/test/java/com/redhat/thermostat/client/heap/TranslateTest.java	Wed Oct 10 18:52:45 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-/*
- * Copyright 2012 Red Hat, Inc.
- *
- * This file is part of Thermostat.
- *
- * Thermostat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Thermostat is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Thermostat; see the file COPYING.  If not see
- * <http://www.gnu.org/licenses/>.
- *
- * Linking this code with other modules is making a combined work
- * based on this code.  Thus, the terms and conditions of the GNU
- * General Public License cover the whole combination.
- *
- * As a special exception, the copyright holders of this code give
- * you permission to link this code with independent modules to
- * produce an executable, regardless of the license terms of these
- * independent modules, and to copy and distribute the resulting
- * executable under terms of your choice, provided that you also
- * meet, for each linked independent module, the terms and conditions
- * of the license of that module.  An independent module is a module
- * which is not derived from or based on this code.  If you modify
- * this code, you may extend this exception to your version of the
- * library, but you are not obligated to do so.  If you do not wish
- * to do so, delete this exception statement from your version.
- */
-
-package com.redhat.thermostat.client.heap;
-
-import java.io.IOException;
-import java.util.Locale;
-import java.util.Properties;
-
-import junit.framework.Assert;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import static com.redhat.thermostat.client.heap.Translate.localize;
-
-public class TranslateTest {
-
-    private Locale lang;
-
-    @Before
-    public void setUp() {
-        this.lang = Locale.getDefault();
-        Locale.setDefault(Locale.US);
-    }
-
-    @After
-    public void tearDown() {
-        Locale.setDefault(lang);
-    }
-
-    @Test
-    public void testLocalizeWithoutArguments() {
-        String testString = localize(LocaleResources.MISSING_INFO);
-        Assert.assertEquals("Missing Information", testString);
-    }
-
-    @Test
-    public void testLocalizedStringsArePresent() throws IOException {
-
-        String stringsResource = "/" + LocaleResources.RESOURCE_BUNDLE.replace(".", "/") + ".properties";
-
-        Properties props = new Properties();
-        props.load(getClass().getResourceAsStream(stringsResource));
-
-        Assert.assertEquals(LocaleResources.values().length, props.values().size());
-        for (LocaleResources resource : LocaleResources.values()) {
-            Assert.assertTrue("missing property from resource bound file: " + resource,
-                              props.containsKey(resource.name()));
-        }
-    }
-}
--- a/client/memory-stats-panel/pom.xml	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/memory-stats-panel/pom.xml	Tue Oct 16 14:23:29 2012 -0400
@@ -17,13 +17,13 @@
         <extensions>true</extensions>
         <configuration>
           <instructions>
-            <Private-Package>com.redhat.thermostat.client.stats.memory</Private-Package>
+            <Private-Package>
+            	com.redhat.thermostat.client.stats.memory,
+         		com.redhat.thermostat.client.stats.memory.locale,
+            </Private-Package>
             <Bundle-Activator>com.redhat.thermostat.client.stats.memory.MemoryStatsPanelActivator</Bundle-Activator>
             <Bundle-Vendor>Red Hat, Inc.</Bundle-Vendor>
             <Bundle-SymbolicName>com.redhat.thermostat.client.stats.memory</Bundle-SymbolicName>
-            <Export-Package>
-              com.redhat.thermostat.client.stats.memory.locale,
-            </Export-Package>
             <!-- Do not autogenerate uses clauses in Manifests -->
             <_nouses>true</_nouses>
           </instructions>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/vmclassstat/src/main/java/com/redhat/thermostat/client/vmclassstat/LocaleResources.java	Tue Oct 16 14:23:29 2012 -0400
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2012 Red Hat, Inc.
+ *
+ * This file is part of Thermostat.
+ *
+ * Thermostat is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2, or (at your
+ * option) any later version.
+ *
+ * Thermostat is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Thermostat; see the file COPYING.  If not see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Linking this code with other modules is making a combined work
+ * based on this code.  Thus, the terms and conditions of the GNU
+ * General Public License cover the whole combination.
+ *
+ * As a special exception, the copyright holders of this code give
+ * you permission to link this code with independent modules to
+ * produce an executable, regardless of the license terms of these
+ * independent modules, and to copy and distribute the resulting
+ * executable under terms of your choice, provided that you also
+ * meet, for each linked independent module, the terms and conditions
+ * of the license of that module.  An independent module is a module
+ * which is not derived from or based on this code.  If you modify
+ * this code, you may extend this exception to your version of the
+ * library, but you are not obligated to do so.  If you do not wish
+ * to do so, delete this exception statement from your version.
+ */
+
+package com.redhat.thermostat.client.vmclassstat;
+
+import com.redhat.thermostat.common.locale.Translate;
+
+public enum LocaleResources {
+
+    VM_INFO_TAB_CLASSES,
+    VM_CLASSES_TITLE,
+    VM_CLASSES_CHART_REAL_TIME_LABEL,
+    VM_CLASSES_CHART_LOADED_CLASSES_LABEL,
+
+    ;
+
+    static final String RESOURCE_BUNDLE =
+            "com.redhat.thermostat.client.vmclassstat.strings";
+
+    public static Translate<LocaleResources> createLocalizer() {
+        return new Translate<>(RESOURCE_BUNDLE, LocaleResources.class);
+    }
+}
--- a/client/vmclassstat/src/main/java/com/redhat/thermostat/client/vmclassstat/VmClassStatController.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/vmclassstat/src/main/java/com/redhat/thermostat/client/vmclassstat/VmClassStatController.java	Tue Oct 16 14:23:29 2012 -0400
@@ -44,7 +44,6 @@
 import com.redhat.thermostat.client.core.views.UIComponent;
 import com.redhat.thermostat.client.core.views.BasicView.Action;
 import com.redhat.thermostat.client.vmclassstat.locale.LocaleResources;
-import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.ActionEvent;
 import com.redhat.thermostat.common.ActionListener;
 import com.redhat.thermostat.common.NotImplementedException;
@@ -53,11 +52,14 @@
 import com.redhat.thermostat.common.appctx.ApplicationContext;
 import com.redhat.thermostat.common.dao.VmClassStatDAO;
 import com.redhat.thermostat.common.dao.VmRef;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.model.DiscreteTimeData;
 import com.redhat.thermostat.common.model.VmClassStat;
 
 class VmClassStatController implements VmInformationServiceController {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private class UpdateChartData implements Runnable {
         @Override
         public void run() {
--- a/client/vmclassstat/src/main/java/com/redhat/thermostat/client/vmclassstat/VmClassStatPanel.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/client/vmclassstat/src/main/java/com/redhat/thermostat/client/vmclassstat/VmClassStatPanel.java	Tue Oct 16 14:23:29 2012 -0400
@@ -69,12 +69,13 @@
 
 public class VmClassStatPanel extends VmClassStatView implements SwingComponent {
 
+    private static final Translate<LocaleResources> t = LocaleResources.createLocalizer();
+
     private HeaderPanel visiblePanel;
     
     private final TimeSeriesCollection dataset = new TimeSeriesCollection();
 
     private final ActionNotifier<Action> notifier = new ActionNotifier<Action>(this);
-    private final Translate<LocaleResources> t = LocaleResources.createLocalizer();
 
     public VmClassStatPanel() {
         visiblePanel = new HeaderPanel();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/vmclassstat/src/main/resources/com/redhat/thermostat/client/vmclassstat/strings.properties	Tue Oct 16 14:23:29 2012 -0400
@@ -0,0 +1,4 @@
+VM_INFO_TAB_CLASSES = Classes
+VM_CLASSES_TITLE = Loaded Classes
+VM_CLASSES_CHART_REAL_TIME_LABEL = Time
+VM_CLASSES_CHART_LOADED_CLASSES_LABEL = Number of loaded classes
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/vmclassstat/src/test/java/com/redhat/thermostat/client/vmclassstat/LocaleResourcesTest.java	Tue Oct 16 14:23:29 2012 -0400
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2012 Red Hat, Inc.
+ *
+ * This file is part of Thermostat.
+ *
+ * Thermostat is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2, or (at your
+ * option) any later version.
+ *
+ * Thermostat is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Thermostat; see the file COPYING.  If not see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Linking this code with other modules is making a combined work
+ * based on this code.  Thus, the terms and conditions of the GNU
+ * General Public License cover the whole combination.
+ *
+ * As a special exception, the copyright holders of this code give
+ * you permission to link this code with independent modules to
+ * produce an executable, regardless of the license terms of these
+ * independent modules, and to copy and distribute the resulting
+ * executable under terms of your choice, provided that you also
+ * meet, for each linked independent module, the terms and conditions
+ * of the license of that module.  An independent module is a module
+ * which is not derived from or based on this code.  If you modify
+ * this code, you may extend this exception to your version of the
+ * library, but you are not obligated to do so.  If you do not wish
+ * to do so, delete this exception statement from your version.
+ */
+
+package com.redhat.thermostat.client.vmclassstat;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.junit.Test;
+
+public class LocaleResourcesTest {
+
+    @Test
+    public void testLocalizedStringsArePresent() throws IOException {
+
+        String stringsResource = "/" + LocaleResources.RESOURCE_BUNDLE.replace(".", "/") + ".properties";
+
+        Properties props = new Properties();
+        try (InputStream stream = getClass().getResourceAsStream(stringsResource)) {
+            assertNotNull(stream);
+
+            props.load(stream);
+
+            assertEquals(LocaleResources.values().length, props.values().size());
+            for (LocaleResources resource : LocaleResources.values()) {
+                assertTrue("missing property from resource bound file: " + resource,
+                        props.containsKey(resource.name()));
+            }
+
+        }
+    }
+}
--- a/common/command/src/main/java/com/redhat/thermostat/common/command/internal/locale/LocaleResources.java	Wed Oct 10 18:52:45 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/*
- * Copyright 2012 Red Hat, Inc.
- *
- * This file is part of Thermostat.
- *
- * Thermostat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Thermostat is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Thermostat; see the file COPYING.  If not see
- * <http://www.gnu.org/licenses/>.
- *
- * Linking this code with other modules is making a combined work
- * based on this code.  Thus, the terms and conditions of the GNU
- * General Public License cover the whole combination.
- *
- * As a special exception, the copyright holders of this code give
- * you permission to link this code with independent modules to
- * produce an executable, regardless of the license terms of these
- * independent modules, and to copy and distribute the resulting
- * executable under terms of your choice, provided that you also
- * meet, for each linked independent module, the terms and conditions
- * of the license of that module.  An independent module is a module
- * which is not derived from or based on this code.  If you modify
- * this code, you may extend this exception to your version of the
- * library, but you are not obligated to do so.  If you do not wish
- * to do so, delete this exception statement from your version.
- */
-package com.redhat.thermostat.common.command.internal.locale;
-
-public enum LocaleResources {
-    ARGUMENT_HEAP_ID_DESCRIPTION,
-    ARGUMENT_FILE_NAME_DESCRIPTION;
-
-    static final String RESOURCE_BUNDLE = "com.redhat.thermostat.common.command.internal.strings";
-}
--- a/common/command/src/main/java/com/redhat/thermostat/common/command/internal/locale/Translate.java	Wed Oct 10 18:52:45 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
- * Copyright 2012 Red Hat, Inc.
- *
- * This file is part of Thermostat.
- *
- * Thermostat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Thermostat is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Thermostat; see the file COPYING.  If not see
- * <http://www.gnu.org/licenses/>.
- *
- * Linking this code with other modules is making a combined work
- * based on this code.  Thus, the terms and conditions of the GNU
- * General Public License cover the whole combination.
- *
- * As a special exception, the copyright holders of this code give
- * you permission to link this code with independent modules to
- * produce an executable, regardless of the license terms of these
- * independent modules, and to copy and distribute the resulting
- * executable under terms of your choice, provided that you also
- * meet, for each linked independent module, the terms and conditions
- * of the license of that module.  An independent module is a module
- * which is not derived from or based on this code.  If you modify
- * this code, you may extend this exception to your version of the
- * library, but you are not obligated to do so.  If you do not wish
- * to do so, delete this exception statement from your version.
- */
-
-package com.redhat.thermostat.common.command.internal.locale;
-
-import java.text.MessageFormat;
-import java.util.ResourceBundle;
-
-public class Translate {
-
-    private static ResourceBundle resourceBundle = null;
-
-    static {
-        resourceBundle = ResourceBundle.getBundle(LocaleResources.RESOURCE_BUNDLE);
-    }
-
-    public static String localize(LocaleResources toTranslate) {
-        return resourceBundle.getString(toTranslate.name());
-    }
-
-    public static String localize(LocaleResources toTranslate, String... params) {
-        return MessageFormat.format(localize(toTranslate), (Object[]) params);
-    }
-
-}
--- a/common/command/src/main/resources/com/redhat/thermostat/common/command/internal/strings.properties	Wed Oct 10 18:52:45 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-ARGUMENT_HEAP_ID_DESCRIPTION = 
-ARGUMENT_FILE_NAME_DESCRIPTION = 
\ No newline at end of file
--- a/common/core/src/main/java/com/redhat/thermostat/common/locale/Translate.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/locale/Translate.java	Tue Oct 16 14:23:29 2012 -0400
@@ -39,15 +39,18 @@
 import java.text.MessageFormat;
 import java.util.ResourceBundle;
 
-
 public class Translate<T extends Enum<T>> {
 
-    private ResourceBundle resourceBundle = null;
+    private final ResourceBundle resourceBundle;
 
     public Translate(String stringResources, Class<T> enumClass) {
-        resourceBundle = ResourceBundle.getBundle(stringResources);
+        this(ResourceBundle.getBundle(stringResources), enumClass);
     }
-    
+
+    Translate(ResourceBundle resourceBundle, Class<T> enumClass) {
+        this.resourceBundle = resourceBundle;
+    }
+
     public String localize(T toTranslate) {
         return resourceBundle.getString(toTranslate.name());
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/core/src/test/java/com/redhat/thermostat/common/locale/LocaleResourcesTest.java	Tue Oct 16 14:23:29 2012 -0400
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2012 Red Hat, Inc.
+ *
+ * This file is part of Thermostat.
+ *
+ * Thermostat is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2, or (at your
+ * option) any later version.
+ *
+ * Thermostat is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Thermostat; see the file COPYING.  If not see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Linking this code with other modules is making a combined work
+ * based on this code.  Thus, the terms and conditions of the GNU
+ * General Public License cover the whole combination.
+ *
+ * As a special exception, the copyright holders of this code give
+ * you permission to link this code with independent modules to
+ * produce an executable, regardless of the license terms of these
+ * independent modules, and to copy and distribute the resulting
+ * executable under terms of your choice, provided that you also
+ * meet, for each linked independent module, the terms and conditions
+ * of the license of that module.  An independent module is a module
+ * which is not derived from or based on this code.  If you modify
+ * this code, you may extend this exception to your version of the
+ * library, but you are not obligated to do so.  If you do not wish
+ * to do so, delete this exception statement from your version.
+ */
+
+package com.redhat.thermostat.common.locale;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.junit.Test;
+
+public class LocaleResourcesTest {
+    @Test
+    public void testLocalizedStringsArePresent() throws IOException {
+        
+        String stringsResource = "/" + LocaleResources.RESOURCE_BUNDLE.replace(".", "/") + ".properties";
+        
+        Properties props = new Properties();
+        try (InputStream in = getClass().getResourceAsStream(stringsResource)) {
+            assertNotNull(in);
+            props.load(in);
+
+            assertEquals(LocaleResources.values().length, props.values().size());
+            for (LocaleResources resource : LocaleResources.values()) {
+                assertTrue("missing property from resource bound file: " + resource,
+                                  props.containsKey(resource.name()));
+            }
+            
+        }
+    }
+}
--- a/common/core/src/test/java/com/redhat/thermostat/common/locale/TranslateTest.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/common/core/src/test/java/com/redhat/thermostat/common/locale/TranslateTest.java	Tue Oct 16 14:23:29 2012 -0400
@@ -36,61 +36,52 @@
 
 package com.redhat.thermostat.common.locale;
 
-import java.io.IOException;
-import java.util.Locale;
-import java.util.Properties;
+import static org.junit.Assert.assertEquals;
 
-import junit.framework.Assert;
+import java.util.ListResourceBundle;
+import java.util.ResourceBundle;
 
-import org.junit.After;
-import org.junit.Before;
 import org.junit.Test;
 
 public class TranslateTest {
 
-    private Locale lang;
-    
-    @Before
-    public void setUp() {
-        this.lang = Locale.getDefault();
-        Locale.setDefault(Locale.US);
+    enum TestStrings {
+        SIMPLE_STRING,
+        STRING_WITH_PARAMETER,
     }
-    
-    @After
-    public void tearDown() {
-        Locale.setDefault(lang);
+
+    // Mockito can't mock the final method getMessage() which is what Translate
+    // uses. Create a mock the old-fashioned way.
+    private static class LocalizedResourceBundle extends ListResourceBundle {
+
+        private final Object[] contents;
+
+        public LocalizedResourceBundle(String key, String localizedString) {
+            contents = new Object[] { key, localizedString };
+        }
+
+        @Override
+        protected Object[][] getContents() {
+            return new Object[][] { contents };
+        }
     }
-    
+
     @Test
     public void testLocalizeWithoutArguments() {
-        String testString = LocaleResources.createLocalizer().localize(LocaleResources.MISSING_INFO);
-        Assert.assertEquals("Missing Information", testString);
+        ResourceBundle resources = new LocalizedResourceBundle(TestStrings.SIMPLE_STRING.name(), "Localized String");
+
+        Translate<TestStrings> translate = new Translate<>(resources, TestStrings.class);
+
+        assertEquals("Localized String", translate.localize(TestStrings.SIMPLE_STRING));
     }
-    
+
     @Test
     public void testLocalizeWithArguments() {
-        Translate<LocaleResources> t = LocaleResources.createLocalizer();
-        
-        String testString = t.localize(LocaleResources.APPLICATION_INFO_DESCRIPTION);
-        Assert.assertEquals("A monitoring and serviceability tool for OpenJDK",
-                            testString);
-        testString = t.localize(LocaleResources.APPLICATION_INFO_LICENSE);
-        Assert.assertEquals("Licensed under GPLv2+ with Classpath exception",
-                testString);
-    }
-    
-    @Test
-    public void testLocalizedStringsArePresent() throws IOException {
-        
-        String stringsResource = "/" + LocaleResources.RESOURCE_BUNDLE.replace(".", "/") + ".properties";
-        
-        Properties props = new Properties();
-        props.load(getClass().getResourceAsStream(stringsResource));
-        
-        Assert.assertEquals(LocaleResources.values().length, props.values().size());
-        for (LocaleResources resource : LocaleResources.values()) {
-            Assert.assertTrue("missing property from resource bound file: " + resource,
-                              props.containsKey(resource.name()));
-        }
+        ResourceBundle resources = new LocalizedResourceBundle(TestStrings.STRING_WITH_PARAMETER.name(), "Parameter: {0}");
+
+        Translate<TestStrings> translate = new Translate<>(resources, TestStrings.class);
+
+        assertEquals("Parameter: FOO", translate.localize(TestStrings.STRING_WITH_PARAMETER, "FOO"));
+
     }
 }
--- a/tools/src/main/java/com/redhat/thermostat/tools/LocaleResources.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/tools/src/main/java/com/redhat/thermostat/tools/LocaleResources.java	Tue Oct 16 14:23:29 2012 -0400
@@ -36,6 +36,8 @@
 
 package com.redhat.thermostat.tools;
 
+import com.redhat.thermostat.common.locale.Translate;
+
 public enum LocaleResources {
 
     MISSING_INFO,
@@ -77,4 +79,8 @@
     ;
 
     static final String RESOURCE_BUNDLE = "com.redhat.thermostat.tools.strings";
+
+    public static Translate<LocaleResources> createLocalizer() {
+        return new Translate<>(RESOURCE_BUNDLE, LocaleResources.class);
+    }
 }
--- a/tools/src/main/java/com/redhat/thermostat/tools/Translate.java	Wed Oct 10 18:52:45 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- * Copyright 2012 Red Hat, Inc.
- *
- * This file is part of Thermostat.
- *
- * Thermostat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Thermostat is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Thermostat; see the file COPYING.  If not see
- * <http://www.gnu.org/licenses/>.
- *
- * Linking this code with other modules is making a combined work
- * based on this code.  Thus, the terms and conditions of the GNU
- * General Public License cover the whole combination.
- *
- * As a special exception, the copyright holders of this code give
- * you permission to link this code with independent modules to
- * produce an executable, regardless of the license terms of these
- * independent modules, and to copy and distribute the resulting
- * executable under terms of your choice, provided that you also
- * meet, for each linked independent module, the terms and conditions
- * of the license of that module.  An independent module is a module
- * which is not derived from or based on this code.  If you modify
- * this code, you may extend this exception to your version of the
- * library, but you are not obligated to do so.  If you do not wish
- * to do so, delete this exception statement from your version.
- */
-
-package com.redhat.thermostat.tools;
-
-import java.text.MessageFormat;
-import java.util.ResourceBundle;
-
-public class Translate {
-
-    private static ResourceBundle resourceBundle = null;
-
-    static {
-        resourceBundle = ResourceBundle.getBundle(LocaleResources.RESOURCE_BUNDLE);
-    }
-
-    public static String localize(LocaleResources toTranslate) {
-        return resourceBundle.getString(toTranslate.name());
-    }
-
-    public static String localize(LocaleResources toTranslate, String... params) {
-        return MessageFormat.format(localize(toTranslate), (Object[]) params);
-    }
-}
--- a/tools/src/main/java/com/redhat/thermostat/tools/cli/ConnectCommand.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/tools/src/main/java/com/redhat/thermostat/tools/cli/ConnectCommand.java	Tue Oct 16 14:23:29 2012 -0400
@@ -42,13 +42,13 @@
 import com.redhat.thermostat.common.cli.CommandException;
 import com.redhat.thermostat.common.cli.SimpleCommand;
 import com.redhat.thermostat.common.config.ClientPreferences;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.storage.ConnectionException;
 import com.redhat.thermostat.common.utils.OSGIUtils;
 import com.redhat.thermostat.launcher.CommonCommandOptions;
 import com.redhat.thermostat.launcher.DbService;
 import com.redhat.thermostat.launcher.DbServiceFactory;
 import com.redhat.thermostat.tools.LocaleResources;
-import com.redhat.thermostat.tools.Translate;
 import com.redhat.thermostat.utils.keyring.Keyring;
 
 /**
@@ -61,6 +61,8 @@
  */
 public class ConnectCommand extends SimpleCommand {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private static final String NAME = "connect";
     
     private ClientPreferences prefs;
@@ -71,7 +73,7 @@
         DbService service = OSGIUtils.getInstance().getServiceAllowNull(DbService.class);
         if (service != null) {
             // Already connected, bail out
-            throw new CommandException(Translate.localize(LocaleResources.COMMAND_CONNECT_ALREADY_CONNECTED));
+            throw new CommandException(translator.localize(LocaleResources.COMMAND_CONNECT_ALREADY_CONNECTED));
         }
         if (prefs == null) {
             prefs = new ClientPreferences(OSGIUtils.getInstance().getService(Keyring.class));
@@ -86,7 +88,7 @@
         try {
             service.connect();
         } catch (ConnectionException ex) {
-            throw new CommandException(Translate.localize(LocaleResources.COMMAND_CONNECT_FAILED_TO_CONNECT, dbUrl), ex);
+            throw new CommandException(translator.localize(LocaleResources.COMMAND_CONNECT_FAILED_TO_CONNECT, dbUrl), ex);
         }
         ServiceRegistration registration = OSGIUtils.getInstance().registerService(DbService.class, service);
         service.setServiceRegistration(registration);
--- a/tools/src/main/java/com/redhat/thermostat/tools/cli/DisconnectCommand.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/tools/src/main/java/com/redhat/thermostat/tools/cli/DisconnectCommand.java	Tue Oct 16 14:23:29 2012 -0400
@@ -42,14 +42,16 @@
 import com.redhat.thermostat.common.cli.CommandContext;
 import com.redhat.thermostat.common.cli.CommandException;
 import com.redhat.thermostat.common.cli.SimpleCommand;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.storage.ConnectionException;
 import com.redhat.thermostat.common.utils.OSGIUtils;
 import com.redhat.thermostat.launcher.DbService;
 import com.redhat.thermostat.tools.LocaleResources;
-import com.redhat.thermostat.tools.Translate;
 
 public class DisconnectCommand extends SimpleCommand {
-    
+
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private static final String NAME = "disconnect";
 
     @SuppressWarnings("rawtypes")
@@ -58,12 +60,12 @@
         DbService service = OSGIUtils.getInstance().getServiceAllowNull(DbService.class);
         if (service == null) {
             // not connected
-            throw new CommandException(Translate.localize(LocaleResources.COMMAND_DISCONNECT_NOT_CONNECTED));
+            throw new CommandException(translator.localize(LocaleResources.COMMAND_DISCONNECT_NOT_CONNECTED));
         }
         try {
             service.disconnect();
         } catch (ConnectionException e) {
-            throw new CommandException(Translate.localize(LocaleResources.COMMAND_DISCONNECT_ERROR));
+            throw new CommandException(translator.localize(LocaleResources.COMMAND_DISCONNECT_ERROR));
         }
         // remove DB service
         ServiceRegistration registration = service.getServiceRegistration();
--- a/tools/src/main/java/com/redhat/thermostat/tools/cli/ListVMsCommand.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/tools/src/main/java/com/redhat/thermostat/tools/cli/ListVMsCommand.java	Tue Oct 16 14:23:29 2012 -0400
@@ -45,13 +45,15 @@
 import com.redhat.thermostat.common.dao.HostRef;
 import com.redhat.thermostat.common.dao.VmInfoDAO;
 import com.redhat.thermostat.common.dao.VmRef;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.model.VmInfo;
 import com.redhat.thermostat.common.utils.OSGIUtils;
 import com.redhat.thermostat.tools.LocaleResources;
-import com.redhat.thermostat.tools.Translate;
 
 public class ListVMsCommand extends SimpleCommand {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private static final String NAME = "list-vms";
 
     private final OSGIUtils serviceProvider;
@@ -69,14 +71,14 @@
 
         HostInfoDAO hostsDAO = serviceProvider.getServiceAllowNull(HostInfoDAO.class);
         if (hostsDAO == null) {
-            throw new CommandException(Translate.localize(LocaleResources.HOST_SERVICE_UNAVAILABLE));
+            throw new CommandException(translator.localize(LocaleResources.HOST_SERVICE_UNAVAILABLE));
         }
         Collection<HostRef> hosts = hostsDAO.getHosts();
         serviceProvider.ungetService(HostInfoDAO.class, hostsDAO);
 
         VmInfoDAO vmsDAO = serviceProvider.getServiceAllowNull(VmInfoDAO.class);
         if (vmsDAO == null) {
-            throw new CommandException(Translate.localize(LocaleResources.VM_SERVICE_UNAVAILABLE));
+            throw new CommandException(translator.localize(LocaleResources.VM_SERVICE_UNAVAILABLE));
         }
         VMListFormatter formatter = new VMListFormatter();
         for (HostRef host : hosts) {
--- a/tools/src/main/java/com/redhat/thermostat/tools/cli/VMInfoCommand.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/tools/src/main/java/com/redhat/thermostat/tools/cli/VMInfoCommand.java	Tue Oct 16 14:23:29 2012 -0400
@@ -49,15 +49,17 @@
 import com.redhat.thermostat.common.dao.HostRef;
 import com.redhat.thermostat.common.dao.VmInfoDAO;
 import com.redhat.thermostat.common.dao.VmRef;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.model.VmInfo;
 import com.redhat.thermostat.common.utils.OSGIUtils;
 import com.redhat.thermostat.tools.LocaleResources;
-import com.redhat.thermostat.tools.Translate;
 
 public class VMInfoCommand extends SimpleCommand {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private static final String NAME = "vm-info";
-    private static final String STILL_ALIVE = Translate.localize(LocaleResources.VM_STOP_TIME_RUNNING);
+    private static final String STILL_ALIVE = translator.localize(LocaleResources.VM_STOP_TIME_RUNNING);
 
     private OSGIUtils serviceProvider;
 
@@ -74,7 +76,7 @@
     public void run(CommandContext ctx) throws CommandException {
         VmInfoDAO vmsDAO = serviceProvider.getServiceAllowNull(VmInfoDAO.class);
         if (vmsDAO == null) {
-            throw new CommandException(Translate.localize(LocaleResources.VM_SERVICE_UNAVAILABLE));
+            throw new CommandException(translator.localize(LocaleResources.VM_SERVICE_UNAVAILABLE));
         }
 
         HostVMArguments hostVMArgs = new HostVMArguments(ctx.getArguments(), true, false);
@@ -106,18 +108,18 @@
         VmInfo vmInfo = vmsDAO.getVmInfo(vm);
 
         TableRenderer table = new TableRenderer(2);
-        table.printLine(Translate.localize(LocaleResources.VM_INFO_PROCESS_ID), String.valueOf(vmInfo.getVmPid()));
-        table.printLine(Translate.localize(LocaleResources.VM_INFO_START_TIME), new Date(vmInfo.getStartTimeStamp()).toString());
+        table.printLine(translator.localize(LocaleResources.VM_INFO_PROCESS_ID), String.valueOf(vmInfo.getVmPid()));
+        table.printLine(translator.localize(LocaleResources.VM_INFO_START_TIME), new Date(vmInfo.getStartTimeStamp()).toString());
         if (vmInfo.isAlive()) {
-            table.printLine(Translate.localize(LocaleResources.VM_INFO_STOP_TIME), STILL_ALIVE);
+            table.printLine(translator.localize(LocaleResources.VM_INFO_STOP_TIME), STILL_ALIVE);
         } else {
-            table.printLine(Translate.localize(LocaleResources.VM_INFO_STOP_TIME), new Date(vmInfo.getStopTimeStamp()).toString());
+            table.printLine(translator.localize(LocaleResources.VM_INFO_STOP_TIME), new Date(vmInfo.getStopTimeStamp()).toString());
         }
-        table.printLine(Translate.localize(LocaleResources.VM_INFO_MAIN_CLASS), vmInfo.getMainClass());
-        table.printLine(Translate.localize(LocaleResources.VM_INFO_COMMAND_LINE), vmInfo.getJavaCommandLine());
-        table.printLine(Translate.localize(LocaleResources.VM_INFO_JAVA_VERSION), vmInfo.getJavaVersion());
-        table.printLine(Translate.localize(LocaleResources.VM_INFO_VIRTUAL_MACHINE), vmInfo.getVmName());
-        table.printLine(Translate.localize(LocaleResources.VM_INFO_VM_ARGUMENTS), vmInfo.getVmArguments());
+        table.printLine(translator.localize(LocaleResources.VM_INFO_MAIN_CLASS), vmInfo.getMainClass());
+        table.printLine(translator.localize(LocaleResources.VM_INFO_COMMAND_LINE), vmInfo.getJavaCommandLine());
+        table.printLine(translator.localize(LocaleResources.VM_INFO_JAVA_VERSION), vmInfo.getJavaVersion());
+        table.printLine(translator.localize(LocaleResources.VM_INFO_VIRTUAL_MACHINE), vmInfo.getVmName());
+        table.printLine(translator.localize(LocaleResources.VM_INFO_VM_ARGUMENTS), vmInfo.getVmArguments());
 
         PrintStream out = ctx.getConsole().getOutput();
         table.render(out);
--- a/tools/src/main/java/com/redhat/thermostat/tools/cli/VMListFormatter.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/tools/src/main/java/com/redhat/thermostat/tools/cli/VMListFormatter.java	Tue Oct 16 14:23:29 2012 -0400
@@ -40,20 +40,22 @@
 
 import com.redhat.thermostat.common.cli.TableRenderer;
 import com.redhat.thermostat.common.dao.VmRef;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.model.VmInfo;
 import com.redhat.thermostat.tools.LocaleResources;
-import com.redhat.thermostat.tools.Translate;
 
 class VMListFormatter {
 
-    private static final String HOST_ID = Translate.localize(LocaleResources.COLUMN_HEADER_HOST_ID);
-    private static final String HOST = Translate.localize(LocaleResources.COLUMN_HEADER_HOST);
-    private static final String VM_ID = Translate.localize(LocaleResources.COLUMN_HEADER_VM_ID);
-    private static final String VM_NAME = Translate.localize(LocaleResources.COLUMN_HEADER_VM_NAME);
-    private static final String VM_STATUS = Translate.localize(LocaleResources.COLUMN_HEADER_VM_STATUS);
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
 
-    private static final String STATUS_ALIVE = Translate.localize(LocaleResources.VM_STATUS_ALIVE);
-    private static final String STATUS_DEAD = Translate.localize(LocaleResources.VM_STATUS_DEAD);
+    private static final String HOST_ID = translator.localize(LocaleResources.COLUMN_HEADER_HOST_ID);
+    private static final String HOST = translator.localize(LocaleResources.COLUMN_HEADER_HOST);
+    private static final String VM_ID = translator.localize(LocaleResources.COLUMN_HEADER_VM_ID);
+    private static final String VM_NAME = translator.localize(LocaleResources.COLUMN_HEADER_VM_NAME);
+    private static final String VM_STATUS = translator.localize(LocaleResources.COLUMN_HEADER_VM_STATUS);
+
+    private static final String STATUS_ALIVE = translator.localize(LocaleResources.VM_STATUS_ALIVE);
+    private static final String STATUS_DEAD = translator.localize(LocaleResources.VM_STATUS_DEAD);
 
     private TableRenderer tableRenderer;
 
--- a/tools/src/main/java/com/redhat/thermostat/tools/cli/VMStatCommand.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/tools/src/main/java/com/redhat/thermostat/tools/cli/VMStatCommand.java	Tue Oct 16 14:23:29 2012 -0400
@@ -51,12 +51,14 @@
 import com.redhat.thermostat.common.dao.VmCpuStatDAO;
 import com.redhat.thermostat.common.dao.VmMemoryStatDAO;
 import com.redhat.thermostat.common.dao.VmRef;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.utils.OSGIUtils;
 import com.redhat.thermostat.tools.LocaleResources;
-import com.redhat.thermostat.tools.Translate;
 
 public class VMStatCommand extends SimpleCommand {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private static final Logger log = Logger.getLogger(VMStatCommand.class.getName());
 
     private static final String CMD_NAME = "vm-stat";
@@ -75,12 +77,12 @@
     public void run(final CommandContext ctx) throws CommandException {
         VmCpuStatDAO vmCpuStatDAO = serviceProvider.getServiceAllowNull(VmCpuStatDAO.class);
         if (vmCpuStatDAO == null) {
-            throw new CommandException(Translate.localize(LocaleResources.VM_CPU_SERVICE_NOT_AVAILABLE));
+            throw new CommandException(translator.localize(LocaleResources.VM_CPU_SERVICE_NOT_AVAILABLE));
         }
 
         VmMemoryStatDAO vmMemoryStatDAO = serviceProvider.getServiceAllowNull(VmMemoryStatDAO.class);
         if (vmMemoryStatDAO == null) {
-            throw new CommandException(Translate.localize(LocaleResources.VM_MEMORY_SERVICE_NOT_AVAILABLE));
+            throw new CommandException(translator.localize(LocaleResources.VM_MEMORY_SERVICE_NOT_AVAILABLE));
         }
 
         HostVMArguments hostVMArgs = new HostVMArguments(ctx.getArguments());
--- a/tools/src/main/java/com/redhat/thermostat/tools/cli/VMStatPrinter.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/tools/src/main/java/com/redhat/thermostat/tools/cli/VMStatPrinter.java	Tue Oct 16 14:23:29 2012 -0400
@@ -51,6 +51,7 @@
 import com.redhat.thermostat.common.dao.VmCpuStatDAO;
 import com.redhat.thermostat.common.dao.VmMemoryStatDAO;
 import com.redhat.thermostat.common.dao.VmRef;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.model.TimeStampedPojo;
 import com.redhat.thermostat.common.model.TimeStampedPojoComparator;
 import com.redhat.thermostat.common.model.TimeStampedPojoCorrelator;
@@ -58,12 +59,13 @@
 import com.redhat.thermostat.common.model.VmMemoryStat;
 import com.redhat.thermostat.common.utils.DisplayableValues;
 import com.redhat.thermostat.tools.LocaleResources;
-import com.redhat.thermostat.tools.Translate;
 
 class VMStatPrinter {
 
-    private static final String CPU_PERCENT = Translate.localize(LocaleResources.COLUMN_HEADER_CPU_PERCENT);
-    private static final String TIME = Translate.localize(LocaleResources.COLUMN_HEADER_TIME);
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
+    private static final String CPU_PERCENT = translator.localize(LocaleResources.COLUMN_HEADER_CPU_PERCENT);
+    private static final String TIME = translator.localize(LocaleResources.COLUMN_HEADER_TIME);
 
     private VmRef vm;
     private VmCpuStatDAO vmCpuStatDAO;
@@ -161,7 +163,7 @@
         for (VmMemoryStat.Generation gen : vmMemoryStat.getGenerations()) {
             for (VmMemoryStat.Space space : gen.spaces) {
                 String[] displayableSize = DisplayableValues.bytes(space.used);
-                memoryUsage[i] = Translate.localize(LocaleResources.VALUE_AND_UNIT, displayableSize[0], displayableSize[1]);
+                memoryUsage[i] = translator.localize(LocaleResources.VALUE_AND_UNIT, displayableSize[0], displayableSize[1]);
                 i++;
             }
         }
@@ -177,7 +179,7 @@
         int i = 0;
         for (VmMemoryStat.Generation gen : stat.getGenerations()) {
             for (VmMemoryStat.Space space : gen.spaces) {
-                spacesNames[i] = Translate.localize(LocaleResources.COLUMN_HEADER_MEMORY_PATTERN, space.name);
+                spacesNames[i] = translator.localize(LocaleResources.COLUMN_HEADER_MEMORY_PATTERN, space.name);
                 i++;
             }
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/src/test/java/com/redhat/thermostat/tools/LocaleResourcesTest.java	Tue Oct 16 14:23:29 2012 -0400
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2012 Red Hat, Inc.
+ *
+ * This file is part of Thermostat.
+ *
+ * Thermostat is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2, or (at your
+ * option) any later version.
+ *
+ * Thermostat is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Thermostat; see the file COPYING.  If not see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Linking this code with other modules is making a combined work
+ * based on this code.  Thus, the terms and conditions of the GNU
+ * General Public License cover the whole combination.
+ *
+ * As a special exception, the copyright holders of this code give
+ * you permission to link this code with independent modules to
+ * produce an executable, regardless of the license terms of these
+ * independent modules, and to copy and distribute the resulting
+ * executable under terms of your choice, provided that you also
+ * meet, for each linked independent module, the terms and conditions
+ * of the license of that module.  An independent module is a module
+ * which is not derived from or based on this code.  If you modify
+ * this code, you may extend this exception to your version of the
+ * library, but you are not obligated to do so.  If you do not wish
+ * to do so, delete this exception statement from your version.
+ */
+
+package com.redhat.thermostat.tools;
+
+import java.io.IOException;
+import java.util.Properties;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+
+public class LocaleResourcesTest {
+
+    @Test
+    public void testLocalizedStringsArePresent() throws IOException {
+
+        String stringsResource = "/" + LocaleResources.RESOURCE_BUNDLE.replace(".", "/") + ".properties";
+
+        Properties props = new Properties();
+        props.load(getClass().getResourceAsStream(stringsResource));
+
+        Assert.assertEquals(LocaleResources.values().length, props.values().size());
+        for (LocaleResources resource : LocaleResources.values()) {
+            Assert.assertTrue("missing property from resource bound file: " + resource,
+                              props.containsKey(resource.name()));
+        }
+    }
+}
--- a/tools/src/test/java/com/redhat/thermostat/tools/TranslateTest.java	Wed Oct 10 18:52:45 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-/*
- * Copyright 2012 Red Hat, Inc.
- *
- * This file is part of Thermostat.
- *
- * Thermostat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Thermostat is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Thermostat; see the file COPYING.  If not see
- * <http://www.gnu.org/licenses/>.
- *
- * Linking this code with other modules is making a combined work
- * based on this code.  Thus, the terms and conditions of the GNU
- * General Public License cover the whole combination.
- *
- * As a special exception, the copyright holders of this code give
- * you permission to link this code with independent modules to
- * produce an executable, regardless of the license terms of these
- * independent modules, and to copy and distribute the resulting
- * executable under terms of your choice, provided that you also
- * meet, for each linked independent module, the terms and conditions
- * of the license of that module.  An independent module is a module
- * which is not derived from or based on this code.  If you modify
- * this code, you may extend this exception to your version of the
- * library, but you are not obligated to do so.  If you do not wish
- * to do so, delete this exception statement from your version.
- */
-
-package com.redhat.thermostat.tools;
-
-import java.io.IOException;
-import java.util.Locale;
-import java.util.Properties;
-
-import junit.framework.Assert;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import static com.redhat.thermostat.tools.Translate.localize;
-
-public class TranslateTest {
-
-    private Locale lang;
-
-    @Before
-    public void setUp() {
-        this.lang = Locale.getDefault();
-        Locale.setDefault(Locale.US);
-    }
-
-    @After
-    public void tearDown() {
-        Locale.setDefault(lang);
-    }
-
-    @Test
-    public void testLocalizeWithoutArguments() {
-        String testString = localize(LocaleResources.MISSING_INFO);
-        Assert.assertEquals("Missing Information", testString);
-    }
-
-    @Test
-    public void testLocalizedStringsArePresent() throws IOException {
-
-        String stringsResource = "/" + LocaleResources.RESOURCE_BUNDLE.replace(".", "/") + ".properties";
-
-        Properties props = new Properties();
-        props.load(getClass().getResourceAsStream(stringsResource));
-
-        Assert.assertEquals(LocaleResources.values().length, props.values().size());
-        for (LocaleResources resource : LocaleResources.values()) {
-            Assert.assertTrue("missing property from resource bound file: " + resource,
-                              props.containsKey(resource.name()));
-        }
-    }
-}
--- a/tools/src/test/java/com/redhat/thermostat/tools/cli/ConnectCommandTest.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/tools/src/test/java/com/redhat/thermostat/tools/cli/ConnectCommandTest.java	Tue Oct 16 14:23:29 2012 -0400
@@ -64,18 +64,20 @@
 import com.redhat.thermostat.common.cli.CommandContext;
 import com.redhat.thermostat.common.cli.CommandException;
 import com.redhat.thermostat.common.cli.SimpleArguments;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.utils.OSGIUtils;
 import com.redhat.thermostat.launcher.CommonCommandOptions;
 import com.redhat.thermostat.launcher.DbService;
 import com.redhat.thermostat.launcher.DbServiceFactory;
 import com.redhat.thermostat.test.TestCommandContextFactory;
 import com.redhat.thermostat.tools.LocaleResources;
-import com.redhat.thermostat.tools.Translate;
 
 @RunWith(PowerMockRunner.class)
 @PrepareForTest({ OSGIUtils.class, DbServiceFactory.class })
 public class ConnectCommandTest {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private ConnectCommand cmd;
     private TestCommandContextFactory cmdCtxFactory;
     private BundleContext bundleContext;
@@ -116,7 +118,7 @@
         try {
             cmd.run(cmdCtxFactory.createContext(args));
         } catch (CommandException e) {
-            assertEquals(Translate.localize(LocaleResources.COMMAND_CONNECT_ALREADY_CONNECTED), e.getMessage());
+            assertEquals(translator.localize(LocaleResources.COMMAND_CONNECT_ALREADY_CONNECTED), e.getMessage());
         }
     }
     
--- a/tools/src/test/java/com/redhat/thermostat/tools/cli/DisconnectCommandTest.java	Wed Oct 10 18:52:45 2012 +0200
+++ b/tools/src/test/java/com/redhat/thermostat/tools/cli/DisconnectCommandTest.java	Tue Oct 16 14:23:29 2012 -0400
@@ -62,16 +62,18 @@
 import com.redhat.thermostat.common.cli.CommandContext;
 import com.redhat.thermostat.common.cli.CommandException;
 import com.redhat.thermostat.common.cli.SimpleArguments;
+import com.redhat.thermostat.common.locale.Translate;
 import com.redhat.thermostat.common.utils.OSGIUtils;
 import com.redhat.thermostat.launcher.DbService;
 import com.redhat.thermostat.test.TestCommandContextFactory;
 import com.redhat.thermostat.tools.LocaleResources;
-import com.redhat.thermostat.tools.Translate;
 
 @RunWith(PowerMockRunner.class)
 @PrepareForTest({ OSGIUtils.class, FrameworkUtil.class })
 public class DisconnectCommandTest {
 
+    private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
+
     private DisconnectCommand cmd;
     private TestCommandContextFactory cmdCtxFactory;
     private BundleContext bundleContext;
@@ -110,7 +112,7 @@
             cmd.run(cmdCtxFactory.createContext(new SimpleArguments()));
             fail("cmd.run() should have thrown exception.");
         } catch (CommandException e) {
-            assertEquals(Translate.localize(LocaleResources.COMMAND_DISCONNECT_NOT_CONNECTED), e.getMessage());
+            assertEquals(translator.localize(LocaleResources.COMMAND_DISCONNECT_NOT_CONNECTED), e.getMessage());
         }
     }