private static org.apache.commons.configuration.Configuration init() {
   PropertiesConfiguration config = null;
   try {
     config = new PropertiesConfiguration();
     config.setListDelimiter('\0');
     config.load(ERR_CODE_FILE);
   } catch (ConfigurationException ex) {
     // error out if the configuration file is not there
     String message = "Failed to load serengeti error message file.";
     Logger.getLogger(RestResource.class).fatal(message, ex);
     throw BddException.APP_INIT_ERROR(ex, message);
   }
   return config;
 }
Exemple #2
0
  // Loads the settings from config file. If no values defined, the deafult values are returned.
  public static Settings loadSettings() {
    config.setListDelimiter('|');
    Settings s = new Settings();
    try {
      config.load("vidor.config");
    } catch (ConfigurationException ex) {
      ex.printStackTrace();
    }

    s.setVlcLocation(config.getString("vlclocation", ""));
    s.setThumbnailCount(config.getInt("thumbnailcount", 10));
    s.setThumbnailWidth(config.getInt("thumbnailwidth", 200));
    s.setThumbnailHighlightColor(config.getString("thumbnailhighlightcolor", ""));

    List<String> f = new ArrayList(Arrays.asList(config.getStringArray("folders")));
    if (!f.get(0).trim().isEmpty()) { // Bug fix - Empty folder check
      s.setFolders(f);
    }

    return s;
  }