org.elasticsearch.common.settings.Settings.toDelimitedString()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(129)

本文整理了Java中org.elasticsearch.common.settings.Settings.toDelimitedString()方法的一些代码示例,展示了Settings.toDelimitedString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Settings.toDelimitedString()方法的具体详情如下:
包路径:org.elasticsearch.common.settings.Settings
类名称:Settings
方法名:toDelimitedString

Settings.toDelimitedString介绍

[英]Returns the settings as delimited string.
[中]以分隔字符串的形式返回设置。

代码示例

代码示例来源:origin: floragunncom/search-guard

private Map<String, Tuple<Long, Settings>> validate(Map<String, Tuple<Long, Settings>> conf, int expectedSize) throws InvalidConfigException {
  if(conf == null || conf.size() != expectedSize) {
    throw new InvalidConfigException("Retrieved only partial configuration");
  }
  final Tuple<Long, Settings> roles = conf.get("roles");
  final String rolesDelimited;
  if (roles != null && roles.v2() != null && (rolesDelimited = roles.v2().toDelimitedString('#')) != null) {
    //<role>.indices.<indice>._dls_= OK
    //<role>.indices.<indice>._fls_.<num>= OK
    final String[] rolesString = rolesDelimited.split("#");
    for (String role : rolesString) {
      if (role.contains("_fls_.") && !FLS_PATTERN.matcher(role).matches()) {
        LOGGER.error("Invalid FLS configuration detected, FLS/DLS will not work correctly: {}", role);
      }
      if (role.contains("_dls_=") && !DLS_PATTERN.matcher(role).matches()) {
        LOGGER.error("Invalid DLS configuration detected, FLS/DLS will not work correctly: {}", role);
      }
    }
  }
  return conf;
}

代码示例来源:origin: org.elasticsearch.client/elasticsearch-rest-high-level-client

@Override
  public String toString() {
    if (definition == null) {
      return name;
    } else {
      return definition.toDelimitedString(';');
    }
  }
}

代码示例来源:origin: com.floragunn/search-guard-6

private Map<String, Tuple<Long, Settings>> validate(Map<String, Tuple<Long, Settings>> conf, int expectedSize) throws InvalidConfigException {
  if(conf == null || conf.size() != expectedSize) {
    throw new InvalidConfigException("Retrieved only partial configuration");
  }
  final Tuple<Long, Settings> roles = conf.get("roles");
  final String rolesDelimited;
  if (roles != null && roles.v2() != null && (rolesDelimited = roles.v2().toDelimitedString('#')) != null) {
    //<role>.indices.<indice>._dls_= OK
    //<role>.indices.<indice>._fls_.<num>= OK
    final String[] rolesString = rolesDelimited.split("#");
    for (String role : rolesString) {
      if (role.contains("_fls_.") && !FLS_PATTERN.matcher(role).matches()) {
        LOGGER.error("Invalid FLS configuration detected, FLS/DLS will not work correctly: {}", role);
      }
      if (role.contains("_dls_=") && !DLS_PATTERN.matcher(role).matches()) {
        LOGGER.error("Invalid DLS configuration detected, FLS/DLS will not work correctly: {}", role);
      }
    }
  }
  return conf;
}

代码示例来源:origin: org.nuxeo.elasticsearch/nuxeo-elasticsearch-core

@SuppressWarnings("resource")
protected ESClient createRemoteClient(ElasticSearchClientConfig config) {
  Settings settings = getSetting(config).build();
  log.debug("Using settings: " + settings.toDelimitedString(','));
  TransportClient client = new PreBuiltTransportClient(settings); // not closed here
  String[] addresses = config.getOption("addressList", "").split(",");
  if (addresses.length == 0) {
    throw new IllegalArgumentException("No addressList option provided cannot connect TransportClient");
  } else {
    for (String item : addresses) {
      String[] address = item.split(":");
      log.debug("Add transport address: " + item);
      try {
        InetAddress inet = InetAddress.getByName(address[0]);
        client.addTransportAddress(new TransportAddress(inet, Integer.parseInt(address[1])));
      } catch (UnknownHostException e) {
        log.error("Unable to resolve host " + address[0], e);
      }
    }
  }
  return new ESTransportClient(client);
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

profileSettings.toDelimitedString(','));
  continue;
} else if (TransportSettings.DEFAULT_PROFILE.equals(name)) {

代码示例来源:origin: org.nuxeo.elasticsearch/nuxeo-elasticsearch-core

log.debug("Using settings: " + settings.toDelimitedString(','));

代码示例来源:origin: com.strapdata.elasticsearch.test/framework

/**
 * Restricts the given index to be allocated on <code>n</code> nodes using the allocation deciders.
 * Yet if the shards can't be allocated on any other node shards for this index will remain allocated on
 * more than <code>n</code> nodes.
 */
public void allowNodes(String index, int n) {
  assert index != null;
  internalCluster().ensureAtLeastNumDataNodes(n);
  Settings.Builder builder = Settings.builder();
  if (n > 0) {
    getExcludeSettings(index, n, builder);
  }
  Settings build = builder.build();
  if (!build.isEmpty()) {
    logger.debug("allowNodes: updating [{}]'s setting to [{}]", index, build.toDelimitedString(';'));
    client().admin().indices().prepareUpdateSettings(index).setSettings(build).execute().actionGet();
  }
}

代码示例来源:origin: harbby/presto-connectors

logger.info("transport profile configured without a name. skipping profile with settings [{}]", profileSettings.toDelimitedString(','));
  continue;
} else if (DEFAULT_PROFILE.equals(name)) {

相关文章