public interface AlertManager extends AdminAware
The alert manager provides two options for configuration of alert configurations - as bulk or one
by one. The AlertConfiguration is the main interface of an alert configuration - a
configuration based on String key-value property pairs.
To configure with a bulk of alert configurations, the configure(AlertConfiguration[])
method can be used. These configurations can be extracted from a resource using an
AlertConfigurationParser. The parser AlertConfigurationParser.parse() returns an
array of AlertConfiguration. The XmlAlertConfigurationParser can be used to parse
the alerts.xml configuration file located under config/alerts.
To Register/Unregister for alert events (of all types), use the AlertTriggeredEventManager to
add/remove AlertTriggeredEventListeners.
The triggerAlert(Alert) method call allows alert triggers to 'fire' an alert and
trigger an event to be sent to all registered alert event listeners.
| Modifier and Type | Method and Description |
|---|---|
void |
configure(AlertConfiguration... configurations)
Define an alert configuration for a 'bulk' of configurations.
|
void |
disableAlert(Class<? extends AlertConfiguration> clazz)
Disables a previously enabled alert.
|
void |
enableAlert(Class<? extends AlertConfiguration> clazz)
Enable a previously set alert configuration.
|
AlertTriggeredEventManager |
getAlertTriggered() |
<T extends AlertConfiguration> |
getConfig(Class<T> clazz)
Get the currently set alert configuration.
|
boolean |
isAlertEnabled(Class<? extends AlertConfiguration> clazz) |
boolean |
removeConfig(Class<? extends AlertConfiguration> clazz)
Removes a previously set alert configuration.
|
void |
setConfig(AlertConfiguration config)
Defines an alert configuration.
|
void |
triggerAlert(Alert alert)
Trigger an alert event for registered alert event listeners.
|
getAdminvoid configure(AlertConfiguration... configurations) throws AlertConfigurationException
See the XmlAlertConfigurationParser which can be used to parse the default
alerts.xml configuration file located under config/alerts.
If AlertConfiguration.isEnabled() returns true it is equivalent to
calling (for a predefined alert) disableAlert(Class), followed by
setConfig(AlertConfiguration) followed by enableAlert(Class).
If it returns false it is equivalent to calling (for a predefined alert)
disableAlert(Class) followed by setConfig(AlertConfiguration).
if an alert configuration was not previously set, the current setting will be used.
configurations - the alert configurations (as varargs).AlertConfigurationException - if the alert is already enabled (need to disable it first).AlertConfigurationParservoid setConfig(AlertConfiguration config) throws AlertConfigurationException
The AlertConfiguration.isEnabled() is ignored. To enable, call enableAlert(Class).
To perform both operations in a single call, use configure(AlertConfiguration[]).
An exception is raised if the alert is already enabled.
config - the alert configurationAlertConfigurationException - if the alert is already enabled (need to disable it first).void enableAlert(Class<? extends AlertConfiguration> clazz) throws AlertConfigurationException
If the alert is already enabled, the request is silently ignored.
clazz - the class of the alert configurationAlertConfigurationException - if the alert can't be enabled for any of the following reasons:
void disableAlert(Class<? extends AlertConfiguration> clazz) throws AlertConfigurationException
If the alert is already disabled, the request is silently ignored.
clazz - the class of the alert configurationAlertConfigurationException - if the alert configuration was not previously set.boolean isAlertEnabled(Class<? extends AlertConfiguration> clazz)
clazz - the class of the alert configurationtrue if the alert is already enabled, false if the alert is
disabled or if it's configuration was not found.boolean removeConfig(Class<? extends AlertConfiguration> clazz) throws AlertConfigurationException
An exception is raised if the alert is currently enabled. Disable the alert prior to this call.
clazz - the class of the alert configurationtrue if removed ,false if it did not exist in the first
place.AlertConfigurationException - if the alert configuration can't be removed for any of the following reasons:
<T extends AlertConfiguration> T getConfig(Class<T> clazz) throws AlertConfigurationException
clazz - the class of the alert configurationAlertConfigurationException - if the alert configuration was not previously set.void triggerAlert(Alert alert)
alert - an alert.AlertTriggeredEventManager getAlertTriggered()
Copyright © GigaSpaces.