Author: j16sdiz
Date: 2008-08-14 07:41:14 +0000 (Thu, 14 Aug 2008)
New Revision: 21833

Modified:
   trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java
   trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
   trunk/freenet/src/freenet/clients/http/SymlinkerToadlet.java
   trunk/freenet/src/freenet/config/ConfigCallback.java
   trunk/freenet/src/freenet/crypt/SSL.java
   trunk/freenet/src/freenet/node/ConfigurablePersister.java
   trunk/freenet/src/freenet/node/LoggingConfigHandler.java
   trunk/freenet/src/freenet/node/Node.java
   trunk/freenet/src/freenet/node/NodeClientCore.java
   trunk/freenet/src/freenet/node/NodeCryptoConfig.java
   trunk/freenet/src/freenet/node/NodeIPDetector.java
   trunk/freenet/src/freenet/node/NodeStats.java
   trunk/freenet/src/freenet/node/TestnetHandler.java
   trunk/freenet/src/freenet/node/TextModeClientInterfaceServer.java
   trunk/freenet/src/freenet/node/fcp/FCPServer.java
   trunk/freenet/src/freenet/node/updater/NodeUpdateManager.java
   trunk/freenet/src/freenet/oldplugins/plugin/PluginManager.java
   trunk/freenet/src/freenet/pluginmanager/PluginManager.java
Log:
add isReadOnly() for ConfigCallback
some options, such as opennet port, depends on current status.
that's why it should be in ConfigCallback, not Option

Modified: trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java
===================================================================
--- trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java  
2008-08-14 07:40:13 UTC (rev 21832)
+++ trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java  
2008-08-14 07:41:14 UTC (rev 21833)
@@ -76,6 +76,10 @@
                public void setPossibleValues(String[] val) {
                        throw new NullPointerException("Should not happen!");
                }
+
+               public boolean isReadOnly() {
+                       return false;
+               }
        }

        /**

Modified: trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java     
2008-08-14 07:40:13 UTC (rev 21832)
+++ trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java     
2008-08-14 07:41:14 UTC (rev 21833)
@@ -93,6 +93,9 @@
                        ssl = val;
                        throw new InvalidConfigValueException("Cannot change 
SSL on the fly, please restart freenet");
                }
+               public boolean isReadOnly() {
+                       return true;
+               }
        }

        class FProxyPassthruMaxSize implements IntCallback {
@@ -105,6 +108,9 @@
                        if(val == get()) return;
                        FProxyToadlet.MAX_LENGTH = val;
                }
+               public boolean isReadOnly() {
+                       return false;
+               }
        }

        class FProxyPortCallback implements IntCallback {
@@ -118,6 +124,9 @@
                                throw new 
InvalidConfigValueException(L10n.getString("cannotChangePortOnTheFly"));
                        // FIXME
                }
+               public boolean isReadOnly() {
+                       return true;
+               }
        }

        class FProxyBindtoCallback implements StringCallback {
@@ -139,6 +148,9 @@
                                }
                        }
                }
+               public boolean isReadOnly() {
+                       return false;
+               }
        }

        class FProxyAllowedHostsCallback implements StringCallback {
@@ -152,7 +164,10 @@
                                networkInterface.setAllowedHosts(allowedHosts);
                        }
                }
-               
+
+               public boolean isReadOnly() {
+                       return false;
+               }
        }

        class FProxyCSSNameCallback implements StringCallback, 
EnumerableOptionCallback {
@@ -175,6 +190,9 @@
                public String[] getPossibleValues() {
                        return 
StringArray.toArray(pageMaker.getThemes().toArray());
                }
+               public boolean isReadOnly() {
+                       return false;
+               }
        }

        class FProxyCSSOverrideCallback implements StringCallback {
@@ -197,6 +215,9 @@
                        }
                        pageMaker.setOverride(cssOverride);
                }
+               public boolean isReadOnly() {
+                       return false;
+               }
        }

        class FProxyEnabledCallback implements BooleanCallback {
@@ -222,6 +243,9 @@
                        myThread.setDaemon(true);
                        myThread.start();
                }
+               public boolean isReadOnly() {
+                       return false;
+               }
        }

        private boolean haveCalledFProxy = false;
@@ -257,6 +281,9 @@
                        if(val == get()) return;
                                ts.enableAdvancedMode(val);
                }
+               public boolean isReadOnly() {
+                       return false;
+               }
        }

        private static class FProxyJavascriptEnabledCallback implements 
BooleanCallback {
@@ -275,6 +302,9 @@
                        if(val == get()) return;
                                ts.enableFProxyJavascript(val);
                }
+               public boolean isReadOnly() {
+                       return false;
+               }
        }

        public synchronized void setCore(NodeClientCore core) {
@@ -360,6 +390,10 @@
                                        if(value == 
SimpleToadletServer.isPanicButtonToBeShown) return;
                                        else    
SimpleToadletServer.isPanicButtonToBeShown = value;
                                }
+
+                               public boolean isReadOnly() {
+                                       return false;
+                               }
                });

                // This is OFF BY DEFAULT because for example firefox has a 
limit of 2 persistent 
@@ -381,6 +415,10 @@
                                                        
enablePersistentConnections = val;
                                                }
                                        }
+
+                               public boolean isReadOnly() {
+                                       return false;
+                               }
                });
                enablePersistentConnections = 
fproxyConfig.getBoolean("enablePersistentConnections");

@@ -404,6 +442,10 @@
                                                        enableInlinePrefetch = 
val;
                                                }
                                        }
+
+                               public boolean isReadOnly() {
+                                       return false;
+                               }
                });
                enableInlinePrefetch = 
fproxyConfig.getBoolean("enableInlinePrefetch");

@@ -423,6 +465,9 @@
                                        public void set(String val) throws 
InvalidConfigValueException {
                                                
allowedFullAccess.setAllowedHosts(val);
                                        }
+                                       public boolean isReadOnly() {
+                                       return false;
+                               }

                });
                allowedFullAccess = new 
AllowedHosts(fproxyConfig.getString("allowedHostsFullAccess"));
@@ -434,6 +479,9 @@
                                        public void set(boolean val) throws 
InvalidConfigValueException {
                                                doRobots = val;
                                        }
+                                       public boolean isReadOnly() {
+                                       return false;
+                               }
                });
                doRobots = fproxyConfig.getBoolean("doRobots");


Modified: trunk/freenet/src/freenet/clients/http/SymlinkerToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/SymlinkerToadlet.java        
2008-08-14 07:40:13 UTC (rev 21832)
+++ trunk/freenet/src/freenet/clients/http/SymlinkerToadlet.java        
2008-08-14 07:41:14 UTC (rev 21833)
@@ -35,6 +35,10 @@
                                // FIXME
                                throw new InvalidConfigValueException("Cannot 
set the plugins that's loaded.");
                        }
+
+                               public boolean isReadOnly() {
+                                       return true;
+                               }
                });

                String fns[] = tslconfig.getStringArr("symlinks");

Modified: trunk/freenet/src/freenet/config/ConfigCallback.java
===================================================================
--- trunk/freenet/src/freenet/config/ConfigCallback.java        2008-08-14 
07:40:13 UTC (rev 21832)
+++ trunk/freenet/src/freenet/config/ConfigCallback.java        2008-08-14 
07:41:14 UTC (rev 21833)
@@ -4,5 +4,5 @@
 package freenet.config;

 public interface ConfigCallback {
-       /** Nothing usefull here */
+       boolean isReadOnly(); 
 }

