Class AbstractCmJaxbConfigDao<E>
- java.lang.Object
-
- org.opennms.features.config.service.impl.AbstractCmJaxbConfigDao<E>
-
- Type Parameters:
E
- Configuration class
- All Implemented Interfaces:
CmJaxbConfigDao
- Direct Known Subclasses:
DefaultProvisiondConfigurationDao
public abstract class AbstractCmJaxbConfigDao<E> extends Object implements CmJaxbConfigDao
Abstract AbstractCmJaxbConfigDao class.
- Version:
- $Id: $
-
-
Field Summary
Fields Modifier and Type Field Description protected ConfigurationManagerService
configurationManagerService
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractCmJaxbConfigDao(Class<E> entityClass, String description)
Constructor for AbstractJaxbConfigDao.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addOnReloadedCallback(String configId, java.util.function.Consumer<ConfigUpdateInfo> callback)
void
addValidationCallback(java.util.function.Consumer<ConfigUpdateInfo> callback)
E
getConfig(String configId)
It will the config in cache, if nothing found it will load from db.String
getDescription()
getDescriptionE
loadConfig()
It will load the default configE
loadConfig(String configId)
loadConfig from database by CM.void
postConstruct()
Add default callbackvoid
updateConfig(E config)
void
updateConfig(String configJsonStr)
it will update the default configvoid
updateConfig(String configId, E config)
Update config with configIdvoid
updateConfig(String configId, String jsonConfigString)
It is expected to have json String inputvoid
updateConfig(String configId, String jsonConfigString, boolean isReplace)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opennms.features.config.service.api.CmJaxbConfigDao
getConfigName, getDefaultConfigId, getUpdateCallback, getValidationCallback
-
-
-
-
Field Detail
-
configurationManagerService
@Autowired protected ConfigurationManagerService configurationManagerService
-
-
Method Detail
-
postConstruct
@PostConstruct public void postConstruct()
Add default callback
-
loadConfig
public E loadConfig()
Description copied from interface:CmJaxbConfigDao
It will load the default config- Specified by:
loadConfig
in interfaceCmJaxbConfigDao<E>
- Returns:
- ConfigObject
-
loadConfig
public E loadConfig(String configId)
loadConfig from database by CM. If it is already in cache, it will update the cache.- Specified by:
loadConfig
in interfaceCmJaxbConfigDao<E>
- Parameters:
configId
-- Returns:
- ConfigObject
-
getConfig
public E getConfig(String configId)
Description copied from interface:CmJaxbConfigDao
It will the config in cache, if nothing found it will load from db. Please notice that, config can be different in db.- Specified by:
getConfig
in interfaceCmJaxbConfigDao<E>
- Returns:
- config
-
updateConfig
public void updateConfig(String configId, E config) throws ValidationException
Update config with configId- Parameters:
configId
-config
-- Throws:
ValidationException
-
updateConfig
public void updateConfig(String configId, String jsonConfigString) throws ValidationException
It is expected to have json String input- Parameters:
configId
-jsonConfigString
-- Throws:
ValidationException
-
updateConfig
public void updateConfig(String configId, String jsonConfigString, boolean isReplace) throws ValidationException
- Specified by:
updateConfig
in interfaceCmJaxbConfigDao<E>
- Throws:
ValidationException
-
updateConfig
public void updateConfig(String configJsonStr) throws ValidationException
it will update the default config- Parameters:
configJsonStr
-- Throws:
ValidationException
- See Also:
updateConfig(String, String)
-
updateConfig
public void updateConfig(E config) throws ValidationException
- Throws:
ValidationException
-
addOnReloadedCallback
public void addOnReloadedCallback(String configId, java.util.function.Consumer<ConfigUpdateInfo> callback)
- Parameters:
callback
- a callback that will be called when the entity maintained by this DAO is reloaded
-
addValidationCallback
public void addValidationCallback(java.util.function.Consumer<ConfigUpdateInfo> callback)
-
-