org.rhq.enterprise.server.event
Class EventManagerBean

java.lang.Object
  extended by org.rhq.enterprise.server.event.EventManagerBean
All Implemented Interfaces:
EventManagerLocal, EventManagerRemote

public class EventManagerBean
extends java.lang.Object
implements EventManagerLocal, EventManagerRemote

Manager for Handling of Events.

Author:
Heiko W. Rupp, Ian Springer

Constructor Summary
EventManagerBean()
           
 
Method Summary
 void addEventData(java.util.Map<EventSource,java.util.Set<Event>> events)
          Add the passed events to the database
 int deleteAllEventsForCompatibleGroup(Subject subject, int groupId)
           
 int deleteAllEventsForResource(Subject subject, int resourceId)
           
 int deleteEvents(Subject subject, java.util.List<java.lang.Integer> eventIds)
           
 void deleteEventSourcesForDefinition(EventDefinition def)
           
 PageList<EventComposite> findEvents(Subject subject, int[] resourceIds, long begin, long end, EventSeverity[] severities, java.lang.String source, java.lang.String searchString, PageControl pc)
          Return a PageList of Event objects, that match the input
 PageList<Event> findEventsByCriteria(Subject subject, EventCriteria criteria)
           
 PageList<EventComposite> findEventsForAutoGroup(Subject subject, int parent, int type, long begin, long endDate, EventSeverity[] severities, PageControl pc)
           
 PageList<EventComposite> findEventsForAutoGroup(Subject subject, int parent, int type, long begin, long endDate, EventSeverity[] severities, java.lang.String source, java.lang.String searchString, PageControl pc)
           
 PageList<EventComposite> findEventsForAutoGroup(Subject subject, int parentResourceId, int resourceTypeId, long begin, long end, EventSeverity severity, java.lang.String source, java.lang.String detail, PageControl pc)
           
 PageList<EventComposite> findEventsForCompGroup(Subject subject, int groupId, long begin, long endDate, EventSeverity[] severities, PageControl pc)
           
 PageList<EventComposite> findEventsForCompGroup(Subject subject, int groupId, long begin, long endDate, EventSeverity[] severities, java.lang.String source, java.lang.String searchString, PageControl pc)
           
 PageList<EventComposite> findEventsForCompGroup(Subject subject, int groupId, long begin, long endDate, EventSeverity severity, java.lang.String source, java.lang.String searchString, PageControl pc)
           
 PageList<EventComposite> findEventsForResource(Subject subject, int resourceId, long startDate, long endDate, EventSeverity[] severities, PageControl pc)
          Retrieve the events for the given resource that happened in the given time frame.
 PageList<EventComposite> findEventsForResource(Subject subject, int resourceId, long startDate, long endDate, EventSeverity severity, java.lang.String source, java.lang.String detail, PageControl pc)
           
 java.util.List<Event> findEventsForResources(Subject subject, java.util.List<Resource> resources, long startDate, long endDate)
          Retrieve the events for the given resources that happened in the given time frame.
 int[] getEventCounts(Subject subject, int resourceId, long begin, long end, int numBuckets)
          Retrieve the count of events for the given resource in the time between begin and end, nicely separated in numBuckets.
 java.util.Map<EventSeverity,java.lang.Integer> getEventCountsBySeverity(Subject subject, int resourceId, long startDate, long endDate)
           
 int getEventDefinitionCountForResourceType(int resourceTypeId)
           
 EventComposite getEventDetailForEventId(Subject subject, int eventId)
          Obtain detail information about the passed event
 EventSeverity[] getSeverityBuckets(Subject subject, int resourceId, long begin, long end, int numBuckets)
          Provide the buckets for a timeline with the (most severe) severity for each bucket.
 EventSeverity[] getSeverityBucketsForAutoGroup(Subject subject, int parentId, int type, long begin, long end, int numBuckets)
          Provide the buckets for a timeline with the (most severe) severity for each bucket.
 EventSeverity[] getSeverityBucketsForCompGroup(Subject subject, int groupId, long begin, long end, int numBuckets)
          Provide the buckets for a timeline with the (most severe) severity for each bucket.
 void init()
           
 int purgeEventData(java.util.Date deleteUpToTime)
          Deletes event data older than the specified time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventManagerBean

public EventManagerBean()
Method Detail

init

@PostConstruct
public void init()

addEventData

public void addEventData(java.util.Map<EventSource,java.util.Set<Event>> events)
Description copied from interface: EventManagerLocal
Add the passed events to the database