Modified: trunk/freenet/src/freenet/crypt/SSL.java
===================================================================
--- trunk/freenet/src/freenet/crypt/SSL.java    2008-08-14 07:40:13 UTC (rev 
21832)
+++ trunk/freenet/src/freenet/crypt/SSL.java    2008-08-14 07:41:14 UTC (rev 
21833)
@@ -15,7 +15,6 @@
  */
 package freenet.crypt;

-import com.sleepycat.je.utilint.NotImplementedYetException;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
@@ -24,16 +23,18 @@
 import java.security.Key;
 import java.security.KeyStore;
 import java.security.cert.Certificate;
+
 import javax.net.ServerSocketFactory;
 import javax.net.ssl.KeyManagerFactory;
 import javax.net.ssl.SSLContext;

+import com.sleepycat.je.utilint.NotImplementedYetException;
+
 import freenet.config.InvalidConfigValueException;
 import freenet.config.SubConfig;
 import freenet.support.Logger;
 import freenet.support.api.BooleanCallback;
 import freenet.support.api.StringCallback;
-
 import freenet.support.io.Closer;

 public class SSL {
@@ -87,6 +88,10 @@
                                                }
                                        }
                                }
+
+                               public boolean isReadOnly() {
+                                       return false;
+                               }
                        });

                sslConfig.register("sslKeyStore", "datastore/certs", 
configItemOrder++, true, true, "SSL.keyStore", "SSL.keyStoreLong",
@@ -109,6 +114,10 @@
                                                }
                                        }
                                }
+
+                               public boolean isReadOnly() {
+                                       return false;
+                               }
                        });

                sslConfig.register("sslKeyStorePass", "freenet", 
configItemOrder++, true, true, "SSL.keyStorePass", "SSL.keyStorePassLong",
@@ -131,6 +140,10 @@
                                                }
                                        }
                                }
+
+                               public boolean isReadOnly() {
+                                       return false;
+                               }
                        });

                sslConfig.register("sslKeyPass", "freenet", configItemOrder++, 
true, true, "SSL.keyPass", "SSL.keyPassLong",
@@ -156,6 +169,10 @@
                                                }
                                        }
                                }
+
+                               public boolean isReadOnly() {
+                                       return false;
+                               }
                        });

                sslConfig.register("sslVersion", "SSLv3", configItemOrder++, 
true, true, "SSL.version", "SSL.versionLong",
@@ -178,6 +195,10 @@
                                                }
                                        }
                                }
+
+                               public boolean isReadOnly() {
+                                       return false;
+                               }
                        });

                enable = sslConfig.getBoolean("sslEnable");

Modified: trunk/freenet/src/freenet/node/ConfigurablePersister.java
===================================================================
--- trunk/freenet/src/freenet/node/ConfigurablePersister.java   2008-08-14 
07:40:13 UTC (rev 21832)
+++ trunk/freenet/src/freenet/node/ConfigurablePersister.java   2008-08-14 
07:41:14 UTC (rev 21833)
@@ -22,7 +22,9 @@
                        public void set(String val) throws 
