@Test public void testGetPortRange() { AccumuloConfiguration c = DefaultConfiguration.getInstance(); ConfigurationCopy cc = new ConfigurationCopy(c); cc.set(Property.TSERV_CLIENTPORT, "9997-9999"); int[] ports = cc.getPort(Property.TSERV_CLIENTPORT); assertEquals(3, ports.length); assertEquals(9997, ports[0]); assertEquals(9998, ports[1]); assertEquals(9999, ports[2]); }
public int[] getPort(Property property) { checkType(property, PropertyType.PORT); String portString = get(property); int[] ports = null; try { Pair<Integer,Integer> portRange = PortRange.parse(portString); int low = portRange.getFirst(); int high = portRange.getSecond(); ports = new int[high - low + 1]; for (int i = 0, j = low; j <= high; i++, j++) { ports[i] = j; } } catch (IllegalArgumentException e) { ports = new int[1]; try { int port = Integer.parseInt(portString); if (port == 0) { ports[0] = port; } else { if (port < 1024 || port > 65535) { log.error("Invalid port number {}; Using default {}", port, property.getDefaultValue()); ports[0] = Integer.parseInt(property.getDefaultValue()); } else { ports[0] = port; } } } catch (NumberFormatException e1) { throw new IllegalArgumentException("Invalid port syntax. Must be a single positive " + "integers or a range (M-N) of positive integers"); } } return ports; }
AccumuloConfiguration implements Iterable<Entry<String,String>> { public int[] getPort(Property property) { checkType(property, PropertyType.PORT); String portString = get(property); int[] ports = null; try { Pair<Integer,Integer> portRange = PortRange.parse(portString); int low = portRange.getFirst(); int high = portRange.getSecond(); ports = new int[high - low + 1]; for (int i = 0, j = low; j <= high; i++, j++) { ports[i] = j; } } catch (IllegalArgumentException e) { ports = new int[1]; try { int port = Integer.parseInt(portString); if (port == 0) { ports[0] = port; } else { if (port < 1024 || port > 65535) { log.error("Invalid port number {}; Using default {}", port, property.getDefaultValue()); ports[0] = Integer.parseInt(property.getDefaultValue()); } else { ports[0] = port; } } } catch (NumberFormatException e1) { throw new IllegalArgumentException("Invalid port syntax. Must be a single positive " + "integers or a range (M-N) of positive integers"); } } return ports; } }
AccumuloConfiguration implements Iterable<Entry<String,String>> { public int[] getPort(Property property) { checkType(property, PropertyType.PORT); String portString = get(property); int[] ports = null; try { Pair<Integer,Integer> portRange = PortRange.parse(portString); int low = portRange.getFirst(); int high = portRange.getSecond(); ports = new int[high - low + 1]; for (int i = 0, j = low; j <= high; i++, j++) { ports[i] = j; } } catch (IllegalArgumentException e) { ports = new int[1]; try { int port = Integer.parseInt(portString); if (port == 0) { ports[0] = port; } else { if (port < 1024 || port > 65535) { log.error("Invalid port number {}; Using default {}", port, property.getDefaultValue()); ports[0] = Integer.parseInt(property.getDefaultValue()); } else { ports[0] = port; } } } catch (NumberFormatException e1) { throw new IllegalArgumentException("Invalid port syntax. Must be a single positive " + "integers or a range (M-N) of positive integers"); } } return ports; }  }
AccumuloConfiguration implements Iterable<Entry<String,String>> { public int[] getPort(Property property) { checkType(property, PropertyType.PORT); String portString = get(property); int[] ports = null; try { Pair<Integer,Integer> portRange = PortRange.parse(portString); int low = portRange.getFirst(); int high = portRange.getSecond(); ports = new int[high - low + 1]; for (int i = 0, j = low; j <= high; i++, j++) { ports[i] = j; } } catch (IllegalArgumentException e) { ports = new int[1]; try { int port = Integer.parseInt(portString); if (port == 0) { ports[0] = port; } else { if (port < 1024 || port > 65535) { log.error("Invalid port number {}; Using default {}", port, property.getDefaultValue()); ports[0] = Integer.parseInt(property.getDefaultValue()); } else { ports[0] = port; } } } catch (NumberFormatException e1) { throw new IllegalArgumentException("Invalid port syntax. Must be a single positive " + "integers or a range (M-N) of positive integers"); } } return ports; }  String get(String property); abstract String get(Property property); Property resolve(Property property, Property deprecatedProperty); abstract void getProperties(Map<String,String> props, Predicate<String> filter); @Override Iterator<Entry<String,String>> iterator(); long getUpdateCount(); Map<String,String> getAllPropertiesWithPrefix(Property property); Map<String,String> getAllPropertiesWithPrefixStripped(Property prefix); long getAsBytes(Property property); long getTimeInMillis(Property property); boolean getBoolean(Property property); double getFraction(Property property); int[] getPort(Property property); int getCount(Property property); String getPath(Property property); int getMaxFilesPerTablet(); boolean isPropertySet(Property prop, boolean cacheAndWatch); Deriver<T> newDeriver(Function<AccumuloConfiguration,T> converter); Collection<ScanExecutorConfig> getScanExecutors(); void invalidateCache(); }
AccumuloConfiguration implements Iterable<Entry<String,String>> { public int[] getPort(Property property) { checkType(property, PropertyType.PORT); String portString = get(property); int[] ports = null; try { Pair<Integer,Integer> portRange = PortRange.parse(portString); int low = portRange.getFirst(); int high = portRange.getSecond(); ports = new int[high - low + 1]; for (int i = 0, j = low; j <= high; i++, j++) { ports[i] = j; } } catch (IllegalArgumentException e) { ports = new int[1]; try { int port = Integer.parseInt(portString); if (port == 0) { ports[0] = port; } else { if (port < 1024 || port > 65535) { log.error("Invalid port number {}; Using default {}", port, property.getDefaultValue()); ports[0] = Integer.parseInt(property.getDefaultValue()); } else { ports[0] = port; } } } catch (NumberFormatException e1) { throw new IllegalArgumentException("Invalid port syntax. Must be a single positive " + "integers or a range (M-N) of positive integers"); } } return ports; }  String get(String property); abstract String get(Property property); Property resolve(Property property, Property deprecatedProperty); abstract void getProperties(Map<String,String> props, Predicate<String> filter); @Override Iterator<Entry<String,String>> iterator(); long getUpdateCount(); Map<String,String> getAllPropertiesWithPrefix(Property property); Map<String,String> getAllPropertiesWithPrefixStripped(Property prefix); long getAsBytes(Property property); long getTimeInMillis(Property property); boolean getBoolean(Property property); double getFraction(Property property); int[] getPort(Property property); int getCount(Property property); String getPath(Property property); int getMaxFilesPerTablet(); boolean isPropertySet(Property prop, boolean cacheAndWatch); Deriver<T> newDeriver(Function<AccumuloConfiguration,T> converter); Collection<ScanExecutorConfig> getScanExecutors(); void invalidateCache();  }