@Test public void onlyReadsRelevantIteratorScopeConfigurations() { Map<String,String> data = new HashMap<>(); data.put(Property.TABLE_ITERATOR_SCAN_PREFIX + "foo", "50," + SummingCombiner.class.getName()); data.put(Property.TABLE_ITERATOR_SCAN_PREFIX + "foo.opt.all", "true"); data.put(Property.TABLE_ITERATOR_PREFIX + ".fakescope.bar", "50," + SummingCombiner.class.getName()); data.put(Property.TABLE_ITERATOR_SCAN_PREFIX + "foo.opt.fakeopt", "fakevalue"); AccumuloConfiguration conf = new ConfigurationCopy(data); List<IterInfo> iterators = IterConfigUtil.parseIterConf(IteratorScope.scan, EMPTY_ITERS, new HashMap<>(), conf); assertEquals(1, iterators.size()); IterInfo ii = iterators.get(0); assertEquals(new IterInfo(50, SummingCombiner.class.getName(), "foo"), ii); }
public static List<IterInfo> parseIterConf(IteratorScope scope, List<IterInfo> iters, Map<String,Map<String,String>> allOptions, AccumuloConfiguration conf) { Map<String,String> properties = conf.getAllPropertiesWithPrefix(getProperty(scope)); ArrayList<IterInfo> iterators = new ArrayList<>(iters); final Property scopeProperty = getProperty(scope); final String scopePropertyKey = scopeProperty.getKey(); for (Entry<String,String> entry : properties.entrySet()) { String suffix = entry.getKey().substring(scopePropertyKey.length()); String[] suffixSplit = suffix.split("\\.", 3); if (suffixSplit.length == 1) { String[] sa = entry.getValue().split(","); int prio = Integer.parseInt(sa[0]); String className = sa[1]; iterators.add(new IterInfo(prio, className, suffixSplit[0])); } else if (suffixSplit.length == 3 && suffixSplit[1].equals("opt")) { String iterName = suffixSplit[0]; String optName = suffixSplit[2]; allOptions.computeIfAbsent(iterName, k -> new HashMap<>()).put(optName, entry.getValue()); } else { throw new IllegalArgumentException("Invalid iterator format: " + entry.getKey()); } } iterators.sort(ITER_INFO_COMPARATOR); return iterators; }
IterConfigUtil { public static List<IterInfo> parseIterConf(IteratorScope scope, List<IterInfo> iters, Map<String,Map<String,String>> allOptions, AccumuloConfiguration conf) { Map<String,String> properties = conf.getAllPropertiesWithPrefix(getProperty(scope)); ArrayList<IterInfo> iterators = new ArrayList<>(iters); final Property scopeProperty = getProperty(scope); final String scopePropertyKey = scopeProperty.getKey(); for (Entry<String,String> entry : properties.entrySet()) { String suffix = entry.getKey().substring(scopePropertyKey.length()); String[] suffixSplit = suffix.split("\\.", 3); if (suffixSplit.length == 1) { String[] sa = entry.getValue().split(","); int prio = Integer.parseInt(sa[0]); String className = sa[1]; iterators.add(new IterInfo(prio, className, suffixSplit[0])); } else if (suffixSplit.length == 3 && suffixSplit[1].equals("opt")) { String iterName = suffixSplit[0]; String optName = suffixSplit[2]; allOptions.computeIfAbsent(iterName, k -> new HashMap<>()).put(optName, entry.getValue()); } else { throw new IllegalArgumentException("Invalid iterator format: " + entry.getKey()); } } iterators.sort(ITER_INFO_COMPARATOR); return iterators; } }
IterConfigUtil { public static List<IterInfo> parseIterConf(IteratorScope scope, List<IterInfo> iters, Map<String,Map<String,String>> allOptions, AccumuloConfiguration conf) { Map<String,String> properties = conf.getAllPropertiesWithPrefix(getProperty(scope)); ArrayList<IterInfo> iterators = new ArrayList<>(iters); final Property scopeProperty = getProperty(scope); final String scopePropertyKey = scopeProperty.getKey(); for (Entry<String,String> entry : properties.entrySet()) { String suffix = entry.getKey().substring(scopePropertyKey.length()); String[] suffixSplit = suffix.split("\\.", 3); if (suffixSplit.length == 1) { String[] sa = entry.getValue().split(","); int prio = Integer.parseInt(sa[0]); String className = sa[1]; iterators.add(new IterInfo(prio, className, suffixSplit[0])); } else if (suffixSplit.length == 3 && suffixSplit[1].equals("opt")) { String iterName = suffixSplit[0]; String optName = suffixSplit[2]; allOptions.computeIfAbsent(iterName, k -> new HashMap<>()).put(optName, entry.getValue()); } else { throw new IllegalArgumentException("Invalid iterator format: " + entry.getKey()); } } iterators.sort(ITER_INFO_COMPARATOR); return iterators; }  }
IterConfigUtil { public static List<IterInfo> parseIterConf(IteratorScope scope, List<IterInfo> iters, Map<String,Map<String,String>> allOptions, AccumuloConfiguration conf) { Map<String,String> properties = conf.getAllPropertiesWithPrefix(getProperty(scope)); ArrayList<IterInfo> iterators = new ArrayList<>(iters); final Property scopeProperty = getProperty(scope); final String scopePropertyKey = scopeProperty.getKey(); for (Entry<String,String> entry : properties.entrySet()) { String suffix = entry.getKey().substring(scopePropertyKey.length()); String[] suffixSplit = suffix.split("\\.", 3); if (suffixSplit.length == 1) { String[] sa = entry.getValue().split(","); int prio = Integer.parseInt(sa[0]); String className = sa[1]; iterators.add(new IterInfo(prio, className, suffixSplit[0])); } else if (suffixSplit.length == 3 && suffixSplit[1].equals("opt")) { String iterName = suffixSplit[0]; String optName = suffixSplit[2]; allOptions.computeIfAbsent(iterName, k -> new HashMap<>()).put(optName, entry.getValue()); } else { throw new IllegalArgumentException("Invalid iterator format: " + entry.getKey()); } } iterators.sort(ITER_INFO_COMPARATOR); return iterators; }  static Property getProperty(IteratorScope scope); static Map<String,String> generateInitialTableProperties(boolean limitVersion); static List<IterInfo> parseIterConf(IteratorScope scope, List<IterInfo> iters,
      Map<String,Map<String,String>> allOptions, AccumuloConfiguration conf); static void mergeIteratorConfig(List<IterInfo> destList,
      Map<String,Map<String,String>> destOpts, List<IterInfo> tableIters,
      Map<String,Map<String,String>> tableOpts, List<IterInfo> ssi,
      Map<String,Map<String,String>> ssio); static IterLoad loadIterConf(IteratorScope scope, List<IterInfo> iters,
      Map<String,Map<String,String>> iterOpts, AccumuloConfiguration conf); static SortedKeyValueIterator<Key,Value> convertItersAndLoad(IteratorScope scope,
      SortedKeyValueIterator<Key,Value> source, AccumuloConfiguration conf,
      List<IteratorSetting> iterators, IteratorEnvironment env); static SortedKeyValueIterator<Key,Value> loadIterators(
      SortedKeyValueIterator<Key,Value> source, IterLoad iterLoad); }
