org.rhq.enterprise.server.alert
Class AlertManagerBean

java.lang.Object
  extended by org.rhq.enterprise.server.alert.AlertManagerBean
All Implemented Interfaces:
AlertManagerLocal, AlertManagerRemote

public class AlertManagerBean
extends Object
implements AlertManagerLocal, AlertManagerRemote

Author:
Joseph Marques, Ian Springer

Constructor Summary
AlertManagerBean()
           
 
Method Summary
 int acknowledgeAlerts(org.rhq.core.domain.auth.Subject subject, int[] alertIds)
          Acknowledge alert(s) so that administrators know who is working on remedying the underlying condition(s) that caused the alert(s) in the first place.
 int acknowledgeAlertsByContext(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.common.EntityContext context)
           
 org.rhq.core.domain.alert.Alert createAlert(org.rhq.core.domain.alert.Alert alert)
          Persist a detached alert.
 int deleteAlerts(long beginTime, long endTime)
          Remove alerts for the specified range of time.
 int deleteAlerts(org.rhq.core.domain.auth.Subject user, int[] alertIds)
          Remove the alerts with the specified id's.
 int deleteAlertsByContext(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.common.EntityContext context)
           
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.alert.Alert> findAlertsByCriteria(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.criteria.AlertCriteria criteria)
           
 void fireAlert(int alertDefinitionId)
           
 int getAlertCountByMeasurementDefinitionAndAutoGroup(int measurementDefinitionId, int resourceParentId, int resourceTypeId, long beginDate, long endDate)
           
 int getAlertCountByMeasurementDefinitionAndResource(int measurementDefinitionId, int resourceId, long beginDate, long endDate)
           
 int getAlertCountByMeasurementDefinitionAndResourceGroup(int measurementDefinitionId, int groupId, long beginDate, long endDate)
           
 int getAlertCountByMeasurementDefinitionAndResources(int measurementDefinitionId, int[] resourceIds, long beginDate, long endDate)
           
 int getAlertCountByMeasurementDefinitionId(Integer measurementDefinitionId, long begin, long end)
           
 Map<Integer,Integer> getAlertCountForSchedules(long begin, long end, List<Integer> scheduleIds)
           
 AlertSenderPluginManager getAlertPluginManager()
          Return the plugin manager that is managing alert sender plugins
 String prettyPrintAlertConditions(org.rhq.core.domain.alert.Alert alert, boolean shortVersion)
          Create a human readable description of the conditions that led to this alert.
 String prettyPrintAlertURL(org.rhq.core.domain.alert.Alert alert)
           
 int purgeAlerts()
           
 Collection<String> sendAlertNotificationEmails(org.rhq.core.domain.alert.Alert alert, Collection<String> emailAddresses)
           
 void sendAlertNotifications(org.rhq.core.domain.alert.Alert alert)
          This is the core of the alert sending process.
 boolean willDefinitionBeDisabled(org.rhq.core.domain.alert.Alert alert)
          Tells us if the definition of the passed alert will be disabled after this alert was fired
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AlertManagerBean

public AlertManagerBean()
Method Detail

createAlert

public org.rhq.core.domain.alert.Alert createAlert(org.rhq.core.domain.alert.Alert alert)
Persist a detached alert.

Specified by:
createAlert in interface AlertManagerLocal
Returns:
an alert

deleteAlerts

public int deleteAlerts(org.rhq.core.domain.auth.Subject user,
                        int[] alertIds)
Description copied from interface: AlertManagerLocal
Remove the alerts with the specified id's.

Specified by:
deleteAlerts in interface AlertManagerLocal
Specified by:
deleteAlerts in interface AlertManagerRemote
Parameters:
user - caller
alertIds - primary keys of the alerts to delete
Returns:
number of alerts deleted

acknowledgeAlerts

public int acknowledgeAlerts(org.rhq.core.domain.auth.Subject subject,
                             int[] alertIds)
Acknowledge alert(s) so that administrators know who is working on remedying the underlying condition(s) that caused the alert(s) in the first place.

Specified by:
acknowledgeAlerts in interface AlertManagerLocal
Specified by:
acknowledgeAlerts in interface AlertManagerRemote
Parameters:
subject - calling user
alertIds - PKs of the alerts to acknowledge
Returns:
number of alerts acknowledged

deleteAlertsByContext

public int deleteAlertsByContext(org.rhq.core.domain.auth.Subject subject,
                                 org.rhq.core.domain.common.EntityContext context)
Specified by:
deleteAlertsByContext in interface AlertManagerLocal
Specified by:
deleteAlertsByContext in interface AlertManagerRemote

acknowledgeAlertsByContext

public int acknowledgeAlertsByContext(org.rhq.core.domain.auth.Subject subject,
                                      org.rhq.core.domain.common.EntityContext context)
