|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.jameleon.util.Configurator
public class Configurator
Field Summary | |
---|---|
protected String |
configName
|
static String |
DEFAULT_CONFIG_NAME
|
protected Properties |
props
|
protected static boolean |
warningMsgGiven
|
Method Summary | |
---|---|
static void |
clearInstance()
Cleans everything up and sets the current instance to null |
protected void |
configure()
Set everything up by reading the configuration file. |
String |
getConfigName()
Gets the name of the configuration file. |
protected InputStream |
getInputStream(String fileName)
|
static Configurator |
getInstance()
Gets an instance Configurator if one has already been created or creates a new one if not. |
Set |
getKeys()
|
Set |
getKeysStartingWith(String prefix)
|
Properties |
getProperties()
|
String |
getValue(String key)
Gets a value from the provided configuration file. |
String |
getValue(String key,
String defaultValue)
Gets a value from the provided configuration file or if it's not set, then set it's default value |
String[] |
getValueAsArray(String key)
Gets a value from the provided configuration file as an array. |
String[] |
getValueAsArray(String key,
String separator)
Gets a value from the provided configuration file as an array. |
void |
setConfigName(String configName)
Sets the name of the configuration file. |
void |
setValue(String key,
String value)
Sets a value of a given property |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_CONFIG_NAME
protected String configName
protected static boolean warningMsgGiven
protected Properties props
Method Detail |
---|
public static Configurator getInstance()
public Set getKeys()
public Properties getProperties()
public Set getKeysStartingWith(String prefix)
public String getValue(String key, String defaultValue)
key
- - the name of the variable in the configuration file.defaultValue
- - the default value to set if the variable is not set in the configuration file.
public String getValue(String key)
key
- - the name of the variable in the configuration file.
public String[] getValueAsArray(String key)
public String[] getValueAsArray(String key, String separator)
public void setValue(String key, String value)
key
- - the name of the variable to setvalue
- - the value to the variable to.protected void configure()
getValue(java.lang.String, java.lang.String)
and is only executed if things aren't already set up.
In other words, once a file has been read in, this method will no longer do
anything. To read in a new file, call clearInstance()
first.
protected InputStream getInputStream(String fileName) throws IOException
IOException
public void setConfigName(String configName)
configName
- - the name and path of the config file. The default location is from where the JVM was started from.public String getConfigName()
public static void clearInstance()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |