Package com.github.diamond.client.config

Examples of com.github.diamond.client.config.PropertiesReader


   * @throws Exception
   */
  public void load(Reader in, boolean reload) throws ConfigurationRuntimeException {
    Map<String, String> tmpStore = new LinkedHashMap<String, String>();
   
    PropertiesReader reader = new PropertiesReader(in);
    try {
      while (reader.nextProperty()) {
        String key = reader.getPropertyName();
        String value = reader.getPropertyValue();
        tmpStore.put(key, value);
        if(reload) {
          String oldValue = store.remove(key);
          if(oldValue == null)
            fireEvent(EventType.ADD, key, value);
          else if(!oldValue.equals(value))
            fireEvent(EventType.UPDATE, key, value);
        }
      }
     
      if(reload) {
        for(String key : store.keySet()) {
          fireEvent(EventType.CLEAR, key, store.get(key));
        }
      }
    } catch (IOException ioex) {
      throw new ConfigurationRuntimeException(ioex);
    } finally {
      try {
        reader.close();
      } catch (IOException e) {
        ;
      }
    }
   
View Full Code Here

TOP

Related Classes of com.github.diamond.client.config.PropertiesReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.