Specified by:
addEventData in interface EventManagerLocal
Parameters:
events - a set of events.

purgeEventData

public int purgeEventData(java.util.Date deleteUpToTime)
                   throws java.sql.SQLException
Description copied from interface: EventManagerLocal
Deletes event data older than the specified time.

Specified by:
purgeEventData in interface EventManagerLocal
Parameters:
deleteUpToTime - event data older than this time will be deleted
Returns:
number of deleted Events
Throws:
java.sql.SQLException

findEventsForResources

@NotNull
public java.util.List<Event> findEventsForResources(Subject subject,
                                                            java.util.List<Resource> resources,
                                                            long startDate,
                                                            long endDate)
Description copied from interface: EventManagerLocal
Retrieve the events for the given resources that happened in the given time frame.

Specified by:
findEventsForResources in interface EventManagerLocal
resources - Resources we are interested in
startDate - Start time of interest
endDate - End time of interest
Returns:
List of Events for that time frame.

findEventsForAutoGroup

public PageList<EventComposite> findEventsForAutoGroup(Subject subject,
                                                       int parent,
                                                       int type,
                                                       long begin,
                                                       long endDate,
                                                       EventSeverity[] severities,
                                                       PageControl pc)
Specified by:
findEventsForAutoGroup in interface EventManagerLocal

findEventsForAutoGroup

public PageList<EventComposite> findEventsForAutoGroup(Subject subject,
                                                       int parent,
                                                       int type,
                                                       long begin,
                                                       long endDate,
                                                       EventSeverity[] severities,
                                                       java.lang.String source,
                                                       java.lang.String searchString,
                                                       PageControl pc)
Specified by:
findEventsForAutoGroup in interface EventManagerLocal

findEventsForCompGroup

public PageList<EventComposite> findEventsForCompGroup(Subject subject,
                                                       int groupId,
                                                       long begin,
                                                       long endDate,
                                                       EventSeverity[] severities,
                                                       PageControl pc)
Specified by:
findEventsForCompGroup in interface EventManagerLocal

findEventsForCompGroup

public PageList<EventComposite> findEventsForCompGroup(Subject subject,
                                                       int groupId,
                                                       long begin,
                                                       long endDate,
                                                       EventSeverity[] severities,
                                                       java.lang.String source,
                                                       java.lang.String searchString,
                                                       PageControl pc)
Specified by:
findEventsForCompGroup in interface EventManagerLocal

getEventCounts

public int[] getEventCounts(Subject subject,
                            int resourceId,
                            long begin,
                            long end,
                            int numBuckets)
Description copied from interface: EventManagerLocal
Retrieve the count of events for the given resource in the time between begin and end, nicely separated in numBuckets.

Specified by:
getEventCounts in interface EventManagerLocal
Parameters:
subject - Subject of the caller
resourceId - Id of the resource we want to know the data
begin - Begin date
end - End date
numBuckets - Number of buckets to distribute into.
Returns:

getSeverityBuckets

public EventSeverity[] getSeverityBuckets(Subject subject,
                                          int resourceId,
                                          long begin,
                                          long end,
                                          int numBuckets)
Description copied from interface: EventManagerLocal
Provide the buckets for a timeline with the (most severe) severity for each bucket.

Specified by:
getSeverityBuckets in interface EventManagerLocal
Specified by:
getSeverityBuckets in interface EventManagerRemote
Parameters:
subject - Subject of the caller
resourceId - Id of the resource for which we want to know the data
begin - Begin date
end - End date
numBuckets - Number of buckets to distribute into.

getSeverityBucketsForAutoGroup

public EventSeverity[] getSeverityBucketsForAutoGroup(Subject subject,
                                                      int parentId,
                                                      int type,
                                                      long begin,
                                                      long end,
                                                      int numBuckets)
Description copied from interface: EventManagerLocal
Provide the buckets for a timeline with the (most severe) severity for each bucket.

Specified by:
getSeverityBucketsForAutoGroup in interface EventManagerLocal
Specified by:
getSeverityBucketsForAutoGroup in interface EventManagerRemote
Parameters:
subject - Subject of the caller
parentId - Id of the parent of the autogroup for which we want to know the data
type - Id of the children type of the autogroup
begin - Begin date
end - End date
numBuckets - Number of buckets to distribute into.

getSeverityBucketsForCompGroup

public EventSeverity[] getSeverityBucketsForCompGroup(Subject subject,
                                                      int groupId,
                                                      long begin,
                                                      long end,
                                                      int numBuckets)
