當前位置: 首頁>>代碼示例>>Java>>正文


Java Settings.getGroups方法代碼示例

本文整理匯總了Java中org.elasticsearch.common.settings.Settings.getGroups方法的典型用法代碼示例。如果您正苦於以下問題:Java Settings.getGroups方法的具體用法?Java Settings.getGroups怎麽用?Java Settings.getGroups使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.elasticsearch.common.settings.Settings的用法示例。


在下文中一共展示了Settings.getGroups方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: processEngineSpecificSettings

import org.elasticsearch.common.settings.Settings; //導入方法依賴的package包/類
private static void processEngineSpecificSettings(Settings settings, Map<String, ScriptEngineService> scriptEngines, ScriptContextRegistry scriptContextRegistry, Map<String, ScriptMode> scriptModes) {
    Map<String, Settings> langGroupedSettings = settings.getGroups(ENGINE_SETTINGS_PREFIX, true);
    for (Map.Entry<String, Settings> langSettings : langGroupedSettings.entrySet()) {
        //read engine specific settings that refer to a non existing script lang will be ignored
        ScriptEngineService scriptEngineService = scriptEngines.get(langSettings.getKey());
        if (scriptEngineService != null) {
            for (ScriptType scriptType : ScriptType.values()) {
                String scriptTypePrefix = scriptType + ".";
                for (ScriptContext scriptContext : scriptContextRegistry.scriptContexts()) {
                    ScriptMode scriptMode = getScriptContextMode(langSettings.getValue(), scriptTypePrefix, scriptContext);
                    if (scriptMode != null) {
                        addScriptMode(scriptEngineService, scriptType, scriptContext, scriptMode, scriptModes);
                    }
                }
            }
        }
    }
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:19,代碼來源:ScriptModes.java

示例2: AwarenessAllocationDecider

import org.elasticsearch.common.settings.Settings; //導入方法依賴的package包/類
@Inject
public AwarenessAllocationDecider(Settings settings, NodeSettingsService nodeSettingsService) {
    super(settings);
    this.awarenessAttributes = settings.getAsArray(CLUSTER_ROUTING_ALLOCATION_AWARENESS_ATTRIBUTES);

    forcedAwarenessAttributes = Maps.newHashMap();
    Map<String, Settings> forceGroups = settings.getGroups(CLUSTER_ROUTING_ALLOCATION_AWARENESS_FORCE_GROUP);
    for (Map.Entry<String, Settings> entry : forceGroups.entrySet()) {
        String[] aValues = entry.getValue().getAsArray("values");
        if (aValues.length > 0) {
            forcedAwarenessAttributes.put(entry.getKey(), aValues);
        }
    }

    nodeSettingsService.addListener(new ApplySettings());
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:17,代碼來源:AwarenessAllocationDecider.java

示例3: TribeService

import org.elasticsearch.common.settings.Settings; //導入方法依賴的package包/類
public TribeService(Settings settings, ClusterService clusterService, final String tribeNodeId,
                    NamedWriteableRegistry namedWriteableRegistry, Function<Settings, Node> clientNodeBuilder) {
    super(settings);
    this.clusterService = clusterService;
    this.namedWriteableRegistry = namedWriteableRegistry;
    Map<String, Settings> nodesSettings = new HashMap<>(settings.getGroups("tribe", true));
    nodesSettings.remove("blocks"); // remove prefix settings that don't indicate a client
    nodesSettings.remove("on_conflict"); // remove prefix settings that don't indicate a client
    for (Map.Entry<String, Settings> entry : nodesSettings.entrySet()) {
        Settings clientSettings = buildClientSettings(entry.getKey(), tribeNodeId, settings, entry.getValue());
        nodes.add(clientNodeBuilder.apply(clientSettings));
    }

    this.blockIndicesMetadata = BLOCKS_METADATA_INDICES_SETTING.get(settings).toArray(Strings.EMPTY_ARRAY);
    this.blockIndicesRead = BLOCKS_READ_INDICES_SETTING.get(settings).toArray(Strings.EMPTY_ARRAY);
    this.blockIndicesWrite = BLOCKS_WRITE_INDICES_SETTING.get(settings).toArray(Strings.EMPTY_ARRAY);

    if (!nodes.isEmpty()) {
        if (BLOCKS_WRITE_SETTING.get(settings)) {
            clusterService.addInitialStateBlock(TRIBE_WRITE_BLOCK);
        }
        if (BLOCKS_METADATA_SETTING.get(settings)) {
            clusterService.addInitialStateBlock(TRIBE_METADATA_BLOCK);
        }
    }

    this.onConflict = ON_CONFLICT_SETTING.get(settings);
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:29,代碼來源:TribeService.java

示例4: onRefreshSettings

import org.elasticsearch.common.settings.Settings; //導入方法依賴的package包/類
@Override
public void onRefreshSettings(Settings settings) {
    String[] awarenessAttributes = settings.getAsArray(CLUSTER_ROUTING_ALLOCATION_AWARENESS_ATTRIBUTES,
            AwarenessAllocationDecider.this.settings.getAsArray(CLUSTER_ROUTING_ALLOCATION_AWARENESS_ATTRIBUTES));
    if ("".equals(settings.get(CLUSTER_ROUTING_ALLOCATION_AWARENESS_ATTRIBUTES, null))) {
        awarenessAttributes = Strings.EMPTY_ARRAY; // the empty string resets this
    }
    if (awarenessAttributes != null && !Arrays.equals(AwarenessAllocationDecider.this.awarenessAttributes, awarenessAttributes)) {
        logger.info("updating [cluster.routing.allocation.awareness.attributes] from [{}] to [{}]", AwarenessAllocationDecider.this.awarenessAttributes, awarenessAttributes);
        AwarenessAllocationDecider.this.awarenessAttributes = awarenessAttributes;
    }
    Map<String, String[]> forcedAwarenessAttributes = new HashMap<>();
    Map<String, Settings> forceGroups = settings.getGroups(CLUSTER_ROUTING_ALLOCATION_AWARENESS_FORCE_GROUP);
    if (forceGroups.isEmpty()) {
        // check initial values (from config file)
        forceGroups = AwarenessAllocationDecider.this.settings.getGroups(CLUSTER_ROUTING_ALLOCATION_AWARENESS_FORCE_GROUP);
    }
    if (!forceGroups.isEmpty()) {
        for (Map.Entry<String, Settings> entry : forceGroups.entrySet()) {
            String[] aValues = entry.getValue().getAsArray("values");
            if (aValues.length > 0) {
                forcedAwarenessAttributes.put(entry.getKey(), aValues);
            }
        }
    }
    AwarenessAllocationDecider.this.forcedAwarenessAttributes = forcedAwarenessAttributes;
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:28,代碼來源:AwarenessAllocationDecider.java

示例5: addBindPermissions

import org.elasticsearch.common.settings.Settings; //導入方法依賴的package包/類
static void addBindPermissions(Permissions policy, Settings settings) throws IOException {
    // http is simple
    String httpRange = settings.get("http.netty.port", 
                           settings.get("http.port", 
                                   NettyHttpServerTransport.DEFAULT_PORT_RANGE));
    // listen is always called with 'localhost' but use wildcard to be sure, no name service is consulted.
    // see SocketPermission implies() code
    policy.add(new SocketPermission("*:" + httpRange, "listen,resolve"));
    // transport is waaaay overengineered
    Map<String, Settings> profiles = settings.getGroups("transport.profiles", true);
    if (!profiles.containsKey(NettyTransport.DEFAULT_PROFILE)) {
        profiles = new HashMap<>(profiles);
        profiles.put(NettyTransport.DEFAULT_PROFILE, Settings.EMPTY);
    }

    // loop through all profiles and add permissions for each one, if its valid.
    // (otherwise NettyTransport is lenient and ignores it)
    for (Map.Entry<String, Settings> entry : profiles.entrySet()) {
        Settings profileSettings = entry.getValue();
        String name = entry.getKey();
        String transportRange = profileSettings.get("port", 
                                    settings.get("transport.tcp.port", 
                                            NettyTransport.DEFAULT_PORT_RANGE));

        // a profile is only valid if its the default profile, or if it has an actual name and specifies a port
        boolean valid = NettyTransport.DEFAULT_PROFILE.equals(name) || (Strings.hasLength(name) && profileSettings.get("port") != null);
        if (valid) {
            // listen is always called with 'localhost' but use wildcard to be sure, no name service is consulted.
            // see SocketPermission implies() code
            policy.add(new SocketPermission("*:" + transportRange, "listen,resolve"));
        }
    }
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:34,代碼來源:Security.java

示例6: getThreadPoolSettingsGroup

import org.elasticsearch.common.settings.Settings; //導入方法依賴的package包/類
private Map<String, Settings> getThreadPoolSettingsGroup(Settings settings) {
    Map<String, Settings> groupSettings = settings.getGroups(THREADPOOL_GROUP);
    validate(groupSettings);
    return groupSettings;
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:6,代碼來源:ThreadPool.java


注:本文中的org.elasticsearch.common.settings.Settings.getGroups方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。