org.rhq.core.domain.event.transfer
Class EventReport

java.lang.Object
  extended by org.rhq.core.domain.event.transfer.EventReport
All Implemented Interfaces:
Serializable

public class EventReport
extends Object
implements Serializable

A report of resource Events that the Plugin Container periodically sends to the Server. The report contains all Events that have occurred since the last time a report was successfully sent. Each report has a limit on the number of events they can hold. There are actually two limits: first, each event source has a limit on the number of events they can have and second, the report has a total number of events it can hold at a maximum (i.e. the sum of all events for all event sources cannot exceed this total maximum). This report maintains a counter of the number of events that have been dropped due to hitting these maximum limits. If you want this report to get additional warning events added to them to indicate if these maximum limits were exceeded, call addLimitWarningEvents().

See Also:
Serialized Form

Constructor Summary
EventReport(int maxEventsPerSource, int maxEventsPerReport)
           
 
Method Summary
 void addEvent(Event event, EventSource eventSource)
          Adds the given event to this report.
 boolean addLimitWarningEvents()
          This method will check to see if any maximum limits were exceeded and if so adds warning events to indicate that the limits were breached.
 Map<EventSource,Integer> getDroppedEvents()
           
 Map<EventSource,Set<Event>> getEvents()
          Returns the Events contained in this report; the Events are in a map keyed off Event sources.
 int getMaxEventsPerReport()
           
 int getMaxEventsPerSource()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EventReport

public EventReport(int maxEventsPerSource,
                   int maxEventsPerReport)
Method Detail

addEvent

public void addEvent(@NotNull
                     Event event,
                     @NotNull
                     EventSource eventSource)
Adds the given event to this report. If this report is too full, the event will be silently rejected (i.e. an exception will not be thrown, but the event will not be sent to the server).

Parameters:
event - the Event to be added
eventSource - the source of the Event to be added

getEvents

@NotNull
public Map<EventSource,Set<Event>> getEvents()
Returns the Events contained in this report; the Events are in a map keyed off Event sources.

Returns:
the Events contained in this report

addLimitWarningEvents

public boolean addLimitWarningEvents()
This method will check to see if any maximum limits were exceeded and if so adds warning events to indicate that the limits were breached. The plugin container should call this method before it wants to send the report over the wire to the server side. This method should be called whenever you are done adding events to the report and you want to then process the events. This method will only add warning events once. If this method adds at least one warning event to the report, further calls to this method will be a no-op (i.e. the method will do nothing and return immediately). Therefore, it is recommended you call this method only after the report is done and you are ready to send the report to the server for further processing.

Returns:
true if some events in teh current report were dropped due to limits

getDroppedEvents

public Map<EventSource,Integer> getDroppedEvents()

getMaxEventsPerSource

public int getMaxEventsPerSource()

getMaxEventsPerReport

public int getMaxEventsPerReport()

toString

public String toString()
Overrides:
toString in class Object


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