private Map<String, Tuple<Long, Settings>> validate(Map<String, Tuple<Long, Settings>> conf, int expectedSize) throws InvalidConfigException { if(conf == null || conf.size() != expectedSize) { throw new InvalidConfigException("Retrieved only partial configuration"); } final Tuple<Long, Settings> roles = conf.get("roles"); final String rolesDelimited; if (roles != null && roles.v2() != null && (rolesDelimited = roles.v2().toDelimitedString('#')) != null) { //<role>.indices.<indice>._dls_= OK //<role>.indices.<indice>._fls_.<num>= OK final String[] rolesString = rolesDelimited.split("#"); for (String role : rolesString) { if (role.contains("_fls_.") && !FLS_PATTERN.matcher(role).matches()) { LOGGER.error("Invalid FLS configuration detected, FLS/DLS will not work correctly: {}", role); } if (role.contains("_dls_=") && !DLS_PATTERN.matcher(role).matches()) { LOGGER.error("Invalid DLS configuration detected, FLS/DLS will not work correctly: {}", role); } } } return conf; }
@Override public String toString() { if (definition == null) { return name; } else { return definition.toDelimitedString(';'); } } }
private Map<String, Tuple<Long, Settings>> validate(Map<String, Tuple<Long, Settings>> conf, int expectedSize) throws InvalidConfigException { if(conf == null || conf.size() != expectedSize) { throw new InvalidConfigException("Retrieved only partial configuration"); } final Tuple<Long, Settings> roles = conf.get("roles"); final String rolesDelimited; if (roles != null && roles.v2() != null && (rolesDelimited = roles.v2().toDelimitedString('#')) != null) { //<role>.indices.<indice>._dls_= OK //<role>.indices.<indice>._fls_.<num>= OK final String[] rolesString = rolesDelimited.split("#"); for (String role : rolesString) { if (role.contains("_fls_.") && !FLS_PATTERN.matcher(role).matches()) { LOGGER.error("Invalid FLS configuration detected, FLS/DLS will not work correctly: {}", role); } if (role.contains("_dls_=") && !DLS_PATTERN.matcher(role).matches()) { LOGGER.error("Invalid DLS configuration detected, FLS/DLS will not work correctly: {}", role); } } } return conf; }
@SuppressWarnings("resource") protected ESClient createRemoteClient(ElasticSearchClientConfig config) { Settings settings = getSetting(config).build(); log.debug("Using settings: " + settings.toDelimitedString(',')); TransportClient client = new PreBuiltTransportClient(settings); // not closed here String[] addresses = config.getOption("addressList", "").split(","); if (addresses.length == 0) { throw new IllegalArgumentException("No addressList option provided cannot connect TransportClient"); } else { for (String item : addresses) { String[] address = item.split(":"); log.debug("Add transport address: " + item); try { InetAddress inet = InetAddress.getByName(address[0]); client.addTransportAddress(new TransportAddress(inet, Integer.parseInt(address[1]))); } catch (UnknownHostException e) { log.error("Unable to resolve host " + address[0], e); } } } return new ESTransportClient(client); }
profileSettings.toDelimitedString(',')); continue; } else if (TransportSettings.DEFAULT_PROFILE.equals(name)) {
log.debug("Using settings: " + settings.toDelimitedString(','));
/** * Restricts the given index to be allocated on <code>n</code> nodes using the allocation deciders. * Yet if the shards can't be allocated on any other node shards for this index will remain allocated on * more than <code>n</code> nodes. */ public void allowNodes(String index, int n) { assert index != null; internalCluster().ensureAtLeastNumDataNodes(n); Settings.Builder builder = Settings.builder(); if (n > 0) { getExcludeSettings(index, n, builder); } Settings build = builder.build(); if (!build.isEmpty()) { logger.debug("allowNodes: updating [{}]'s setting to [{}]", index, build.toDelimitedString(';')); client().admin().indices().prepareUpdateSettings(index).setSettings(build).execute().actionGet(); } }
logger.info("transport profile configured without a name. skipping profile with settings [{}]", profileSettings.toDelimitedString(',')); continue; } else if (DEFAULT_PROFILE.equals(name)) {