/** * Returns an iterator over property key/value pairs in this configuration. Some implementations * may elect to omit properties. * * @return iterator over properties */ @Override public Iterator<Entry<String,String>> iterator() { Predicate<String> all = x -> true; TreeMap<String,String> entries = new TreeMap<>(); getProperties(entries, all); return entries.entrySet().iterator(); }
/** * Gets a property value from this configuration. * * <p> * Note: this is inefficient, but convenient on occasion. For retrieving multiple properties, use * {@link #getProperties(Map, Predicate)} with a custom filter. * * @param property * property to get * @return property value */ public String get(String property) { Map<String,String> propMap = new HashMap<>(1); getProperties(propMap, key -> Objects.equals(property, key)); return propMap.get(property); }
public void getProperties(Map<String,String> props, Predicate<String> filter, boolean useDefaults) { if (useDefaults) { parent.getProperties(props, filter); } config.keySet().forEach(k -> { if (filter.test(k)) props.put(k, config.get(k)); }); } }
@Override public void getProperties(Map<String,String> props, Predicate<String> filter) { parent.getProperties(props, filter); List<String> children = propCache.getChildren(propPathPrefix); if (children != null) { for (String child : children) { if (child != null && filter.test(child)) { String value = getRaw(child); if (value != null) props.put(child, value); } } } }
parent.getProperties(props, parentFilter != null ? parentFilter : filter);
Map<String,String> propMap = new HashMap<>(); getProperties(propMap, key -> key.startsWith(property.getKey())); propMap = ImmutableMap.copyOf(propMap);
@Override public void getProperties(Map<String,String> props, Predicate<String> filter) { defaults.getProperties(props, filter);
/** * Returns an iterator over property key/value pairs in this configuration. Some implementations * may elect to omit properties. * * @return iterator over properties */ @Override public Iterator<Entry<String,String>> iterator() { Predicate<String> all = Predicates.alwaysTrue(); TreeMap<String,String> entries = new TreeMap<>(); getProperties(entries, all); return entries.entrySet().iterator(); }
private int getMaxThreads(final String prop) { if (this.confFactory != null) { AccumuloConfiguration conf = this.confFactory.getConfiguration(); Map<String,String> properties = new TreeMap<>(); conf.getProperties(properties, new AccumuloConfiguration.MatchFilter(prop)); if (properties.containsKey(prop)) { return Integer.parseInt(properties.get(prop)); } } return DEFAULT_THREAD_POOL_SIZE; }
/** * Gets a property value from this configuration. * * <p> * Note: this is inefficient, but convenient on occasion. For retrieving multiple properties, use * {@link #getProperties(Map, Predicate)} with a custom filter. * * @param property * property to get * @return property value */ public String get(String property) { Map<String,String> propMap = new HashMap<>(1); getProperties(propMap, new MatchFilter(property)); return propMap.get(property); }
private long getLongProperty(final String prop, final long defaultValue) { if (this.myEnv != null && this.myEnv.getConfig() != null) { AccumuloConfiguration conf = this.myEnv.getConfig(); Map<String,String> properties = new TreeMap<>(); conf.getProperties(properties, new AccumuloConfiguration.MatchFilter(prop)); if (properties.containsKey(prop)) { return Long.parseLong(properties.get(prop)); } } return defaultValue; }
@Override public void getProperties(Map<String,String> props, Predicate<String> filter) { parent.getProperties(props, filter); List<String> children = propCache.getChildren(propPathPrefix); if (children != null) { for (String child : children) { if (child != null && filter.apply(child)) { String value = getRaw(child); if (value != null) props.put(child, value); } } } }
parent.getProperties(props, parentFilter != null ? parentFilter : filter);
@Override public void getProperties(Map<String,String> props, Predicate<String> filter) { parent.getProperties(props, filter); for (Entry<String,String> entry : getXmlConfig()) if (filter.apply(entry.getKey())) props.put(entry.getKey(), entry.getValue()); // CredentialProvider should take precedence over site Configuration hadoopConf = getHadoopConfiguration(); if (null != hadoopConf) { try { for (String key : CredentialProviderFactoryShim.getKeys(hadoopConf)) { if (!Property.isValidPropertyKey(key) || !Property.isSensitive(key)) { continue; } if (filter.apply(key)) { char[] value = CredentialProviderFactoryShim.getValueFromCredentialProvider(hadoopConf, key); if (null != value) { props.put(key, new String(value)); } } } } catch (IOException e) { log.warn("Failed to extract sensitive properties from Hadoop" + " CredentialProvider, falling back to accumulo-site.xml", e); } } }
Map<String,String> propMap = new HashMap<>(); getProperties(propMap, new PrefixFilter(property.getKey())); propMap = ImmutableMap.copyOf(propMap);
@Override public void getProperties(Map<String,String> props, Predicate<String> filter) { defaults.getProperties(props, filter);