当前位置: 首页>>代码示例>>Java>>正文


Java Setting.exists方法代码示例

本文整理汇总了Java中org.elasticsearch.common.settings.Setting.exists方法的典型用法代码示例。如果您正苦于以下问题:Java Setting.exists方法的具体用法?Java Setting.exists怎么用?Java Setting.exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.common.settings.Setting的用法示例。


在下文中一共展示了Setting.exists方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildClientSettings

import org.elasticsearch.common.settings.Setting; //导入方法依赖的package包/类
/**
 * Builds node settings for a tribe client node from the tribe node's global settings,
 * combined with tribe specific settings.
 */
static Settings buildClientSettings(String tribeName, String parentNodeId, Settings globalSettings, Settings tribeSettings) {
    for (String tribeKey : tribeSettings.getAsMap().keySet()) {
        if (tribeKey.startsWith("path.")) {
            throw new IllegalArgumentException("Setting [" + tribeKey + "] not allowed in tribe client [" + tribeName + "]");
        }
    }
    Settings.Builder sb = Settings.builder().put(tribeSettings);
    sb.put(Node.NODE_NAME_SETTING.getKey(), Node.NODE_NAME_SETTING.get(globalSettings) + "/" + tribeName);
    sb.put(Environment.PATH_HOME_SETTING.getKey(), Environment.PATH_HOME_SETTING.get(globalSettings)); // pass through ES home dir
    if (Environment.PATH_CONF_SETTING.exists(globalSettings)) {
        sb.put(Environment.PATH_CONF_SETTING.getKey(), Environment.PATH_CONF_SETTING.get(globalSettings));
    }
    if (Environment.PATH_LOGS_SETTING.exists(globalSettings)) {
        sb.put(Environment.PATH_LOGS_SETTING.getKey(), Environment.PATH_LOGS_SETTING.get(globalSettings));
    }
    if (Environment.PATH_SCRIPTS_SETTING.exists(globalSettings)) {
        sb.put(Environment.PATH_SCRIPTS_SETTING.getKey(), Environment.PATH_SCRIPTS_SETTING.get(globalSettings));
    }
    for (Setting<?> passthrough : PASS_THROUGH_SETTINGS) {
        if (passthrough.exists(tribeSettings) == false && passthrough.exists(globalSettings)) {
            sb.put(passthrough.getKey(), globalSettings.get(passthrough.getKey()));
        }
    }
    sb.put(TRIBE_NAME_SETTING.getKey(), tribeName);
    if (sb.get(NetworkModule.HTTP_ENABLED.getKey()) == null) {
        sb.put(NetworkModule.HTTP_ENABLED.getKey(), false);
    }
    sb.put(Node.NODE_DATA_SETTING.getKey(), false);
    sb.put(Node.NODE_MASTER_SETTING.getKey(), false);
    sb.put(Node.NODE_INGEST_SETTING.getKey(), false);

    // node id of a tribe client node is determined by node id of parent node and tribe name
    final BytesRef seedAsString = new BytesRef(parentNodeId + "/" + tribeName);
    long nodeIdSeed = MurmurHash3.hash128(seedAsString.bytes, seedAsString.offset, seedAsString.length, 0, new MurmurHash3.Hash128()).h1;
    sb.put(NodeEnvironment.NODE_ID_SEED_SETTING.getKey(), nodeIdSeed);
    sb.put(Node.NODE_LOCAL_STORAGE_SETTING.getKey(), false);
    return sb.build();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:43,代码来源:TribeService.java

示例2: 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);
            }
        }
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:16,代码来源:MetaDataUpdateSettingsService.java

示例3: 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);
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:11,代码来源:AzureStorageSettings.java

示例4: getEffectiveSetting

import org.elasticsearch.common.settings.Setting; //导入方法依赖的package包/类
public static <T> Setting<T> getEffectiveSetting(Settings repositorySettings,
                                          Setting<T> repositorySetting,
                                          Setting<T> repositoriesSetting) {
    if (repositorySetting.exists(repositorySettings)) {
        return repositorySetting;
    } else {
        return repositoriesSetting;
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:10,代码来源:AzureStorageSettings.java

示例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);
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:17,代码来源:InternalAwsS3Service.java

示例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();
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:16,代码来源:Randomness.java


注:本文中的org.elasticsearch.common.settings.Setting.exists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。