InvalidConfigValueException {
                                setThrottles(val);
                        }
-                       
+                       public boolean isReadOnly() {
+                                       return false;
+                               }
                });

                String throttleFile = nodeConfig.getString(optionName);

Modified: trunk/freenet/src/freenet/node/LoggingConfigHandler.java
===================================================================
--- trunk/freenet/src/freenet/node/LoggingConfigHandler.java    2008-08-14 
07:40:13 UTC (rev 21832)
+++ trunk/freenet/src/freenet/node/LoggingConfigHandler.java    2008-08-14 
07:41:14 UTC (rev 21833)
@@ -45,6 +45,10 @@

                public void setPossibleValues(String[] val) {
                        throw new NullPointerException("Should not happen!");
+                }
+
+               public boolean isReadOnly() {
+                       return false;
                }
        }

@@ -74,6 +78,10 @@
                                                } else 
                                                        enableLogger();
                                        }
+                                       
+                                       public boolean isReadOnly() {
+                                       return false;
+                               }
        });

        boolean loggingEnabled = loggingConfig.getBoolean("enabled");
@@ -99,6 +107,10 @@
                                                        new 
Deleter(logDir).start();
                                                }
                                        }
+
+                                       public boolean isReadOnly() {
+                                       return false;
+                               }
        });

        logDir = new File(config.getString("dirname"));
@@ -120,6 +132,9 @@
                                                        
fileLoggerHook.setMaxOldLogsSize(val);
                                                }
                                        }
+                                       public boolean isReadOnly() {
+                                       return false;
+                               }
        });

        maxZippedLogsSize = config.getLong("maxZippedLogsSize");
@@ -150,6 +165,10 @@
                                                        throw new 
InvalidConfigValueException(e.getMessage());
                                                }
                                        }
+
+                                       public boolean isReadOnly() {
+                                       return false;
+                               }

        });

@@ -172,6 +191,10 @@
                                                }
                                                logRotateInterval = val;
                                        }
+
+                                       public boolean isReadOnly() {
+                                       return false;
+                               }
        });

        logRotateInterval = config.getString("interval");
@@ -189,6 +212,9 @@
                                                if(fileLoggerHook != null)
                                                        
fileLoggerHook.setMaxListBytes(val);
                                        }
+                                       public boolean isReadOnly() {
+                                       return false;
+                               }
        });

        maxCachedLogBytes = config.getLong("maxCachedBytes");
@@ -206,6 +232,9 @@
                                                if(fileLoggerHook != null)
                                                        
fileLoggerHook.setMaxListLength(val);
                                        }
+                                       public boolean isReadOnly() {
+                                       return false;
+                               }
        });

        maxCachedLogLines = config.getInt("maxCachedLines");

Modified: trunk/freenet/src/freenet/node/Node.java
===================================================================
--- trunk/freenet/src/freenet/node/Node.java    2008-08-14 07:40:13 UTC (rev 
21832)
+++ trunk/freenet/src/freenet/node/Node.java    2008-08-14 07:41:14 UTC (rev 
21833)
@@ -3,6 +3,7 @@

 import java.io.BufferedReader;
 import java.io.File;
+import java.io.FileFilter;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
@@ -118,7 +119,6 @@
 import freenet.support.io.FileUtil;
 import freenet.support.io.NativeThread;
 import freenet.support.transport.ip.HostnameSyntaxException;
-import java.io.FileFilter;

 /**
  * @author amphibian
@@ -168,6 +168,9 @@
                        // has been unregistered ... see #1595
                        get();
                }
+               public boolean isReadOnly() {
+                       return false;
+               }
        }

        private class StoreTypeCallback implements StringCallback, 
EnumerableOptionCallback {
@@ -190,7 +193,10 @@
                public void setPossibleValues(String[] val) {
                        throw new UnsupportedOperationException();
                }
-               
+
+               public boolean isReadOnly() {
+                       return true;
+               }
        }

        private static class L10nCallback implements StringCallback, 
EnumerableOptionCallback {
@@ -218,6 +224,9 @@
                                result[i] = L10n.AVAILABLE_LANGUAGES[i][1];
                        return result;
                }
+               public boolean isReadOnly() {
+                       return false;
+               }
        }

        /** Stats */
@@ -754,6 +763,9 @@
                                                // Don't translate the below as 
very few users will use it.
                                                throw new 
InvalidConfigValueException("Moving node directory on the fly not supported at 
present");
                                        }
+                                       public boolean isReadOnly() {
+                                       return true;
+                               }
                });

                nodeDir = new File(nodeConfig.getString("nodeDir"));
@@ -816,6 +828,10 @@
                                        public void set(boolean val) throws 
InvalidConfigValueException {
                                                disableProbabilisticHTLs = val;
                                        }
+
+                                       public boolean isReadOnly() {
+                                       return false;
+                               }

                });

@@ -831,6 +847,10 @@
                                                if(maxHTL < 0) throw new 
InvalidConfigValueException("Impossible max HTL");
                                                maxHTL = val;
                                        }
+
+                               public boolean isReadOnly() {
+                                       return false;
+                               }
                });

                maxHTL = nodeConfig.getShort("maxHTL");
@@ -858,7 +878,10 @@
                        public void set(boolean val) throws 
