Author: toad
Date: 2006-12-16 00:43:10 +0000 (Sat, 16 Dec 2006)
New Revision: 11432
Added:
trunk/freenet/src/freenet/support/api/BaseSubConfig.java
trunk/freenet/src/freenet/support/api/BooleanCallback.java
trunk/freenet/src/freenet/support/api/IntCallback.java
trunk/freenet/src/freenet/support/api/LongCallback.java
trunk/freenet/src/freenet/support/api/ShortCallback.java
trunk/freenet/src/freenet/support/api/StringArrCallback.java
trunk/freenet/src/freenet/support/api/StringCallback.java
Removed:
trunk/freenet/src/freenet/config/BooleanCallback.java
trunk/freenet/src/freenet/config/IntCallback.java
trunk/freenet/src/freenet/config/LongCallback.java
trunk/freenet/src/freenet/config/ShortCallback.java
trunk/freenet/src/freenet/config/StringArrCallback.java
trunk/freenet/src/freenet/config/StringCallback.java
Modified:
trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java
trunk/freenet/src/freenet/clients/http/BookmarkManager.java
trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
trunk/freenet/src/freenet/clients/http/SymlinkerToadlet.java
trunk/freenet/src/freenet/config/BooleanOption.java
trunk/freenet/src/freenet/config/IntOption.java
trunk/freenet/src/freenet/config/LongOption.java
trunk/freenet/src/freenet/config/ShortOption.java
trunk/freenet/src/freenet/config/StringArrOption.java
trunk/freenet/src/freenet/config/StringOption.java
trunk/freenet/src/freenet/config/SubConfig.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/NodeIPDetector.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/NodeUpdaterManager.java
trunk/freenet/src/freenet/oldplugins/plugin/PluginManager.java
trunk/freenet/src/freenet/pluginmanager/PluginManager.java
trunk/plugins/SNMP/snmplib/SNMPBindtoCallback.java
trunk/plugins/SNMP/snmplib/SNMPPortNumberCallback.java
Log:
Extract an interface for a SubConfig.
Move *Callback into freenet.support.api.
Modified: trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java
===================================================================
--- trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java
2006-12-16 00:37:10 UTC (rev 11431)
+++ trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java
2006-12-16 00:43:10 UTC (rev 11432)
@@ -8,7 +8,6 @@
import java.util.Iterator;
import freenet.config.InvalidConfigValueException;
-import freenet.config.StringCallback;
import freenet.config.SubConfig;
import freenet.crypt.RandomSource;
import freenet.keys.ClientKeyBlock;
@@ -23,6 +22,7 @@
import freenet.support.SectoredRandomGrabArrayWithClient;
import freenet.support.SectoredRandomGrabArrayWithInt;
import freenet.support.SortedVectorByNumber;
+import freenet.support.api.StringCallback;
/**
* Every X seconds, the RequestSender calls the ClientRequestScheduler to
Modified: trunk/freenet/src/freenet/clients/http/BookmarkManager.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/BookmarkManager.java 2006-12-16
00:37:10 UTC (rev 11431)
+++ trunk/freenet/src/freenet/clients/http/BookmarkManager.java 2006-12-16
00:43:10 UTC (rev 11432)
@@ -12,7 +12,7 @@
import freenet.node.NodeClientCore;
import freenet.node.useralerts.UserAlert;
import freenet.support.HTMLNode;
-import freenet.config.StringArrCallback;
+import freenet.support.api.StringArrCallback;
import freenet.config.StringArrOption;
import freenet.config.InvalidConfigValueException;
import freenet.config.SubConfig;
Modified: trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
2006-12-16 00:37:10 UTC (rev 11431)
+++ trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
2006-12-16 00:43:10 UTC (rev 11432)
@@ -21,10 +21,7 @@
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
-import freenet.config.BooleanCallback;
-import freenet.config.IntCallback;
import freenet.config.InvalidConfigValueException;
-import freenet.config.StringCallback;
import freenet.config.SubConfig;
import freenet.crypt.DummyRandomSource;
import freenet.io.NetworkInterface;
@@ -32,7 +29,10 @@
import freenet.support.FileLoggerHook;
import freenet.support.Logger;
import freenet.support.FileLoggerHook.IntervalParseException;
+import freenet.support.api.BooleanCallback;
import freenet.support.api.BucketFactory;
+import freenet.support.api.IntCallback;
+import freenet.support.api.StringCallback;
import freenet.support.io.FilenameGenerator;
import freenet.support.io.TempBucketFactory;
Modified: trunk/freenet/src/freenet/clients/http/SymlinkerToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/SymlinkerToadlet.java
2006-12-16 00:37:10 UTC (rev 11431)
+++ trunk/freenet/src/freenet/clients/http/SymlinkerToadlet.java
2006-12-16 00:43:10 UTC (rev 11432)
@@ -8,12 +8,12 @@
import freenet.client.HighLevelSimpleClient;
import freenet.config.InvalidConfigValueException;
-import freenet.config.StringArrCallback;
import freenet.config.StringArrOption;
import freenet.config.SubConfig;
import freenet.node.Node;
import freenet.support.Logger;
import freenet.support.api.HTTPRequest;
+import freenet.support.api.StringArrCallback;
public class SymlinkerToadlet extends Toadlet {
Deleted: trunk/freenet/src/freenet/config/BooleanCallback.java
===================================================================
--- trunk/freenet/src/freenet/config/BooleanCallback.java 2006-12-16
00:37:10 UTC (rev 11431)
+++ trunk/freenet/src/freenet/config/BooleanCallback.java 2006-12-16
00:43:10 UTC (rev 11432)
@@ -1,25 +0,0 @@
-/* This code is part of Freenet. It is distributed under the GNU General
- * Public License, version 2 (or at your option any later version). See
- * http://www.gnu.org/ for further details of the GPL. */
-package freenet.config;
-
-/**
- * A callback to be called when a config value of integer type changes.
- * Also reports the current value.
- */
-public interface BooleanCallback {
-
- /**
- * Get the current, used value of the config variable.
- */
- boolean get();
-
- /**
- * Set the config variable to a new value.
- * @param val The new value.
- * @throws InvalidConfigOptionException If the new value is invalid for
- * this particular option.
- */
- void set(boolean val) throws InvalidConfigValueException;
-
-}
Modified: trunk/freenet/src/freenet/config/BooleanOption.java
===================================================================
--- trunk/freenet/src/freenet/config/BooleanOption.java 2006-12-16 00:37:10 UTC
(rev 11431)
+++ trunk/freenet/src/freenet/config/BooleanOption.java 2006-12-16 00:43:10 UTC
(rev 11432)
@@ -3,6 +3,8 @@
* http://www.gnu.org/ for further details of the GPL. */
package freenet.config;
+import freenet.support.api.BooleanCallback;
+
public class BooleanOption extends Option {
final boolean defaultValue;
Deleted: trunk/freenet/src/freenet/config/IntCallback.java
===================================================================
--- trunk/freenet/src/freenet/config/IntCallback.java 2006-12-16 00:37:10 UTC
(rev 11431)
+++ trunk/freenet/src/freenet/config/IntCallback.java 2006-12-16 00:43:10 UTC
(rev 11432)
@@ -1,25 +0,0 @@
-/* This code is part of Freenet. It is distributed under the GNU General
- * Public License, version 2 (or at your option any later version). See
- * http://www.gnu.org/ for further details of the GPL. */
-package freenet.config;
-
-/**
- * A callback to be called when a config value of integer type changes.
- * Also reports the current value.
- */
-public interface IntCallback {
-
- /**
- * Get the current, used value of the config variable.
- */
- int get();
-
- /**
- * Set the config variable to a new value.
- * @param val The new value.
- * @throws InvalidConfigOptionException If the new value is invalid for
- * this particular option.
- */
- void set(int val) throws InvalidConfigValueException;
-
-}
Modified: trunk/freenet/src/freenet/config/IntOption.java
===================================================================
--- trunk/freenet/src/freenet/config/IntOption.java 2006-12-16 00:37:10 UTC
(rev 11431)
+++ trunk/freenet/src/freenet/config/IntOption.java 2006-12-16 00:43:10 UTC
(rev 11432)
@@ -4,6 +4,7 @@
package freenet.config;
import freenet.support.Fields;
+import freenet.support.api.IntCallback;
/** Integer config variable */
public class IntOption extends Option {
Deleted: trunk/freenet/src/freenet/config/LongCallback.java
===================================================================
--- trunk/freenet/src/freenet/config/LongCallback.java 2006-12-16 00:37:10 UTC
(rev 11431)
+++ trunk/freenet/src/freenet/config/LongCallback.java 2006-12-16 00:43:10 UTC
(rev 11432)
@@ -1,25 +0,0 @@
-/* This code is part of Freenet. It is distributed under the GNU General
- * Public License, version 2 (or at your option any later version). See
- * http://www.gnu.org/ for further details of the GPL. */
-package freenet.config;
-
-/**
- * A callback to be called when a config value of long type changes.
- * Also reports the current value.
- */
-public interface LongCallback {
-
- /**
- * Get the current, used value of the config variable.
- */
- long get();
-
- /**
- * Set the config variable to a new value.
- * @param val The new value.
- * @throws InvalidConfigOptionException If the new value is invalid for
- * this particular option.
- */
- void set(long val) throws InvalidConfigValueException;
-
-}
Modified: trunk/freenet/src/freenet/config/LongOption.java
===================================================================
--- trunk/freenet/src/freenet/config/LongOption.java 2006-12-16 00:37:10 UTC
(rev 11431)
+++ trunk/freenet/src/freenet/config/LongOption.java 2006-12-16 00:43:10 UTC
(rev 11432)
@@ -4,6 +4,7 @@
package freenet.config;
import freenet.support.Fields;
+import freenet.support.api.LongCallback;
/** Long config variable */
public class LongOption extends Option {
Deleted: trunk/freenet/src/freenet/config/ShortCallback.java
===================================================================
--- trunk/freenet/src/freenet/config/ShortCallback.java 2006-12-16 00:37:10 UTC
(rev 11431)
+++ trunk/freenet/src/freenet/config/ShortCallback.java 2006-12-16 00:43:10 UTC
(rev 11432)
@@ -1,22 +0,0 @@
-package freenet.config;
-
-/**
- * A callback to be called when a config value of short type changes.
- * Also reports the current value.
- */
-public interface ShortCallback {
-
- /**
- * Get the current, used value of the config variable.
- */
- short get();
-
- /**
- * Set the config variable to a new value.
- * @param val The new value.
- * @throws InvalidConfigOptionException If the new value is invalid for
- * this particular option.
- */
- void set(short val) throws InvalidConfigValueException;
-
-}
Modified: trunk/freenet/src/freenet/config/ShortOption.java
===================================================================
--- trunk/freenet/src/freenet/config/ShortOption.java 2006-12-16 00:37:10 UTC
(rev 11431)
+++ trunk/freenet/src/freenet/config/ShortOption.java 2006-12-16 00:43:10 UTC
(rev 11432)
@@ -1,6 +1,7 @@
package freenet.config;
import freenet.support.Fields;
+import freenet.support.api.ShortCallback;
public class ShortOption extends Option {
Deleted: trunk/freenet/src/freenet/config/StringArrCallback.java
===================================================================
--- trunk/freenet/src/freenet/config/StringArrCallback.java 2006-12-16
00:37:10 UTC (rev 11431)
+++ trunk/freenet/src/freenet/config/StringArrCallback.java 2006-12-16
00:43:10 UTC (rev 11432)
@@ -1,22 +0,0 @@
-/* This code is part of Freenet. It is distributed under the GNU General
- * Public License, version 2 (or at your option any later version). See
- * http://www.gnu.org/ for further details of the GPL. */
-package freenet.config;
-
-/** Callback (getter/setter) for a string config variable */
-public interface StringArrCallback {
-
- /**
- * Get the current, used value of the config variable.
- */
- String get();
-
- /**
- * Set the config variable to a new value.
- * @param val The new value.
- * @throws InvalidConfigOptionException If the new value is invalid for
- * this particular option.
- */
- void set(String val) throws InvalidConfigValueException;
-
-}
Modified: trunk/freenet/src/freenet/config/StringArrOption.java
===================================================================
--- trunk/freenet/src/freenet/config/StringArrOption.java 2006-12-16
00:37:10 UTC (rev 11431)
+++ trunk/freenet/src/freenet/config/StringArrOption.java 2006-12-16
00:43:10 UTC (rev 11432)
@@ -3,6 +3,7 @@
import freenet.support.URLDecoder;
import freenet.support.URLEncodedFormatException;
import freenet.support.URLEncoder;
+import freenet.support.api.StringArrCallback;
public class StringArrOption extends Option {
Deleted: trunk/freenet/src/freenet/config/StringCallback.java
===================================================================
--- trunk/freenet/src/freenet/config/StringCallback.java 2006-12-16
00:37:10 UTC (rev 11431)
+++ trunk/freenet/src/freenet/config/StringCallback.java 2006-12-16
00:43:10 UTC (rev 11432)
@@ -1,22 +0,0 @@
-/* This code is part of Freenet. It is distributed under the GNU General
- * Public License, version 2 (or at your option any later version). See
- * http://www.gnu.org/ for further details of the GPL. */
-package freenet.config;
-
-/** Callback (getter/setter) for a string config variable */
-public interface StringCallback {
-
- /**
- * Get the current, used value of the config variable.
- */
- String get();
-
- /**
- * Set the config variable to a new value.
- * @param val The new value.
- * @throws InvalidConfigOptionException If the new value is invalid for
- * this particular option.
- */
- void set(String val) throws InvalidConfigValueException;
-
-}
Modified: trunk/freenet/src/freenet/config/StringOption.java
===================================================================
--- trunk/freenet/src/freenet/config/StringOption.java 2006-12-16 00:37:10 UTC
(rev 11431)
+++ trunk/freenet/src/freenet/config/StringOption.java 2006-12-16 00:43:10 UTC
(rev 11432)
@@ -3,6 +3,8 @@
* http://www.gnu.org/ for further details of the GPL. */
package freenet.config;
+import freenet.support.api.StringCallback;
+
public class StringOption extends Option {
final String defaultValue;
Modified: trunk/freenet/src/freenet/config/SubConfig.java
===================================================================
--- trunk/freenet/src/freenet/config/SubConfig.java 2006-12-16 00:37:10 UTC
(rev 11431)
+++ trunk/freenet/src/freenet/config/SubConfig.java 2006-12-16 00:43:10 UTC
(rev 11432)
@@ -10,6 +10,12 @@
import freenet.support.Logger;
import freenet.support.SimpleFieldSet;
+import freenet.support.api.BooleanCallback;
+import freenet.support.api.IntCallback;
+import freenet.support.api.LongCallback;
+import freenet.support.api.ShortCallback;
+import freenet.support.api.StringArrCallback;
+import freenet.support.api.StringCallback;
/**
* A specific configuration block.
Modified: trunk/freenet/src/freenet/node/LoggingConfigHandler.java
===================================================================
--- trunk/freenet/src/freenet/node/LoggingConfigHandler.java 2006-12-16
00:37:10 UTC (rev 11431)
+++ trunk/freenet/src/freenet/node/LoggingConfigHandler.java 2006-12-16
00:43:10 UTC (rev 11432)
@@ -6,12 +6,8 @@
import java.io.File;
import java.io.IOException;
-import freenet.config.BooleanCallback;
-import freenet.config.IntCallback;
import freenet.config.InvalidConfigValueException;
-import freenet.config.LongCallback;
import freenet.config.OptionFormatException;
-import freenet.config.StringCallback;
import freenet.config.SubConfig;
import freenet.support.FileLoggerHook;
import freenet.support.Logger;
@@ -19,6 +15,10 @@
import freenet.support.LoggerHookChain;
import freenet.support.FileLoggerHook.IntervalParseException;
import freenet.support.LoggerHook.InvalidThresholdException;
+import freenet.support.api.BooleanCallback;
+import freenet.support.api.IntCallback;
+import freenet.support.api.LongCallback;
+import freenet.support.api.StringCallback;
public class LoggingConfigHandler {
Modified: trunk/freenet/src/freenet/node/Node.java
===================================================================
--- trunk/freenet/src/freenet/node/Node.java 2006-12-16 00:37:10 UTC (rev
11431)
+++ trunk/freenet/src/freenet/node/Node.java 2006-12-16 00:43:10 UTC (rev
11432)
@@ -38,10 +38,7 @@
import freenet.client.FetcherContext;
import freenet.config.FreenetFilePersistentConfig;
-import freenet.config.IntCallback;
import freenet.config.InvalidConfigValueException;
-import freenet.config.LongCallback;
-import freenet.config.StringCallback;
import freenet.config.SubConfig;
import freenet.crypt.DSA;
import freenet.crypt.DSAGroup;
@@ -103,6 +100,9 @@
import freenet.support.SimpleFieldSet;
import freenet.support.TimeUtil;
import freenet.support.TokenBucket;
+import freenet.support.api.IntCallback;
+import freenet.support.api.LongCallback;
+import freenet.support.api.StringCallback;
import freenet.support.math.RunningAverage;
import freenet.support.math.TimeDecayingRunningAverage;
Modified: trunk/freenet/src/freenet/node/NodeClientCore.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeClientCore.java 2006-12-16 00:37:10 UTC
(rev 11431)
+++ trunk/freenet/src/freenet/node/NodeClientCore.java 2006-12-16 00:43:10 UTC
(rev 11432)
@@ -19,10 +19,8 @@
import freenet.clients.http.filter.FilterCallback;
import freenet.clients.http.filter.FoundURICallback;
import freenet.clients.http.filter.GenericReadFilterCallback;
-import freenet.config.BooleanCallback;
import freenet.config.Config;
import freenet.config.InvalidConfigValueException;
-import freenet.config.StringCallback;
import freenet.config.SubConfig;
import freenet.crypt.RandomSource;
import freenet.io.xfer.AbortedException;
@@ -46,7 +44,9 @@
import freenet.support.Base64;
import freenet.support.Logger;
import freenet.support.SimpleFieldSet;
+import freenet.support.api.BooleanCallback;
import freenet.support.api.BucketFactory;
+import freenet.support.api.StringCallback;
import freenet.support.io.FilenameGenerator;
import freenet.support.io.PaddedEphemerallyEncryptedBucketFactory;
import freenet.support.io.PersistentEncryptedTempBucketFactory;
Modified: trunk/freenet/src/freenet/node/NodeIPDetector.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeIPDetector.java 2006-12-16 00:37:10 UTC
(rev 11431)
+++ trunk/freenet/src/freenet/node/NodeIPDetector.java 2006-12-16 00:43:10 UTC
(rev 11432)
@@ -7,9 +7,7 @@
import java.util.Iterator;
import java.util.Vector;
-import freenet.config.BooleanCallback;
import freenet.config.InvalidConfigValueException;
-import freenet.config.StringCallback;
import freenet.config.SubConfig;
import freenet.io.comm.FreenetInetAddress;
import freenet.io.comm.Peer;
@@ -20,6 +18,8 @@
import freenet.pluginmanager.DetectedIP;
import freenet.pluginmanager.FredPluginIPDetector;
import freenet.support.Logger;
+import freenet.support.api.BooleanCallback;
+import freenet.support.api.StringCallback;
import freenet.support.transport.ip.IPAddressDetector;
import freenet.support.transport.ip.IPUtil;
Modified: trunk/freenet/src/freenet/node/TestnetHandler.java
===================================================================
--- trunk/freenet/src/freenet/node/TestnetHandler.java 2006-12-16 00:37:10 UTC
(rev 11431)
+++ trunk/freenet/src/freenet/node/TestnetHandler.java 2006-12-16 00:43:10 UTC
(rev 11432)
@@ -17,15 +17,15 @@
import java.util.Locale;
import java.util.TimeZone;
-import freenet.config.BooleanCallback;
import freenet.config.Config;
-import freenet.config.IntCallback;
import freenet.config.InvalidConfigValueException;
import freenet.config.SubConfig;
import freenet.node.Node.NodeInitException;
import freenet.support.FileLoggerHook;
import freenet.support.Logger;
import freenet.support.SimpleFieldSet;
+import freenet.support.api.BooleanCallback;
+import freenet.support.api.IntCallback;
/**
* Testnet handler.
Modified: trunk/freenet/src/freenet/node/TextModeClientInterfaceServer.java
===================================================================
--- trunk/freenet/src/freenet/node/TextModeClientInterfaceServer.java
2006-12-16 00:37:10 UTC (rev 11431)
+++ trunk/freenet/src/freenet/node/TextModeClientInterfaceServer.java
2006-12-16 00:43:10 UTC (rev 11432)
@@ -13,15 +13,15 @@
import java.util.Hashtable;
import freenet.client.HighLevelSimpleClient;
-import freenet.config.BooleanCallback;
import freenet.config.Config;
-import freenet.config.IntCallback;
import freenet.config.InvalidConfigValueException;
-import freenet.config.StringCallback;
import freenet.config.SubConfig;
import freenet.crypt.RandomSource;
import freenet.io.NetworkInterface;
import freenet.support.Logger;
+import freenet.support.api.BooleanCallback;
+import freenet.support.api.IntCallback;
+import freenet.support.api.StringCallback;
public class TextModeClientInterfaceServer implements Runnable {
Modified: trunk/freenet/src/freenet/node/fcp/FCPServer.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/FCPServer.java 2006-12-16 00:37:10 UTC
(rev 11431)
+++ trunk/freenet/src/freenet/node/fcp/FCPServer.java 2006-12-16 00:43:10 UTC
(rev 11432)
@@ -26,12 +26,8 @@
import freenet.client.FetcherContext;
import freenet.client.HighLevelSimpleClient;
import freenet.client.InserterContext;
-import freenet.config.BooleanCallback;
import freenet.config.Config;
-import freenet.config.IntCallback;
import freenet.config.InvalidConfigValueException;
-import freenet.config.LongCallback;
-import freenet.config.StringCallback;
import freenet.config.SubConfig;
import freenet.io.NetworkInterface;
import freenet.keys.FreenetURI;
@@ -40,7 +36,11 @@
import freenet.node.RequestStarter;
import freenet.support.Base64;
import freenet.support.Logger;
+import freenet.support.api.BooleanCallback;
import freenet.support.api.Bucket;
+import freenet.support.api.IntCallback;
+import freenet.support.api.LongCallback;
+import freenet.support.api.StringCallback;
/**
* FCP server process.
Modified: trunk/freenet/src/freenet/node/updater/NodeUpdaterManager.java
===================================================================
--- trunk/freenet/src/freenet/node/updater/NodeUpdaterManager.java
2006-12-16 00:37:10 UTC (rev 11431)
+++ trunk/freenet/src/freenet/node/updater/NodeUpdaterManager.java
2006-12-16 00:43:10 UTC (rev 11432)
@@ -6,10 +6,8 @@
import org.tanukisoftware.wrapper.WrapperManager;
-import freenet.config.BooleanCallback;
import freenet.config.Config;
import freenet.config.InvalidConfigValueException;
-import freenet.config.StringCallback;
import freenet.config.SubConfig;
import freenet.keys.FreenetURI;
import freenet.node.Node;
@@ -21,6 +19,8 @@
import freenet.node.useralerts.UpdatedVersionAvailableUserAlert;
import freenet.node.useralerts.UserAlert;
import freenet.support.Logger;
+import freenet.support.api.BooleanCallback;
+import freenet.support.api.StringCallback;
/**
* Supervises NodeUpdater's. Enables us to easily update multiple files,
Modified: trunk/freenet/src/freenet/oldplugins/plugin/PluginManager.java
===================================================================
--- trunk/freenet/src/freenet/oldplugins/plugin/PluginManager.java
2006-12-16 00:37:10 UTC (rev 11431)
+++ trunk/freenet/src/freenet/oldplugins/plugin/PluginManager.java
2006-12-16 00:43:10 UTC (rev 11432)
@@ -11,12 +11,12 @@
import java.util.List;
import freenet.config.InvalidConfigValueException;
-import freenet.config.StringArrCallback;
import freenet.config.StringArrOption;
import freenet.config.SubConfig;
import freenet.node.Node;
import freenet.node.NodeClientCore;
import freenet.support.Logger;
+import freenet.support.api.StringArrCallback;
/**
* Manages plugins.
@@ -53,7 +53,7 @@
/**
* Returns the current value of this option.
*
- * @see freenet.config.StringArrCallback#get()
+ * @see freenet.support.api.StringArrCallback#get()
* @return The current value of this option
*/
public String get() {
@@ -77,7 +77,7 @@
/**
* Sets the new value of this option.
*
- * @see
freenet.config.StringArrCallback#set(java.lang.String)
+ * @see
freenet.support.api.StringArrCallback#set(java.lang.String)
* @param val
* The new value
* @throws InvalidConfigValueException
Modified: trunk/freenet/src/freenet/pluginmanager/PluginManager.java
===================================================================
--- trunk/freenet/src/freenet/pluginmanager/PluginManager.java 2006-12-16
00:37:10 UTC (rev 11431)
+++ trunk/freenet/src/freenet/pluginmanager/PluginManager.java 2006-12-16
00:43:10 UTC (rev 11432)
@@ -19,7 +19,6 @@
import java.util.jar.JarFile;
import freenet.config.InvalidConfigValueException;
-import freenet.config.StringArrCallback;
import freenet.config.StringArrOption;
import freenet.config.SubConfig;
import freenet.node.Node;
@@ -29,6 +28,7 @@
import freenet.support.Logger;
import freenet.support.URIPreEncoder;
import freenet.support.api.HTTPRequest;
+import freenet.support.api.StringArrCallback;
public class PluginManager {
Added: trunk/freenet/src/freenet/support/api/BaseSubConfig.java
===================================================================
--- trunk/freenet/src/freenet/support/api/BaseSubConfig.java
(rev 0)
+++ trunk/freenet/src/freenet/support/api/BaseSubConfig.java 2006-12-16
00:43:10 UTC (rev 11432)
@@ -0,0 +1,76 @@
+package freenet.support.api;
+
+import freenet.config.InvalidConfigValueException;
+
+public interface BaseSubConfig {
+
+ public void register(String optionName, int defaultValue, int sortOrder,
+ boolean expert, boolean forceWrite, String shortDesc,
+ String longDesc, IntCallback cb);
+
+ public void register(String optionName, long defaultValue, int
sortOrder,
+ boolean expert, boolean forceWrite, String shortDesc,
+ String longDesc, LongCallback cb);
+
+ public void register(String optionName, String defaultValueString,
+ int sortOrder, boolean expert, boolean forceWrite,
+ String shortDesc, String longDesc, IntCallback cb);
+
+ public void register(String optionName, String defaultValueString,
+ int sortOrder, boolean expert, boolean forceWrite,
+ String shortDesc, String longDesc, LongCallback cb);
+
+ public void register(String optionName, boolean defaultValue,
+ int sortOrder, boolean expert, boolean forceWrite,
+ String shortDesc, String longDesc, BooleanCallback cb);
+
+ public void register(String optionName, String defaultValue, int
sortOrder,
+ boolean expert, boolean forceWrite, String shortDesc,
+ String longDesc, StringCallback cb);
+
+ public void register(String optionName, short defaultValue, int
sortOrder,
+ boolean expert, boolean forceWrite, String shortDesc,
+ String longDesc, ShortCallback cb);
+
+ public void register(String optionName, String[] defaultValue,
+ int sortOrder, boolean expert, boolean forceWrite,
+ String shortDesc, String longDesc, StringArrCallback
cb);
+
+ public int getInt(String optionName);
+
+ public long getLong(String optionName);
+
+ public boolean getBoolean(String optionName);
+
+ public String getString(String optionName);
+
+ public String[] getStringArr(String optionName);
+
+ public short getShort(String optionName);
+
+ /**
+ * Has the object we are attached to finished initialization?
+ */
+ public boolean hasFinishedInitialization();
+
+ /**
+ * Called when the object we are attached to has finished init.
+ * After this point, the callbacks are authoritative for values of
+ * config variables, and will be called when values are changed by
+ * the user.
+ */
+ public void finishedInitialization();
+
+ /**
+ * Force an option to be updated even if it hasn't changed.
+ * @throws InvalidConfigValueException
+ */
+ public void forceUpdate(String optionName)
+ throws InvalidConfigValueException;
+
+ public void set(String name, String value)
+ throws InvalidConfigValueException;
+
+ public void fixOldDefault(String name, String value);
+
+}
\ No newline at end of file
Copied: trunk/freenet/src/freenet/support/api/BooleanCallback.java (from rev
11395, trunk/freenet/src/freenet/config/BooleanCallback.java)
===================================================================
--- trunk/freenet/src/freenet/support/api/BooleanCallback.java
(rev 0)
+++ trunk/freenet/src/freenet/support/api/BooleanCallback.java 2006-12-16
00:43:10 UTC (rev 11432)
@@ -0,0 +1,27 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+package freenet.support.api;
+
+import freenet.config.InvalidConfigValueException;
+
+/**
+ * A callback to be called when a config value of integer type changes.
+ * Also reports the current value.
+ */
+public interface BooleanCallback {
+
+ /**
+ * Get the current, used value of the config variable.
+ */
+ boolean get();
+
+ /**
+ * Set the config variable to a new value.
+ * @param val The new value.
+ * @throws InvalidConfigOptionException If the new value is invalid for
+ * this particular option.
+ */
+ void set(boolean val) throws InvalidConfigValueException;
+
+}
Copied: trunk/freenet/src/freenet/support/api/IntCallback.java (from rev 11395,
trunk/freenet/src/freenet/config/IntCallback.java)
===================================================================
--- trunk/freenet/src/freenet/support/api/IntCallback.java
(rev 0)
+++ trunk/freenet/src/freenet/support/api/IntCallback.java 2006-12-16
00:43:10 UTC (rev 11432)
@@ -0,0 +1,27 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+package freenet.support.api;
+
+import freenet.config.InvalidConfigValueException;
+
+/**
+ * A callback to be called when a config value of integer type changes.
+ * Also reports the current value.
+ */
+public interface IntCallback {
+
+ /**
+ * Get the current, used value of the config variable.
+ */
+ int get();
+
+ /**
+ * Set the config variable to a new value.
+ * @param val The new value.
+ * @throws InvalidConfigOptionException If the new value is invalid for
+ * this particular option.
+ */
+ void set(int val) throws InvalidConfigValueException;
+
+}
Copied: trunk/freenet/src/freenet/support/api/LongCallback.java (from rev
11395, trunk/freenet/src/freenet/config/LongCallback.java)
===================================================================
--- trunk/freenet/src/freenet/support/api/LongCallback.java
(rev 0)
+++ trunk/freenet/src/freenet/support/api/LongCallback.java 2006-12-16
00:43:10 UTC (rev 11432)
@@ -0,0 +1,27 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+package freenet.support.api;
+
+import freenet.config.InvalidConfigValueException;
+
+/**
+ * A callback to be called when a config value of long type changes.
+ * Also reports the current value.
+ */
+public interface LongCallback {
+
+ /**
+ * Get the current, used value of the config variable.
+ */
+ long get();
+
+ /**
+ * Set the config variable to a new value.
+ * @param val The new value.
+ * @throws InvalidConfigOptionException If the new value is invalid for
+ * this particular option.
+ */
+ void set(long val) throws InvalidConfigValueException;
+
+}
Copied: trunk/freenet/src/freenet/support/api/ShortCallback.java (from rev
11395, trunk/freenet/src/freenet/config/ShortCallback.java)
===================================================================
--- trunk/freenet/src/freenet/support/api/ShortCallback.java
(rev 0)
+++ trunk/freenet/src/freenet/support/api/ShortCallback.java 2006-12-16
00:43:10 UTC (rev 11432)
@@ -0,0 +1,24 @@
+package freenet.support.api;
+
+import freenet.config.InvalidConfigValueException;
+
+/**
+ * A callback to be called when a config value of short type changes.
+ * Also reports the current value.
+ */
+public interface ShortCallback {
+
+ /**
+ * Get the current, used value of the config variable.
+ */
+ short get();
+
+ /**
+ * Set the config variable to a new value.
+ * @param val The new value.
+ * @throws InvalidConfigOptionException If the new value is invalid for
+ * this particular option.
+ */
+ void set(short val) throws InvalidConfigValueException;
+
+}
Copied: trunk/freenet/src/freenet/support/api/StringArrCallback.java (from rev
11395, trunk/freenet/src/freenet/config/StringArrCallback.java)
===================================================================
--- trunk/freenet/src/freenet/support/api/StringArrCallback.java
(rev 0)
+++ trunk/freenet/src/freenet/support/api/StringArrCallback.java
2006-12-16 00:43:10 UTC (rev 11432)
@@ -0,0 +1,24 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+package freenet.support.api;
+
+import freenet.config.InvalidConfigValueException;
+
+/** Callback (getter/setter) for a string config variable */
+public interface StringArrCallback {
+
+ /**
+ * Get the current, used value of the config variable.
+ */
+ String get();
+
+ /**
+ * Set the config variable to a new value.
+ * @param val The new value.
+ * @throws InvalidConfigOptionException If the new value is invalid for
+ * this particular option.
+ */
+ void set(String val) throws InvalidConfigValueException;
+
+}
Copied: trunk/freenet/src/freenet/support/api/StringCallback.java (from rev
11395, trunk/freenet/src/freenet/config/StringCallback.java)
===================================================================
--- trunk/freenet/src/freenet/support/api/StringCallback.java
(rev 0)
+++ trunk/freenet/src/freenet/support/api/StringCallback.java 2006-12-16
00:43:10 UTC (rev 11432)
@@ -0,0 +1,24 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+package freenet.support.api;
+
+import freenet.config.InvalidConfigValueException;
+
+/** Callback (getter/setter) for a string config variable */
+public interface StringCallback {
+
+ /**
+ * Get the current, used value of the config variable.
+ */
+ String get();
+
+ /**
+ * Set the config variable to a new value.
+ * @param val The new value.
+ * @throws InvalidConfigOptionException If the new value is invalid for
+ * this particular option.
+ */
+ void set(String val) throws InvalidConfigValueException;
+
+}
Modified: trunk/plugins/SNMP/snmplib/SNMPBindtoCallback.java
===================================================================
--- trunk/plugins/SNMP/snmplib/SNMPBindtoCallback.java 2006-12-16 00:37:10 UTC
(rev 11431)
+++ trunk/plugins/SNMP/snmplib/SNMPBindtoCallback.java 2006-12-16 00:43:10 UTC
(rev 11432)
@@ -1,7 +1,7 @@
package plugins.SNMP.snmplib;
import freenet.config.InvalidConfigValueException;
-import freenet.config.StringCallback;
+import freenet.support.api.StringCallback;
public class SNMPBindtoCallback implements StringCallback {
Modified: trunk/plugins/SNMP/snmplib/SNMPPortNumberCallback.java
===================================================================
--- trunk/plugins/SNMP/snmplib/SNMPPortNumberCallback.java 2006-12-16
00:37:10 UTC (rev 11431)
+++ trunk/plugins/SNMP/snmplib/SNMPPortNumberCallback.java 2006-12-16
00:43:10 UTC (rev 11432)
@@ -1,7 +1,7 @@
package plugins.SNMP.snmplib;
-import freenet.config.IntCallback;
import freenet.config.InvalidConfigValueException;
+import freenet.support.api.IntCallback;
public class SNMPPortNumberCallback implements IntCallback {