Package org.n52.faroe
Class SettingsServiceImpl
java.lang.Object
org.n52.faroe.SettingsServiceImpl
- All Implemented Interfaces:
SettingsService
Class to handle the settings and configuration of the service. Allows other classes to change, delete, and
declare settings and to create, modify and delete administrator users. Classes can subscribe to specific
settings using the
Configurable and Setting annotations. To be recognized by the
SettingsManager configure(java.lang.Object) has to be called for every object that wants to
receive settings. All other classes have to call configure(java.lang.Object) manually.- Since:
- 1.0.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSetting(SettingDefinition<?> definition) voidaddSettings(Collection<SettingDefinition<?>> definitions) voidchangeSetting(SettingValue<?> newValue) Changes a setting.voidConfigureowith the required settings.voidconfigureOnce(Object object) Configureowith the required settings.voidDeletes all settings and users.voiddeleteSetting(SettingDefinition<?> setting) Deletes the setting defined bysetting.getDefinitionByKey(String key) Get the definition that is defined with the specified key.getKeys()<T> SettingValue<T> getSetting(String key) Gets the value of the setting defined bykey.<T> SettingValue<T> getSetting(SettingDefinition<T> key) Gets the value of the setting defined bykey.Set<SettingDefinition<?>> Gets allSettingDefinitions known by this class.Map<SettingDefinition<?>, SettingValue<?>> Gets all values for all definitions.voidGets all values for all definitions and udpates (changes or configures) all configured objets.voidsetServiceEventBus(EventBus serviceEventBus) voidvoidsetSettingsManagerDao(SettingsDao settingsManagerDao) voidsetSettingValueFactory(SettingValueFactory settingValueFactory)
-
Constructor Details
-
SettingsServiceImpl
public SettingsServiceImpl()
-
-
Method Details
-
setServiceEventBus
-
setSettingValueFactory
-
setSettingsManagerDao
-
setSettingDefinitions
-
addSetting
- Specified by:
addSettingin interfaceSettingsService
-
addSettings
- Specified by:
addSettingsin interfaceSettingsService
-
getSettingDefinitions
Gets allSettingDefinitions known by this class.- Specified by:
getSettingDefinitionsin interfaceSettingsService- Returns:
- the definitions
-
configureOnce
Description copied from interface:SettingsServiceConfigureowith the required settings. Future changes to settings will not be propagated to the object.- Specified by:
configureOncein interfaceSettingsService- Parameters:
object- the object to configure- Throws:
ConfigurationError- if there is a problem configuring the object- See Also:
-
configure
Configureowith the required settings. All changes to a setting required by the object will be applied.- Specified by:
configurein interfaceSettingsService- Parameters:
object- the object to configure- Throws:
ConfigurationError- if there is a problem configuring the object- See Also:
-
getDefinitionByKey
Get the definition that is defined with the specified key.- Specified by:
getDefinitionByKeyin interfaceSettingsService- Parameters:
key- the key- Returns:
- the definition or
nullif there is no definition for the key
-
getSetting
Gets the value of the setting defined bykey.- Specified by:
getSettingin interfaceSettingsService- Type Parameters:
T- the type of the setting and value- Parameters:
key- the definition of the setting- Returns:
- the value of the setting
-
getSetting
Gets the value of the setting defined bykey.- Specified by:
getSettingin interfaceSettingsService- Type Parameters:
T- the type of the setting and value- Parameters:
key- the id of the setting- Returns:
- the value of the setting
-
getSettings
Gets all values for all definitions. If there is no value for a definitionnullis added to the map.- Specified by:
getSettingsin interfaceSettingsService- Returns:
- all values by definition
-
deleteSetting
Deletes the setting defined bysetting.- Specified by:
deleteSettingin interfaceSettingsService- Parameters:
setting- the definition- Throws:
ConfigurationError- if there is a problem deleting the setting
-
getKeys
- Specified by:
getKeysin interfaceSettingsService- Returns:
- the keys for all definitions
-
changeSetting
Changes a setting. The change is propagated to all Objects that are configured. If the change fails for one of these objects, the setting is reverted to the old value of the setting for all objects.- Specified by:
changeSettingin interfaceSettingsService- Parameters:
newValue- the new value of the setting- Throws:
ConfigurationError- if there is a problem changing the setting.
-
getSettingFactory
- Specified by:
getSettingFactoryin interfaceSettingsService- Returns:
- the
SettingValueFactoryto produce values
-
deleteAll
public void deleteAll()Deletes all settings and users.- Specified by:
deleteAllin interfaceSettingsService
-
reconfigure
public void reconfigure()Description copied from interface:SettingsServiceGets all values for all definitions and udpates (changes or configures) all configured objets.- Specified by:
reconfigurein interfaceSettingsService
-