Interface AlertManager

All Superinterfaces:
AdminAware
All Known Subinterfaces:
InternalAlertManager
All Known Implementing Classes:
DefaultAlertManager

public interface AlertManager extends AdminAware
The AlertManager is a manager for configuring of alerts, firing of alerts, and registering for alert events.

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.

Since:
8.0
Author:
Moran Avigdor
  • Method Details

    • configure

      void configure(AlertConfiguration... configurations) throws AlertConfigurationException
      Define an alert configuration for a 'bulk' of configurations. Overrides all previously set properties for any of the alerts.

      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.

      Parameters:
      configurations - the alert configurations (as varargs).
      Throws:
      AlertConfigurationException - if the alert is already enabled (need to disable it first).
      See Also:
    • setConfig

      void setConfig(AlertConfiguration config) throws AlertConfigurationException
      Defines an alert configuration. Overrides all previously set properties for this alert.

      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.

      Parameters:
      config - the alert configuration
      Throws:
      AlertConfigurationException - if the alert is already enabled (need to disable it first).
    • enableAlert

      void enableAlert(Class<? extends AlertConfiguration> clazz) throws AlertConfigurationException
      Enable a previously set alert configuration. From this point, alerts will be triggered.

      If the alert is already enabled, the request is silently ignored.

      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.
    • disableAlert

      void disableAlert(Class<? extends AlertConfiguration> clazz) throws AlertConfigurationException
      Disables 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.

      Parameters:
      clazz - the class of the alert configuration
      Throws:
      AlertConfigurationException - if the alert configuration was not previously set.
    • isAlertEnabled

      boolean isAlertEnabled(Class<? extends AlertConfiguration> clazz)
      Parameters:
      clazz - the class of the alert configuration
      Returns:
      true if the alert is already enabled, false if the alert is disabled or if it's configuration was not found.
    • removeConfig

      boolean removeConfig(Class<? extends AlertConfiguration> clazz) throws AlertConfigurationException
      Removes a previously set alert configuration.

      An exception is raised if the alert is currently enabled. Disable the alert prior to this call.

      Parameters:
      clazz - the class of the alert configuration
      Returns:
      true if removed ,false if 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
    • getConfig

      <T extends AlertConfiguration> T getConfig(Class<T> clazz) throws AlertConfigurationException
      Get the currently set alert configuration.
      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.
    • triggerAlert

      void triggerAlert(Alert alert)
      Trigger an alert event for registered alert event listeners.
      Parameters:
      alert - an alert.
    • getAlertTriggered

      AlertTriggeredEventManager getAlertTriggered()
      Returns:
      the alert event manager to register/unregister for alert events.
    • getAlertStatusByGroupId

      AlertStatus getAlertStatusByGroupId(String groupUid)
      Parameters:
      groupUid - The group unique identifier
      Returns:
      the status of the alerts in this group
      Since:
      12.0.0