first pass at the 0.4 architecture. not ready for use or integration yet, but is functional with some manual build/config work

This commit is contained in:
jrandom
2004-07-24 02:06:07 +00:00
committed by zzz
parent 740a2da702
commit b68463249e
29 changed files with 1503 additions and 0 deletions

View File

@ -0,0 +1,38 @@
package net.i2p.router.web;
import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;
import net.i2p.router.RouterContext;
public class ConfigAdvancedHelper {
private RouterContext _context;
/**
* Configure this bean to query a particular router context
*
* @param contextId begging few characters of the routerHash, or null to pick
* the first one we come across.
*/
public void setContextId(String contextId) {
try {
_context = ContextHelper.getContext(contextId);
} catch (Throwable t) {
t.printStackTrace();
}
}
public ConfigAdvancedHelper() {}
public String getSettings() {
StringBuffer buf = new StringBuffer(4*1024);
Set names = _context.router().getConfigSettings();
TreeSet sortedNames = new TreeSet(names);
for (Iterator iter = sortedNames.iterator(); iter.hasNext(); ) {
String name = (String)iter.next();
String val = _context.router().getConfigSetting(name);
buf.append(name).append('=').append(val).append('\n');
}
return buf.toString();
}
}