Class ConfigService
java.lang.Object
com.kosdev.kos.commons.core.service.config.ConfigService
System service that manages all configuration data and can apply configuration data
on top of any ConfigAware object.
As of api version 10, most api's have been duplicated to add support for a src
parameter. This value will be included in log output and allows developers to determine
who is changing config values by simply reading the logs. The original methods have
been marked deprecated in order to encourage the use of the src parameter while will
maintaining backwards binary compatibility.
- Since:
- 1
- Version:
- 10
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidaddOptionsType(String type, Class<? extends ConfigOptions> clazz) Register an options type for converting options json to options beans.configureBean(Object bean, String path, String tracker) Deprecated.Consider version with src parameter for improved loggingconfigureBean(Object bean, String path, String src, String tracker) Configure an arbitrary bean using the settings associated with the specified handle path and tag the results with the specified tracker.configureConfigAware(ConfigAware<?> bean, String tracker) Deprecated.Consider version with src parameter for improved loggingconfigureConfigAware(ConfigAware<?> bean, String src, String tracker) Configure a ConfigAware bean and tag the results with the specified tracker.configureConfigAware(Collection<ConfigAware<?>> beans, String tracker) Deprecated.Consider version with src parameter for improved loggingconfigureConfigAware(Collection<ConfigAware<?>> beans, String src, String tracker) Configure a collection of ConfigAware beans and tag the results with the specified tracker.configurePath(String path, String tracker) Deprecated.Consider version with src parameter for improved loggingconfigurePath(String path, String src, String tracker) Configure a ConfigAware bean identified by the specified handle path and tag the results with the specified tracker.configurePath(Collection<String> paths, String tracker) Deprecated.Consider version with src parameter for improved loggingconfigurePath(Collection<String> paths, String src, String tracker) Configure the list of ConfigAware bean identified by the specified handle paths and tag the results with the specified tracker.configureUnconfigured(String tracker) Deprecated.Consider version with src parameter for improved loggingconfigureUnconfigured(String src, String tracker) Configure any ConfigAware bean that has not yet been configured.getConfigValueForScopedPath(String scopedPath, String attr) Return the config value of an attribute from the scope implied by the path.getDefaultsForScopedPath(String scopedPath) Return the default values for the specified scoped path.getMergedConfigForPath(String path) Return the config data for the specified handle path.getMergedConfigValueForScopedPath(String scopedPath, String attr) Return the merged config value of an attribute starting at the scope implied within the path.Get theDefaultConfigSourcefor the local node scope.getOverridesForScopedPath(String scopedPath) Return the overrides for the specified scoped path.update(BeanUpdate beanUpdate, String tracker) Deprecated.Consider version with src parameter for improved loggingupdate(BeanUpdate beanUpdate, String src, String tracker) Update the ConfigAware bean referenced by the handle path in the updates with the values in the updates object.update(ConfigAware<?> bean, String attr, Object val, String tracker) Deprecated.Consider version with src parameter for improved loggingUpdate the specified attribute of the config for the specified bean to the specified value.Deprecated.Consider version with src parameter for improved loggingUpdate the attributes of the config for the specified bean to the values specified in the map.update(Collection<BeanUpdate> beanUpdates, String tracker) Deprecated.Consider version with src parameter for improved loggingupdate(Collection<BeanUpdate> beanUpdates, String src, String tracker) Update all the beans identified by the list of updates.
-
Field Details
-
SCOPE_SEPARATOR
- See Also:
-
REVERT_VALUE
- See Also:
-
-
Method Details
-
getNodeLocalSource
Get theDefaultConfigSourcefor the local node scope. This allows sources private to the node to be installed.- Since:
- 1
-
configureUnconfigured
Deprecated.Consider version with src parameter for improved loggingConfigure any ConfigAware bean that has not yet been configured.- Parameters:
tracker- optional tracker to tag the changes- Returns:
- the changes made
- Since:
- 1
-
configureUnconfigured
Configure any ConfigAware bean that has not yet been configured. This includes an optional src which will be used to label the log entries.- Parameters:
src- the source of the change, included in logstracker- optional tracker to tag the changes- Returns:
- the changes made
- Since:
- 10
-
configurePath
Deprecated.Consider version with src parameter for improved loggingConfigure a ConfigAware bean identified by the specified handle path and tag the results with the specified tracker.- Parameters:
path- handle path of the bean to configuretracker- optional tracker to tag the changes- Returns:
- the changes made
- Since:
- 1
-
configurePath
Configure a ConfigAware bean identified by the specified handle path and tag the results with the specified tracker.- Parameters:
path- handle path of the bean to configuresrc- the source of the change, included in logstracker- optional tracker to tag the changes- Returns:
- the changes made
- Since:
- 10
-
configurePath
Deprecated.Consider version with src parameter for improved loggingConfigure the list of ConfigAware bean identified by the specified handle paths and tag the results with the specified tracker.- Parameters:
paths- handle paths of the beans to configuretracker- optional tracker to tag the changes- Returns:
- the changes made
- Since:
- 1
-
configurePath
Configure the list of ConfigAware bean identified by the specified handle paths and tag the results with the specified tracker.- Parameters:
paths- handle paths of the beans to configuresrc- the source of the change, included in logstracker- optional tracker to tag the changes- Returns:
- the changes made
- Since:
- 10
-
configureConfigAware
Deprecated.Consider version with src parameter for improved loggingConfigure a ConfigAware bean and tag the results with the specified tracker.- Parameters:
bean- the bean to configuretracker- optional tracker to tag the changes- Returns:
- the changes made
- Since:
- 1
-
configureConfigAware
Configure a ConfigAware bean and tag the results with the specified tracker.- Parameters:
bean- the bean to configuresrc- the source of the change, included in logstracker- optional tracker to tag the changes- Returns:
- the changes made
- Since:
- 10
-
configureConfigAware
@Deprecated public ConfigChanges configureConfigAware(Collection<ConfigAware<?>> beans, String tracker) Deprecated.Consider version with src parameter for improved loggingConfigure a collection of ConfigAware beans and tag the results with the specified tracker.- Parameters:
beans- the beans to configuretracker- optional tracker to tag the changes- Returns:
- the changes made
- Since:
- 1
-
configureConfigAware
public ConfigChanges configureConfigAware(Collection<ConfigAware<?>> beans, String src, String tracker) Configure a collection of ConfigAware beans and tag the results with the specified tracker.- Parameters:
beans- the beans to configuresrc- the source of the change, included in logstracker- optional tracker to tag the changes- Returns:
- the changes made
- Since:
- 10
-
configureBean
Deprecated.Consider version with src parameter for improved loggingConfigure an arbitrary bean using the settings associated with the specified handle path and tag the results with the specified tracker.- Parameters:
bean- bean to configurepath- handle path to use for settingstracker- optional tracker to tag the changes- Returns:
- the changes made
- Since:
- 1
-
configureBean
Configure an arbitrary bean using the settings associated with the specified handle path and tag the results with the specified tracker.- Parameters:
bean- bean to configurepath- handle path to use for settingssrc- the source of the change, included in logstracker- optional tracker to tag the changes- Returns:
- the changes made
- Since:
- 10
-
update
@Deprecated public ConfigChanges update(ConfigAware<?> bean, String attr, Object val, String tracker) Deprecated.Consider version with src parameter for improved loggingUpdate the specified attribute of the config for the specified bean to the specified value.- Parameters:
bean- the bean to get the config fromattr- the config attribute to updateval- the new value (converted to simple type)tracker- optional tracker to put in the changes- Returns:
- the changes applied to the config
- Since:
- 1
-
update
public ConfigChanges update(ConfigAware<?> bean, String attr, Object val, String src, String tracker) Update the specified attribute of the config for the specified bean to the specified value.- Parameters:
bean- the bean to get the config fromattr- the config attribute to updateval- the new value (converted to simple type)src- source of the change, included in logstracker- optional tracker to put in the changes- Returns:
- the changes applied to the config
- Since:
- 10
-
update
@Deprecated public ConfigChanges update(ConfigAware<?> bean, Map<String, Object> attrs, String tracker) Deprecated.Consider version with src parameter for improved loggingUpdate the attributes of the config for the specified bean to the values specified in the map.- Parameters:
bean- the bean to get the config fromattrs- the attribute names / values to updatetracker- optional tracker to put in the changes- Returns:
- the changes applied to the config
- Since:
- 1
-
update
public ConfigChanges update(ConfigAware<?> bean, Map<String, Object> attrs, String src, String tracker) Update the attributes of the config for the specified bean to the values specified in the map.- Parameters:
bean- the bean to get the config fromattrs- the attribute names / values to updatesrc- source of the change, included in logstracker- optional tracker to put in the changes- Returns:
- the changes applied to the config
- Since:
- 10
-
update
Deprecated.Consider version with src parameter for improved loggingUpdate the ConfigAware bean referenced by the handle path in the updates with the values in the updates object.- Parameters:
beanUpdate- identifies the handle path and contains the attributes / valuestracker- optional tracker to put in the changes- Returns:
- the changes applied to the config
- Since:
- 1
-
update
Update the ConfigAware bean referenced by the handle path in the updates with the values in the updates object.- Parameters:
beanUpdate- identifies the handle path and contains the attributes / valuessrc- source of the change, included in logstracker- optional tracker to put in the changes- Returns:
- the changes applied to the config
- Since:
- 10
-
update
Deprecated.Consider version with src parameter for improved loggingUpdate all the beans identified by the list of updates.- Parameters:
beanUpdates- the list of beans to update along with attributes / values per beantracker- optional tracker to put in the changes- Returns:
- the changes applied to the configs
- Since:
- 1
-
update
Update all the beans identified by the list of updates.- Parameters:
beanUpdates- the list of beans to update along with attributes / values per beansrc- source of the changes, included in logstracker- optional tracker to put in the changes- Returns:
- the changes applied to the configs
- Since:
- 10
-
getMergedConfigForPath
Return the config data for the specified handle path. This will start with the defaults and then apply the overrides on top.- Parameters:
path- the handle path to return config data for- Returns:
- the config data
- Since:
- 1
-
getOverridesForScopedPath
Return the overrides for the specified scoped path. On the primary node this can return data for scopes on other nodes.- Parameters:
scopedPath- the scoped path to return overrides for- Returns:
- the overrides
- Since:
- 1
-
getDefaultsForScopedPath
Return the default values for the specified scoped path. On the primary node this can return data for scopes on other nodes.- Parameters:
scopedPath- the scoped path to return defaults for- Returns:
- the default values
- Since:
- 1
-
getMergedConfigValueForScopedPath
Return the merged config value of an attribute starting at the scope implied within the path. This will apply all scope override rules to return a single effective value. If specifying a nodeType or global scope, no config bean defaults will be applied as config bean defaults are specific to a particular nodeId scope.- Parameters:
scopedPath- the scope and path of the configattr- the attribute of the config- Since:
- 1
-
getConfigValueForScopedPath
Return the config value of an attribute from the scope implied by the path. This will only examine values in the scope (defaults + overrides) and will not reflect data from any other scope.- Parameters:
scopedPath- the scope and path of the configattr- the attribute of the config- Since:
- 1
-
addOptionsType
Register an options type for converting options json to options beans.- Parameters:
type- options typeclazz- options class- Since:
- 1
-