| java.util.Properties gov.nasa.jpf.Config
Config | public class Config extends Properties (Code) | | class that encapsulates property-based JPF configuration. This is mainly an
associative array with various typed accessors, and a structured
initialization process. This implementation has the design constraint that it
does not promote symbolic information to concrete types, which means that
frequently accessed data should be promoted and cached in client classes.
This in turn means we assume the data is not going to change at runtime.
Major motivation for this mechanism is to avoid 'Option' classes that have
concrete type fields, and hence are structural bottlenecks, i.e. every
parameterized user extension (Heuristics, Scheduler etc.) require to update
this single class. Note that Config is also not thread safe with respect to
retrieving exceptions that occurrred during instantiation
Another important caveat for both implementation and usage of Config is that
it is supposed to be our master configuration mechanism, i.e. it is also used
to configure other core services like logging. This means that Config
initialization should not depend on these services. Initialization has to
return at all times, recording potential problems for later handling. This is
why we have to keep the Config data model and initialization fairly simple
and robust.
|
Method Summary | |
public String | getArg(int i) | public String[] | getArgs() | public boolean | getBoolean(String key) | public boolean | getBoolean(String key, boolean def) | public static Class | getCallerClass(int up) | public int | getChoiceIndexIgnoreCase(String key, String[] choices) | public Class | getClass(String key) | public Class[] | getClasses(String key) | public String | getDefaultsSourceName() | public double | getDouble(String key) | public double | getDouble(String key, double defValue) | public double[] | getDoubleArray(String key) | public Class | getEssentialClass(String key) | public Object | getEssentialInstance(String key, Class type) | public Object | getEssentialInstance(String key, Class type, Class[] argTypes, Object[] args) | public String | getExpandedString(String key) same as getString(), except of that we look for '${ }' patterns, and
replace them with values if we find corresponding keys. | public String | getFileName() | public Object | getInstance(String key, Class type) | public Object | getInstance(String key, Class type, Class[] argTypes, Object[] args) | Object | getInstance(String key, Class cls, Class type, Class[] argTypes, Object[] args) this is our private instantiation workhorse try to instantiate an object of
class 'cls' by using the following ordered set of ctors 1. | public Object[] | getInstances(String key, Class type) | public int | getInt(String key) | public int | getInt(String key, int defValue) | public int[] | getIntArray(String key) | public long | getLong(String key) | public long | getLong(String key, long defValue) | public long[] | getLongArray(String key) | public long | getMemorySize(String key, long defValue) return memory size in bytes, or 'defValue' if not in dictionary. | String | getMethodSignature(Constructor ctor) | public int | getNonOptionArgIndex() | public Object | getSource() | public String | getSourceName() | public String | getString(String key) | public String | getString(String key, String defValue) | public String[] | getStringArray(String key) | public String | getTargetArg() | public String[] | getTargetArgParameters() | public boolean | gotDefaultProperties() | public boolean | gotProperties() | public boolean | hasArg(String regex) | public boolean | hasValue(String key) | public boolean | hasValueIgnoreCase(String key, String value) | boolean | loadFile(String fileName, String alternatePath, Class codeBase) | void | normalizeValues() | public void | print(PrintWriter pw) | public void | printStatus(Logger log) | void | processArgs(String[] args) | public void | throwException(String msg) |
freeArgs | String[] freeArgs(Code) | | all arguments that are not = pairs
|
gotProperties | boolean gotProperties(Code) | | |
getBoolean | public boolean getBoolean(String key, boolean def)(Code) | | |
getCallerClass | public static Class getCallerClass(int up)(Code) | | find callers class
Parameters: up - -levels upwards from our caller (NOT counting ourselves) caller class, null if illegal 'up' value |
getChoiceIndexIgnoreCase | public int getChoiceIndexIgnoreCase(String key, String[] choices)(Code) | | |
getDefaultsSourceName | public String getDefaultsSourceName()(Code) | | |
getDouble | public double getDouble(String key, double defValue)(Code) | | |
getExpandedString | public String getExpandedString(String key)(Code) | | same as getString(), except of that we look for '${ }' patterns, and
replace them with values if we find corresponding keys. Expansion is not
done recursively (but could be)
|
getInstance | Object getInstance(String key, Class cls, Class type, Class[] argTypes, Object[] args) throws Exception(Code) | | this is our private instantiation workhorse try to instantiate an object of
class 'cls' by using the following ordered set of ctors 1. (
) 2. (Config) 3. () if all of that fails, or there was
a 'type' provided the instantiated object does not comply with, return null
|
getMemorySize | public long getMemorySize(String key, long defValue)(Code) | | return memory size in bytes, or 'defValue' if not in dictionary. Encoding
can have a 'M' or 'k' postfix, values have to be positive integers (decimal
notation)
|
getNonOptionArgIndex | public int getNonOptionArgIndex()(Code) | | return the index of the first free argument that does not start with an
hyphen
|
getTargetArg | public String getTargetArg()(Code) | | return the first non-option freeArg, or 'null' if there is none (usually
denotes the application to start)
|
getTargetArgParameters | public String[] getTargetArgParameters()(Code) | | return all args that follow the first non-option freeArgs (usually denotes
the parametsr to pass to the application to start)
|
gotDefaultProperties | public boolean gotDefaultProperties()(Code) | | |
gotProperties | public boolean gotProperties()(Code) | | |
hasArg | public boolean hasArg(String regex)(Code) | | check if any of the freeArgs matches a regular expression
Parameters: regex - -regular expression to check for true if found, false if not found or no freeArgs |
normalizeValues | void normalizeValues()(Code) | | turn standard type values (boolean etc.) into common formats
("true"/"false" for booleans)
|
processArgs | void processArgs(String[] args)(Code) | | extract all "+ = " parameters, store/overwrite them in our
dictionary, collect all other parameters in a String array
Parameters: args - -array of String parameters to process |
|
|