Description copied from interface: EventManagerLocal
Provide the buckets for a timeline with the (most severe) severity for each bucket.

Specified by:
getSeverityBucketsForCompGroup in interface EventManagerLocal
Specified by:
getSeverityBucketsForCompGroup in interface EventManagerRemote
Parameters:
subject - Subject of the caller
groupId - Id of the compatible group for which we want to know the data
begin - Begin date
end - End date
numBuckets - Number of buckets to distribute into.

findEventsForResource

@NotNull
public PageList<EventComposite> findEventsForResource(Subject subject,
                                                              int resourceId,
                                                              long startDate,
                                                              long endDate,
                                                              EventSeverity[] severities,
                                                              PageControl pc)
Description copied from interface: EventManagerLocal
Retrieve the events for the given resource that happened in the given time frame.

Specified by:
findEventsForResource in interface EventManagerLocal
pc - TODO
Returns:

findEvents

public PageList<EventComposite> findEvents(Subject subject,
                                           int[] resourceIds,
                                           long begin,
                                           long end,
                                           EventSeverity[] severities,
                                           java.lang.String source,
                                           java.lang.String searchString,
                                           PageControl pc)
Description copied from interface: EventManagerLocal
Return a PageList of Event objects, that match the input

Specified by:
findEvents in interface EventManagerLocal
resourceIds - We want events for those resources
begin - Begin time for the events display
end - End time for the events display
source - TODO
searchString - TODO
pc - PageControl to specify the list size
Returns:
List of Events

getEventDetailForEventId

public EventComposite getEventDetailForEventId(Subject subject,
                                               int eventId)
                                        throws EventException
Description copied from interface: EventManagerLocal
Obtain detail information about the passed event

Specified by:
getEventDetailForEventId in interface EventManagerLocal
Parameters:
subject - Subject of the caller
eventId - ID of the desired event.
Returns:
Throws:
EventException

deleteEventSourcesForDefinition

public void deleteEventSourcesForDefinition(EventDefinition def)
Specified by:
deleteEventSourcesForDefinition in interface EventManagerLocal

getEventDefinitionCountForResourceType

public int getEventDefinitionCountForResourceType(int resourceTypeId)
Specified by:
getEventDefinitionCountForResourceType in interface EventManagerLocal

deleteEvents

public int deleteEvents(Subject subject,
                        java.util.List<java.lang.Integer> eventIds)
Specified by:
deleteEvents in interface EventManagerLocal

deleteAllEventsForResource

public int deleteAllEventsForResource(Subject subject,
                                      int resourceId)
Specified by:
deleteAllEventsForResource in interface EventManagerLocal

deleteAllEventsForCompatibleGroup

public int deleteAllEventsForCompatibleGroup(Subject subject,
                                             int groupId)
Specified by:
deleteAllEventsForCompatibleGroup in interface EventManagerLocal

getEventCountsBySeverity

public java.util.Map<EventSeverity,java.lang.Integer> getEventCountsBySeverity(Subject subject,
                                                                               int resourceId,
                                                                               long startDate,
                                                                               long endDate)
Specified by:
getEventCountsBySeverity in interface EventManagerLocal

findEventsForResource

public PageList<EventComposite> findEventsForResource(Subject subject,
                                                      int resourceId,
                                                      long startDate,
                                                      long endDate,
                                                      EventSeverity severity,
                                                      java.lang.String source,
                                                      java.lang.String detail,
                                                      PageControl pc)
Specified by:
findEventsForResource in interface EventManagerLocal

findEventsForCompGroup

public PageList<EventComposite> findEventsForCompGroup(Subject subject,
                                                       int groupId,
                                                       long begin,
                                                       long endDate,
                                                       EventSeverity severity,
                                                       java.lang.String source,
                                                       java.lang.String searchString,
                                                       PageControl pc)
Specified by:
findEventsForCompGroup in interface EventManagerLocal

findEventsForAutoGroup

public PageList<EventComposite> findEventsForAutoGroup(Subject subject,
                                                       int parentResourceId,
                                                       int resourceTypeId,
                                                       long begin,
                                                       long end,
                                                       EventSeverity severity,
                                                       java.lang.String source,
                                                       java.lang.String detail,
                                                       PageControl pc)
Specified by:
findEventsForAutoGroup in interface EventManagerLocal

findEventsByCriteria

public PageList<Event> findEventsByCriteria(Subject subject,
                                            EventCriteria criteria)
Specified by:
findEventsByCriteria in interface EventManagerLocal
Specified by:
findEventsByCriteria in interface EventManagerRemote


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