Specified by:
acknowledgeAlertsByContext in interface AlertManagerLocal
Specified by:
acknowledgeAlertsByContext in interface AlertManagerRemote

deleteAlerts

public int deleteAlerts(long beginTime,
                        long endTime)
Remove alerts for the specified range of time.

Specified by:
deleteAlerts in interface AlertManagerLocal

purgeAlerts

public int purgeAlerts()

getAlertCountByMeasurementDefinitionId

public int getAlertCountByMeasurementDefinitionId(Integer measurementDefinitionId,
                                                  long begin,
                                                  long end)
Specified by:
getAlertCountByMeasurementDefinitionId in interface AlertManagerLocal

getAlertCountByMeasurementDefinitionAndResources

public int getAlertCountByMeasurementDefinitionAndResources(int measurementDefinitionId,
                                                            int[] resourceIds,
                                                            long beginDate,
                                                            long endDate)
Specified by:
getAlertCountByMeasurementDefinitionAndResources in interface AlertManagerLocal

getAlertCountByMeasurementDefinitionAndResourceGroup

public int getAlertCountByMeasurementDefinitionAndResourceGroup(int measurementDefinitionId,
                                                                int groupId,
                                                                long beginDate,
                                                                long endDate)
Specified by:
getAlertCountByMeasurementDefinitionAndResourceGroup in interface AlertManagerLocal

getAlertCountByMeasurementDefinitionAndAutoGroup

public int getAlertCountByMeasurementDefinitionAndAutoGroup(int measurementDefinitionId,
                                                            int resourceParentId,
                                                            int resourceTypeId,
                                                            long beginDate,
                                                            long endDate)
Specified by:
getAlertCountByMeasurementDefinitionAndAutoGroup in interface AlertManagerLocal

getAlertCountByMeasurementDefinitionAndResource

public int getAlertCountByMeasurementDefinitionAndResource(int measurementDefinitionId,
                                                           int resourceId,
                                                           long beginDate,
                                                           long endDate)
Specified by:
getAlertCountByMeasurementDefinitionAndResource in interface AlertManagerLocal

getAlertCountForSchedules

public Map<Integer,Integer> getAlertCountForSchedules(long begin,
                                                      long end,
                                                      List<Integer> scheduleIds)
Specified by:
getAlertCountForSchedules in interface AlertManagerLocal

fireAlert

public void fireAlert(int alertDefinitionId)
Specified by:
fireAlert in interface AlertManagerLocal

sendAlertNotifications

public void sendAlertNotifications(org.rhq.core.domain.alert.Alert alert)
This is the core of the alert sending process. For each AlertNotification that is hanging on the alerts definition, the sender is instantiated and its send() method called. If a sender returns a list of email addresses, those will be collected and sent at the end.

Specified by:
sendAlertNotifications in interface AlertManagerLocal
Parameters:
alert - the fired alert

getAlertPluginManager

public AlertSenderPluginManager getAlertPluginManager()
Return the plugin manager that is managing alert sender plugins

Specified by:
getAlertPluginManager in interface AlertManagerLocal
Returns:
The alert sender plugin manager

sendAlertNotificationEmails

public Collection<String> sendAlertNotificationEmails(org.rhq.core.domain.alert.Alert alert,
                                                      Collection<String> emailAddresses)
Specified by:
sendAlertNotificationEmails in interface AlertManagerLocal

prettyPrintAlertConditions

public String prettyPrintAlertConditions(org.rhq.core.domain.alert.Alert alert,
                                         boolean shortVersion)
Create a human readable description of the conditions that led to this alert.

Specified by:
prettyPrintAlertConditions in interface AlertManagerLocal
Parameters:
alert - Alert to create human readable condition description
shortVersion - if true the messages printed are abbreviated to save space
Returns:
human readable condition log

prettyPrintAlertURL

public String prettyPrintAlertURL(org.rhq.core.domain.alert.Alert alert)
Specified by:
prettyPrintAlertURL in interface AlertManagerLocal

willDefinitionBeDisabled

public boolean willDefinitionBeDisabled(org.rhq.core.domain.alert.Alert alert)
Tells us if the definition of the passed alert will be disabled after this alert was fired

Specified by:
willDefinitionBeDisabled in interface AlertManagerLocal
Parameters:
alert - alert to check
Returns:
true if the definition got disabled

findAlertsByCriteria

public org.rhq.core.domain.util.PageList<org.rhq.core.domain.alert.Alert> findAlertsByCriteria(org.rhq.core.domain.auth.Subject subject,
                                                                                               org.rhq.core.domain.criteria.AlertCriteria criteria)
Specified by:
findAlertsByCriteria in interface AlertManagerLocal
Specified by:
findAlertsByCriteria in interface AlertManagerRemote


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.