org.rhq.enterprise.server.measurement
Class AvailabilityManagerBean

java.lang.Object
  extended by org.rhq.enterprise.server.measurement.AvailabilityManagerBean
All Implemented Interfaces:
AvailabilityManagerLocal, AvailabilityManagerRemote

public class AvailabilityManagerBean
extends Object
implements AvailabilityManagerLocal, AvailabilityManagerRemote

Manager for availability related tasks.

Author:
Heiko W. Rupp, John Mazzitelli

Constructor Summary
AvailabilityManagerBean()
           
 
Method Summary
 List<AvailabilityPoint> findAvailabilitiesForAutoGroup(org.rhq.core.domain.auth.Subject subject, int parentResourceId, int resourceTypeId, long fullRangeBeginTime, long fullRangeEndTime, int numberOfPoints, boolean withCurrentAvailability)
          Get the individual availability data points for the given auto group.
 List<AvailabilityPoint> findAvailabilitiesForResource(org.rhq.core.domain.auth.Subject subject, int resourceId, long fullRangeBeginTime, long fullRangeEndTime, int numberOfPoints, boolean withCurrentAvailability)
          Get the individual availability data points for the given resource.
 List<AvailabilityPoint> findAvailabilitiesForResourceGroup(org.rhq.core.domain.auth.Subject subject, int groupId, long fullRangeBeginTime, long fullRangeEndTime, int numberOfPoints, boolean withCurrentAvailability)
          Get the individual availability data points for the given resource group.
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.measurement.Availability> findAvailabilityForResource(org.rhq.core.domain.auth.Subject subject, int resourceId, org.rhq.core.domain.util.PageControl pageControl)
          #see {@link AvailabilityManagerRemote#getAvailabilityForResource(Subject, int, PageControl)
 List<org.rhq.core.domain.measurement.Availability> findAvailabilityWithinInterval(int resourceId, Date startDate, Date endDate)
          Find all availability records for a given Resource that match the given interval [startDate, endDate].
 org.rhq.core.domain.measurement.Availability getCurrentAvailabilityForResource(org.rhq.core.domain.auth.Subject subject, int resourceId)
          #see {@link AvailabilityManagerRemote#getCurrentAvailabilityForResource(Subject, int)
 org.rhq.core.domain.measurement.AvailabilityType getCurrentAvailabilityTypeForResource(org.rhq.core.domain.auth.Subject subject, int resourceId)
          Indicates if the given resource is currently up (i.e.
 boolean mergeAvailabilityReport(org.rhq.core.domain.discovery.AvailabilityReport report)
          Merge an AvailabilityReport that has been received from an agent.
 int purgeAvailabilities(long oldest)
          Purges all availabilities that are old.
 void setAllAgentResourceAvailabilities(int agentId, org.rhq.core.domain.measurement.AvailabilityType availabilityType)
          Sets all availabilities for all resources managed by the given agent to the given availability type (which may be null to indicate unknown).
 void updateLastAvailabilityReport(int agentId)
          Executing this method will update the given agent's lastAvailabilityReport time in a new transaction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AvailabilityManagerBean

public AvailabilityManagerBean()
Method Detail

purgeAvailabilities

public int purgeAvailabilities(long oldest)
Description copied from interface: AvailabilityManagerLocal
Purges all availabilities that are old. The oldest time is the epoch milliseconds of the oldest availability that is to be retained. The end time is the time that is examined. No availability row with a null end time will ever be purged.

Specified by:
purgeAvailabilities in interface AvailabilityManagerLocal
Parameters:
oldest - oldest time (in epoch milliseconds) to retain; older records get purged
Returns:
the number of availabilities that were purged

getCurrentAvailabilityTypeForResource

public org.rhq.core.domain.measurement.AvailabilityType getCurrentAvailabilityTypeForResource(org.rhq.core.domain.auth.Subject subject,
                                                                                              int resourceId)
Description copied from interface: AvailabilityManagerLocal
Indicates if the given resource is currently up (i.e. available) or down.

Specified by:
getCurrentAvailabilityTypeForResource in interface AvailabilityManagerLocal
Returns:
the current status of the resource

getCurrentAvailabilityForResource

public org.rhq.core.domain.measurement.Availability getCurrentAvailabilityForResource(org.rhq.core.domain.auth.Subject subject,
                                                                                      int resourceId)
Description copied from interface: AvailabilityManagerLocal
#see {@link AvailabilityManagerRemote#getCurrentAvailabilityForResource(Subject, int)

Specified by:
getCurrentAvailabilityForResource in interface AvailabilityManagerLocal
Specified by:
getCurrentAvailabilityForResource in interface AvailabilityManagerRemote
Returns:
the full and current status of the resource
See Also:
AvailabilityManagerLocal.getCurrentAvailabilityTypeForResource(Subject, int), ResourceAvailabilityManagerLocal

findAvailabilitiesForResource

public List<AvailabilityPoint> findAvailabilitiesForResource(org.rhq.core.domain.auth.Subject subject,
                                                             int resourceId,
                                                             long fullRangeBeginTime,
                                                             long fullRangeEndTime,
                                                             int numberOfPoints,
                                                             boolean withCurrentAvailability)
Description copied from interface: AvailabilityManagerLocal
Get the individual availability data points for the given resource.

Specified by:
findAvailabilitiesForResource in interface AvailabilityManagerLocal
resourceId - PK of the resource wanted
fullRangeBeginTime - start time for data we are interested in
fullRangeEndTime - end time for data we are interested in
numberOfPoints - number of data points to return
withCurrentAvailability - if true, the last data point in the range will match the resource's current availability no matter what
Returns:
the availabilities over the given time span in a list

findAvailabilitiesForResourceGroup

public List<AvailabilityPoint> findAvailabilitiesForResourceGroup(org.rhq.core.domain.auth.Subject subject,
                                                                  int groupId,
                                                                  long fullRangeBeginTime,
                                                                  long fullRangeEndTime,
                                                                  int numberOfPoints,
                                                                  boolean withCurrentAvailability)
Description copied from interface: AvailabilityManagerLocal
Get the individual availability data points for the given resource group.

Specified by:
findAvailabilitiesForResourceGroup in interface AvailabilityManagerLocal
groupId - PK of the resource group wanted
fullRangeBeginTime - start time for data we are interested in
fullRangeEndTime - end time for data we are interested in
numberOfPoints - number of data points to return
withCurrentAvailability - if true, the last data point in the range will match the resource group's current availability no matter what
Returns:
the availabilities over the given time span in a list

findAvailabilitiesForAutoGroup

public List<AvailabilityPoint> findAvailabilitiesForAutoGroup(org.rhq.core.domain.auth.Subject subject,
                                                              int parentResourceId,
                                                              int resourceTypeId,
                                                              long fullRangeBeginTime,
                                                              long fullRangeEndTime,
                                                              int numberOfPoints,
                                                              boolean withCurrentAvailability)
Description copied from interface: AvailabilityManagerLocal
Get the individual availability data points for the given auto group.

Specified by:
findAvailabilitiesForAutoGroup in interface AvailabilityManagerLocal
parentResourceId - PK of the parent resource of the auto group wanted
resourceTypeId - PK of the resource type of the auto group wanted
fullRangeBeginTime - start time for data we are interested in
fullRangeEndTime - end time for data we are interested in
numberOfPoints - number of data points to return
withCurrentAvailability - if true, the last data point in the range will match the autogroup's current availability no matter what
Returns:
the availabilities over the given time span in a list

mergeAvailabilityReport

public boolean mergeAvailabilityReport(org.rhq.core.domain.discovery.AvailabilityReport report)
Description copied from interface: AvailabilityManagerLocal
Merge an AvailabilityReport that has been received from an agent. A report will only contain those availabilities that have changed since the agent's last sent report. Note that if an agent has been restarted, it will always send a full report as its first. An agent is obliged to sent at least one availability record in the report in order for the server to determine which agent is sending the report (since a record has a Resource in it and from any Resource we can dsetermine the Agent).

Specified by:
mergeAvailabilityReport in interface AvailabilityManagerLocal
Parameters:
report - the report containing 1 or more availabilities for 1 or more resources.
Returns:
If true, this indicates everything seems OK - the server merged everything successfully and the server and agent seem to be in sync with each. If false, the server thinks something isn't right and it may be out of sync with the agent. When false is returned, the caller should send in a full availability report the next time in order to ensure the server and agent are in sync. true should always be returned if the given availability report is already a full report.

updateLastAvailabilityReport

public void updateLastAvailabilityReport(int agentId)
Description copied from interface: AvailabilityManagerLocal
Executing this method will update the given agent's lastAvailabilityReport time in a new transaction

Specified by:
updateLastAvailabilityReport in interface AvailabilityManagerLocal
Parameters:
agentId - the id of the agent

setAllAgentResourceAvailabilities

public void setAllAgentResourceAvailabilities(int agentId,
                                              org.rhq.core.domain.measurement.AvailabilityType availabilityType)
Description copied from interface: AvailabilityManagerLocal
Sets all availabilities for all resources managed by the given agent to the given availability type (which may be null to indicate unknown).

Specified by:
setAllAgentResourceAvailabilities in interface AvailabilityManagerLocal
Parameters:
agentId - all resources managed by this agent will have their availabilities changed
availabilityType - the type that all of the agent's resources will have

findAvailabilityWithinInterval

public List<org.rhq.core.domain.measurement.Availability> findAvailabilityWithinInterval(int resourceId,
                                                                                         Date startDate,
                                                                                         Date endDate)
Find all availability records for a given Resource that match the given interval [startDate, endDate]. The returned objects will probably cover a larger interval than the required one.

Specified by:
findAvailabilityWithinInterval in interface AvailabilityManagerLocal
Parameters:
resourceId - identifies the resource for which we want the values
startDate - start date of the desired interval
endDate - end date of the desired interval
Returns:
A list of availabilities that cover at least the given date range

findAvailabilityForResource

public org.rhq.core.domain.util.PageList<org.rhq.core.domain.measurement.Availability> findAvailabilityForResource(org.rhq.core.domain.auth.Subject subject,
                                                                                                                   int resourceId,
                                                                                                                   org.rhq.core.domain.util.PageControl pageControl)
Description copied from interface: AvailabilityManagerLocal
#see {@link AvailabilityManagerRemote#getAvailabilityForResource(Subject, int, PageControl)

Specified by:
findAvailabilityForResource in interface AvailabilityManagerLocal
Specified by:
findAvailabilityForResource in interface AvailabilityManagerRemote
Returns:


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