InvalidConfigValueException {
                                throw new InvalidConfigValueException("Cannot 
change on the fly");
                        }
-                       
+
+                       public boolean isReadOnly() {
+                                       return true;
+                               }                       
                });
                enableARKs = nodeConfig.getBoolean("enableARKs");

@@ -871,7 +894,10 @@
                        public void set(boolean val) throws 
InvalidConfigValueException {
                                throw new InvalidConfigValueException("Cannot 
change on the fly");
                        }
-                       
+
+                       public boolean isReadOnly() {
+                                       return true;
+                             }                 
                });
                enablePerNodeFailureTables = 
nodeConfig.getBoolean("enablePerNodeFailureTables");

@@ -884,7 +910,10 @@
                        public void set(boolean val) throws 
InvalidConfigValueException {
                                throw new InvalidConfigValueException("Cannot 
change on the fly");
                        }
-                       
+
+                       public boolean isReadOnly() {
+                                       return true;
+                               }                       
                });
                enableULPRDataPropagation = 
nodeConfig.getBoolean("enableULPRDataPropagation");

@@ -897,7 +926,10 @@
                        public void set(boolean val) throws 
InvalidConfigValueException {
                                throw new InvalidConfigValueException("Cannot 
change on the fly");
                        }
-                       
+
+                       public boolean isReadOnly() {
+                                       return true;
+                               }                       
                });
                enableSwapping = nodeConfig.getBoolean("enableSwapping");

@@ -910,6 +942,10 @@
                        public void set(boolean val) throws 
InvalidConfigValueException {
                                publishOurPeersLocation = val;
                        }
+
+                       public boolean isReadOnly() {
+                                       return false;
+                               }
                });
                publishOurPeersLocation = 
nodeConfig.getBoolean("publishOurPeersLocation");

@@ -922,6 +958,10 @@
                        public void set(boolean val) throws 
InvalidConfigValueException {
                                routeAccordingToOurPeersLocation = val;
                        }
+
+                       public boolean isReadOnly() {
+                                       return false;
+                               }
                });
                routeAccordingToOurPeersLocation = 
nodeConfig.getBoolean("routeAccordingToOurPeersLocation");

@@ -933,6 +973,10 @@
                        public void set(boolean val) throws 
InvalidConfigValueException {
                                enableSwapQueueing = val;
                        }
+
+                       public boolean isReadOnly() {
+                                       return false;
+                               }

                });
                enableSwapQueueing = 
nodeConfig.getBoolean("enableSwapQueueing");
@@ -945,6 +989,10 @@
                        public void set(boolean val) throws 
InvalidConfigValueException {
                                enablePacketCoalescing = val;
                        }
+
+                       public boolean isReadOnly() {
+                                       return false;
+                               }

                });
                enablePacketCoalescing = 
nodeConfig.getBoolean("enablePacketCoalescing");
@@ -998,6 +1046,10 @@
                                                
outputThrottle.changeNanosAndBucketSize((1000L * 1000L * 1000L) / obwLimit, 
obwLimit/2);
                                                
nodeStats.setOutputLimit(obwLimit);
                                        }
+
+                               public boolean isReadOnly() {
+                                       return false;
+                               }
                });

                int obwLimit = nodeConfig.getInt("outputBandwidthLimit");
@@ -1028,6 +1080,10 @@
                                                }
                                                
nodeStats.setInputLimit(ibwLimit);
                                        }
+
+                               public boolean isReadOnly() {
+                                       return false;
+                               }
                });

                int ibwLimit = nodeConfig.getInt("inputBandwidthLimit");
@@ -1047,6 +1103,10 @@
                        public void set(boolean val) throws 
InvalidConfigValueException {
                                throttleLocalData = val;
                        }
+
+                       public boolean isReadOnly() {
+                                       return false;
+                               }

                });

@@ -1152,6 +1212,10 @@
                                                isAllowedToConnectToSeednodes = 
val;
                                }
                        }
+
+                       public boolean isReadOnly() {
+                                       return opennet != null;
+                               }
                });
                isAllowedToConnectToSeednodes = 
opennetConfig.getBoolean("connectToSeednodes");

@@ -1182,6 +1246,9 @@
                                else o.stop(true);
                                
ipDetector.ipDetectorManager.notifyPortChange(getPublicInterfacePorts());
                        }
+                       public boolean isReadOnly() {
+                                       return false;
+                               }
                });             
                boolean opennetEnabled = opennetConfig.getBoolean("enabled");

@@ -1195,6 +1262,9 @@
                                                if(inputMaxOpennetPeers > 20) 
throw new 
InvalidConfigValueException(l10n("maxOpennetPeersMustBeTwentyOrLess"));
                                                maxOpennetPeers = 
inputMaxOpennetPeers;
                                                }
+                                       public boolean isReadOnly() {
+                                       return false;
+                               }
                                        }
                );

@@ -1222,6 +1292,10 @@
                        public void set(boolean val) throws 
InvalidConfigValueException {
                                acceptSeedConnections = val;
                        }
+
+                       public boolean isReadOnly() {
+                                       return false;
+                               }

                });

@@ -1243,6 +1317,9 @@
                                                        
passOpennetRefsThroughDarknet = val;
                                                }
                                        }
+                                       public boolean isReadOnly() {
+                                       return false;
+                               }

                });

@@ -1259,6 +1336,9 @@
                                                // FIXME
                                                throw new 
