Class DefaultAlertManager
- All Implemented Interfaces:
AdminAware,AlertManager,InternalAlertManager
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(AlertConfiguration... configurations) Define an alert configuration for a 'bulk' of configurations.voiddisableAlert(Class<? extends AlertConfiguration> clazz) Disables a previously enabled alert.voidenableAlert(Class<? extends AlertConfiguration> clazz) Enable a previously set alert configuration.getAdmin()Returns theAdminassociated with this element.getAlertStatusByGroupId(String groupUid) <T extends AlertConfiguration>
TGet the currently set alert configuration.booleanisAlertEnabled(Class<? extends AlertConfiguration> clazz) booleanremoveConfig(Class<? extends AlertConfiguration> clazz) Removes a previously set alert configuration.voidsetConfig(AlertConfiguration config) Defines an alert configuration.voidtriggerAlert(Alert alert) Trigger an alert event for registered alert event listeners.
-
Constructor Details
-
DefaultAlertManager
-
-
Method Details
-
getAlertRepository
- Specified by:
getAlertRepositoryin interfaceInternalAlertManager
-
getAlertTriggered
- Specified by:
getAlertTriggeredin interfaceAlertManager- Returns:
- the alert event manager to register/unregister for alert events.
-
getAlertStatusByGroupId
- Specified by:
getAlertStatusByGroupIdin interfaceAlertManager- Parameters:
groupUid- The group unique identifier- Returns:
- the status of the alerts in this group
-
triggerAlert
Description copied from interface:AlertManagerTrigger an alert event for registered alert event listeners.- Specified by:
triggerAlertin interfaceAlertManager- Parameters:
alert- an alert.
-
getAdmin
Description copied from interface:AdminAwareReturns theAdminassociated with this element.- Specified by:
getAdminin interfaceAdminAware
-
getBeanConfigPropertiesManager
- Specified by:
getBeanConfigPropertiesManagerin interfaceInternalAlertManager- Returns:
- the weakly typed configuration API.
-
disableAlert
public void disableAlert(Class<? extends AlertConfiguration> clazz) throws AlertConfigurationException Description copied from interface:AlertManagerDisables a previously enabled alert. The configuration remains, but alerts will no longer be triggered. The alert can be enabled at a later time, based on previously set configuration.If the alert is already disabled, the request is silently ignored.
- Specified by:
disableAlertin interfaceAlertManager- Parameters:
clazz- the class of the alert configuration- Throws:
AlertConfigurationException- if the alert configuration was not previously set.
-
enableAlert
public void enableAlert(Class<? extends AlertConfiguration> clazz) throws AlertConfigurationException Description copied from interface:AlertManagerEnable a previously set alert configuration. From this point, alerts will be triggered.If the alert is already enabled, the request is silently ignored.
- Specified by:
enableAlertin interfaceAlertManager- Parameters:
clazz- the class of the alert configuration- Throws:
AlertConfigurationException- if the alert can't be enabled for any of the following reasons:- if the configuration was not previously set.
- in the event of misconfiguration (such as failure to set an essential property).
- if initialization fails.
-
getConfig
public <T extends AlertConfiguration> T getConfig(Class<T> clazz) throws AlertConfigurationException Description copied from interface:AlertManagerGet the currently set alert configuration.- Specified by:
getConfigin interfaceAlertManager- Parameters:
clazz- the class of the alert configuration- Returns:
- The alert configuration implementation object set with the configuration properties.
- Throws:
AlertConfigurationException- if the alert configuration was not previously set.
-
removeConfig
public boolean removeConfig(Class<? extends AlertConfiguration> clazz) throws AlertConfigurationException Description copied from interface:AlertManagerRemoves a previously set alert configuration.An exception is raised if the alert is currently enabled. Disable the alert prior to this call.
- Specified by:
removeConfigin interfaceAlertManager- Parameters:
clazz- the class of the alert configuration- Returns:
trueif removed ,falseif it did not exist in the first place.- Throws:
AlertConfigurationException- if the alert configuration can't be removed for any of the following reasons:- if the alert is currently enabled (need to disable it first).
- if the configuration was not previously set
-
setConfig
Description copied from interface:AlertManagerDefines an alert configuration. Overrides all previously set properties for this alert.The
AlertConfiguration.isEnabled()is ignored. To enable, callAlertManager.enableAlert(Class). To perform both operations in a single call, useAlertManager.configure(AlertConfiguration[]).An exception is raised if the alert is already enabled.
- Specified by:
setConfigin interfaceAlertManager- Parameters:
config- the alert configuration- Throws:
AlertConfigurationException- if the alert is already enabled (need to disable it first).
-
isAlertEnabled
- Specified by:
isAlertEnabledin interfaceAlertManager- Parameters:
clazz- the class of the alert configuration- Returns:
trueif the alert is already enabled,falseif the alert is disabled or if it's configuration was not found.
-
configure
Description copied from interface:AlertManagerDefine an alert configuration for a 'bulk' of configurations. Overrides all previously set properties for any of the alerts.See the
XmlAlertConfigurationParserwhich can be used to parse the default alerts.xml configuration file located under config/alerts.If
AlertConfiguration.isEnabled()returnstrueit is equivalent to calling (for a predefined alert)AlertManager.disableAlert(Class), followed byAlertManager.setConfig(AlertConfiguration)followed byAlertManager.enableAlert(Class).If it returns
falseit is equivalent to calling (for a predefined alert)AlertManager.disableAlert(Class)followed byAlertManager.setConfig(AlertConfiguration).if an alert configuration was not previously set, the current setting will be used.
- Specified by:
configurein interfaceAlertManager- Parameters:
configurations- the alert configurations (as varargs).- Throws:
AlertConfigurationException- if the alert is already enabled (need to disable it first).- See Also:
-