| java.lang.Object org.cougaar.util.Parameters
findParameter | public static String findParameter(String param, Map map)(Code) | | Look in various places for the value of a parameter.
The parameter may be specifed in the form "NAME" or
"NAME:DEFAULT", where "DEFAULT" is the default value.
The NAME will be looked up in this order:
- the passed-in parameter table (if supplied)
- the System properties
- the "$HOME/.cougaarrc" (if that file exists)
- the "./cougaar.rc" (if that file exists)
- the DEFAULT value (if "NAME:DEFAULT" is used)
- lastly, if the NAME is not found in any of the above
cases, null will be returned.
|
replaceParameters | public static String replaceParameters(String arg, Map map)(Code) | | Replace occurances of ${PARAM} in the argument with the result
of calling findParameter("PARAM");
Note: this is ugly, slow, inflexible and wastes lots of memory.
This code handles recursive expansions, but not nested parameter references.
Example: "${FOO}" -> "This is a ${BAR}" -> "This is a test"
but not "${FOO:${BAR}}"
|
|
|