InvalidConfigValueException("Moving extra peer data directory on the fly not 
supported at present");
                                        }
+                                       public boolean isReadOnly() {
+                                       return true;
+                               }
                });
                extraPeerDataDir = new 
File(nodeConfig.getString("extraPeerDataDir"));
                if(!((extraPeerDataDir.exists() && 
extraPeerDataDir.isDirectory()) || (extraPeerDataDir.mkdir()))) {
@@ -1287,6 +1367,9 @@
                                                        storeForceBigShrinks = 
val;
                                                }
                                        }
+                                       public boolean isReadOnly() {
+                                       return false;
+                               }

                });

@@ -1334,6 +1417,9 @@
                                                
nodeStats.avgStoreLocation.changeMaxReports((int)maxStoreKeys);
                                                
nodeStats.avgCacheLocation.changeMaxReports((int)maxCacheKeys);
                                        }
+                                       public boolean isReadOnly() {
+                                       return false;
+                               }
                });

                maxTotalDatastoreSize = nodeConfig.getLong("storeSize");
@@ -1354,6 +1440,9 @@
                                                // FIXME
                                                throw new 
InvalidConfigValueException("Moving datastore on the fly not supported at 
present");
                                        }
+                                       public boolean isReadOnly() {
+                                       return true;
+                               }
                });

                final String suffix = "-" + getDarknetPortNumber();
@@ -1527,6 +1616,10 @@
                                }
                                databaseMaxMemory = val;
                        }
+
+                                       public boolean isReadOnly() {
+                                               return false;
+                                       }

                });

@@ -1639,7 +1732,10 @@
                        public void set(boolean val) throws 
InvalidConfigValueException {
                                disableHangCheckers = val;
                        }
-                       
+
+                       public boolean isReadOnly() {
+                                       return false;
+                               }
                });

                disableHangCheckers = 
nodeConfig.getBoolean("disableHangCheckers");

Modified: trunk/freenet/src/freenet/node/NodeClientCore.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeClientCore.java  2008-08-14 07:40:13 UTC 
(rev 21832)
+++ trunk/freenet/src/freenet/node/NodeClientCore.java  2008-08-14 07:41:14 UTC 
(rev 21833)
@@ -154,6 +154,9 @@
                                        // FIXME
                                        throw new 
InvalidConfigValueException(l10n("movingTempDirOnTheFlyNotSupported"));
                                }
+                               public boolean isReadOnly() {
+                                       return true;
+                               }
                        });

                tempDir = new File(nodeConfig.getString("tempDir"));
@@ -180,6 +183,9 @@
                                if((val == get()) || 
(persistentTempBucketFactory == null)) return;
                                persistentTempBucketFactory.setEncryption(val);
                        }
+                       public boolean isReadOnly() {
+                                       return false;
+                               }
                });

                nodeConfig.register("persistentTempDir", new File(nodeDir, 
"persistent-temp-" + portNumber).toString(), sortOrder++, true, false, 
"NodeClientCore.persistentTempDir", "NodeClientCore.persistentTempDirLong",
@@ -195,6 +201,9 @@
                                        // FIXME
                                        throw new 
InvalidConfigValueException("Moving persistent temp directory on the fly not 
supported at present");
                                }
+                               public boolean isReadOnly() {
+                                       return true;
+                               }
                        });
                try {
                        persistentTempBucketFactory = new 
PersistentTempBucketFactory(new 
File(nodeConfig.getString("persistentTempDir")), "freenet-temp-", random, 
node.fastWeakRandom, nodeConfig.getBoolean("encryptPersistentTempBuckets"));
@@ -213,6 +222,9 @@
                                if((val == get()) || (tempBucketFactory == 
null)) return;
                                tempBucketFactory.setMaxRAMBucketSize(val);
                        }
+                       public boolean isReadOnly() {
+                                       return false;
+                               }
                });
                nodeConfig.register("RAMBucketPoolSize", "10MiB", sortOrder++, 
true, false, "NodeClientCore.ramBucketPoolSize", 
"NodeClientCore.ramBucketPoolSizeLong", new LongCallback() {

@@ -224,6 +236,9 @@
                                if((val == get()) || (tempBucketFactory == 
null)) return;
                                tempBucketFactory.setMaxRamUsed(val);
                        }
+                       public boolean isReadOnly() {
+                                       return false;
+                               }
                });

                nodeConfig.register("encryptTempBuckets", true, sortOrder++, 
true, false, "NodeClientCore.encryptTempBuckets", 
"NodeClientCore.encryptTempBucketsLong", new BooleanCallback() {
@@ -236,6 +251,9 @@
                                if((val == get()) || (tempBucketFactory == 
null)) return;
                                tempBucketFactory.setEncryption(val);
                        }
+                       public boolean isReadOnly() {
+                                       return false;
+                               }
                });
                tempBucketFactory = new 
TempBucketFactory(tempFilenameGenerator, 
nodeConfig.getLong("maxRAMBucketSize"), 
nodeConfig.getLong("RAMBucketPoolSize"), random, node.fastWeakRandom, 
nodeConfig.getBoolean("encryptTempBuckets"));

@@ -256,6 +274,9 @@
                                        throw new 
InvalidConfigValueException(l10n("couldNotFindOrCreateDir"));
                                downloadDir = new File(val);
                        }
