Author: j16sdiz
Date: 2008-08-14 13:45:37 +0000 (Thu, 14 Aug 2008)
New Revision: 21841

Modified:
   trunk/freenet/src/freenet/node/Node.java
Log:
allow changing storeType

Modified: trunk/freenet/src/freenet/node/Node.java
===================================================================
--- trunk/freenet/src/freenet/node/Node.java    2008-08-14 13:45:17 UTC (rev 
21840)
+++ trunk/freenet/src/freenet/node/Node.java    2008-08-14 13:45:37 UTC (rev 
21841)
@@ -172,20 +172,24 @@
        }

        private class StoreTypeCallback extends StringCallback implements 
EnumerableOptionCallback {
+               private String cachedStoreType;

                public String get() {
-                       return storeType;
+                       if (cachedStoreType == null)
+                               cachedStoreType = storeType;
+                       return cachedStoreType;
                }

-               public void set(String val) throws InvalidConfigValueException {
-                       throw new InvalidConfigValueException("Store type 
cannot be changed on the fly");
+               public void set(String val) throws InvalidConfigValueException, 
NodeNeedRestartException {
+                       if (val.equals(storeType))
+                               return;
+
+                       cachedStoreType = val;
+                       throw new NodeNeedRestartException("Store type cannot 
be changed on the fly");
                }

                public String[] getPossibleValues() {
-                       return new String[] {
-                                       "bdb-index",
-                                       "ram"
-                       };
+                       return new String[] { "bdb-index", "ram" };
                }

                public void setPossibleValues(String[] val) {
@@ -193,7 +197,7 @@
                }

                public boolean isReadOnly() {
-                       return true;
+                       return false;
                }
        }



Reply via email to