/** * Returns the value of a variable with the same priority replacement scheme as getProperty. * * @param variable * The variable you need the replacement for. * @return The value for variable. * @see org.opencastproject.util.XProperties#getProperty(String) */ public String expandVariable(String variable) { return findReplacement(START_REPLACEMENT + variable + END_REPLACEMENT, variable); }
/** * {@inheritDoc} See the class description for more details. * * @see java.util.Properties#getProperty(java.lang.String) */ @Override public String getProperty(String key) { String prop = getUninterpretedProperty(key); if (prop != null) { int start = prop.indexOf(START_REPLACEMENT); while (start != -1) { int end = prop.indexOf(END_REPLACEMENT); int next = prop.indexOf(START_REPLACEMENT, start + START_REPLACEMENT.length()); if (next > 0 && next <= end) { log.error("Start of next subkey before end of last subkey, unable to resolve replacements for key {}!", key); return null; } String subkey = prop.substring(start + START_REPLACEMENT.length(), end); prop = findReplacement(prop, subkey); if (prop == null) { log.error("Unable to find replacement for subkey {} in key {}, returning null!", subkey, key); return null; } start = prop.indexOf(START_REPLACEMENT); } } return prop; }