Beispiel #1
0
 /** Saves the configuration info to the disk. */
 public synchronized void save() {
   if (BulkChange.contains(this)) return;
   try {
     getConfigFile().write(this);
     SaveableListener.fireOnChange(this, getConfigFile());
   } catch (IOException e) {
     LOGGER.log(Level.WARNING, "Failed to save " + getConfigFile(), e);
   }
 }
Beispiel #2
0
  /**
   * Loads the data from the disk into this object.
   *
   * <p>The constructor of the derived class must call this method. (If we do that in the base
   * class, the derived class won't get a chance to set default values.)
   */
  public synchronized void load() {
    XmlFile file = getConfigFile();
    if (!file.exists()) return;

    try {
      file.unmarshal(this);
    } catch (IOException e) {
      LOGGER.log(Level.WARNING, "Failed to load " + file, e);
    }
  }