class VulasConfiguration {

  public void checkSettings() throws ConfigurationException {

    // Optional settings
    final String[] optional_settings = this.getStringArray(OPTI_SETTINGS, null);
    if (optional_settings != null && optional_settings.length > 0) {
      for (String s : optional_settings) {
        if (this.isEmpty(s)) {
          log.warn("Optional setting [" + s + "] not specified");
        }
      }
    }

    // Mandatory settings
    final String[] mandatory_settings = this.getStringArray(MAND_SETTINGS, null);
    final Set<String> not_specified = new HashSet<String>();
    if (mandatory_settings != null && mandatory_settings.length > 0) {
      for (String s : mandatory_settings) {
        // Check if empty
        if (this.isEmpty(s)) {
          log.error("Mandatory setting [" + s + "] not specified");
          not_specified.add(s);
        }
      }
    }

    // Check format (where provided)
    final Iterator<String> iter = this.cfg.getKeys();
    final Set<String> wrong_format = new HashSet<String>();
    while (iter.hasNext()) {
      final String key = iter.next();
      if (key.startsWith("vulas.") && key.endsWith(".format") && !this.isEmpty(key)) {
        final String key_to_check = key.substring(0, key.indexOf(".format"));
        if (!this.isEmpty(key_to_check)) {
          final String[] values_to_check = this.getStringArray(key_to_check, new String[] {});
          for (String value_to_check : values_to_check) {
            if (!value_to_check.matches(this.cfg.getString(key))) {
              log.error(
                  "Setting ["
                      + key_to_check
                      + "], value ["
                      + value_to_check
                      + "] does not comply with the required format ["
                      + this.cfg.getString(key)
                      + "]");
              wrong_format.add(key_to_check);
            }
          }
        }
      }
    }

    if (!not_specified.isEmpty() || !wrong_format.isEmpty())
      throw new ConfigurationException(
          "The following mandatory settings are not specified: ["
              + StringUtil.join(not_specified, ", ")
              + "], the following settings do not comply with the required format: ["
              + StringUtil.join(wrong_format, ", ")
              + "]");
  }

  public  VulasConfiguration();

}