changeset 933:102f62b0715a

Merge
author Roman Kennke <rkennke@redhat.com>
date Fri, 25 Jan 2013 17:43:23 +0100
parents 9444814349bd (current diff) a01bd1646437 (diff)
children 4290490a2e05
files common/core/src/main/java/com/redhat/thermostat/common/Configuration.java common/core/src/main/java/com/redhat/thermostat/common/ConfigurationException.java common/core/src/main/java/com/redhat/thermostat/common/config/ConfigUtils.java common/core/src/test/java/com/redhat/thermostat/common/ConfigurationTest.java common/core/src/test/java/com/redhat/thermostat/common/config/ConfigUtilsTest.java
diffstat 20 files changed, 240 insertions(+), 481 deletions(-) [+]
line wrap: on
line diff
--- a/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/impl/db/StorageCommand.java	Fri Jan 25 17:42:53 2013 +0100
+++ b/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/impl/db/StorageCommand.java	Fri Jan 25 17:43:23 2013 +0100
@@ -42,7 +42,7 @@
 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.config.ConfigUtils;
+import com.redhat.thermostat.common.config.Configuration;
 import com.redhat.thermostat.common.config.InvalidConfigurationException;
 import com.redhat.thermostat.common.tools.ApplicationException;
 import com.redhat.thermostat.common.tools.ApplicationState;