+                       public boolean isReadOnly() {
+                                       return false;
+                               }
                });

                String val = nodeConfig.getString("downloadsDir");
@@ -285,6 +306,9 @@
                                public void set(String[] val) throws 
InvalidConfigValueException {
                                        setDownloadAllowedDirs(val);
                                }
+                               public boolean isReadOnly() {
+                                       return false;
+                               }
                        });
                
setDownloadAllowedDirs(nodeConfig.getStringArr("downloadAllowedDirs"));

@@ -306,6 +330,9 @@
                                public void set(String[] val) throws 
InvalidConfigValueException {
                                        setUploadAllowedDirs(val);
                                }
+                               public boolean isReadOnly() {
+                                       return false;
+                               }
                        });
                
setUploadAllowedDirs(nodeConfig.getStringArr("uploadAllowedDirs"));

@@ -331,6 +358,9 @@
                                        lazyResume = val;
                                }
                        }
+                       public boolean isReadOnly() {
+                                       return false;
+                               }
                });

                lazyResume = nodeConfig.getBoolean("lazyResume");
@@ -347,6 +377,9 @@
                                        throw new 
InvalidConfigValueException(l10n("maxUSKFetchersMustBeGreaterThanZero"));
                                maxBackgroundUSKFetchers = uskFetch;
                        }
+                       public boolean isReadOnly() {
+                                       return false;
+                               }
                });

                maxBackgroundUSKFetchers = 
nodeConfig.getInt("maxBackgroundUSKFetchers");

Modified: trunk/freenet/src/freenet/node/NodeCryptoConfig.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeCryptoConfig.java        2008-08-14 
07:40:13 UTC (rev 21832)
+++ trunk/freenet/src/freenet/node/NodeCryptoConfig.java        2008-08-14 
07:41:14 UTC (rev 21833)
@@ -73,6 +73,9 @@
                                        portNumber = val;
                                }
                        }
+                       public boolean isReadOnly() {
+                                       return true;
+                               }               
                });

                try{
@@ -112,6 +115,9 @@
                                                }
                                                
crypto.onSetDropProbability(val);
                                        }
+                                       public boolean isReadOnly() {
+                                       return false;
+                               }               

                });
                dropProbability = config.getInt("testingDropPacketsEvery"); 
@@ -130,6 +136,10 @@
                                                        oneConnectionPerAddress 
= val;
                                                }
                                        }
+
+                                       public boolean isReadOnly() {
+                                       return false;
+                               }

                });
                oneConnectionPerAddress = 
config.getBoolean("oneConnectionPerIP");
@@ -148,6 +158,9 @@
                                                        
alwaysAllowLocalAddresses = val;
                                                }
                                        }
+                                       public boolean isReadOnly() {
+                                       return false;
+                               }                       
                });
                alwaysAllowLocalAddresses = 
config.getBoolean("alwaysAllowLocalAddresses");

@@ -160,6 +173,9 @@
                        public void set(boolean val) throws 
InvalidConfigValueException {
                                assumeNATed = val;
                        }
+                       public boolean isReadOnly() {
+                                       return false;
+                               }               
                });
                assumeNATed = config.getBoolean("assumeNATed");
        }
@@ -199,6 +215,9 @@
                        // FIXME why not? Can't we use 
freenet.io.NetworkInterface like everywhere else, just adapt it for UDP?
                        throw new InvalidConfigValueException("Cannot be 
updated on the fly");
                }
+               public boolean isReadOnly() {
+                       return true;
+               }
        }

        public synchronized FreenetInetAddress getBindTo() {

Modified: trunk/freenet/src/freenet/node/NodeIPDetector.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeIPDetector.java  2008-08-14 07:40:13 UTC 
(rev 21832)
+++ trunk/freenet/src/freenet/node/NodeIPDetector.java  2008-08-14 07:41:14 UTC 
(rev 21833)
@@ -373,7 +373,10 @@
                                }
                                redetectAddress();
                        }
-                       
+
+                       public boolean isReadOnly() {
+                                       return false;
+                               }
                });

                hasValidAddressOverride = true;
@@ -420,7 +423,10 @@
                                }
                                redetectAddress();
                        }
-                       
+
+                       public boolean isReadOnly() {
+                                       return false;
+                               }
                });

                String ipHintString = nodeConfig.getString("tempIPAddressHint");
@@ -448,7 +454,10 @@
                                lastIPAddress = null;
                                ipDetector.clearCached();
                        }
-                       
+
+                               public boolean isReadOnly() {
+                                       return false;
+                               }
                });

                includeLocalAddressesInNoderefs = 
nodeConfig.getBoolean("includeLocalAddressesInNoderefs");

Modified: trunk/freenet/src/freenet/node/NodeStats.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeStats.java       2008-08-14 07:40:13 UTC 
(rev 21832)
+++ trunk/freenet/src/freenet/node/NodeStats.java       2008-08-14 07:41:14 UTC 
(rev 21833)
@@ -221,6 +221,10 @@
                                                        throw new 
InvalidConfigValueException(l10n("valueTooLow"));
                                                threadLimit = val;
                                        }
+
+                               public boolean isReadOnly() {
+                                       return false;
+                               }
                });
                threadLimit = statsConfig.getInt("threadLimit");

@@ -235,6 +239,10 @@
                                                Logger.normal(this, "Changing 
aggressiveGCModificator to "+val);
                                                aggressiveGCModificator = val;
                                        }
