@Test public final void testReadArguments() { FilePropertyReader filePropReader = new FilePropertyReader(); try { filePropReader.readArguments(stunArgs, relayArgs, mediatorArgs); } catch (IllegalArgumentException e) { } }
@Override public void readArguments(List<String> stunArgs, List<String> relayArgs, List<String> mediatorArgs) throws IllegalArgumentException { try { Properties props = new Properties(); FileInputStream fis = new FileInputStream("config/master.server.properties"); props.load(fis); Enumeration<?> propEnumeration = props.propertyNames(); while (propEnumeration.hasMoreElements()) { try { String key = propEnumeration.nextElement().toString(); if (key.equals(STUN_FIRST_IP)) { String value = props.getProperty(key); processStunFirstIP(stunArgs, value); } else if (key.equals(STUN_SECOND_IP)) { String value = props.getProperty(key); processStunSecondIP(stunArgs, value); } else if (key.equals(RELAY_PORT)) { String value = props.getProperty(key); processRelayPort(relayArgs, value); } else if (key.equals(MEDIATOR_PORT)) { String value = props.getProperty(key); processMediatorPort(mediatorArgs, value); } else if (key.equals(MEDIATOR_ITERATION)) { String value = props.getProperty(key); processMediatorIteration(mediatorArgs, value); } else if (key.equals(MEDIATOR_LIFETIME)) { String value = props.getProperty(key); processMediatorLifeTime(mediatorArgs, value); } else { logInfo("Key \"" + key + "\" not recognized"); } } catch (IllegalArgumentException e) { logError("FilePropertyReader: Argument \"" + e.getMessage() + "\" is empty or invalid"); continue; } } fis.close(); } catch (IOException e) { logError("Config file not found!"); } }
FilePropertyReader extends AbstractReader { @Override public void readArguments(List<String> stunArgs, List<String> relayArgs, List<String> mediatorArgs) throws IllegalArgumentException { try { Properties props = new Properties(); FileInputStream fis = new FileInputStream("config/master.server.properties"); props.load(fis); Enumeration<?> propEnumeration = props.propertyNames(); while (propEnumeration.hasMoreElements()) { try { String key = propEnumeration.nextElement().toString(); if (key.equals(STUN_FIRST_IP)) { String value = props.getProperty(key); processStunFirstIP(stunArgs, value); } else if (key.equals(STUN_SECOND_IP)) { String value = props.getProperty(key); processStunSecondIP(stunArgs, value); } else if (key.equals(RELAY_PORT)) { String value = props.getProperty(key); processRelayPort(relayArgs, value); } else if (key.equals(MEDIATOR_PORT)) { String value = props.getProperty(key); processMediatorPort(mediatorArgs, value); } else if (key.equals(MEDIATOR_ITERATION)) { String value = props.getProperty(key); processMediatorIteration(mediatorArgs, value); } else if (key.equals(MEDIATOR_LIFETIME)) { String value = props.getProperty(key); processMediatorLifeTime(mediatorArgs, value); } else { logInfo("Key \"" + key + "\" not recognized"); } } catch (IllegalArgumentException e) { logError("FilePropertyReader: Argument \"" + e.getMessage() + "\" is empty or invalid"); continue; } } fis.close(); } catch (IOException e) { logError("Config file not found!"); } } }
FilePropertyReader extends AbstractReader { @Override public void readArguments(List<String> stunArgs, List<String> relayArgs, List<String> mediatorArgs) throws IllegalArgumentException { try { Properties props = new Properties(); FileInputStream fis = new FileInputStream("config/master.server.properties"); props.load(fis); Enumeration<?> propEnumeration = props.propertyNames(); while (propEnumeration.hasMoreElements()) { try { String key = propEnumeration.nextElement().toString(); if (key.equals(STUN_FIRST_IP)) { String value = props.getProperty(key); processStunFirstIP(stunArgs, value); } else if (key.equals(STUN_SECOND_IP)) { String value = props.getProperty(key); processStunSecondIP(stunArgs, value); } else if (key.equals(RELAY_PORT)) { String value = props.getProperty(key); processRelayPort(relayArgs, value); } else if (key.equals(MEDIATOR_PORT)) { String value = props.getProperty(key); processMediatorPort(mediatorArgs, value); } else if (key.equals(MEDIATOR_ITERATION)) { String value = props.getProperty(key); processMediatorIteration(mediatorArgs, value); } else if (key.equals(MEDIATOR_LIFETIME)) { String value = props.getProperty(key); processMediatorLifeTime(mediatorArgs, value); } else { logInfo("Key \"" + key + "\" not recognized"); } } catch (IllegalArgumentException e) { logError("FilePropertyReader: Argument \"" + e.getMessage() + "\" is empty or invalid"); continue; } } fis.close(); } catch (IOException e) { logError("Config file not found!"); } } FilePropertyReader(); }
FilePropertyReader extends AbstractReader { @Override public void readArguments(List<String> stunArgs, List<String> relayArgs, List<String> mediatorArgs) throws IllegalArgumentException { try { Properties props = new Properties(); FileInputStream fis = new FileInputStream("config/master.server.properties"); props.load(fis); Enumeration<?> propEnumeration = props.propertyNames(); while (propEnumeration.hasMoreElements()) { try { String key = propEnumeration.nextElement().toString(); if (key.equals(STUN_FIRST_IP)) { String value = props.getProperty(key); processStunFirstIP(stunArgs, value); } else if (key.equals(STUN_SECOND_IP)) { String value = props.getProperty(key); processStunSecondIP(stunArgs, value); } else if (key.equals(RELAY_PORT)) { String value = props.getProperty(key); processRelayPort(relayArgs, value); } else if (key.equals(MEDIATOR_PORT)) { String value = props.getProperty(key); processMediatorPort(mediatorArgs, value); } else if (key.equals(MEDIATOR_ITERATION)) { String value = props.getProperty(key); processMediatorIteration(mediatorArgs, value); } else if (key.equals(MEDIATOR_LIFETIME)) { String value = props.getProperty(key); processMediatorLifeTime(mediatorArgs, value); } else { logInfo("Key \"" + key + "\" not recognized"); } } catch (IllegalArgumentException e) { logError("FilePropertyReader: Argument \"" + e.getMessage() + "\" is empty or invalid"); continue; } } fis.close(); } catch (IOException e) { logError("Config file not found!"); } } FilePropertyReader(); @Override void readArguments(List<String> stunArgs, List<String> relayArgs, List<String> mediatorArgs); }
FilePropertyReader extends AbstractReader { @Override public void readArguments(List<String> stunArgs, List<String> relayArgs, List<String> mediatorArgs) throws IllegalArgumentException { try { Properties props = new Properties(); FileInputStream fis = new FileInputStream("config/master.server.properties"); props.load(fis); Enumeration<?> propEnumeration = props.propertyNames(); while (propEnumeration.hasMoreElements()) { try { String key = propEnumeration.nextElement().toString(); if (key.equals(STUN_FIRST_IP)) { String value = props.getProperty(key); processStunFirstIP(stunArgs, value); } else if (key.equals(STUN_SECOND_IP)) { String value = props.getProperty(key); processStunSecondIP(stunArgs, value); } else if (key.equals(RELAY_PORT)) { String value = props.getProperty(key); processRelayPort(relayArgs, value); } else if (key.equals(MEDIATOR_PORT)) { String value = props.getProperty(key); processMediatorPort(mediatorArgs, value); } else if (key.equals(MEDIATOR_ITERATION)) { String value = props.getProperty(key); processMediatorIteration(mediatorArgs, value); } else if (key.equals(MEDIATOR_LIFETIME)) { String value = props.getProperty(key); processMediatorLifeTime(mediatorArgs, value); } else { logInfo("Key \"" + key + "\" not recognized"); } } catch (IllegalArgumentException e) { logError("FilePropertyReader: Argument \"" + e.getMessage() + "\" is empty or invalid"); continue; } } fis.close(); } catch (IOException e) { logError("Config file not found!"); } } FilePropertyReader(); @Override void readArguments(List<String> stunArgs, List<String> relayArgs, List<String> mediatorArgs);  }