/** * The values associated with a setting prefix as an array. The settings array is in the format of: * <tt>settingPrefix.[index]</tt>. * <p> * It will also automatically load a comma separated list under the settingPrefix and merge with * the numbered format. * * @param settingPrefix The setting prefix to load the array by * @return The setting array values */ public String[] getAsArray(String settingPrefix) throws SettingsException { return getAsArray(settingPrefix, Strings.EMPTY_ARRAY, true); }
/** * The values associated with a setting prefix as an array. The settings array is in the format of: * <tt>settingPrefix.[index]</tt>. * <p> * It will also automatically load a comma separated list under the settingPrefix and merge with * the numbered format. * * @param settingPrefix The setting prefix to load the array by * @return The setting array values */ public String[] getAsArray(String settingPrefix) throws SettingsException { return getAsArray(settingPrefix, Strings.EMPTY_ARRAY, true); }
/** * The values associated with a setting prefix as an array. The settings array is in the format of: * <tt>settingPrefix.[index]</tt>. * <p> * If commaDelimited is true, it will automatically load a comma separated list under the settingPrefix and merge with * the numbered format. * * @param settingPrefix The setting prefix to load the array by * @return The setting array values */ public String[] getAsArray(String settingPrefix, String[] defaultArray) throws SettingsException { return getAsArray(settingPrefix, defaultArray, true); }
public RestActionFilter(final SearchGuardService service, final String filterType, final String filterName, final AuditListener auditListener) { super(service, filterType, filterName, auditListener); allowedActions = Arrays.asList(settings.getAsArray("searchguard." + filterType + "." + filterName + ".allowed_actions", new String[0])); forbiddenActions = Arrays.asList(settings.getAsArray("searchguard." + filterType + "." + filterName + ".forbidden_actions", new String[0])); }
public KeepTypesFilterFactory(IndexSettings indexSettings, Environment env, String name, Settings settings) { super(indexSettings, name, settings); final String[] arrayKeepTypes = settings.getAsArray(KEEP_TYPES_KEY, null); if ((arrayKeepTypes == null)) { throw new IllegalArgumentException("keep_types requires `" + KEEP_TYPES_KEY + "` to be configured"); } this.keepTypes = new HashSet<>(Arrays.asList(arrayKeepTypes)); }
public PatternCaptureGroupTokenFilterFactory(IndexSettings indexSettings, Environment environment, String name, Settings settings) { super(indexSettings, name, settings); String[] regexes = settings.getAsArray(PATTERNS_KEY, null, false); if (regexes == null) { throw new IllegalArgumentException("required setting '" + PATTERNS_KEY + "' is missing for token filter [" + name + "]"); } patterns = new Pattern[regexes.length]; for (int i = 0; i < regexes.length; i++) { patterns[i] = Pattern.compile(regexes[i]); } preserveOriginal = settings.getAsBoolean(PRESERVE_ORIG_KEY, true); }
public PatternCaptureGroupTokenFilterFactory(Index index, Settings indexSettings, String name, Settings settings) { super(index, indexSettings, name, settings); String[] regexes = settings.getAsArray(PATTERNS_KEY, null, false); if (regexes == null) { throw new IllegalArgumentException("required setting '" + PATTERNS_KEY + "' is missing for token filter [" + name + "]"); } patterns = new Pattern[regexes.length]; for (int i = 0; i < regexes.length; i++) { patterns[i] = Pattern.compile(regexes[i]); } preserveOriginal = settings.getAsBoolean(PRESERVE_ORIG_KEY, true); }
private void setForcedAwarenessAttributes(Settings forceSettings) { Map<String, String[]> forcedAwarenessAttributes = new HashMap<>(); Map<String, Settings> forceGroups = forceSettings.getAsGroups(); for (Map.Entry<String, Settings> entry : forceGroups.entrySet()) { String[] aValues = entry.getValue().getAsArray("values"); if (aValues.length > 0) { forcedAwarenessAttributes.put(entry.getKey(), aValues); } } this.forcedAwarenessAttributes = forcedAwarenessAttributes; }
public HtmlStripCharFilterFactory(IndexSettings indexSettings, Environment env, String name, Settings settings) { super(indexSettings, name); String[] escapedTags = settings.getAsArray("escaped_tags"); if (escapedTags.length > 0) { this.escapedTags = unmodifiableSet(newHashSet(escapedTags)); } else { this.escapedTags = null; } }
private String[] getSettingArray(String key, String[] defaultValue) throws Exception { Settings s = settings.getByPrefix(ElasticfenceSettings.SETTINGS_PREFIX); String[] value = s.getAsArray(key, defaultValue); if (value == null || value.length == 0) { EFLogger.warn(key + " is not defined in settings, setting default value of " + Arrays.toString(defaultValue)); return defaultValue; } //EFLogger.info(key + ": " + Arrays.toString(value)); return value; }
@Inject public TransportService(Settings settings, Transport transport, ThreadPool threadPool) { super(settings); this.transport = transport; this.threadPool = threadPool; this.tracerLogInclude = settings.getAsArray(SETTING_TRACE_LOG_INCLUDE, Strings.EMPTY_ARRAY, true); this.tracelLogExclude = settings.getAsArray(SETTING_TRACE_LOG_EXCLUDE, new String[]{"internal:discovery/zen/fd*", TransportLivenessAction.NAME}, true); tracerLog = Loggers.getLogger(logger, ".tracer"); adapter = createAdapter(); taskManager = createTaskManager(); }
@Inject public KeepTypesFilterFactory(Index index, IndexSettingsService indexSettingsService, Environment env, @Assisted String name, @Assisted Settings settings) { super(index, indexSettingsService.getSettings(), name, settings); final String[] arrayKeepTypes = settings.getAsArray(KEEP_TYPES_KEY, null); if ((arrayKeepTypes == null)) { throw new IllegalArgumentException("keep_types requires `" + KEEP_TYPES_KEY + "` to be configured"); } this.keepTypes = new HashSet<>(Arrays.asList(arrayKeepTypes)); }
@Override public void fillRoles(final User user, final AuthCredentials optionalAuthCreds) throws AuthException { final String[] roles = settings.getAsArray(ConfigConstants.SEARCHGUARD_AUTHENTICATION_AUTHORIZATION_SETTINGSDB_ROLES + user.getName()); if (optionalAuthCreds != null) { optionalAuthCreds.clear(); } if (roles != null) { user.addRoles(Arrays.asList(roles)); } } }
public EdgeNGramTokenizerFactory(IndexSettings indexSettings, Environment environment, String name, Settings settings) { super(indexSettings, name, settings); this.minGram = settings.getAsInt("min_gram", NGramTokenizer.DEFAULT_MIN_NGRAM_SIZE); this.maxGram = settings.getAsInt("max_gram", NGramTokenizer.DEFAULT_MAX_NGRAM_SIZE); this.matcher = parseTokenChars(settings.getAsArray("token_chars")); }
public NGramTokenizerFactory(IndexSettings indexSettings, Environment environment, String name, Settings settings) { super(indexSettings, name, settings); this.minGram = settings.getAsInt("min_gram", NGramTokenizer.DEFAULT_MIN_NGRAM_SIZE); this.maxGram = settings.getAsInt("max_gram", NGramTokenizer.DEFAULT_MAX_NGRAM_SIZE); this.matcher = parseTokenChars(settings.getAsArray("token_chars")); }
@Inject public HttpBasicServer(Settings settings, Environment environment, HttpServerTransport transport, RestController restController, NodeService nodeService) { super(settings, environment, transport, restController, nodeService); this.realm = settings.get("http.basic.realm", "karaf"); this.roles = settings.getAsArray("http.basic.roles", new String[]{"admin", "manager", "viewer", "Monitor", "Operator", "Maintainer", "Deployer", "Auditor", "Administrator", "SuperUser"}); this.log = settings.getAsBoolean("http.basic.log", false); Loggers.getLogger(getClass()).info("using realm: [{}] and authorized roles: [{}]", realm, roles); }
@Inject public HttpBasicServer(Settings settings, Environment environment, HttpServerTransport transport, RestController restController, NodeService nodeService) { super(settings, environment, transport, restController, nodeService); this.realm = settings.get("http.basic.realm", "karaf"); this.roles = settings.getAsArray("http.basic.roles", new String[]{"admin", "manager", "viewer", "Monitor", "Operator", "Maintainer", "Deployer", "Auditor", "Administrator", "SuperUser"}); this.log = settings.getAsBoolean("http.basic.log", false); Loggers.getLogger(getClass()).info("using realm: [{}] and authorized roles: [{}]", realm, roles); }
NGramTokenizerFactory(Index index, Settings indexSettings, String name, Settings settings) { super(index, indexSettings, name, settings); this.minGram = settings.getAsInt("min_gram", NGramTokenizer.DEFAULT_MIN_NGRAM_SIZE); this.maxGram = settings.getAsInt("max_gram", NGramTokenizer.DEFAULT_MAX_NGRAM_SIZE); this.matcher = parseTokenChars(settings.getAsArray("token_chars")); this.esVersion = org.elasticsearch.Version.indexCreated(indexSettings); }
@Inject public HtmlStripCharFilterFactory(Index index, IndexSettingsService indexSettingsService, @Assisted String name, @Assisted Settings settings) { super(index, indexSettingsService.getSettings(), name); String[] escapedTags = settings.getAsArray("escaped_tags"); if (escapedTags.length > 0) { this.escapedTags = ImmutableSet.copyOf(escapedTags); } else { this.escapedTags = null; } }
public EdgeNGramTokenizerFactory(Index index, Settings indexSettings, String name, Settings settings) { super(index, indexSettings, name, settings); this.minGram = settings.getAsInt("min_gram", NGramTokenizer.DEFAULT_MIN_NGRAM_SIZE); this.maxGram = settings.getAsInt("max_gram", NGramTokenizer.DEFAULT_MAX_NGRAM_SIZE); this.side = Lucene43EdgeNGramTokenizer.Side.getSide(settings.get("side", Lucene43EdgeNGramTokenizer.DEFAULT_SIDE.getLabel())); this.matcher = parseTokenChars(settings.getAsArray("token_chars")); this.esVersion = org.elasticsearch.Version.indexCreated(indexSettings); }