+
+                               public boolean isReadOnly() {
+                                       return false;
+                               }
                });
                aggressiveGCModificator = statsConfig.getInt("aggressiveGC");

@@ -253,6 +261,10 @@
                                                else
                                                        
myMemoryChecker.terminate();
                                        }
+
+                               public boolean isReadOnly() {
+                                       return false;
+                               }
                });
                if(statsConfig.getBoolean("memoryChecker"))
                        myMemoryChecker.start();
@@ -270,7 +282,9 @@
                                        ignoreLocalVsRemoteBandwidthLiability = 
val;
                                }
                        }
-                       
+                       public boolean isReadOnly() {
+                                       return false;
+                               }
                });

                persister = new ConfigurablePersister(this, statsConfig, 
"nodeThrottleFile", "node-throttle.dat", sortOrder++, true, false, 

Modified: trunk/freenet/src/freenet/node/TestnetHandler.java
===================================================================
--- trunk/freenet/src/freenet/node/TestnetHandler.java  2008-08-14 07:40:13 UTC 
(rev 21832)
+++ trunk/freenet/src/freenet/node/TestnetHandler.java  2008-08-14 07:41:14 UTC 
(rev 21833)
@@ -224,7 +224,10 @@
                        if(node.testnetEnabled == val) return;
                        throw new 
InvalidConfigValueException(L10n.getString("TestnetHandler.cannotEnableDisableOnTheFly"));
                }
-               
+
+               public boolean isReadOnly() {
+                       return true;
+               }
        }


@@ -243,6 +246,9 @@
                        if(val == get()) return;
                        node.testnetHandler.rebind(val);
                }
+               public boolean isReadOnly() {
+                       return false;
+               }
        }       



Modified: trunk/freenet/src/freenet/node/TextModeClientInterfaceServer.java
===================================================================
--- trunk/freenet/src/freenet/node/TextModeClientInterfaceServer.java   
2008-08-14 07:40:13 UTC (rev 21832)
+++ trunk/freenet/src/freenet/node/TextModeClientInterfaceServer.java   
2008-08-14 07:41:14 UTC (rev 21833)
@@ -120,6 +120,9 @@
                // FIXME implement - see bug #122
                throw new InvalidConfigValueException("Cannot be updated on the 
fly");
        }
+               public boolean isReadOnly() {
+                       return true;
+               }
     }

     static class TMCISSLCallback implements BooleanCallback {
@@ -136,6 +139,9 @@
                ssl = val;
                throw new InvalidConfigValueException("Cannot change SSL on the 
fly, please restart freenet");
        }
+               public boolean isReadOnly() {
+                       return true;
+               }
     }

     static class TMCIDirectEnabledCallback implements BooleanCallback {
@@ -155,6 +161,9 @@
                // FIXME implement - see bug #122
                throw new InvalidConfigValueException("Cannot be updated on the 
fly");
        }
+               public boolean isReadOnly() {
+                       return true;
+               }
     }

     static class TMCIBindtoCallback implements StringCallback {
@@ -181,6 +190,9 @@
                        throw new InvalidConfigValueException("could not change 
bind to!");
                }
        }
+               public boolean isReadOnly() {
+                       return false;
+               }
     }

     static class TMCIAllowedHostsCallback implements StringCallback {
@@ -208,7 +220,10 @@
                                        throw new 
InvalidConfigValueException("Setting allowedHosts for TMCI (console) server 
when TMCI is disabled");
                        }
                }
-       
+
+               public boolean isReadOnly() {
+                       return false;
+               }
     }

     static class TCMIPortNumberCallback implements IntCallback{
@@ -231,6 +246,10 @@
                if(val == get()) return;
                core.getTextModeClientInterface().setPort(val);
        }
