本文整理了Java中org.elasticsearch.common.settings.Settings.names()
方法的一些代码示例,展示了Settings.names()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Settings.names()
方法的具体详情如下:
包路径:org.elasticsearch.common.settings.Settings
类名称:Settings
方法名:names
暂无
代码示例来源:origin: floragunncom/search-guard
public Set<String> getAllConfiguredTenantNames() {
final Settings roles = getRolesSettings();
if(roles == null || roles.isEmpty()) {
return Collections.emptySet();
}
final Set<String> configuredTenants = new HashSet<>();
for(String sgRole: roles.names()) {
Settings tenants = roles.getByPrefix(sgRole+".tenants.");
if(tenants != null) {
configuredTenants.addAll(tenants.names());
}
}
return Collections.unmodifiableSet(configuredTenants);
}
代码示例来源:origin: floragunncom/search-guard
private Set<String> resolve(final Settings actionGroups, final String entry) {
final Set<String> ret = new HashSet<String>();
// SG5 format, plain array
List<String> en = actionGroups.getAsList(entry);
if (en.isEmpty()) {
// try SG6 format including readonly and permissions key
en = actionGroups.getAsList(entry +"." + ConfigConstants.CONFIGKEY_ACTION_GROUPS_PERMISSIONS);
}
for (String string: en) {
if (actionGroups.names().contains(string)) {
ret.addAll(resolve(actionGroups,string));
} else {
ret.add(string);
}
}
return ret;
}
代码示例来源:origin: floragunncom/search-guard
public Map<String, Boolean> mapTenants(final User user, final TransportAddress caller) {
if(user == null) {
return Collections.emptyMap();
}
final Map<String, Boolean> result = new HashMap<>();
result.put(user.getName(), true);
for(String sgRole: mapSgRoles(user, caller)) {
Settings tenants = getRolesSettings().getByPrefix(sgRole+".tenants.");
if(tenants != null) {
for(String tenant: tenants.names()) {
if(tenant.equals(user.getName())) {
continue;
}
if("RW".equalsIgnoreCase(tenants.get(tenant, "RO"))) {
result.put(tenant, true);
} else {
if(!result.containsKey(tenant)) { //RW outperforms RO
result.put(tenant, false);
}
}
}
}
}
return Collections.unmodifiableMap(result);
}
代码示例来源:origin: floragunncom/search-guard
for (final String roleMap : rolesMapping.names()) {
final Settings roleMapSettings = rolesMapping.getByPrefix(roleMap);
代码示例来源:origin: floragunncom/search-guard
for(String username:cfg.names()) {
String u = cfg.get(username + ".username");
if(credentials.getUsername().equals(u)) {
for(String attributeName: customAttributes.names()) {
credentials.addAttribute("attr.internal."+attributeName, customAttributes.get(attributeName));
代码示例来源:origin: floragunncom/search-guard
public SgRoles load() {
final Settings settings = configurationRepository.getConfiguration("roles");
SgRoles _sgRoles = new SgRoles();
Set<String> sgRoles = settings.names();
for(String sgRole: sgRoles) {
if (sgRoleSettings.names().isEmpty()) {
continue;
for(String tenant: tenants.names()) {
_indexPattern.addMaskedFields(maskedFields);
for(String type: permittedAliasesIndices.get(indexPattern).names()) {
代码示例来源:origin: floragunncom/search-guard
for(String username:cfg.names()) {
String u = cfg.get(username + ".username");
if(user.getName().equals(u)) {
代码示例来源:origin: org.elasticsearch/elasticsearch
private Map<String, Settings> getGroupsInternal(String settingPrefix, boolean ignoreNonGrouped) throws SettingsException {
Settings prefixSettings = getByPrefix(settingPrefix);
Map<String, Settings> groups = new HashMap<>();
for (String groupName : prefixSettings.names()) {
Settings groupSettings = prefixSettings.getByPrefix(groupName + ".");
if (groupSettings.isEmpty()) {
if (ignoreNonGrouped) {
continue;
}
throw new SettingsException("Failed to get setting group for [" + settingPrefix + "] setting prefix and setting ["
+ settingPrefix + groupName + "] because of a missing '.'");
}
groups.put(groupName, groupSettings);
}
return Collections.unmodifiableMap(groups);
}
/**
代码示例来源:origin: org.elasticsearch/elasticsearch
/**
* Creates a new ThreadContext instance
* @param settings the settings to read the default request headers from
*/
public ThreadContext(Settings settings) {
Settings headers = DEFAULT_HEADERS_SETTING.get(settings);
if (headers == null) {
this.defaultHeader = Collections.emptyMap();
} else {
Map<String, String> defaultHeader = new HashMap<>();
for (String key : headers.names()) {
defaultHeader.put(key, headers.get(key));
}
this.defaultHeader = Collections.unmodifiableMap(defaultHeader);
}
threadLocal = new ContextThreadLocal();
this.maxWarningHeaderCount = SETTING_HTTP_MAX_WARNING_HEADER_COUNT.get(settings);
this.maxWarningHeaderSize = SETTING_HTTP_MAX_WARNING_HEADER_SIZE.get(settings).getBytes();
}
代码示例来源:origin: org.elasticsearch/elasticsearch
if (changeSettings.names().isEmpty() && ignoreSettings.length == 0) {
return indexMetaData;
代码示例来源:origin: org.elasticsearch/elasticsearch
this.features = new String[0];
} else {
defaultFeatures.names().forEach(key -> {
if (Booleans.parseBoolean(defaultFeatures.get(key)) == false) {
throw new IllegalArgumentException("feature settings must have default [true] value");
this.features = new TreeSet<>(defaultFeatures.names()).toArray(new String[defaultFeatures.names().size()]);
代码示例来源:origin: apache/servicemix-bundles
private Map<String, Settings> getGroupsInternal(String settingPrefix, boolean ignoreNonGrouped) throws SettingsException {
Settings prefixSettings = getByPrefix(settingPrefix);
Map<String, Settings> groups = new HashMap<>();
for (String groupName : prefixSettings.names()) {
Settings groupSettings = prefixSettings.getByPrefix(groupName + ".");
if (groupSettings.isEmpty()) {
if (ignoreNonGrouped) {
continue;
}
throw new SettingsException("Failed to get setting group for [" + settingPrefix + "] setting prefix and setting ["
+ settingPrefix + groupName + "] because of a missing '.'");
}
groups.put(groupName, groupSettings);
}
return Collections.unmodifiableMap(groups);
}
/**
代码示例来源:origin: com.floragunn/search-guard-6
public Set<String> getAllConfiguredTenantNames() {
final Settings roles = getRolesSettings();
if(roles == null || roles.isEmpty()) {
return Collections.emptySet();
}
final Set<String> configuredTenants = new HashSet<>();
for(String sgRole: roles.names()) {
Settings tenants = roles.getByPrefix(sgRole+".tenants.");
if(tenants != null) {
configuredTenants.addAll(tenants.names());
}
}
return Collections.unmodifiableSet(configuredTenants);
}
代码示例来源:origin: org.codelibs/elasticsearch-dynarank
ScriptInfo(final String script, final String lang, final String scriptType, final Settings settings, final int reorderSize) {
this.script = script;
this.lang = lang;
this.reorderSize = reorderSize;
this.settings = new HashMap<>();
for (final String name : settings.names()) {
final String value = settings.get(name);
if (value != null) {
this.settings.put(name, value);
} else {
this.settings.put(name, settings.getAsArray(name));
}
}
if ("STORED".equalsIgnoreCase(scriptType)) {
this.scriptType = ScriptType.STORED;
} else if ("FILE".equalsIgnoreCase(scriptType)) {
this.scriptType = ScriptType.FILE;
} else {
this.scriptType = ScriptType.INLINE;
}
}
代码示例来源:origin: com.floragunn/search-guard-6
private Set<String> resolve(final Settings actionGroups, final String entry) {
final Set<String> ret = new HashSet<String>();
// SG5 format, plain array
List<String> en = actionGroups.getAsList(entry);
if (en.isEmpty()) {
// try SG6 format including readonly and permissions key
en = actionGroups.getAsList(entry +"." + ConfigConstants.CONFIGKEY_ACTION_GROUPS_PERMISSIONS);
}
for (String string: en) {
if (actionGroups.names().contains(string)) {
ret.addAll(resolve(actionGroups,string));
} else {
ret.add(string);
}
}
return ret;
}
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
/**
* Creates a new ThreadContext instance
* @param settings the settings to read the default request headers from
*/
public ThreadContext(Settings settings) {
Settings headers = DEFAULT_HEADERS_SETTING.get(settings);
if (headers == null) {
this.defaultHeader = Collections.emptyMap();
} else {
Map<String, String> defaultHeader = new HashMap<>();
for (String key : headers.names()) {
defaultHeader.put(key, headers.get(key));
}
this.defaultHeader = Collections.unmodifiableMap(defaultHeader);
}
threadLocal = new ContextThreadLocal();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
private Map<String, Settings> getGroupsInternal(String settingPrefix, boolean ignoreNonGrouped) throws SettingsException {
Settings prefixSettings = getByPrefix(settingPrefix);
Map<String, Settings> groups = new HashMap<>();
for (String groupName : prefixSettings.names()) {
Settings groupSettings = prefixSettings.getByPrefix(groupName + ".");
if (groupSettings.isEmpty()) {
if (ignoreNonGrouped) {
continue;
}
throw new SettingsException("Failed to get setting group for [" + settingPrefix + "] setting prefix and setting ["
+ settingPrefix + groupName + "] because of a missing '.'");
}
groups.put(groupName, groupSettings);
}
return Collections.unmodifiableMap(groups);
}
/**
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
private Map<String, Settings> getGroupsInternal(String settingPrefix, boolean ignoreNonGrouped) throws SettingsException {
Settings prefixSettings = getByPrefix(settingPrefix);
Map<String, Settings> groups = new HashMap<>();
for (String groupName : prefixSettings.names()) {
Settings groupSettings = prefixSettings.getByPrefix(groupName + ".");
if (groupSettings.isEmpty()) {
if (ignoreNonGrouped) {
continue;
}
throw new SettingsException("Failed to get setting group for [" + settingPrefix + "] setting prefix and setting ["
+ settingPrefix + groupName + "] because of a missing '.'");
}
groups.put(groupName, groupSettings);
}
return Collections.unmodifiableMap(groups);
}
/**
代码示例来源:origin: harbby/presto-connectors
public <M extends TransportMessage<?>> M applyTo(M message) {
for (String key : headers.names()) {
if (!message.hasHeader(key)) {
message.putHeader(key, headers.get(key));
}
}
return message;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
/**
* Creates a new ThreadContext instance
* @param settings the settings to read the default request headers from
*/
public ThreadContext(Settings settings) {
Settings headers = DEFAULT_HEADERS_SETTING.get(settings);
if (headers == null) {
this.defaultHeader = Collections.emptyMap();
} else {
Map<String, String> defaultHeader = new HashMap<>();
for (String key : headers.names()) {
defaultHeader.put(key, headers.get(key));
}
this.defaultHeader = Collections.unmodifiableMap(defaultHeader);
}
threadLocal = new ContextThreadLocal();
this.maxWarningHeaderCount = SETTING_HTTP_MAX_WARNING_HEADER_COUNT.get(settings);
this.maxWarningHeaderSize = SETTING_HTTP_MAX_WARNING_HEADER_SIZE.get(settings).getBytes();
}
内容来源于网络,如有侵权,请联系作者删除!