+ if (containsParam(user, property, conf, PORT_PARAM)) {
+ conf.setProperty(property + "." + PORT_PARAM, port);
+ } else if (port != null && !port.isEmpty()) {
+ conf.addProperty(property + "." + PORT_PARAM, port);
+ }
+ if (containsParam(user, property, conf, URL_PARAM)) {
+ conf.setProperty(property + "." + URL_PARAM, url);
+ } else {
+ conf.addProperty(property + "." + URL_PARAM, url);
+ }
+ }
+
+ private static void resolveProperty(String user, String password, String port, String url, String property,
+ PropertiesConfiguration conf, String key) {
+ if (contains(user, property, key, USER_PARAM)) {
+ conf.setProperty(property + "." + key, user);
+ }
+ if (contains(user, property, key, PASS_PARAM)) {
+ conf.setProperty(property + "." + key, password);
+ }
+ if (contains(user, property, key, PORT_PARAM)) {
+ conf.setProperty(property + "." + key, port);
+ }
+ if (contains(user, property, key, URL_PARAM)) {
+ conf.setProperty(property + "." + key, url);
+ }
+ }
+
+ private static boolean containsParam(String var, String property, PropertiesConfiguration conf, String param) {
+ return StringUtils.isNotBlank(var) && conf.containsKey(property + "." + param);
+ }