@@ -59,10 +59,11 @@
     
     private void parseArguments(Arguments args) throws InvalidConfigurationException {
     
-        File dbPath = ConfigUtils.getStorageDirectory();
-        File logFile = ConfigUtils.getStorageLogFile();
-        File pidFile = ConfigUtils.getStoragePidFile();
-        File propertyFile = ConfigUtils.getStorageConfigurationFile();
+        Configuration thermostatConfiguration = new Configuration();
+        File dbPath = thermostatConfiguration.getStorageDirectory();
+        File logFile = thermostatConfiguration.getStorageLogFile();
+        File pidFile = thermostatConfiguration.getStoragePidFile();
+        File propertyFile = thermostatConfiguration.getStorageConfigurationFile();
         if (!propertyFile.exists()) {
             throw new InvalidConfigurationException("can't access database configuration file " +
                                                     propertyFile);
--- a/agent/core/src/main/java/com/redhat/thermostat/agent/config/AgentConfigsUtils.java	Fri Jan 25 17:42:53 2013 +0100
+++ b/agent/core/src/main/java/com/redhat/thermostat/agent/config/AgentConfigsUtils.java	Fri Jan 25 17:43:23 2013 +0100
@@ -41,7 +41,7 @@
 import java.io.IOException;
 import java.util.Properties;
 
-import com.redhat.thermostat.common.config.ConfigUtils;
+import com.redhat.thermostat.common.config.Configuration;
 import com.redhat.thermostat.common.config.InvalidConfigurationException;
 
 public class AgentConfigsUtils {
@@ -50,7 +50,7 @@
         
         AgentStartupConfiguration config = new AgentStartupConfiguration();
         
-        File propertyFile = ConfigUtils.getAgentConfigurationFile();
+        File propertyFile = new Configuration().getAgentConfigurationFile();
         readAndSetProperties(propertyFile, config);
         
         return config;
--- a/client/cli/src/main/java/com/redhat/thermostat/client/cli/internal/ShellCommand.java	Fri Jan 25 17:42:53 2013 +0100
+++ b/client/cli/src/main/java/com/redhat/thermostat/client/cli/internal/ShellCommand.java	Fri Jan 25 17:43:23 2013 +0100
@@ -56,7 +56,7 @@
 import com.redhat.thermostat.common.cli.CommandException;
 import com.redhat.thermostat.common.cli.Console;
 import com.redhat.thermostat.common.cli.SimpleCommand;
-import com.redhat.thermostat.common.config.ConfigUtils;
+import com.redhat.thermostat.common.config.Configuration;
 import com.redhat.thermostat.common.config.InvalidConfigurationException;
 import com.redhat.thermostat.common.utils.LoggingUtils;
 import com.redhat.thermostat.launcher.Launcher;
@@ -79,7 +79,7 @@
         public PersistentHistory get() {
             PersistentHistory history = null;
             try {
-                history = new FileHistory(ConfigUtils.getHistoryFile());
+                history = new FileHistory(new Configuration().getHistoryFile());
             } catch (InvalidConfigurationException | IOException e) {
                 /* no history available */
             }
--- a/common/core/src/main/java/com/redhat/thermostat/common/Configuration.java	Fri Jan 25 17:42:53 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +0,0 @@
-/*
- * Copyright 2012, 2013 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;
-
-import java.io.File;
-
-/*
- * This is a duplicate of com.redhat.thermostat.common.config.ConfigUtils
- * TODO: expose this as an OSGI service and remove the copy in config
- *  _or_
- * remove this; somehow tell the launcher to figure out where it can find files
- * and bundles and expose the real ConfigUtils as an OSGI service.
- */
-public class Configuration {
-
-    private static final String THERMOSTAT_USER_DIR = ".thermostat";
-
-    private final String home;
-    private boolean printOSGiInfo;
-
-    public Configuration() throws ConfigurationException {
-        // allow this to be specified also as a property, especially for
-        // tests, this overrides the env setting
-        String home = System.getProperty("THERMOSTAT_HOME");
-        if (home == null) {
-            home = System.getenv("THERMOSTAT_HOME");
-        }
-        if (home == null) {
-            throw new ConfigurationException("THERMOSTAT_HOME is not defined as either Java property or environment variable.  Cannot proceed.");
-        }
-        this.home = home;
-        printOSGiInfo = false;
-    }
-
-    public String getThermostatHome() {
-        return home;
-    }
-
-    public String getThermostatUserHome() {
-        String home = System.getProperty("user.home");
-        return home + File.separator + THERMOSTAT_USER_DIR;
-    }
-
-    public File getStorageBaseDirectory() throws ConfigurationException {
-        String loc = getThermostatHome() + File.separatorChar + "storage";
-        File file = new File(loc);
-        return file;
-    }
-
-    public File getStorageDirectory() throws ConfigurationException {
-        return new File(getStorageBaseDirectory(), "db");
-    }
-
-    public File getStorageConfigurationFile() throws ConfigurationException {
-        return new File(getStorageBaseDirectory(), "db.properties");
-    }
-
-    public File getStorageLogFile() throws ConfigurationException {
-        File logDir = new File(getStorageBaseDirectory(), "logs");
-        File logFile = new File(logDir, "db.log");
-
-        return logFile;
-    }
-
-    public File getStoragePidFile() throws ConfigurationException {
-        File logDir = new File(getStorageBaseDirectory(), "run");
-        File logFile = new File(logDir, "db.pid");
-
-        return logFile;
-    }
-
-    public File getAgentConfigurationFile() throws ConfigurationException {
-        File agent = new File(getThermostatHome(), "agent");
-        return new File(agent, "agent.properties");
-    }
-
-    public boolean getPrintOSGiInfo() {
-        return printOSGiInfo;
-    }
-
-    public void setPrintOSGiInfo(boolean newValue) {
-        printOSGiInfo = newValue;
-    }
-}
-
--- a/common/core/src/main/java/com/redhat/thermostat/common/ConfigurationException.java	Fri Jan 25 17:42:53 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- * Copyright 2012, 2013 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;
-
-public class ConfigurationException extends Exception {
-
-    public ConfigurationException() {
-        super();
-    }
-
-    public ConfigurationException(String message) {
-        super(message);
-    }
-
-    public ConfigurationException(Throwable throwable) {
-        super(throwable);
-    }
-
-    public ConfigurationException(String message, Throwable throwable) {
-        super(message,throwable);
-    }
-}
-
--- a/common/core/src/main/java/com/redhat/thermostat/common/config/ConfigUtils.java	Fri Jan 25 17:42:53 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-/*
- * Copyright 2012, 2013 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.config;
-
-import java.io.File;
-
-public class ConfigUtils {
-
-    private static final String THERMOSTAT_USER_DIR = ".thermostat";
-
-    public static String getThermostatHome() throws InvalidConfigurationException {
-        // allow this to be specified also as a property, especially for
-        // tests, this overrides the env setting
-        String home = System.getProperty("THERMOSTAT_HOME");
-        if (home == null) {
-            home = System.getenv("THERMOSTAT_HOME");
-        }
-        
-        if (home == null) {
-            throw new InvalidConfigurationException("THERMOSTAT_HOME not defined...");
-        }
-        return home;
-    }
-
-    public static String getThermostatUserHome() {
-        String home = System.getProperty("user.home");
-        return home + File.separator + THERMOSTAT_USER_DIR;
-    }
-
-    public static File getBackendsBaseDirectory() throws InvalidConfigurationException {
-        String loc = getThermostatHome() + File.separatorChar + "backends";
-        File file = new File(loc);
-        return file;
-    }
-    
-    public static File getStorageBaseDirectory() throws InvalidConfigurationException {
-        String loc = getThermostatHome() + File.separatorChar + "storage";
-        File file = new File(loc);
-        return file;
-    }
-    
-    public static File getStorageDirectory() throws InvalidConfigurationException {
-        return new File(getStorageBaseDirectory(), "db");
-    }
-    
-    public static File getStorageConfigurationFile() throws InvalidConfigurationException {
-        return new File(getStorageBaseDirectory(), "db.properties");
-    }
-
-    public static File getStorageLogFile() throws InvalidConfigurationException {
-        File logDir = new File(getStorageBaseDirectory(), "logs");
-        File logFile = new File(logDir, "db.log");
-        
-        return logFile;
-    }
-
-    public static File getStoragePidFile() throws InvalidConfigurationException {
-        File logDir = new File(getStorageBaseDirectory(), "run");
-        File logFile = new File(logDir, "db.pid");
-        
-        return logFile;
-    }
-
-    public static File getAgentConfigurationFile() throws InvalidConfigurationException {
-
-        File agent = new File(getThermostatHome(), "agent");
-        return new File(agent, "agent.properties");
-    }
-
-    public static File getClientConfigurationDirectory() throws InvalidConfigurationException {
-        File client = new File(getThermostatHome(), "client");
-        return client;
-    }
-
-    public static File getHistoryFile() throws InvalidConfigurationException {
-        File history = new File(getClientConfigurationDirectory(), "cli-history");
-        return history;
-    }
-}
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/core/src/main/java/com/redhat/thermostat/common/config/Configuration.java	Fri Jan 25 17:43:23 2013 +0100
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2012, 2013 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.config;
+
+import java.io.File;
+
+public class Configuration {
+
+    private static final String THERMOSTAT_USER_DIR = ".thermostat";
+
+    private String home;
+    private boolean printOsgiInfo = false;
+
+    public Configuration() throws InvalidConfigurationException {
+        // allow this to be specified also as a property, especially for
+        // tests, this overrides the env setting
+        String home = System.getProperty("THERMOSTAT_HOME");
+        if (home == null) {
+            home = System.getenv("THERMOSTAT_HOME");
+        }
+        
+        if (home == null) {
+            throw new InvalidConfigurationException("THERMOSTAT_HOME not defined...");
+        }
+        this.home = home;
+    }
+
+    public String getThermostatHome() throws InvalidConfigurationException {
+        return home;
+    }
+
+    public String getThermostatUserHome() {
+        String home = System.getProperty("user.home");
+        return home + File.separator + THERMOSTAT_USER_DIR;
+    }
+
+    public File getBackendsBaseDirectory() throws InvalidConfigurationException {
+        String loc = getThermostatHome() + File.separatorChar + "backends";
+        File file = new File(loc);
+        return file;
+    }
+    
+    public File getStorageBaseDirectory() throws InvalidConfigurationException {
+        String loc = getThermostatHome() + File.separatorChar + "storage";
+        File file = new File(loc);
+        return file;
+    }
+    
+    public File getStorageDirectory() throws InvalidConfigurationException {
+        return new File(getStorageBaseDirectory(), "db");
+    }
+    
+    public File getStorageConfigurationFile() throws InvalidConfigurationException {
+        return new File(getStorageBaseDirectory(), "db.properties");
+    }
+
+    public File getStorageLogFile() throws InvalidConfigurationException {
+        File logDir = new File(getStorageBaseDirectory(), "logs");
+        File logFile = new File(logDir, "db.log");
+        
+        return logFile;
+    }
+
+    public File getStoragePidFile() throws InvalidConfigurationException {
+        File logDir = new File(getStorageBaseDirectory(), "run");
+        File logFile = new File(logDir, "db.pid");
+        
+        return logFile;
+    }
+
+    public File getAgentConfigurationFile() throws InvalidConfigurationException {
+
+        File agent = new File(getThermostatHome(), "agent");
+        return new File(agent, "agent.properties");
+    }
+
+    public File getClientConfigurationDirectory() throws InvalidConfigurationException {
+        File client = new File(getThermostatHome(), "client");
+        return client;
+    }
+
+    public File getHistoryFile() throws InvalidConfigurationException {
+        File history = new File(getClientConfigurationDirectory(), "cli-history");
+        return history;
+    }
+
+    public boolean getPrintOSGiInfo() {
+        return printOsgiInfo;
+    }
+
+    public void setPrintOSGiInfo(boolean newValue) {
+        printOsgiInfo = newValue;
+    }
+}
+
--- a/common/core/src/main/java/com/redhat/thermostat/common/config/InvalidConfigurationException.java	Fri Jan 25 17:42:53 2013 +0100
+++ b/common/core/src/main/java/com/redhat/thermostat/common/config/InvalidConfigurationException.java	Fri Jan 25 17:43:23 2013 +0100
@@ -37,7 +37,7 @@
 package com.redhat.thermostat.common.config;
 
 
-public class InvalidConfigurationException extends Exception {
+public class InvalidConfigurationException extends RuntimeException {
 
     private static final long serialVersionUID = -6555406006758264587L;
 
--- a/common/core/src/main/java/com/redhat/thermostat/common/ssl/SSLKeystoreConfiguration.java	Fri Jan 25 17:42:53 2013 +0100
+++ b/common/core/src/main/java/com/redhat/thermostat/common/ssl/SSLKeystoreConfiguration.java	Fri Jan 25 17:43:23 2013 +0100
@@ -41,7 +41,7 @@
 import java.io.IOException;
 import java.util.Properties;
 
-import com.redhat.thermostat.common.config.ConfigUtils;
+import com.redhat.thermostat.common.config.Configuration;
 import com.redhat.thermostat.common.config.InvalidConfigurationException;
 
 public class SSLKeystoreConfiguration {
@@ -128,7 +128,7 @@
     private static void loadClientProperties()
             throws InvalidConfigurationException {
         if (clientProps == null) {
-            File thermostatEtcDir = new File(ConfigUtils.getThermostatHome(),
+            File thermostatEtcDir = new File(new Configuration().getThermostatHome(),
                     "etc");
             File clientPropertiesFile = new File(thermostatEtcDir,
                     "ssl.properties");
--- a/common/core/src/main/java/com/redhat/thermostat/common/utils/LoggingUtils.java	Fri Jan 25 17:42:53 2013 +0100
+++ b/common/core/src/main/java/com/redhat/thermostat/common/utils/LoggingUtils.java	Fri Jan 25 17:43:23 2013 +0100
@@ -47,7 +47,7 @@
 import java.util.logging.Logger;
 
 import com.redhat.thermostat.common.LogFormatter;
-import com.redhat.thermostat.common.config.ConfigUtils;
+import com.redhat.thermostat.common.config.Configuration;
 import com.redhat.thermostat.common.config.InvalidConfigurationException;
 
 /**
@@ -119,14 +119,14 @@
     }
 
     public static void loadGlobalLoggingConfig() throws InvalidConfigurationException {
-        File thermostatEtcDir = new File(ConfigUtils.getThermostatHome(), "etc");
+        File thermostatEtcDir = new File(new Configuration().getThermostatHome(), "etc");
         File loggingPropertiesFile = new File(thermostatEtcDir, "logging.properties");
         loadConfig(loggingPropertiesFile);
     }
     
 
     public static void loadUserLoggingConfig() throws InvalidConfigurationException {
-        File thermostatUserDir = new File(ConfigUtils.getThermostatUserHome());
+        File thermostatUserDir = new File(new Configuration().getThermostatUserHome());
         File loggingPropertiesFile = new File(thermostatUserDir, "logging.properties");
         loadConfig(loggingPropertiesFile);
     }
--- a/common/core/src/test/java/com/redhat/thermostat/common/ConfigurationTest.java	Fri Jan 25 17:42:53 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
- * Copyright 2012, 2013 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;
-
-import java.io.File;
-import java.io.IOException;
-
-import junit.framework.Assert;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class ConfigurationTest {
-
-    @Before
-    public void setUp() throws IOException {
-        System.setProperty("THERMOSTAT_HOME", "/tmp/");
-    }
-
-    @Test
-    public void testLocations() throws ConfigurationException, IOException {
-        String path = System.getProperty("THERMOSTAT_HOME");
-        char s = File.separatorChar;
-
-        Configuration config = new Configuration();
-
-        Assert.assertEquals(path, config.getThermostatHome());
-
-        Assert.assertEquals(path + "agent" + s + "agent.properties",
-                            config.getAgentConfigurationFile().getCanonicalPath());
-        Assert.assertEquals(path + "storage", config.getStorageBaseDirectory().getCanonicalPath());
-        Assert.assertEquals(path + "storage" + s + "db.properties",
-                            config.getStorageConfigurationFile().getCanonicalPath());
-        Assert.assertEquals(path + "storage" + s + "db",
-                config.getStorageDirectory().getCanonicalPath());
-        Assert.assertEquals(path + "storage" + s + "logs" + s + "db.log",
-                config.getStorageLogFile().getCanonicalPath());
-        Assert.assertEquals(path + "storage" + s + "run" + s + "db.pid",
-                config.getStoragePidFile().getCanonicalPath());
-
-    }
-}
-
--- a/common/core/src/test/java/com/redhat/thermostat/common/config/ConfigUtilsTest.java	Fri Jan 25 17:42:53 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
- * Copyright 2012, 2013 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.config;
-
-import java.io.File;
-import java.io.IOException;
-
-import junit.framework.Assert;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class ConfigUtilsTest {
-    
-    @Before
-    public void setUp() throws IOException {
-        System.setProperty("THERMOSTAT_HOME", "/tmp/");
-    }
-    
-    @Test
-    public void testLocations() throws InvalidConfigurationException, IOException {
-        String path = System.getProperty("THERMOSTAT_HOME");
-        char s = File.separatorChar;
-        
-        Assert.assertEquals(path, ConfigUtils.getThermostatHome());
-        
-        Assert.assertEquals(path + "agent" + s + "agent.properties",
-                            ConfigUtils.getAgentConfigurationFile().getCanonicalPath());
-        Assert.assertEquals(path + "backends", ConfigUtils.getBackendsBaseDirectory().getCanonicalPath());
-        Assert.assertEquals(path + "client", ConfigUtils.getClientConfigurationDirectory().getCanonicalPath());
-        Assert.assertEquals(path + "client" + s + "cli-history", ConfigUtils.getHistoryFile().getCanonicalPath());
-        Assert.assertEquals(path + "storage", ConfigUtils.getStorageBaseDirectory().getCanonicalPath());
-        Assert.assertEquals(path + "storage" + s + "db.properties",
-                            ConfigUtils.getStorageConfigurationFile().getCanonicalPath());
-        Assert.assertEquals(path + "storage" + s + "db",
-                ConfigUtils.getStorageDirectory().getCanonicalPath());
-        Assert.assertEquals(path + "storage" + s + "logs" + s + "db.log",
-                ConfigUtils.getStorageLogFile().getCanonicalPath());
-        Assert.assertEquals(path + "storage" + s + "run" + s + "db.pid",
-                ConfigUtils.getStoragePidFile().getCanonicalPath());        
-    }
-}
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/core/src/test/java/com/redhat/thermostat/common/config/ConfigurationTest.java	Fri Jan 25 17:43:23 2013 +0100
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2012, 2013 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.config;
+
+import java.io.File;
+import java.io.IOException;
+
+import junit.framework.Assert;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class ConfigurationTest {
+
+    @Before
+    public void setUp() throws IOException {
+        System.setProperty("THERMOSTAT_HOME", "/tmp/");
+    }
+
+    @Test
+    public void testLocations() throws InvalidConfigurationException, IOException {
+        String path = System.getProperty("THERMOSTAT_HOME");
+        char s = File.separatorChar;
+
+        Configuration config = new Configuration();
+
+        Assert.assertEquals(path, config.getThermostatHome());
+
+        Assert.assertEquals(path + "agent" + s + "agent.properties",
+                            config.getAgentConfigurationFile().getCanonicalPath());
+        Assert.assertEquals(path + "storage", config.getStorageBaseDirectory().getCanonicalPath());
+        Assert.assertEquals(path + "storage" + s + "db.properties",
+                            config.getStorageConfigurationFile().getCanonicalPath());
+        Assert.assertEquals(path + "storage" + s + "db",
+                config.getStorageDirectory().getCanonicalPath());
+        Assert.assertEquals(path + "storage" + s + "logs" + s + "db.log",
+                config.getStorageLogFile().getCanonicalPath());
+        Assert.assertEquals(path + "storage" + s + "run" + s + "db.pid",
+                config.getStoragePidFile().getCanonicalPath());
+
+    }
+}
+
--- a/launcher/src/main/java/com/redhat/thermostat/launcher/BundleManager.java	Fri Jan 25 17:42:53 2013 +0100
+++ b/launcher/src/main/java/com/redhat/thermostat/launcher/BundleManager.java	Fri Jan 25 17:43:23 2013 +0100
@@ -43,9 +43,9 @@
 import org.osgi.framework.launch.Framework;
 
 import com.redhat.thermostat.annotations.Service;
-import com.redhat.thermostat.common.Configuration;
 import com.redhat.thermostat.common.cli.CommandInfoNotFoundException;
 import com.redhat.thermostat.common.cli.CommandInfoSource;
+import com.redhat.thermostat.common.config.Configuration;
 import com.redhat.thermostat.launcher.internal.BundleLoader;
 
 /**
--- a/launcher/src/main/java/com/redhat/thermostat/launcher/internal/Activator.java	Fri Jan 25 17:42:53 2013 +0100
+++ b/launcher/src/main/java/com/redhat/thermostat/launcher/internal/Activator.java	Fri Jan 25 17:43:23 2013 +0100
@@ -43,9 +43,9 @@
 import org.osgi.util.tracker.ServiceTrackerCustomizer;
 
 import com.redhat.thermostat.common.CommandLoadingBundleActivator;
-import com.redhat.thermostat.common.Configuration;
 import com.redhat.thermostat.common.cli.CommandContextFactory;
 import com.redhat.thermostat.common.cli.CommandInfoSource;
+import com.redhat.thermostat.common.config.Configuration;
 import com.redhat.thermostat.launcher.BundleManager;
 import com.redhat.thermostat.launcher.Launcher;
 import com.redhat.thermostat.utils.keyring.Keyring;
--- a/launcher/src/main/java/com/redhat/thermostat/launcher/internal/BundleManagerImpl.java	Fri Jan 25 17:42:53 2013 +0100
+++ b/launcher/src/main/java/com/redhat/thermostat/launcher/internal/BundleManagerImpl.java	Fri Jan 25 17:43:23 2013 +0100
@@ -36,12 +36,6 @@
 
 package com.redhat.thermostat.launcher.internal;
 
-import com.redhat.thermostat.common.Configuration;
-import com.redhat.thermostat.common.ConfigurationException;
-import com.redhat.thermostat.common.cli.CommandInfoNotFoundException;
-import com.redhat.thermostat.common.cli.CommandInfoSource;
-import com.redhat.thermostat.launcher.BundleManager;
-
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -49,11 +43,18 @@
 import java.util.List;
 import java.util.Map;
 
+import javax.naming.ConfigurationException;
+
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleException;
 import org.osgi.framework.FrameworkUtil;
 import org.osgi.framework.launch.Framework;
 
+import com.redhat.thermostat.common.cli.CommandInfoNotFoundException;
+import com.redhat.thermostat.common.cli.CommandInfoSource;
+import com.redhat.thermostat.common.config.Configuration;
+import com.redhat.thermostat.launcher.BundleManager;
+
 public class BundleManagerImpl extends BundleManager {
 
     private CommandInfoSource commandInfos;
--- a/launcher/src/test/java/com/redhat/thermostat/launcher/internal/ActivatorTest.java	Fri Jan 25 17:42:53 2013 +0100
+++ b/launcher/src/test/java/com/redhat/thermostat/launcher/internal/ActivatorTest.java	Fri Jan 25 17:43:23 2013 +0100
@@ -46,7 +46,6 @@
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
-import static org.powermock.api.mockito.PowerMockito.verifyNew;
 import static org.powermock.api.mockito.PowerMockito.whenNew;
 
 import java.io.File;
@@ -55,13 +54,11 @@
 import java.util.ArrayList;
 import java.util.Dictionary;
 import java.util.Hashtable;
-import java.util.Map;
 
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.ArgumentCaptor;
-import org.mockito.Mockito;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.FrameworkUtil;
@@ -74,15 +71,15 @@
 import org.powermock.core.classloader.annotations.PrepareForTest;
 import org.powermock.modules.junit4.PowerMockRunner;
 
-import com.redhat.thermostat.common.Configuration;
 import com.redhat.thermostat.common.MultipleServiceTracker;
 import com.redhat.thermostat.common.MultipleServiceTracker.Action;
 import com.redhat.thermostat.common.cli.Command;
 import com.redhat.thermostat.common.cli.CommandInfo;
 import com.redhat.thermostat.common.cli.CommandInfoSource;
+import com.redhat.thermostat.common.config.Configuration;
 import com.redhat.thermostat.common.utils.ServiceRegistry;
+import com.redhat.thermostat.launcher.BundleManager;
 import com.redhat.thermostat.launcher.Launcher;
-import com.redhat.thermostat.launcher.BundleManager;
 import com.redhat.thermostat.launcher.internal.Activator.RegisterLauncherCustomizer;
 import com.redhat.thermostat.test.StubBundleContext;
 import com.redhat.thermostat.utils.keyring.Keyring;
--- a/launcher/src/test/java/com/redhat/thermostat/launcher/internal/BundleManagerImplTest.java	Fri Jan 25 17:42:53 2013 +0100
+++ b/launcher/src/test/java/com/redhat/thermostat/launcher/internal/BundleManagerImplTest.java	Fri Jan 25 17:43:23 2013 +0100
@@ -36,11 +36,11 @@
 
 package com.redhat.thermostat.launcher.internal;
 
-import static org.mockito.Mockito.any;
-import static org.mockito.Mockito.eq;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
-import static org.mockito.Mockito.verify;
 import static org.powermock.api.mockito.PowerMockito.mockStatic;
 import static org.powermock.api.mockito.PowerMockito.whenNew;
 
@@ -58,11 +58,9 @@
 import org.powermock.core.classloader.annotations.PrepareForTest;
 import org.powermock.modules.junit4.PowerMockRunner;
 
-import com.redhat.thermostat.common.Configuration;
 import com.redhat.thermostat.common.cli.CommandInfo;
 import com.redhat.thermostat.common.cli.CommandInfoSource;
-import com.redhat.thermostat.launcher.internal.BundleLoader;
-import com.redhat.thermostat.launcher.internal.BundleManagerImpl;
+import com.redhat.thermostat.common.config.Configuration;
 
 @RunWith(PowerMockRunner.class)
 @PrepareForTest({BundleManagerImpl.class, FrameworkUtil.class})
--- a/main/src/main/java/com/redhat/thermostat/main/Thermostat.java	Fri Jan 25 17:42:53 2013 +0100
+++ b/main/src/main/java/com/redhat/thermostat/main/Thermostat.java	Fri Jan 25 17:43:23 2013 +0100
@@ -48,7 +48,7 @@
 import org.osgi.framework.BundleException;
 import org.osgi.util.tracker.ServiceTracker;
 
-import com.redhat.thermostat.common.Configuration;
+import com.redhat.thermostat.common.config.Configuration;
 import com.redhat.thermostat.launcher.Launcher;
 import com.redhat.thermostat.main.impl.FrameworkProvider;
 
--- a/main/src/main/java/com/redhat/thermostat/main/impl/FrameworkProvider.java	Fri Jan 25 17:42:53 2013 +0100
+++ b/main/src/main/java/com/redhat/thermostat/main/impl/FrameworkProvider.java	Fri Jan 25 17:43:23 2013 +0100
@@ -59,9 +59,9 @@
 import org.osgi.framework.launch.FrameworkFactory;
 import org.osgi.util.tracker.ServiceTracker;
 
-import com.redhat.thermostat.common.Configuration;
+import com.redhat.thermostat.common.config.Configuration;
+import com.redhat.thermostat.launcher.BundleManager;
 import com.redhat.thermostat.launcher.Launcher;
-import com.redhat.thermostat.launcher.BundleManager;
 
 public class FrameworkProvider {