public class DefaultAlertManager extends Object implements InternalAlertManager
Constructor and Description |
---|
DefaultAlertManager(Admin admin) |
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.
|
Admin |
getAdmin()
Returns the
Admin associated with this element. |
AlertRepository |
getAlertRepository() |
AlertStatus |
getAlertStatusByGroupId(String groupUid) |
AlertTriggeredEventManager |
getAlertTriggered() |
BeanConfigPropertiesManager |
getBeanConfigPropertiesManager() |
<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.
|
public DefaultAlertManager(Admin admin)
public AlertRepository getAlertRepository()
getAlertRepository
in interface InternalAlertManager
public AlertTriggeredEventManager getAlertTriggered()
getAlertTriggered
in interface AlertManager
public AlertStatus getAlertStatusByGroupId(String groupUid)
getAlertStatusByGroupId
in interface AlertManager
groupUid
- The group unique identifierpublic void triggerAlert(Alert alert)
AlertManager
triggerAlert
in interface AlertManager
alert
- an alert.public Admin getAdmin()
AdminAware
Admin
associated with this element.getAdmin
in interface AdminAware
public BeanConfigPropertiesManager getBeanConfigPropertiesManager()
getBeanConfigPropertiesManager
in interface InternalAlertManager
public void disableAlert(Class<? extends AlertConfiguration> clazz) throws AlertConfigurationException
AlertManager
If the alert is already disabled, the request is silently ignored.
disableAlert
in interface AlertManager
clazz
- the class of the alert configurationAlertConfigurationException
- if the alert configuration was not previously set.public void enableAlert(Class<? extends AlertConfiguration> clazz) throws AlertConfigurationException
AlertManager
If the alert is already enabled, the request is silently ignored.
enableAlert
in interface AlertManager
clazz
- the class of the alert configurationAlertConfigurationException
- if the alert can't be enabled for any of the following
reasons: public <T extends AlertConfiguration> T getConfig(Class<T> clazz) throws AlertConfigurationException
AlertManager
getConfig
in interface AlertManager
clazz
- the class of the alert configurationAlertConfigurationException
- if the alert configuration was not previously set.public boolean removeConfig(Class<? extends AlertConfiguration> clazz) throws AlertConfigurationException
AlertManager
An exception is raised if the alert is currently enabled. Disable the alert prior to this call.
removeConfig
in interface AlertManager
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: public void setConfig(AlertConfiguration config) throws AlertConfigurationException
AlertManager
The AlertConfiguration.isEnabled()
is ignored. To enable, call AlertManager.enableAlert(Class)
. To perform both operations in a single call, use AlertManager.configure(AlertConfiguration[])
.
An exception is raised if the alert is already enabled.
setConfig
in interface AlertManager
config
- the alert configurationAlertConfigurationException
- if the alert is already enabled (need to disable it
first).public boolean isAlertEnabled(Class<? extends AlertConfiguration> clazz)
isAlertEnabled
in interface AlertManager
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.public void configure(AlertConfiguration... configurations) throws AlertConfigurationException
AlertManager
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) AlertManager.disableAlert(Class)
, followed by AlertManager.setConfig(AlertConfiguration)
followed by AlertManager.enableAlert(Class)
.
If it returns false
it is equivalent to calling (for a
predefined alert) AlertManager.disableAlert(Class)
followed by AlertManager.setConfig(AlertConfiguration)
.
if an alert configuration was not previously set, the current setting will be used.
configure
in interface AlertManager
configurations
- the alert configurations (as varargs).AlertConfigurationException
- if the alert is already enabled (need to disable it
first).AlertConfigurationParser
Copyright © GigaSpaces.