|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.util.Dictionary
|
+--java.util.Hashtable
|
+--java.util.Properties
|
+--gov.sns.tools.apputils.PropertyManager
PropertyManager is a Properties subclass which loads properties from default properties files for the specified root class. For starters, properties can be supplied to the constructor. Then if a default.properties resource is found relative to the root class, its properties are read and update the properties. If a config file is found in the user's Library/config/ folder and it has the root's fully qualified name along with the "properties" suffix (e.g. gov.sns.xyz.X.properties), then it is read and its properties update the manager's properties. Finally, any command line properties update the manager's properties. This should provide sufficient flexibility to supply defaults for various components.
| Field Summary | |
protected java.io.File |
CONFIG_FILE
|
protected static java.io.File |
CONFIG_FOLDER
|
| Fields inherited from class java.util.Properties |
defaults |
| Constructor Summary | |
PropertyManager(java.lang.Class root)
Constructor to build a properties table for the specified class. |
|
PropertyManager(java.lang.Class root,
java.util.Properties defaults)
Constructor to build a properties table for the specified class. |
|
PropertyManager(java.lang.Object root)
Constructor to build a properties table for the class of the specified object. |
|
| Method Summary | |
protected static java.util.Properties |
fetchDefaults(java.lang.Class root,
java.util.Properties defaults)
Fetch default properties from the root's default.properties resource starting with properties initialized defaults. |
java.io.File |
getUserConfigFile()
Get the user's config file. |
protected void |
loadUserConfig()
Load properties from the user's configuration file if it exists. |
| Methods inherited from class java.util.Properties |
getProperty, getProperty, list, list, load, propertyNames, save, setProperty, store |
| Methods inherited from class java.util.Hashtable |
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected static final java.io.File CONFIG_FOLDER
protected final java.io.File CONFIG_FILE
| Constructor Detail |
public PropertyManager(java.lang.Class root,
java.util.Properties defaults)
root - The class for which to load default properties.defaults - Default properties with which to start.public PropertyManager(java.lang.Class root)
root - The class for which to load default properties.public PropertyManager(java.lang.Object root)
root - The object whose class identifies the properties to load.| Method Detail |
protected void loadUserConfig()
protected static java.util.Properties fetchDefaults(java.lang.Class root,
java.util.Properties defaults)
root - The class whose default.properties resource is used to fetch propertiesdefaults - The properties used for initialization.
public java.io.File getUserConfigFile()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||