org.rhq.enterprise.server.resource
Interface ResourceManagerRemote

All Known Subinterfaces:
WebservicesRemote

public interface ResourceManagerRemote


Method Summary
 List<Integer> disableResources(Subject subject, int[] resourceIds)
          Set these resources to AvailabilityType.DISABLED.
 List<Integer> enableResources(Subject subject, int[] resourceIds)
          Set these resources enabled.
 PageList<Resource> findChildResources(Subject subject, int resourceId, PageControl pageControl)
           
 List<Resource> findResourceLineage(Subject subject, int resourceId)
          Returns the lineage of the Resource with the specified id.
 PageList<Resource> findResourcesByCriteria(Subject subject, ResourceCriteria criteria)
           
 ResourceAvailabilitySummary getAvailabilitySummary(Subject subject, int resourceId)
          Returns a summary object that provides information about a resource's past availability history.
 ResourceAvailability getLiveResourceAvailability(Subject subject, int resourceId)
          Returns the availability of the resource with the specified id.
 Resource getParentResource(Subject subject, int resourceId)
           
 Resource getResource(Subject subject, int resourceId)
          Returns the Resource with the specified id.
 Map<Integer,String> getResourcesAncestry(Subject subject, Integer[] resourceIds, ResourceAncestryFormat format)
          Resource.ancestry is an encoded value that holds the resource's parental ancestry.
 List<Integer> uninventoryResources(Subject subject, int[] resourceIds)
          Removes these resources from inventory.
 Resource updateResource(Subject subject, Resource resource)
          Update resource's editable properties (name, description, location).
 

Method Detail

getAvailabilitySummary

ResourceAvailabilitySummary getAvailabilitySummary(Subject subject,
                                                   int resourceId)
Returns a summary object that provides information about a resource's past availability history.

Parameters:
subject -
resourceId -
Returns:
summary POJO

getLiveResourceAvailability

ResourceAvailability getLiveResourceAvailability(Subject subject,
                                                 int resourceId)
Returns the availability of the resource with the specified id. This performs a live check - a resource will be considered UNKNOWN if the agent cannot be contacted for any reason.

Parameters:
subject - The logged in user's subject.
resourceId - the id of a Resource in inventory.
Returns:
the resource availability - note that if the encapsulated availability type is null, the resource availability is UNKNOWN. As of RHQ 4.4 this does not return null but rather AvailabilityType.UNKNOWN.
Throws:
FetchException - if the resource represented by the resourceId parameter does not exist, or if the passed subject does not have permission to view this resource.

getResource

Resource getResource(Subject subject,
                     int resourceId)
Returns the Resource with the specified id.

Parameters:
subject - The logged in user's subject.
resourceId - the id of a Resource in inventory.
Returns:
the resource
Throws:
FetchException - if the resource represented by the resourceId parameter does not exist, or if the passed subject does not have permission to view this resource.

findResourceLineage

List<Resource> findResourceLineage(Subject subject,
                                   int resourceId)
Returns the lineage of the Resource with the specified id. The lineage is represented as a List of Resources, with the first item being the root of the Resource's ancestry (or the Resource itself if it is a root Resource (i.e. a platform)) and the last item being the Resource itself. Since the lineage includes the Resource itself, the returned List will always contain at least one item.

Parameters:
subject - The logged in user's subject.
resourceId - the id of a Resource in inventory
Returns:
the lineage of the Resource with the specified id
Throws:
FetchException - on any issue. Wraps ResourceNotFoundException when necessary.

updateResource

Resource updateResource(Subject subject,
                        Resource resource)
Update resource's editable properties (name, description, location).

Parameters:
user - the logged in user
resource - the resource to update
Returns:
the updated resource

uninventoryResources

List<Integer> uninventoryResources(Subject subject,
                                   int[] resourceIds)
Removes these resources from inventory. The resources may subsequently be rediscovered. Note that for each specified resource all children will also be removed, it it not necessary or recommended to specify more than one resource in the same ancestry line.

Parameters:
subject - The logged in user's subject.
resourceIds - The resources to uninventory.

findResourcesByCriteria

PageList<Resource> findResourcesByCriteria(Subject subject,
                                           ResourceCriteria criteria)

findChildResources

PageList<Resource> findChildResources(Subject subject,
                                      int resourceId,
                                      PageControl pageControl)

getParentResource

Resource getParentResource(Subject subject,
                           int resourceId)

getResourcesAncestry

Map<Integer,String> getResourcesAncestry(Subject subject,
                                         Integer[] resourceIds,
                                         ResourceAncestryFormat format)
Resource.ancestry is an encoded value that holds the resource's parental ancestry. It is not suitable for display. This method can be used to get decoded and formatted ancestry values for a set of resources. A typical usage would a criteria resource fetch, and then a subsequent call to this method for ancestry display, potentially for resource disambiguation purposes.

Parameters:
subject -
resourceIds -
format -
Returns:
A Map of ResourceIds to FormattedAncestryStrings, one entry for each unique, valid, resourceId passed in.

disableResources

List<Integer> disableResources(Subject subject,
                               int[] resourceIds)
Set these resources to AvailabilityType.DISABLED. While disabled resource availability reported from the agent is ignored. This is typically used for resources undergoing scheduled maintenance or whose avail state should be disregarded fo some period.

The calling user must possess Permission.DELETE permission on all of the provided resources.

Resources already disabled are ignored.

Parameters:
subject - The logged in user's subject.
resourceIds - The resources to uninventory.
See Also:
enableResources(Subject, int[])

enableResources

List<Integer> enableResources(Subject subject,
                              int[] resourceIds)
Set these resources enabled. Resources already enabled are ignored. The availability will be set to UNKNOWN until the agent reports a new, live, availability. The agent will be requested to check availability for the enabled resources at its earliest convenience.

The calling user must possess Permission.DELETE permission on all of the provided resources.

Parameters:
subject - The logged in user's subject.
resourceIds - The resources to uninventory.
See Also:
disableResources(Subject, int[])


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