Hyperic HQ Plugin API v. 4.4.0.2

org.hyperic.hq.events.server.session
Class EventLogManagerEJBImpl

java.lang.Object
  extended by org.hyperic.hq.events.server.session.SessionBase
      extended by org.hyperic.hq.events.server.session.EventLogManagerEJBImpl
All Implemented Interfaces:
java.io.Serializable, javax.ejb.EnterpriseBean, javax.ejb.SessionBean

public class EventLogManagerEJBImpl
extends SessionBase
implements javax.ejb.SessionBean

Stores Events to and deletes Events from storage

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.hyperic.hq.events.server.session.SessionBase
DATASOURCE, SEQUENCE_INTERVAL
 
Constructor Summary
EventLogManagerEJBImpl()
           
 
Method Summary
 EventLog createLog(AbstractEvent event, java.lang.String subject, java.lang.String status, boolean save)
          Create a new vanilla log item.
 int deleteLogs(long from, long to)
          Purge old event logs.
 int deleteLogs(Resource r)
          Delete event logs for the given resource TODO: Authz check.
 void ejbActivate()
           
 void ejbCreate()
           
 void ejbPassivate()
           
 void ejbPostCreate()
           
 void ejbRemove()
           
 java.util.List findLastLogs(Resource proto)
          Find the last event logs of all the resources of a given prototype.
 java.util.Map findLastUnfixedAlertFiredEvents(java.util.List alertDefinitionIds)
          Find the last unfixed AlertFiredEvents for each alert definition in the list
 EventLog findLog(java.lang.String typeClass, int instanceId, long timestamp)
          Finds a unique log entry with the specified event type, instance ID, and timestamp.
 java.util.List findLogs(AppdefEntityID ent, AuthzSubject user, java.lang.String[] eventTypes, long begin, long end)
          Get a list of log records based on resource, event type and time range.
 java.util.List findLogs(AppdefEntityID ent, AuthzSubject user, java.lang.String status, long begin, long end)
          Get a list of log records based on resource, status and time range.
 java.util.List findLogs(AuthzSubject subject, long begin, long end, PageInfo pInfo, EventLogStatus maxStatus, java.lang.String typeClass, java.util.Collection inGroups)
          Get a list of ResourceEventLogs in a given interval, with the maximum specified status.
static org.hyperic.hq.events.shared.EventLogManagerLocal getOne()
           
 int getTotalNumberLogs()
          Retrieve the total number of event logs.
 void insertEventLogs(EventLog[] eventLogs)
          Insert the event logs in batch.
 boolean[] logsExistPerInterval(AppdefEntityID entityId, AuthzSubject subject, long begin, long end, int intervals)
          Get an array of booleans, each element indicating whether or not there are log records for that respective interval, for a particular entity over a given time range.
 void setSessionContext(javax.ejb.SessionContext ctx)
           
 
Methods inherited from class org.hyperic.hq.events.server.session.SessionBase
canCreateAlertDefinition, canCreateEscalation, canCreateResourceTypeAlertDefinitionTemplate, canDeleteAlertDefinition, canDeleteResourceTypeAlertDefinitionTemplate, canFixAcknowledgeAlerts, canFixAcknowledgeAlerts, canModifyAlertDefinition, canModifyEscalation, canModifyResourceTypeAlertDefinitionTemplate, canRemoveEscalation, canViewAlertDefinition, canViewEscalation, canViewResourceTypeAlertDefinitionTemplate, describeCondition, findResource, getAppdefEntityID, getInitialContext, getNextId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventLogManagerEJBImpl

public EventLogManagerEJBImpl()
Method Detail

createLog

public EventLog createLog(AbstractEvent event,
                          java.lang.String subject,
                          java.lang.String status,
                          boolean save)
                   throws ResourceDeletedException
Create a new vanilla log item.

Parameters:
event - The event to log.
subject - The log item subject.
status - The log item status.
save - true to persist the log item; false to create a transient log item only.
Throws:
ResourceDeletedException

