|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.jconfig.ConfigurationManager
This class manages all configurations. This is the main entry point.
You can get the configurations from the ConfigurationManager.
The simple way is:
public static final Configuration config = ConfigurationManager.getConfiguration();
or:
public static final Configuration config = ConfigurationManager.getConfiguration("myconfig");
If you use the getConfiguration() the ConfigurationManager will return the configuration
with the name "default". If there is no configuration wit the given name then
the ConfigurationManager will use the InputStreamHandler and will try to read the
file "config.xml". This file has to be in the classpath.
Method Summary | |
void |
addFileListener(java.lang.String configName,
FileListener fl)
|
static Configuration |
getConfiguration()
This method returns the configuration with the name "default". |
static Configuration |
getConfiguration(java.lang.String name)
This method returns the configuration for the specific name. |
ConfigurationHandler |
getConfigurationHandler(java.lang.String name)
Returns the handler used during the creation of the Configuration. |
java.lang.String[] |
getConfigurationNames()
This method will return all configurations names |
static ConfigurationManager |
getInstance()
This method returns the one and only instance of the ConfigurationManager. |
void |
load(ConfigurationHandler configurationHandler,
java.lang.String configurationName)
This method will load a configuration with the specific ConfigurationHandler and store it in the internal map with the given name. |
void |
reload(java.lang.String name)
This method will reload a configuration with the same handler that was used for the initially loading. |
void |
removeConfiguration(java.lang.String configName)
This method removes a configuration from the ConfigurationManager |
void |
save(ConfigurationHandler handler,
Configuration config)
This method will save a configuration using the defined ConfigurationHandler. |
void |
save(java.lang.String configName)
This method will store the configuration for the given name using the associated handler that was used when the configuration was loaded. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static ConfigurationManager getInstance()
public static Configuration getConfiguration()
public static Configuration getConfiguration(java.lang.String name)
name
- the name of the configurationpublic void load(ConfigurationHandler configurationHandler, java.lang.String configurationName) throws ConfigurationManagerException
configHandler
- an implementation of the ConfigurationHandlerconfigurationName
- the name of the configurationpublic void save(java.lang.String configName) throws ConfigurationManagerException
configName
- the name of the configurationConfigurationManagerException
- public void addFileListener(java.lang.String configName, FileListener fl)
public void save(ConfigurationHandler handler, Configuration config) throws ConfigurationManagerException
handler
- the ConfigurationHandler that will be used to store the configurationconfig
- the configuration to storeConfigurationManagerException
- public void removeConfiguration(java.lang.String configName)
configName
- the name of the configurationpublic void reload(java.lang.String name) throws ConfigurationManagerException
name
- name of the configurationpublic ConfigurationHandler getConfigurationHandler(java.lang.String name)
name
- public java.lang.String[] getConfigurationNames()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |