List of usage examples for org.apache.commons.configuration ConfigurationException getLocalizedMessage
public String getLocalizedMessage()
From source file:org.mot.common.util.DateBuilder.java
private void init() { String pathToConfigDir = pf.getConfigDir(); try {/*from w w w . j ava2 s . co m*/ config = new PropertiesConfiguration(pathToConfigDir + "/date.properties"); } catch (ConfigurationException e) { // TODO Auto-generated catch block logger.error(e.getLocalizedMessage()); e.printStackTrace(); } }
From source file:ws.argo.plugin.probehandler.consul.ConsulProbeHandlerPlugin.java
/** * Digs through the xml file to get the particular configuration items necessary to * run this responder transport.// w ww . ja v a2 s . com * * @param xmlConfigFilename the name of the xml configuration file * @return an XMLConfiguration object * @throws ProbeHandlerConfigException if something goes awry */ private Properties processPropertiesFile(String xmlConfigFilename) throws ProbeHandlerConfigException, IOException { Properties props = new Properties(); XMLConfiguration config; try { config = new XMLConfiguration(xmlConfigFilename); } catch (ConfigurationException e) { throw new ProbeHandlerConfigException(e.getLocalizedMessage(), e); } String host = config.getString("host"); String port = config.getString("port", "80"); props.put("host", host); props.put("port", port); // Put TLS configuration here if (config.getString("username") != null) props.put("username", config.getString("username")); if (config.getString("password") != null) props.put("password", config.getString("password")); return props; }
From source file:ws.argo.probe.transport.responder.mqtt.MqttResponderTransport.java
/** * Digs througs the xml file to get the particular configuration items necessary to * run this responder transport./* w ww.ja v a 2 s . co m*/ * * @param xmlConfigFilename the name of the xml configuration file * @return an XMLConfiguration object * @throws TransportConfigException if something goes awry */ private void processPropertiesFile(String xmlConfigFilename) throws TransportConfigException { XMLConfiguration config; try { config = new XMLConfiguration(xmlConfigFilename); } catch (ConfigurationException e) { throw new TransportConfigException(e.getLocalizedMessage(), e); } _topicName = config.getString("mqttTopic", DEFAULT_TOPIC); try { _qos = parseInt(config.getString("qos", "0")); } catch (NumberFormatException e) { LOGGER.warning("Issue parsing the QOS [" + config.getString("qos") + "]. Using default of 0."); _qos = 0; } _broker = config.getString("broker"); _clientId = config.getString("clientId", "NO CLIENT ID"); if (_broker == null || _broker.isEmpty()) { // probably need to check validity throw new TransportConfigException("The broker MUST be configured correctly"); } if (_topicName.equals(DEFAULT_TOPIC)) { LOGGER.info("MQTT topic not defined. Using the default MQTT Topic [" + DEFAULT_TOPIC + "]"); } _username = config.getString("username"); _password = config.getString("password"); }
From source file:ws.argo.responder.plugin.repeater.mqtt.MqttRepeaterProbeHandlerPlugin.java
/** * Digs through the xml file to get the particular configuration items necessary to * run this responder transport.//from w w w . j a v a 2s . c om * * @param xmlConfigFilename the name of the xml configuration file * @return an XMLConfiguration object * @throws TransportConfigException if something goes awry */ private Properties processPropertiesFile(String xmlConfigFilename) throws TransportConfigException { Properties props = new Properties(); XMLConfiguration config; try { config = new XMLConfiguration(xmlConfigFilename); } catch (ConfigurationException e) { throw new TransportConfigException(e.getLocalizedMessage(), e); } props.put("mqttTopic", config.getString("mqttTopic")); props.put("qos", config.getString("qos", "0")); props.put("broker", config.getString("broker")); props.put("clientId", config.getString("clientId", "NO CLIENT ID")); if (config.getString("username") != null) props.put("username", config.getString("username")); if (config.getString("password") != null) props.put("password", config.getString("password")); return props; }