示例#1
0
 /**
  * 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();
 }
示例#2
0
 public static synchronized void initialize() {
   if (!initialized) {
     initialized = true;
     RC.loadDefaults();
     RC.setWellKnown();
     RC.loadFromJava();
   }
 }
示例#3
0
 /** 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
     }
   }
 }
示例#4
0
  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;
  }
示例#5
0
 public static boolean getAllowSelfSigned() {
   if (!initialized) RC.initialize();
   return allowSelfSigned;
 }
示例#6
0
 public static boolean getVerifyServer() {
   if (!initialized) RC.initialize();
   return verifyServer;
 }
示例#7
0
 public static boolean getUseGroups() {
   if (!initialized) RC.initialize();
   return useGroups;
 }
示例#8
0
 /**
  * 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);
 }
示例#9
0
 static {
   RC.initialize();
 }