Exemplo n.º 1
0
 public static void main(String[] args) {
   StringKeyLinkedMap<Object> defMap = ConfigValueUtil.getConfigDefault(new Configure(true));
   StringEnumer enu = defMap.keys();
   while (enu.hasMoreElements()) {
     String key = enu.nextString();
     if (ignoreSet.contains(key)) continue;
     System.out.println(key + " : " + ConfigValueUtil.toValue(defMap.get(key)));
   }
 }
Exemplo n.º 2
0
 public synchronized boolean reload(boolean force) {
   long now = System.currentTimeMillis();
   if (force == false && now < last_check + 3000) return false;
   last_check = now;
   File file = getPropertyFile();
   if (file.lastModified() == last_load_time) {
     return false;
   }
   last_load_time = file.lastModified();
   Properties temp = new Properties();
   if (file.canRead()) {
     FileInputStream in = null;
     try {
       in = new FileInputStream(file);
       temp.load(in);
     } catch (Exception e) {
       e.printStackTrace();
     } finally {
       FileUtil.close(in);
     }
   }
   property = ConfigValueUtil.replaceSysProp(temp);
   apply();
   ConfObserver.run();
   return true;
 }
Exemplo n.º 3
0
 public MapValue getKeyValueInfo() {
   StringKeyLinkedMap<Object> defMap = ConfigValueUtil.getConfigDefault(new Configure(true));
   StringKeyLinkedMap<Object> curMap = ConfigValueUtil.getConfigDefault(this);
   MapValue m = new MapValue();
   ListValue nameList = m.newList("key");
   ListValue valueList = m.newList("value");
   ListValue defList = m.newList("default");
   StringEnumer enu = defMap.keys();
   while (enu.hasMoreElements()) {
     String key = enu.nextString();
     if (ignoreSet.contains(key)) continue;
     nameList.add(key);
     valueList.add(ConfigValueUtil.toValue(curMap.get(key)));
     defList.add(ConfigValueUtil.toValue(defMap.get(key)));
   }
   return m;
 }