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