lempinen.util
Class Configuration
java.lang.Object
|
+--java.util.Dictionary
|
+--java.util.Hashtable
|
+--java.util.Properties
|
+--lempinen.util.Configuration
- All Implemented Interfaces:
- java.lang.Cloneable, java.util.Map, java.io.Serializable
- public class Configuration
- extends java.util.Properties
Convenience class for merging system properties to a property file.
This enables the user to
- have a default configuration in a property file and
- override these properties e.g. from the command line.
- Version:
- $Id: Configuration.java,v 1.2 2000/10/06 19:48:58 lempinen Exp $
- Author:
- Sami Lempinen
- See Also:
- Serialized Form
Inner classes inherited from class java.util.Map |
java.util.Map.Entry |
Fields inherited from class java.util.Properties |
defaults, hexDigit, keyValueSeparators, serialVersionUID, specialSaveChars, strictKeyValueSeparators, whiteSpaceChars |
Fields inherited from class java.util.Hashtable |
count, emptyEnumerator, emptyIterator, ENTRIES, entrySet, KEYS, keySet, loadFactor, modCount, table, threshold, values, VALUES |
Constructor Summary |
Configuration(java.lang.String prefix)
Creates a Configuration object. |
Configuration(java.lang.String prefix,
java.io.InputStream is)
Creates a Configuration object with the specified prefix and stream. |
Configuration(java.lang.String prefix,
java.util.Properties props)
Creates a Configuration object based on a Properties object. |
Configuration(java.lang.String prefix,
java.util.ResourceBundle bundle)
Creates a Configuration object based on a ResourceBundle. |
Configuration(java.lang.String prefix,
java.lang.String file)
Creates a Configuration object with the specified prefix and file. |
Method Summary |
void |
checkConfig(java.lang.String[] props)
Checks that the properties defined in props[] are defined. |
void |
override(java.lang.String prefix)
Copies matching system properties to the current object. |
Methods inherited from class java.util.Properties |
, continueLine, enumerate, getProperty, getProperty, list, list, load, loadConvert, propertyNames, save, saveConvert, setProperty, store, toHex, writeln |
Methods inherited from class java.util.Hashtable |
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, getEnumeration, getIterator, hashCode, isEmpty, keys, keySet, put, putAll, readObject, rehash, remove, size, toString, values, writeObject |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait |
Configuration
public Configuration(java.lang.String prefix)
throws java.io.IOException
- Creates a Configuration object.
The prefix
argument specifies a string prefix which
is used for filtering appropriate system properties. If the system
property prefix.properties
is set, the value of this
property is used as a path to a property file which is then
subsequently loaded.
Then, any system properties which fulfill the prefix definition are
copied into the Configuration object, effectively overriding the ones
specified in the file.
Configuration
public Configuration(java.lang.String prefix,
java.io.InputStream is)
throws java.io.IOException
- Creates a Configuration object with the specified prefix and stream.
Configuration
public Configuration(java.lang.String prefix,
java.lang.String file)
throws java.io.IOException
- Creates a Configuration object with the specified prefix and file.
Configuration
public Configuration(java.lang.String prefix,
java.util.Properties props)
throws java.io.IOException
- Creates a Configuration object based on a Properties object.
Configuration
public Configuration(java.lang.String prefix,
java.util.ResourceBundle bundle)
throws java.io.IOException
- Creates a Configuration object based on a ResourceBundle.
override
public void override(java.lang.String prefix)
throws java.io.IOException
- Copies matching system properties to the current object.
checkConfig
public void checkConfig(java.lang.String[] props)
- Checks that the properties defined in
props[]
are defined.