Author: toad
Date: 2006-03-07 13:17:51 +0000 (Tue, 07 Mar 2006)
New Revision: 8175

Modified:
   trunk/freenet/src/freenet/config/Config.java
   trunk/freenet/src/freenet/config/SubConfig.java
Log:
502:
Hooks for webconfig.

Modified: trunk/freenet/src/freenet/config/Config.java
===================================================================
--- trunk/freenet/src/freenet/config/Config.java        2006-03-07 02:05:40 UTC 
(rev 8174)
+++ trunk/freenet/src/freenet/config/Config.java        2006-03-07 13:17:51 UTC 
(rev 8175)
@@ -36,5 +36,10 @@
        public void onRegister(SubConfig config, Option o) {
                // Do nothing
        }
+
+       /** Fetch all the SubConfig's. Used by user-facing config thingies. */
+       public synchronized SubConfig[] getConfigs() {
+               return (SubConfig[]) configsByPrefix.values().toArray(new 
SubConfig[configsByPrefix.size()]);
+       }

 }

Modified: trunk/freenet/src/freenet/config/SubConfig.java
===================================================================
--- trunk/freenet/src/freenet/config/SubConfig.java     2006-03-07 02:05:40 UTC 
(rev 8174)
+++ trunk/freenet/src/freenet/config/SubConfig.java     2006-03-07 13:17:51 UTC 
(rev 8175)
@@ -26,6 +26,14 @@
                config.register(this);
        }

+       /**
+        * Return all the options registered. Each includes its name.
+        * Used by e.g. webconfig.
+        */
+       public Option[] getOptions() {
+               return (Option[]) map.values().toArray(new Option[map.size()]);
+       }
+       
        public void register(Option o) {
                synchronized(this) {
                        if(o.name.indexOf(SimpleFieldSet.MULTI_LEVEL_CHAR) != 
-1)


Reply via email to