+
+               public boolean isReadOnly() {
+                       return false;
+               }
     }

     /**

Modified: trunk/freenet/src/freenet/node/fcp/FCPServer.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/FCPServer.java   2008-08-14 07:40:13 UTC 
(rev 21832)
+++ trunk/freenet/src/freenet/node/fcp/FCPServer.java   2008-08-14 07:41:14 UTC 
(rev 21833)
@@ -16,6 +16,7 @@
 import java.io.OutputStreamWriter;
 import java.net.Socket;
 import java.util.Iterator;
+import java.util.LinkedList;
 import java.util.Vector;
 import java.util.WeakHashMap;
 import java.util.zip.GZIPInputStream;
@@ -49,7 +50,6 @@
 import freenet.support.api.StringCallback;
 import freenet.support.io.Closer;
 import freenet.support.io.FileUtil;
-import java.util.LinkedList;

 /**
  * FCP server process.
@@ -210,6 +210,10 @@
                                throw new InvalidConfigValueException("Cannot 
change FCP port number on the fly");
                        }
                }
+
+               public boolean isReadOnly() {
+                       return true;
+               }
        }

        static class FCPEnabledCallback implements BooleanCallback{
@@ -229,6 +233,10 @@
                                throw new 
InvalidConfigValueException(l10n("cannotStartOrStopOnTheFly"));
                        }
                }
+
+               public boolean isReadOnly() {
+                       return true;
+               }
        }

        static class FCPSSLCallback implements BooleanCallback{
@@ -245,6 +253,10 @@
                        ssl = val;
                        throw new InvalidConfigValueException("Cannot change 
SSL on the fly, please restart freenet");
                }
+
+               public boolean isReadOnly() {
+                       return true;
+               }
        }

        // FIXME: Consider moving everything except enabled into constructor
@@ -275,6 +287,10 @@
                                }
                        }
                }
+
+               public boolean isReadOnly() {
+                       return false;
+               }
        }

        static class FCPAllowedHostsCallback implements StringCallback {
@@ -297,11 +313,13 @@
                                
node.getFCPServer().networkInterface.setAllowedHosts(val);
                        }
                }
-               
+
+               public boolean isReadOnly() {
+                       return false;
+               }               
        }

        static class FCPAllowedHostsFullAccessCallback implements 
StringCallback {
-
                private final NodeClientCore node;

                public FCPAllowedHostsFullAccessCallback(NodeClientCore node) {
@@ -317,6 +335,10 @@
                                
node.getFCPServer().allowedHostsFullAccess.setAllowedHosts(val);
                        }
                }
+
+               public boolean isReadOnly() {
+                       return false;
+               }

        }

@@ -332,6 +354,10 @@
                        if(server.persistentDownloadsEnabled() != set)
                                server.setPersistentDownloadsEnabled(set);
                }
+
+               public boolean isReadOnly() {
+                       return false;
+               }

        }

@@ -348,6 +374,10 @@
                        if(f.equals(server.persistentDownloadsFile)) return;
                        server.setPersistentDownloadsFile(f);
                }
+
+               public boolean isReadOnly() {
+                       return false;
+               }
        }

        static class PersistentDownloadsIntervalCallback implements 
LongCallback {
@@ -367,6 +397,10 @@
                                }
                        }
                }
+
+               public boolean isReadOnly() {
+                       return false;
+               }
        }

        static class AssumeDDADownloadIsAllowedCallback implements 
BooleanCallback{
@@ -380,6 +414,10 @@
                        if(val == get()) return;
                        server.assumeDownloadDDAIsAllowed = val;
                }
+
+               public boolean isReadOnly() {
+                       return false;
+               }
        }

        static class AssumeDDAUploadIsAllowedCallback implements 
BooleanCallback{
@@ -393,6 +431,10 @@
                        if(val == get()) return;
                        server.assumeUploadDDAIsAllowed = val;
                }
+
+               public boolean isReadOnly() {
+                       return false;
+               }
        }



Modified: trunk/freenet/src/freenet/node/updater/NodeUpdateManager.java
===================================================================
--- trunk/freenet/src/freenet/node/updater/NodeUpdateManager.java       
2008-08-14 07:40:13 UTC (rev 21832)
+++ trunk/freenet/src/freenet/node/updater/NodeUpdateManager.java       
2008-08-14 07:41:14 UTC (rev 21833)
@@ -813,6 +813,9 @@
                public void set(boolean val) throws InvalidConfigValueException 
{
                        enable(val);
                }
+               public boolean isReadOnly() {
+                       return false;
+               }
        }

        class AutoUpdateAllowedCallback implements BooleanCallback {
@@ -824,6 +827,9 @@
                public void set(boolean val) throws InvalidConfigValueException 
{
                        setAutoUpdateAllowed(val);
                }
+               public boolean isReadOnly() {
+                       return false;
+               }
        }

        class UpdateURICallback implements StringCallback {
@@ -848,6 +854,9 @@
                        setURI(isExt, uri);
                }

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

        public class UpdateRevocationURICallback implements StringCallback {
@@ -865,7 +874,10 @@
                        }
                        setRevocationURI(uri);
                }
-               
+
+               public boolean isReadOnly() {
+                       return false;
+               }
        }

        /** Called when a peer indicates in its UOMAnnounce that it has fetched 
the revocation key

Modified: trunk/freenet/src/freenet/oldplugins/plugin/PluginManager.java
===================================================================
--- trunk/freenet/src/freenet/oldplugins/plugin/PluginManager.java      
2008-08-14 07:40:13 UTC (rev 21832)
+++ trunk/freenet/src/freenet/oldplugins/plugin/PluginManager.java      
2008-08-14 07:41:14 UTC (rev 21833)
@@ -84,6 +84,10 @@
                        public void set(String[] val) throws 
InvalidConfigValueException {
                                throw new 
InvalidConfigValueException(L10n.getString("PluginManager.cannotSetOnceLoaded"));
                        };
+
+                               public boolean isReadOnly() {
+                                       return true;
+                               }
                });

                String[] loadedPluginNames = 
config.getStringArr("loadedPlugins");

Modified: trunk/freenet/src/freenet/pluginmanager/PluginManager.java
===================================================================
--- trunk/freenet/src/freenet/pluginmanager/PluginManager.java  2008-08-14 
07:40:13 UTC (rev 21832)
+++ trunk/freenet/src/freenet/pluginmanager/PluginManager.java  2008-08-14 
07:41:14 UTC (rev 21833)
@@ -127,6 +127,10 @@
                                // FIXME
                                throw new 
InvalidConfigValueException(L10n.getString("PluginManager.cannotSetOnceLoaded"));
                        }
+
+                               public boolean isReadOnly() {
+                                       return true;
+                               }
                });

                String fns[] = pmconfig.getStringArr("loadplugin");


Reply via email to