insertEventLogs

public void insertEventLogs(EventLog[] eventLogs)
Insert the event logs in batch.

Parameters:
eventLogs - The event logs.

findLog

public EventLog findLog(java.lang.String typeClass,
                        int instanceId,
                        long timestamp)
Finds a unique log entry with the specified event type, instance ID, and timestamp. Returns null if no such entry found. If multiple entries are found, returns first one found.


findLastLogs

public java.util.List findLastLogs(Resource proto)
Find the last event logs of all the resources of a given prototype. (i.e. 'Linux' or 'FileServer File')


findLastUnfixedAlertFiredEvents

public java.util.Map findLastUnfixedAlertFiredEvents(java.util.List alertDefinitionIds)
Find the last unfixed AlertFiredEvents for each alert definition in the list

Parameters:
alertDefinitionIds - The list of alert definition ids
Returns:
Map of alert definition id Integer to AlertFiredEvent

findLogs

public java.util.List findLogs(AuthzSubject subject,
                               long begin,
                               long end,
                               PageInfo pInfo,
                               EventLogStatus maxStatus,
                               java.lang.String typeClass,
                               java.util.Collection inGroups)
Get a list of ResourceEventLogs in a given interval, with the maximum specified status. If specified, typeClass dictates the full classname of the rows to check (i.e. org.hyperic.hq.....ResourceLogEvent) If specified, inGroups must be a collection of ResourceGroups which the resulting logs will be associated with.


findLogs

public java.util.List findLogs(AppdefEntityID ent,
                               AuthzSubject user,
                               java.lang.String[] eventTypes,
                               long begin,
                               long end)
Get a list of log records based on resource, event type and time range. All resources which are descendents of the passed resource will also have their event logs included


findLogs

public java.util.List findLogs(AppdefEntityID ent,
                               AuthzSubject user,
                               java.lang.String status,
                               long begin,
                               long end)
Get a list of log records based on resource, status and time range. All resources which are descendants of the passed resource will also have their event logs included


getTotalNumberLogs

public int getTotalNumberLogs()
Retrieve the total number of event logs.

Returns:
The total number of event logs.

logsExistPerInterval

public boolean[] logsExistPerInterval(AppdefEntityID entityId,
                                      AuthzSubject subject,
                                      long begin,
                                      long end,
                                      int intervals)
Get an array of booleans, each element indicating whether or not there are log records for that respective interval, for a particular entity over a given time range. This method also takes descendents of the passed-resource into consideration.

Parameters:
entityId - The entity.
begin - The begin timestamp for the time range.
end - The end timestamp for the time range.
intervals - The number of intervals.
Returns:
The boolean array with length equal to the number of intervals specified.

deleteLogs

public int deleteLogs(Resource r)
Delete event logs for the given resource TODO: Authz check.


deleteLogs

public int deleteLogs(long from,
                      long to)
Purge old event logs.

Parameters:
from - Delete all records starting from (and including) this time. If set to -1, then this method will delete all records from the earliest record forward.
to - Delete all records up to (and including) this time. If set to -1, then this method will delete all records up to and including the most recent record.
Returns:
The number of records removed.

ejbCreate

public void ejbCreate()

ejbPostCreate

public void ejbPostCreate()

ejbActivate

public void ejbActivate()
Specified by:
ejbActivate in interface javax.ejb.SessionBean

ejbPassivate

public void ejbPassivate()
Specified by:
ejbPassivate in interface javax.ejb.SessionBean

ejbRemove

public void ejbRemove()
Specified by:
ejbRemove in interface javax.ejb.SessionBean

setSessionContext

public void setSessionContext(javax.ejb.SessionContext ctx)
Specified by:
setSessionContext in interface javax.ejb.SessionBean

getOne

public static org.hyperic.hq.events.shared.EventLogManagerLocal getOne()

Hyperic HQ Plugin API v. 4.4.0.2

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.