/** * Allow users to add to the default rc * * @param key * @param value * @param url null => not url specific */ public static synchronized void add(String key, String value, String url) { if (key == null) return; if (!initialized) RC.initialize(); Triple t = new Triple(key, value, url); dfaltRC.insert(t); // recompute well-knowns setWellKnown(); }
public static synchronized void initialize() { if (!initialized) { initialized = true; RC.loadDefaults(); RC.setWellKnown(); RC.loadFromJava(); } }
/** Record some well known parameters */ static void setWellKnown() { if (dfaltRC.triplestore.size() == 0) return; // Walk the set of triples looking for those that have no url for (String key : dfaltRC.keySet()) { Triple triple = dfaltRC.lookup(key); if (triple.url == null) { RC.set(key, triple.value); // let set sort it out } } }
static void loadDefaults() { RC rc0 = new RC(); String[] locations = new String[] { System.getProperty("user.home"), System.getProperty("user.dir"), }; boolean found1 = false; for (String loc : locations) { if (loc == null) continue; String dir = loc.replace('\\', '/'); if (dir.endsWith("/")) dir = dir.substring(0, dir.length() - 1); for (String rcpath : rcfilelist) { String filepath = loc + "/" + rcpath; if (rc0.load(filepath)) found1 = true; } } if (!found1) if (showlog) log.debug("No .rc file found"); dfaltRC = rc0; }
public static boolean getAllowSelfSigned() { if (!initialized) RC.initialize(); return allowSelfSigned; }
public static boolean getVerifyServer() { if (!initialized) RC.initialize(); return verifyServer; }
public static boolean getUseGroups() { if (!initialized) RC.initialize(); return useGroups; }
/** * Allow users to search the default rc * * @param key * @param url null => not url specific * @return value corresponding to key+url, or null if does not exist */ public static synchronized String find(String key, String url) { if (key == null) return null; if (!initialized) RC.initialize(); Triple t = dfaltRC.lookup(key, url); return (t == null ? null : t.value); }
static { RC.initialize(); }