コード例 #1
0
  /** Saves the settings state after validating them. */
  public void save() {
    String resource = getTargetResource();
    String hosts = getTargetHosts();

    Assert.hasText(
        resource,
        String.format("No resource (index/query/location) ['%s'] specified", ES_RESOURCE));
    setProperty(INTERNAL_ES_TARGET_RESOURCE, resource);
    setProperty(INTERNAL_ES_HOSTS, hosts);
  }
コード例 #2
0
  public static void setFilters(Settings settings, String... filters) {
    // clear any filters inside the settings
    settings.setProperty(InternalConfigurationOptions.INTERNAL_ES_QUERY_FILTERS, "");

    if (ObjectUtils.isEmpty(filters)) {
      return;
    }

    settings.setProperty(
        InternalConfigurationOptions.INTERNAL_ES_QUERY_FILTERS, IOUtils.serializeToBase64(filters));
  }
コード例 #3
0
  /** Saves the settings state after validating them. */
  public void save() {
    String targetUri = getTargetUri();
    String resource = getTargetResource();

    Assert.hasText(targetUri, "No address specified");
    Assert.hasText(
        resource,
        String.format("No resource (index/query/location) ['%s'] specified", ES_RESOURCE));

    setProperty(INTERNAL_ES_TARGET_URI, targetUri);
    setProperty(INTERNAL_ES_TARGET_RESOURCE, resource);
  }
コード例 #4
0
  static void fixHive13InvalidComments(Settings settings, Properties tbl) {
    if (Booleans.parseBoolean(settings.getProperty("es.hive.disable.columns.comments.fix"))) {
      return;
    }

    settings.setProperty(HiveConstants.COLUMN_COMMENTS, "");
    tbl.remove(HiveConstants.COLUMN_COMMENTS);
  }
コード例 #5
0
  public Settings merge(Properties properties) {
    if (properties == null) {
      return this;
    }

    Enumeration<?> propertyNames = properties.propertyNames();

    Object prop = null;
    for (; propertyNames.hasMoreElements(); ) {
      prop = propertyNames.nextElement();
      if (prop instanceof String) {
        Object value = properties.get(prop);
        setProperty((String) prop, value.toString());
      }
    }

    return this;
  }
コード例 #6
0
 public Settings cleanResource() {
   setProperty(INTERNAL_ES_TARGET_RESOURCE, "");
   return this;
 }
コード例 #7
0
 public Settings cleanUri() {
   setProperty(INTERNAL_ES_TARGET_URI, "");
   return this;
 }
コード例 #8
0
 public Settings setQuery(String query) {
   setProperty(ES_QUERY, query);
   return this;
 }
コード例 #9
0
 private Resource createResource(String target) {
   Settings s = new TestSettings();
   s.setProperty(ConfigurationOptions.ES_RESOURCE, target);
   return new Resource(s, true);
 }
コード例 #10
0
 public Settings cleanHosts() {
   setProperty(INTERNAL_ES_HOSTS, "");
   return this;
 }
コード例 #11
0
 public static void setDiscoveredNodes(Settings settings, Collection<String> nodes) {
   settings.setProperty(
       InternalConfigurationOptions.INTERNAL_ES_DISCOVERED_NODES,
       StringUtils.concatenate(nodes, StringUtils.DEFAULT_DELIMITER));
 }
コード例 #12
0
 public static void pinNode(Settings settings, String node, int port) {
   if (StringUtils.hasText(node) && port > 0) {
     settings.setProperty(
         InternalConfigurationOptions.INTERNAL_ES_PINNED_NODE, qualifyNode(node, port));
   }
 }