Class StandardConfigHandler
java.lang.Object
rs.edu.raf.dsw.rudok.app.observer.IObserver
rs.edu.raf.dsw.rudok.app.observer.IPublisherGlobal
rs.edu.raf.dsw.rudok.app.observer.IPublisher
rs.edu.raf.dsw.rudok.app.confighandler.standard.StandardConfigHandler
- All Implemented Interfaces:
IConfigHandler
public class StandardConfigHandler extends IPublisher implements IConfigHandler
Standard config handler
Standard (default) implementation of the IConfigHandler component.-
Nested Class Summary
Nested classes/interfaces inherited from interface rs.edu.raf.dsw.rudok.app.confighandler.IConfigHandler
IConfigHandler.Message
-
Constructor Summary
Constructors Constructor Description StandardConfigHandler(ApplicationFramework applicationFramework)
-
Method Summary
Modifier and Type Method Description void
createConfig(String name)
Sets up a new configuration in program and in memory.Object
get(String key)
Returns the configuration value for the given key.Object
get(String key, Object defaultValue)
Returns the configuration value for the given key, or default value if key not set.boolean
loadConfig(String name)
Loads the configuration file from the given URI.void
resetConfig()
Loads the default config.void
saveConfig()
Saves the current configuration.void
set(String key, String val)
Sets the configuration value for the given key.Methods inherited from class rs.edu.raf.dsw.rudok.app.observer.IPublisher
addObserver, getObservers, publish, removeObserver, setObservers
Methods inherited from class rs.edu.raf.dsw.rudok.app.observer.IPublisherGlobal
addObserverGlobal, getObserversGlobal, removeObserverGlobal
Methods inherited from class rs.edu.raf.dsw.rudok.app.observer.IObserver
addPublisher, getPublishers, receive, removePublisher, setPublishers
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface rs.edu.raf.dsw.rudok.app.confighandler.IConfigHandler
getOrDefault, loadConfig
-
Constructor Details
-
StandardConfigHandler
-
-
Method Details
-
loadConfig
Description copied from interface:IConfigHandler
Loads the configuration file from the given URI. Returns true if successful, false otherwise.- Specified by:
loadConfig
in interfaceIConfigHandler
- Parameters:
name
- Config name.- Returns:
- True if loaded, false otherwise.
-
resetConfig
public void resetConfig()Description copied from interface:IConfigHandler
Loads the default config.- Specified by:
resetConfig
in interfaceIConfigHandler
-
saveConfig
public void saveConfig()Description copied from interface:IConfigHandler
Saves the current configuration.- Specified by:
saveConfig
in interfaceIConfigHandler
-
set
Description copied from interface:IConfigHandler
Sets the configuration value for the given key.- Specified by:
set
in interfaceIConfigHandler
- Parameters:
key
- Config key.val
- Value to set.
-
get
Description copied from interface:IConfigHandler
Returns the configuration value for the given key.- Specified by:
get
in interfaceIConfigHandler
- Parameters:
key
- Config key.- Returns:
- Value if set, otherwise null.
-
get
Description copied from interface:IConfigHandler
Returns the configuration value for the given key, or default value if key not set.- Specified by:
get
in interfaceIConfigHandler
- Parameters:
key
- Config key.defaultValue
- Default value to return if config key not set.- Returns:
- Value if set, otherwise defaultValue.
-
createConfig
Description copied from interface:IConfigHandler
Sets up a new configuration in program and in memory.- Specified by:
createConfig
in interfaceIConfigHandler
- Parameters:
name
- New configuration name.
-