org.rhq.enterprise.server.resource
Interface ResourceAvailabilityManagerLocal

All Known Implementing Classes:
ResourceAvailabilityManagerBean

public interface ResourceAvailabilityManagerLocal

A manager that provides methods for manipulating and querying the cached current availability for resources.

Author:
Joseph Marques

Method Summary
 org.rhq.core.domain.measurement.ResourceAvailability getLatestAvailability(int resourceId)
          Returns the latest availability for the given Resource
 org.rhq.core.domain.measurement.AvailabilityType getLatestAvailabilityType(org.rhq.core.domain.auth.Subject whoami, int resourceId)
          Returns the latest availability type for the given resource.
 void insertNeededAvailabilityForImportedResources(List<Integer> resourceIds)
          The first time an agent is started and its platform and top-level servers are discovered, the DiscoveryBossBean.mergeInventoryReport(InventoryReport) will use the EntityManager to persist the resource.
 void updateAllResourcesAvailabilitiesForAgent(int agentId, org.rhq.core.domain.measurement.AvailabilityType availabilityType)
          Marks all resources managed by the specified agent as down
 

Method Detail

insertNeededAvailabilityForImportedResources

void insertNeededAvailabilityForImportedResources(List<Integer> resourceIds)
The first time an agent is started and its platform and top-level servers are discovered, the DiscoveryBossBean.mergeInventoryReport(InventoryReport) will use the EntityManager to persist the resource. A PostPersist hook exists on the Resource entity to create a corresponding default ResourceAvailability entity. However, when a platform or top-level server is removed from inventory, the agent might rediscover the resource so quickly that InventoryReport merges the resource instead of persisting new ones, bypassing the PostPersist hook. As a result, this method should be called when resources are imported from the auto-discovery portlet (the InventoryStatus is changed from NEW to COMMITTED, which will add the necessary default ResourceAvailability objects to those resources missing them.

Parameters:
resourceIds - a list of resource ids which should have default ResourceAvailability objects created for them, only if the corresponding data doesn't already exist.

getLatestAvailabilityType

org.rhq.core.domain.measurement.AvailabilityType getLatestAvailabilityType(org.rhq.core.domain.auth.Subject whoami,
                                                                           int resourceId)
Returns the latest availability type for the given resource. This tells you the currently known state of a resource - whether it is UP or DOWN.

Parameters:
whoami - the user asking for the data
resourceId - the id of the resource
Returns:
the latest availability type for the given resource, null if not known

getLatestAvailability

org.rhq.core.domain.measurement.ResourceAvailability getLatestAvailability(int resourceId)
Returns the latest availability for the given Resource

Parameters:
resourceId - the id of the resource
Returns:
the latest availability for the given Resource

updateAllResourcesAvailabilitiesForAgent

void updateAllResourcesAvailabilitiesForAgent(int agentId,
                                              org.rhq.core.domain.measurement.AvailabilityType availabilityType)
Marks all resources managed by the specified agent as down

Parameters:
agentId - the id of the agent


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