Package org.elasticsearch.common.settings

Examples of org.elasticsearch.common.settings.SettingsException


  protected Object value = null;

  @Override
  public void init(Map<String, Object> settings) throws SettingsException {
    if (settings == null) {
      throw new SettingsException("'settings' section is not defined for preprocessor " + name);
    }
    field = XContentMapValues.nodeStringValue(settings.get(CFG_FIELD), null);
    validateConfigurationStringNotEmpty(field, CFG_FIELD);
    value = settings.get(CFG_VALUE);
  }
View Full Code Here


  @SuppressWarnings("unchecked")
  @Override
  public void init(Map<String, Object> settings) throws SettingsException {
    if (settings == null) {
      throw new SettingsException("'settings' section is not defined for preprocessor " + name);
    }
    fieldSource = XContentMapValues.nodeStringValue(settings.get(CFG_SOURCE_FIELD), null);
    validateConfigurationStringNotEmpty(fieldSource, CFG_SOURCE_FIELD);
    fieldTarget = XContentMapValues.nodeStringValue(settings.get(CFG_TARGET_FIELD), null);
    validateConfigurationStringNotEmpty(fieldTarget, CFG_TARGET_FIELD);
View Full Code Here

  protected String field;

  @Override
  public void init(Map<String, Object> settings) throws SettingsException {
    if (settings == null) {
      throw new SettingsException("'settings' section is not defined for preprocessor " + name);
    }
    field = XContentMapValues.nodeStringValue(settings.get(CFG_FIELD), null);
    validateConfigurationStringNotEmpty(field, CFG_FIELD);
  }
View Full Code Here

   * @param configFieldName name of field in preprocessor settings structure. Used for error message.
   * @throws SettingsException thrown if value is null or empty
   */
  protected void validateConfigurationStringNotEmpty(String value, String configFieldName) throws SettingsException {
    if (ValueUtils.isEmpty(value)) {
      throw new SettingsException("Missing or empty 'settings/" + configFieldName + "' configuration value for '"
          + name + "' preprocessor");
    }
  }
View Full Code Here

   */
  @SuppressWarnings("unchecked")
  protected void validateConfigurationObjectNotEmpty(Object value, String configFieldName) throws SettingsException {
    if (value == null || (value instanceof String && ValueUtils.isEmpty((String) value))
        || ((value instanceof Collection) && ((Collection<Object>) value).isEmpty())) {
      throw new SettingsException("Missing or empty 'settings/" + configFieldName + "' configuration value for '"
          + name + "' preprocessor");
    }
  }
View Full Code Here

   * @param configFieldName name of field in preprocessor settings structure. Used for error message.
   * @throws SettingsException thrown if value is null or empty
   */
  protected void validateConfigurationStringNotEmpty(String value, String configFieldName) throws SettingsException {
    if (ValueUtils.isEmpty(value)) {
      throw new SettingsException("Missing or empty 'settings/" + configFieldName + "' configuration value for '"
          + name + "' preprocessor");
    }
  }
View Full Code Here

   */
  @SuppressWarnings("unchecked")
  protected void validateConfigurationObjectNotEmpty(Object value, String configFieldName) throws SettingsException {
    if (value == null || (value instanceof String && ValueUtils.isEmpty((String) value))
        || ((value instanceof Collection) && ((Collection<Object>) value).isEmpty())) {
      throw new SettingsException("Missing or empty 'settings/" + configFieldName + "' configuration value for '"
          + name + "' preprocessor");
    }
  }
View Full Code Here

   */
  protected int readMandatoryIntegerConfigValue(Map<String, Object> settings, String configFieldName) {
    try {
      Integer mv = StructureUtils.getIntegerValue(settings, configFieldName);
      if (mv == null) {
        throw new SettingsException("Missing or empty 'settings/" + configFieldName + "' configuration value for '"
            + name + "' preprocessor");
      } else {
        return mv;
      }
    } catch (NumberFormatException e) {
      throw new SettingsException("Non integer 'settings/" + configFieldName + "' configuration value for '" + name
          + "' preprocessor");
    }
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  @Override
  public void init(Map<String, Object> settings) throws SettingsException {
    if (settings == null) {
      throw new SettingsException("'settings' section is not defined for preprocessor " + name);
    }
    fieldSource = XContentMapValues.nodeStringValue(settings.get(CFG_SOURCE_FIELD), null);
    validateConfigurationStringNotEmpty(fieldSource, CFG_SOURCE_FIELD);
    fieldTarget = XContentMapValues.nodeStringValue(settings.get(CFG_TARGET_FIELD), null);
    validateConfigurationStringNotEmpty(fieldTarget, CFG_TARGET_FIELD);
View Full Code Here

  @SuppressWarnings("unchecked")
  @Override
  public void init(Map<String, Object> settings) throws SettingsException {
    if (settings == null) {
      throw new SettingsException("'settings' section is not defined for preprocessor " + name);
    }
    fieldSource = XContentMapValues.nodeStringValue(settings.get(CFG_SOURCE_FIELD), null);
    validateConfigurationStringNotEmpty(fieldSource, CFG_SOURCE_FIELD);
    fieldTarget = XContentMapValues.nodeStringValue(settings.get(CFG_TARGET_FIELD), null);
    validateConfigurationStringNotEmpty(fieldTarget, CFG_TARGET_FIELD);
View Full Code Here

TOP

Related Classes of org.elasticsearch.common.settings.SettingsException

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.