Package org.elasticsearch.common.settings

Examples of org.elasticsearch.common.settings.SettingsException


    }
  }

  private void validateConfigurationString(String value, String configFieldName) throws SettingsException {
    if (Utils.isEmpty(value)) {
      throw new SettingsException("String value must be provided for '" + configFieldName + "' configuration!");
    }
  }
View Full Code Here


    }
  }

  private void validateConfigurationObject(Object value, String configFieldName) throws SettingsException {
    if (value == null) {
      throw new SettingsException("Value must be provided for '" + configFieldName + "' configuration!");
    }
  }
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

          remoteSettings.get("remoteClientClass"), null));
      if (remoteClientClass != null) {
        try {
          remoteSystemClient = (IRemoteSystemClient) Class.forName(remoteClientClass).newInstance();
        } catch (Exception e) {
          throw new SettingsException("Unable to instantiate class defined by 'remote/remoteClientClass': "
              + e.getMessage());
        }
      } else {
        remoteSystemClient = new GetJSONClient();
      }
      remoteSystemClient.init(remoteSettings, allIndexedSpacesKeysNextRefresh != Long.MAX_VALUE, this);
    } else {
      throw new SettingsException("'remote' element of river configuration structure not found");
    }

    Map<String, Object> indexSettings = null;
    if (settings.containsKey("index")) {
      indexSettings = (Map<String, Object>) settings.get("index");
      indexName = XContentMapValues.nodeStringValue(indexSettings.get("index"), riverName.name());
      typeName = XContentMapValues.nodeStringValue(indexSettings.get("type"), INDEX_DOCUMENT_TYPE_NAME_DEFAULT);
    } else {
      indexName = riverName.name();
      typeName = INDEX_DOCUMENT_TYPE_NAME_DEFAULT;
    }

    Map<String, Object> activityLogSettings = null;
    if (settings.containsKey("activity_log")) {
      activityLogSettings = (Map<String, Object>) settings.get("activity_log");
      activityLogIndexName = Utils
          .trimToNull(XContentMapValues.nodeStringValue(activityLogSettings.get("index"), null));
      if (activityLogIndexName == null) {
        throw new SettingsException(
            "'activity_log/index' element of river configuration structure must be defined with some string");
      }
      activityLogTypeName = Utils.trimToNull(XContentMapValues.nodeStringValue(activityLogSettings.get("type"),
          INDEX_ACTIVITY_TYPE_NAME_DEFAULT));
    }
View Full Code Here

        for (Map<String, Object> ppc : preproclist) {
          try {
            indexStructureBuilder.addDataPreprocessor(StructuredContentPreprocessorFactory.createPreprocessor(ppc,
                client));
          } catch (IllegalArgumentException e) {
            throw new SettingsException(e.getMessage(), e);
          }
        }
      }
    }
  }
View Full Code Here

   */
  public SourceClientREST(Map<String, Object> sourceClientSettings) throws SettingsException {

    restAPIUrlBase = prepareAPIURLFromBaseURL((String) sourceClientSettings.get("urlBase"));
    if (restAPIUrlBase == null) {
      throw new SettingsException("Parameter es_connection/urlBase must be set!");
    }

    URL url = null;
    try {
      url = new URL(restAPIUrlBase);
    } catch (MalformedURLException e) {
      throw new SettingsException("Parameter es_connection/urlBase is malformed: " + e.getMessage());
    }

    PoolingHttpClientConnectionManager connManager = new PoolingHttpClientConnectionManager();
    connManager.setDefaultMaxPerRoute(20);
    connManager.setMaxTotal(20);
View Full Code Here

      Map<String, Object> ret = parser.mapAndClose();
      if (logger.isDebugEnabled())
        logger.debug("jar packaged JSON file {} content is: {}", filePath, ret);
      return ret;
    } catch (IOException e) {
      throw new SettingsException(e.getMessage(), e);
    } finally {
      if (parser != null)
        parser.close();
    }
  }
View Full Code Here

    urlGetSitemap = getUrlFromConfig(config, CFG_URL_GET_SITEMAP, true);

    try {
      htmlMapping = (Map<String, Map<String, Object>>) config.get(CFG_HTML_MAPPING);
    } catch (ClassCastException e) {
      throw new SettingsException("'remote/" + CFG_HTML_MAPPING + "' configuration section is invalid");
    }

    if (spaceListLoadingEnabled) {
      throw new SettingsException(
          "Dynamic Spaces obtaining is not supported, use 'remote/spacesIndexed' to configure one space or static list");
    }

    String remoteUsername = initHttpClient(logger, config, pwdLoader, urlGetSitemap);
View Full Code Here

              ret.put(dataField, value);
            }
            return ret;
          }
        } catch (ClassCastException e) {
          throw new SettingsException("'remote/" + CFG_HTML_MAPPING + "' configuration section is invalid");
        } catch (Exception e) {
          throw new RemoteDocumentNotFoundException("HTML document can't be processed: " + e.getMessage(), e);
        }
      } else {
        throw new RemoteDocumentNotFoundException("HTML document can't be processed as it is not html but: "
View Full Code Here

      String idFieldConfigPropertyName) {
    Object id = XContentMapValues.extractValue(idFieldName, document);
    if (id == null)
      return null;
    if (!isSimpleValue(id))
      throw new SettingsException("Remote data field '" + idFieldName + "' defined in 'index/"
          + idFieldConfigPropertyName + "' config param must provide simple value, but value is " + id);

    return id.toString();
  }
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.