Java Code Examples for org.elasticsearch.common.settings.Setting#get()

The following examples show how to use org.elasticsearch.common.settings.Setting#get() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MetaDataUpdateSettingsService.java    From crate with Apache License 2.0 5 votes vote down vote up
/**
 * Updates the cluster block only iff the setting exists in the given settings
 */
public static void maybeUpdateClusterBlock(String[] actualIndices, ClusterBlocks.Builder blocks, ClusterBlock block, Setting<Boolean> setting, Settings openSettings) {
    if (setting.exists(openSettings)) {
        final boolean updateBlock = setting.get(openSettings);
        for (String index : actualIndices) {
            if (updateBlock) {
                blocks.addIndexBlock(index, block);
            } else {
                blocks.removeIndexBlock(index, block);
            }
        }
    }
}
 
Example 2
Source File: InformationTablesTableInfo.java    From crate with Apache License 2.0 5 votes vote down vote up
private static <T> Function<RelationInfo, T> fromSetting(Setting<T> setting) {
    return rel -> {
        if (rel instanceof StoredTable) {
            return setting.get(rel.parameters());
        }
        return null;
    };
}
 
Example 3
Source File: InformationPartitionsTableInfo.java    From crate with Apache License 2.0 4 votes vote down vote up
private static <T> Function<PartitionInfo, T> fromSetting(Setting<T> setting) {
    return rel -> setting.get(rel.tableParameters());
}
 
Example 4
Source File: CoordinatorTests.java    From crate with Apache License 2.0 4 votes vote down vote up
private static int defaultInt(Setting<Integer> setting) {
    return setting.get(Settings.EMPTY);
}
 
Example 5
Source File: S3ClientSettings.java    From crate with Apache License 2.0 4 votes vote down vote up
private static <T> T getConfigValue(Settings settings, Setting<T> clientSetting) {
    return clientSetting.get(settings);
}
 
Example 6
Source File: AzureStorageSettings.java    From crate with Apache License 2.0 4 votes vote down vote up
private static <T> T getConfigValue(Settings settings, Setting<T> clientSetting) {
    return clientSetting.get(settings);
}
 
Example 7
Source File: Randomness.java    From crate with Apache License 2.0 3 votes vote down vote up
/**
 * 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();
    }
}