@Override public String getProperty(String key, String defaultValue) { String value = getRawPropertyValue(key); if (value == null) { value = defaultValue; } return replaceProperties(value); }
/** * @return File output of the Logger. * @see PGProperty#LOGGER_FILE */ public String getLoggerFile() { ExpressionProperties exprProps = new ExpressionProperties(properties, System.getProperties()); return PGProperty.LOGGER_FILE.get(exprProps); }
private String replaceProperties(String value) { if (value == null) { return null; } Matcher matcher = EXPRESSION.matcher(value); StringBuffer sb = null; while (matcher.find()) { if (sb == null) { sb = new StringBuffer(); } String propValue = getProperty(matcher.group(1)); if (propValue == null) { // Use original content like ${propKey} if property is not found propValue = matcher.group(); } matcher.appendReplacement(sb, Matcher.quoteReplacement(propValue)); } if (sb == null) { return value; } matcher.appendTail(sb); return sb.toString(); } }
ExpressionProperties exprProps = new ExpressionProperties(props, System.getProperties()); final String driverLogFile = PGProperty.LOGGER_FILE.get(exprProps); if (driverLogFile != null && driverLogFile.equals(loggerHandlerFile)) {
/** * <p>Returns property value with all {@code ${propKey}} like references replaced with the value of * the relevant property with recursive resolution.</p> * * <p>The method returns <code>null</code> if the property is not found.</p> * * @param key the property key. * * @return the value in this property list with * the specified key value. */ @Override public String getProperty(String key) { String value = getRawPropertyValue(key); return replaceProperties(value); }