IterConfigUtil { public static List<IterInfo> parseIterConf(IteratorScope scope, List<IterInfo> iters, Map<String,Map<String,String>> allOptions, AccumuloConfiguration conf) { Map<String,String> properties = conf.getAllPropertiesWithPrefix(getProperty(scope)); ArrayList<IterInfo> iterators = new ArrayList<>(iters); final Property scopeProperty = getProperty(scope); final String scopePropertyKey = scopeProperty.getKey(); for (Entry<String,String> entry : properties.entrySet()) { String suffix = entry.getKey().substring(scopePropertyKey.length()); String[] suffixSplit = suffix.split("\\.", 3); if (suffixSplit.length == 1) { String[] sa = entry.getValue().split(","); int prio = Integer.parseInt(sa[0]); String className = sa[1]; iterators.add(new IterInfo(prio, className, suffixSplit[0])); } else if (suffixSplit.length == 3 && suffixSplit[1].equals("opt")) { String iterName = suffixSplit[0]; String optName = suffixSplit[2]; allOptions.computeIfAbsent(iterName, k -> new HashMap<>()).put(optName, entry.getValue()); } else { throw new IllegalArgumentException("Invalid iterator format: " + entry.getKey()); } } iterators.sort(ITER_INFO_COMPARATOR); return iterators; }  static Property getProperty(IteratorScope scope); static Map<String,String> generateInitialTableProperties(boolean limitVersion); static List<IterInfo> parseIterConf(IteratorScope scope, List<IterInfo> iters,
      Map<String,Map<String,String>> allOptions, AccumuloConfiguration conf); static void mergeIteratorConfig(List<IterInfo> destList,
      Map<String,Map<String,String>> destOpts, List<IterInfo> tableIters,
      Map<String,Map<String,String>> tableOpts, List<IterInfo> ssi,
      Map<String,Map<String,String>> ssio); static IterLoad loadIterConf(IteratorScope scope, List<IterInfo> iters,
      Map<String,Map<String,String>> iterOpts, AccumuloConfiguration conf); static SortedKeyValueIterator<Key,Value> convertItersAndLoad(IteratorScope scope,
      SortedKeyValueIterator<Key,Value> source, AccumuloConfiguration conf,
      List<IteratorSetting> iterators, IteratorEnvironment env); static SortedKeyValueIterator<Key,Value> loadIterators(
      SortedKeyValueIterator<Key,Value> source, IterLoad iterLoad); static final Comparator<IterInfo> ITER_INFO_COMPARATOR; }