Author: xor
Date: 2008-09-23 11:10:49 +0000 (Tue, 23 Sep 2008)
New Revision: 22761

Modified:
   trunk/plugins/WoT/Config.java
   trunk/plugins/WoT/WoT.java
Log:
Change the Config class so that it does not store a reference to a db4o 
ObjectContainer. This is not its job.

Modified: trunk/plugins/WoT/Config.java
===================================================================
--- trunk/plugins/WoT/Config.java       2008-09-23 11:10:42 UTC (rev 22760)
+++ trunk/plugins/WoT/Config.java       2008-09-23 11:10:49 UTC (rev 22761)
@@ -19,19 +19,14 @@
  */
 public class Config {

-       private ObjectContainer db;
        private HashMap<String, String> params = null;

        /**
         * 
         * @param db The database where the configuration is stored.
         */
-       public Config(ObjectContainer db) {
+       public Config() {

-               // TODO Refactor this : the database shouldn't try to store its 
own reference
-               // The ObjectContainer should be passed to set/get/... methodes
-               
-               this.db = db;
                if(params == null) {
                        params = new HashMap<String, String>();
                        initDefault(false);
@@ -46,7 +41,6 @@
         */
        public synchronized void set(String key, String value) {
                params.put(key, value);
-               db.store(params);
        }

        /**
@@ -95,7 +89,5 @@
        public void initDefault(boolean overwrite) {
                if (!contains("delayBetweenInserts") || overwrite)
                        set("delayBetweenInserts", "30");
-       
-               db.store(this);
        }
 }

Modified: trunk/plugins/WoT/WoT.java
===================================================================
--- trunk/plugins/WoT/WoT.java  2008-09-23 11:10:42 UTC (rev 22760)
+++ trunk/plugins/WoT/WoT.java  2008-09-23 11:10:49 UTC (rev 22761)
@@ -89,7 +89,7 @@
                        ObjectSet<Config> result = 
db.queryByExample(Config.class);
                        if(result.size() == 0) {
                                Logger.debug(this, "Created new config");
-                               config = new Config(db);
+                               config = new Config();
                                db.store(config);
                        }
                        else {


Reply via email to