Package org.elasticsearch.common.settings

Examples of org.elasticsearch.common.settings.SettingsException


    urlGetDocumentDetails = getUrlFromConfig(config, CFG_URL_GET_DOCUMENT_DETAILS, false);
    urlGetDocumentDetailsField = Utils.trimToNull(XContentMapValues.nodeStringValue(
        config.get(CFG_URL_GET_DOCUMENT_DETAILS_FIELD), null));

    if (urlGetDocumentDetails != null && urlGetDocumentDetailsField != null) {
      throw new SettingsException("You can use only one of remote/" + CFG_URL_GET_DOCUMENT_DETAILS + " and remote/"
          + CFG_URL_GET_DOCUMENT_DETAILS_FIELD + " configuration parametr.");
    }

    getDocsResFieldDocuments = Utils.trimToNull(XContentMapValues.nodeStringValue(
        config.get(CFG_GET_DOCS_RES_FIELD_DOCUMENTS), null));
View Full Code Here


      throws SettingsException {
    String url = null;
    if (config != null)
      url = Utils.trimToNull(XContentMapValues.nodeStringValue(config.get(cfgProperyName), null));
    if (mandatory && url == null) {
      throw new SettingsException("remote/" + cfgProperyName + " element of configuration structure not found or empty");
    }
    if (url != null) {
      try {
        new URL(url);
      } catch (MalformedURLException e) {
        throw new SettingsException("Parameter remote/" + cfgProperyName + " is malformed URL " + e.getMessage());
      }
    }
    return url;
  }
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

      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

    if (settings.containsKey("jira")) {
      Map<String, Object> jiraSettings = (Map<String, Object>) settings.get("jira");
      jiraUrlBase = XContentMapValues.nodeStringValue(jiraSettings.get("urlBase"), null);
      if (Utils.isEmpty(jiraUrlBase)) {
        throw new SettingsException("jira/urlBase element of configuration structure not found or empty");
      }
      Integer timeout = new Long(Utils.parseTimeValue(jiraSettings, "timeout", 5, TimeUnit.SECONDS)).intValue();
      jiraUser = XContentMapValues.nodeStringValue(jiraSettings.get("username"), "Anonymous access");
      jiraClient = new JIRA5RestClient(jiraUrlBase, XContentMapValues.nodeStringValue(jiraSettings.get("username"),
          null), XContentMapValues.nodeStringValue(jiraSettings.get("pwd"), null), timeout,
          XContentMapValues.nodeStringValue(jiraSettings.get("restApiVersion"), null));
      jiraClient.setListJIRAIssuesMax(XContentMapValues.nodeIntegerValue(jiraSettings.get("maxIssuesPerRequest"), 50));
      if (jiraSettings.get("jqlTimeZone") != null) {
        TimeZone tz = TimeZone.getTimeZone(XContentMapValues.nodeStringValue(jiraSettings.get("jqlTimeZone"), null));
        jiraJqlTimezone = tz.getDisplayName();
        jiraClient.setJQLDateFormatTimezone(tz);
      }
      maxIndexingThreads = XContentMapValues.nodeIntegerValue(jiraSettings.get("maxIndexingThreads"), 1);
      indexUpdatePeriod = Utils.parseTimeValue(jiraSettings, "indexUpdatePeriod", 5, TimeUnit.MINUTES);
      indexFullUpdatePeriod = Utils.parseTimeValue(jiraSettings, "indexFullUpdatePeriod", 12, TimeUnit.HOURS);
      if (jiraSettings.containsKey("projectKeysIndexed")) {
        allIndexedProjectsKeys = Utils.parseCsvString(XContentMapValues.nodeStringValue(
            jiraSettings.get("projectKeysIndexed"), null));
        if (allIndexedProjectsKeys != null) {
          // stop loading from JIRA
          allIndexedProjectsKeysNextRefresh = Long.MAX_VALUE;
        }
      }
      if (jiraSettings.containsKey("projectKeysExcluded")) {
        projectKeysExcluded = Utils.parseCsvString(XContentMapValues.nodeStringValue(
            jiraSettings.get("projectKeysExcluded"), null));
      }
    } else {
      throw new SettingsException("'jira' 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_ISSUE_TYPE_NAME_DEFAULT);
    } else {
      indexName = riverName.name();
      typeName = INDEX_ISSUE_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.addIssueDataPreprocessor(StructuredContentPreprocessorFactory.createPreprocessor(ppc,
                client));
          } catch (IllegalArgumentException e) {
            throw new SettingsException(e.getMessage(), e);
          }
        }
      }
    }
  }
View Full Code Here

  public JIRA5RestClient(String jiraUrlBase, String jiraUsername, String jiraPassword, Integer timeout,
      String restApiVersion) {

    jiraRestAPIUrlBase = prepareAPIURLFromBaseURL(jiraUrlBase, restApiVersion);
    if (jiraRestAPIUrlBase == null) {
      throw new SettingsException("Parameter jira/urlBase must be set!");
    }

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

    PoolingClientConnectionManager connectionManager = new PoolingClientConnectionManager();
    connectionManager.setDefaultMaxPerRoute(20);
    connectionManager.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

  }

  private void validateConfigurationFieldsStructure(Map<String, Map<String, String>> value, String configFieldName) {
    for (String idxFieldName : value.keySet()) {
      if (Utils.isEmpty(idxFieldName)) {
        throw new SettingsException("Empty key found in '" + configFieldName + "' map.");
      }
      Map<String, String> fc = value.get(idxFieldName);
      if (Utils.isEmpty(fc.get(CONFIG_FIELDS_JIRAFIELD))) {
        throw new SettingsException("'jira_field' is not defined in '" + configFieldName + "/" + idxFieldName + "'");
      }
      String fil = fc.get(CONFIG_FIELDS_VALUEFILTER);
      if (fil != null && !filtersConfig.containsKey(fil)) {
        throw new SettingsException("Filter definition not found for filter name '" + fil + "' defined in '"
            + configFieldName + "/" + idxFieldName + "/value_filter'");
      }
    }
  }
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.