/** * <p> * This method performs property variable substitution on the * specified value. If the specified value contains the syntax * <tt>${<prop-name>}</tt>, where <tt><prop-name></tt> * refers to either a configuration property or a system property, * then the corresponding property value is substituted for the variable * placeholder. Multiple variable placeholders may exist in the * specified value as well as nested variable placeholders, which * are substituted from inner most to outer most. Configuration * properties override system properties. * </p> * * @param val The string on which to perform property substitution. * @param currentKey The key of the property being evaluated used to * detect cycles. * @param cycleMap Map of variable references used to detect nested cycles. * @param configProps Set of configuration properties. * @return The value of the specified string after system property substitution. * @throws IllegalArgumentException If there was a syntax error in the * property placeholder syntax or a recursive variable reference. **/ public static String substVars(String val, String currentKey, Map<String,String> cycleMap, Map<String,String> configProps) throws IllegalArgumentException { return substVars(val, currentKey, cycleMap, configProps, (SubstitutionCallback) null); }
throws IllegalArgumentException return substVars(val, currentKey, cycleMap, configProps, callback, true, true, true);
/** * <p> * This method performs property variable substitution on the * specified value. If the specified value contains the syntax * <tt>${<prop-name>}</tt>, where <tt><prop-name></tt> * refers to either a configuration property or a system property, * then the corresponding property value is substituted for the variable * placeholder. Multiple variable placeholders may exist in the * specified value as well as nested variable placeholders, which * are substituted from inner most to outer most. Configuration * properties override system properties. * </p> * * @param val The string on which to perform property substitution. * @param currentKey The key of the property being evaluated used to * detect cycles. * @param cycleMap Map of variable references used to detect nested cycles. * @param configProps Set of configuration properties. * @return The value of the specified string after system property substitution. * @throws IllegalArgumentException If there was a syntax error in the * property placeholder syntax or a recursive variable reference. **/ public static String substVars(String val, String currentKey, Map<String,String> cycleMap, Map<String,String> configProps) throws IllegalArgumentException { return substVars(val, currentKey, cycleMap, configProps, (SubstitutionCallback) null); }
/** * <p> * This method performs property variable substitution on the * specified value. If the specified value contains the syntax * <tt>${<prop-name>}</tt>, where <tt><prop-name></tt> * refers to either a configuration property or a system property, * then the corresponding property value is substituted for the variable * placeholder. Multiple variable placeholders may exist in the * specified value as well as nested variable placeholders, which * are substituted from inner most to outer most. Configuration * properties override system properties. * </p> * * @param val The string on which to perform property substitution. * @param currentKey The key of the property being evaluated used to * detect cycles. * @param cycleMap Map of variable references used to detect nested cycles. * @param configProps Set of configuration properties. * @return The value of the specified string after system property substitution. * @throws IllegalArgumentException If there was a syntax error in the * property placeholder syntax or a recursive variable reference. **/ public static String substVars(String val, String currentKey, Map<String,String> cycleMap, Map<String,String> configProps) throws IllegalArgumentException { return substVars(val, currentKey, cycleMap, configProps, (SubstitutionCallback) null); }
/** * <p> * This method performs property variable substitution on the * specified value. If the specified value contains the syntax * <tt>${<prop-name>}</tt>, where <tt><prop-name></tt> * refers to either a configuration property or a system property, * then the corresponding property value is substituted for the variable * placeholder. Multiple variable placeholders may exist in the * specified value as well as nested variable placeholders, which * are substituted from inner most to outer most. Configuration * properties override system properties. * </p> * * @param val The string on which to perform property substitution. * @param currentKey The key of the property being evaluated used to * detect cycles. * @param cycleMap Map of variable references used to detect nested cycles. * @param configProps Set of configuration properties. * @return The value of the specified string after system property substitution. * @throws IllegalArgumentException If there was a syntax error in the * property placeholder syntax or a recursive variable reference. **/ public static String substVars(String val, String currentKey, Map<String,String> cycleMap, Map<String,String> configProps) throws IllegalArgumentException { return substVars(val, currentKey, cycleMap, configProps, (SubstitutionCallback) null); }
throws IllegalArgumentException return substVars(val, currentKey, cycleMap, configProps, callback, true, true, true);
throws IllegalArgumentException return substVars(val, currentKey, cycleMap, configProps, callback, true, true, true);
/** * Perform substitution on a property set * * @param properties the property set to perform substitution on */ public static void performSubstitution(Map<String,String> properties, SubstitutionCallback callback) { Map<String, String> org = new HashMap<String, String>(properties); for (String name : properties.keySet()) { String value = properties.get(name); properties.put(name, substVars(value, name, null, org, callback)); } }
/** * Perform substitution on a property set * * @param properties the property set to perform substitution on * @param callback the callback to obtain substitution values * @param substituteFromConfig If substitute from configuration * @param substituteFromSystemProperties If substitute from system properties * @param defaultsToEmptyString sets an empty string if a replacement value is not found, leaves intact otherwise */ public static void performSubstitution(Map<String,String> properties, SubstitutionCallback callback, boolean substituteFromConfig, boolean substituteFromSystemProperties, boolean defaultsToEmptyString) { Map<String, String> org = new HashMap<String, String>(properties); for (String name : properties.keySet()) { String value = properties.get(name); properties.put(name, substVars(value, name, null, org, callback, substituteFromConfig, substituteFromSystemProperties, defaultsToEmptyString)); } }
/** * Perform substitution on a property set * * @param properties the property set to perform substitution on * @param callback the callback to obtain substitution values * @param substituteFromConfig If substitute from configuration * @param substituteFromSystemProperties If substitute from system properties * @param defaultsToEmptyString sets an empty string if a replacement value is not found, leaves intact otherwise */ public static void performSubstitution(Map<String,String> properties, SubstitutionCallback callback, boolean substituteFromConfig, boolean substituteFromSystemProperties, boolean defaultsToEmptyString) { Map<String, String> org = new HashMap<String, String>(properties); for (String name : properties.keySet()) { String value = properties.get(name); properties.put(name, substVars(value, name, null, org, callback, substituteFromConfig, substituteFromSystemProperties, defaultsToEmptyString)); } }
/** * Perform substitution on a property set * * @param properties the property set to perform substitution on * @param callback the callback to obtain substitution values * @param substituteFromConfig If substitute from configuration * @param substituteFromSystemProperties If substitute from system properties * @param defaultsToEmptyString sets an empty string if a replacement value is not found, leaves intact otherwise */ public static void performSubstitution(Map<String,String> properties, SubstitutionCallback callback, boolean substituteFromConfig, boolean substituteFromSystemProperties, boolean defaultsToEmptyString) { Map<String, String> org = new HashMap<String, String>(properties); for (String name : properties.keySet()) { String value = properties.get(name); properties.put(name, substVars(value, name, null, org, callback, substituteFromConfig, substituteFromSystemProperties, defaultsToEmptyString)); } }
private Handler getDefaultHandlerInternal() { if (handler != null) { return handler; } String filename = getLogFilePath(); filename = InterpolationHelper.substVars(filename, LOG4J_APPENDER_FILE, null, configProps); File logFile = new File(filename); try { return new SimpleFileHandler(logFile); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } }
throws IllegalArgumentException return substVars(val, currentKey, cycleMap, configProps, new BundleContextSubstitutionCallback(context));
String v = substVars(value, key, cycles, this, wrapper, false, finalSubstitution, finalSubstitution); return v;
throws IllegalArgumentException return substVars(val, currentKey, cycleMap, configProps, new BundleContextSubstitutionCallback(context));
throws IllegalArgumentException return substVars(val, currentKey, cycleMap, configProps, new BundleContextSubstitutionCallback(context));
throws IllegalArgumentException return substVars(val, currentKey, cycleMap, configProps, new BundleContextSubstitutionCallback(context));
return result; String urlResolved = InterpolationHelper.substVars(uri, "uri", null, null, context); URL url = null; try {
String v = substVars(value, key, cycles, this, wrapper, false, finalSubstitution, finalSubstitution); return v;
String overrideName = name.substring(OVERRIDE_PREFIX.length()); String value = props.getProperty(name); System.setProperty(overrideName, substVars(value, name, null, props, callback)); } else { String value = System.getProperty(name, props.getProperty(name)); System.setProperty(name, substVars(value, name, null, props, callback));