gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-17 09:23:31 26 4
gpt4 key购买 nike

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

YamlSettingsLoader.<init>介绍

暂无

代码示例

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

/**
   * Returns a {@link SettingsLoader} based on the {@link XContentType}. Note only {@link XContentType#JSON} and
   * {@link XContentType#YAML} are supported
   *
   * @param xContentType The content type
   * @return A settings loader.
   */
  public static SettingsLoader loaderFromXContentType(XContentType xContentType) {
    if (xContentType == XContentType.JSON) {
      return new JsonSettingsLoader(true);
    } else if (xContentType == XContentType.YAML) {
      return new YamlSettingsLoader(true);
    } else {
      throw new IllegalArgumentException("unsupported content type [" + xContentType + "]");
    }
  }
}

代码示例来源:origin: infochimps-labs/wonderdog

private Map<String,String> parsedSettings(JobConf conf) {
String esConfigPath  = conf.get(ES_CONFIG_OPT,  ES_CONFIG);
String esPluginsPath = conf.get(ES_PLUGINS_OPT, ES_PLUGINS);

try {
  BufferedReader reader = new BufferedReader( new FileReader(esConfigPath));
  String         line = null;
  StringBuilder  stringBuilder = new StringBuilder();
  String         ls = System.getProperty("line.separator");
  while( ( line = reader.readLine() ) != null ) {
  stringBuilder.append( line );
  stringBuilder.append( ls );
  }
  return new YamlSettingsLoader().load(stringBuilder.toString());
} catch (IOException e) {
  LOG.error("Could not find or read the configuration file " + esConfigPath + ".");
  return new HashMap<String,String>();
}
}

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

/**
   * Returns a {@link SettingsLoader} based on the actual settings source.
   */
  public static SettingsLoader loaderFromSource(String source) {
    if (source.indexOf('{') != -1 && source.indexOf('}') != -1) {
      return new JsonSettingsLoader();
    }
    if (source.indexOf(':') != -1) {
      return new YamlSettingsLoader();
    }
    return new PropertiesSettingsLoader();
  }
}

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

/**
 * Returns a {@link SettingsLoader} based on the source resource
 * name. This factory method assumes that if the resource name ends
 * with ".json" then the content should be parsed as JSON, else if
 * the resource name ends with ".yml" or ".yaml" then the content
 * should be parsed as YAML, otherwise throws an exception. Note that the
 * parsers returned by this method will not accept null-valued
 * keys.
 *
 * @param resourceName The resource name containing the settings
 *                     content.
 * @return A settings loader.
 */
public static SettingsLoader loaderFromResource(String resourceName) {
  if (resourceName.endsWith(".json")) {
    return new JsonSettingsLoader(false);
  } else if (resourceName.endsWith(".yml") || resourceName.endsWith(".yaml")) {
    return new YamlSettingsLoader(false);
  } else {
    throw new IllegalArgumentException("unable to detect content type from resource name [" + resourceName + "]");
  }
}

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

/**
 * Returns a {@link SettingsLoader} based on the source content.
 * This factory method assumes that if the underlying content
 * contains an opening and closing brace ('{' and '}') then the
 * content should be parsed as JSON, else if the underlying content
 * fails this condition but contains a ':' then the content should
 * be parsed as YAML, and otherwise throws an exception.
 * Note that the JSON and YAML parsers returned by this method will
 * accept null-valued keys.
 *
 * @param source The underlying settings content.
 * @return A settings loader.
 * @deprecated use {@link #loaderFromXContentType(XContentType)} instead
 */
@Deprecated
public static SettingsLoader loaderFromSource(String source) {
  if (source.indexOf('{') != -1 && source.indexOf('}') != -1) {
    return new JsonSettingsLoader(true);
  } else if (source.indexOf(':') != -1) {
    return new YamlSettingsLoader(true);
  } else {
    throw new IllegalArgumentException("unable to detect content type from source [" + source + "]");
  }
}

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

/**
 * Returns a {@link SettingsLoader} based on the resource name.
 */
public static SettingsLoader loaderFromResource(String resourceName) {
  if (resourceName.endsWith(".json")) {
    return new JsonSettingsLoader();
  } else if (resourceName.endsWith(".yml") || resourceName.endsWith(".yaml")) {
    return new YamlSettingsLoader();
  } else if (resourceName.endsWith(".properties")) {
    return new PropertiesSettingsLoader();
  } else {
    // lets default to the json one
    return new JsonSettingsLoader();
  }
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com