本文整理汇总了Java中org.elasticsearch.common.settings.Setting.get方法的典型用法代码示例。如果您正苦于以下问题:Java Setting.get方法的具体用法?Java Setting.get怎么用?Java Setting.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.elasticsearch.common.settings.Setting
的用法示例。
在下文中一共展示了Setting.get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: maybeUpdateClusterBlock
import org.elasticsearch.common.settings.Setting; //导入方法依赖的package包/类
/**
* Updates the cluster block only iff the setting exists in the given settings
*/
private static void maybeUpdateClusterBlock(String[] actualIndices, ClusterBlocks.Builder blocks, ClusterBlock block, Setting<Boolean> setting, Settings openSettings) {
if (setting.exists(openSettings)) {
final boolean updateReadBlock = setting.get(openSettings);
for (String index : actualIndices) {
if (updateReadBlock) {
blocks.addIndexBlock(index, block);
} else {
blocks.removeIndexBlock(index, block);
}
}
}
}
示例2: getSetting
import org.elasticsearch.common.settings.Setting; //导入方法依赖的package包/类
/**
* Get a given setting from the repository settings, throwing a {@link RepositoryException} if the setting does not exist or is empty.
*/
static <T> T getSetting(Setting<T> setting, RepositoryMetaData metadata) {
T value = setting.get(metadata.settings());
if (value == null) {
throw new RepositoryException(metadata.name(), "Setting [" + setting.getKey() + "] is not defined for repository");
}
if ((value instanceof String) && (Strings.hasText((String) value)) == false) {
throw new RepositoryException(metadata.name(), "Setting [" + setting.getKey() + "] is empty for repository");
}
return value;
}
示例3: getRequiredSetting
import org.elasticsearch.common.settings.Setting; //导入方法依赖的package包/类
private static String getRequiredSetting(Settings settings, Setting<String> setting) {
String value = setting.get(settings);
if (value == null || Strings.hasLength(value) == false) {
throw new IllegalArgumentException("Missing required setting " + setting.getKey() + " for azure");
}
return value;
}
示例4: getValue
import org.elasticsearch.common.settings.Setting; //导入方法依赖的package包/类
public static <T> T getValue(Settings repositorySettings,
Settings globalSettings,
Setting<T> repositorySetting,
Setting<T> repositoriesSetting) {
if (repositorySetting.exists(repositorySettings)) {
return repositorySetting.get(repositorySettings);
} else {
return repositoriesSetting.get(globalSettings);
}
}
示例5: getConfigValue
import org.elasticsearch.common.settings.Setting; //导入方法依赖的package包/类
/**
* Find the setting value, trying first with named configs,
* then falling back to repository and global repositories settings.
*/
private static <T> T getConfigValue(Settings repositorySettings, Settings globalSettings, String clientName,
Setting.AffixSetting<T> configSetting, Setting<T> repositorySetting, Setting<T> globalSetting) {
Setting<T> concreteSetting = configSetting.getConcreteSettingForNamespace(clientName);
if (concreteSetting.exists(globalSettings)) {
return concreteSetting.get(globalSettings);
} else if (repositorySetting == null) {
// no repository setting, just use global setting
return globalSetting.get(globalSettings);
} else {
return S3Repository.getValue(repositorySettings, globalSettings, repositorySetting, globalSetting);
}
}
示例6: get
import org.elasticsearch.common.settings.Setting; //导入方法依赖的package包/类
/**
* Provides a reproducible source of randomness seeded by a long
* seed in the settings with the key setting.
*
* @param settings the settings containing the seed
* @param setting the setting to access the seed
* @return a reproducible source of randomness
*/
public static Random get(Settings settings, Setting<Long> setting) {
if (setting.exists(settings)) {
return new Random(setting.get(settings));
} else {
return get();
}
}