org.rhq.enterprise.server.resource
Class ResourceManagerBean

java.lang.Object
  extended by org.rhq.enterprise.server.resource.ResourceManagerBean
All Implemented Interfaces:
ResourceManagerLocal, ResourceManagerRemote

public class ResourceManagerBean
extends java.lang.Object
implements ResourceManagerLocal, ResourceManagerRemote

A manager that provides methods for creating, updating, deleting, and querying Resources.

Author:
Ian Springer, Joseph Marques, Jay Shaughnessy (delete operations)

Constructor Summary
ResourceManagerBean()
           
 
Method Summary
 void addResourceError(ResourceError resourceError)
          Indicates an error occurred on a resource.
 boolean bulkNamedQueryDeleteInNewTransaction(Subject subject, java.lang.String namedQuery, java.util.List<java.lang.Integer> resourceIds)
           
 boolean bulkNativeQueryDeleteInNewTransaction(Subject subject, java.lang.String nativeQueryString, java.util.List<java.lang.Integer> resourceIds)
           
 void clearResourceConfigError(int resourceId)
          Clears errors of type ResourceErrorType.INVALID_PLUGIN_CONFIGURATION
 void createResource(Subject user, Resource resource, int parentId)
          Create a new Resource.
 java.util.List<java.lang.Integer> deleteResource(Subject user, int resourceId)
          This will delete the resource with the given ID along with all of its child resources.
 void deleteResourceError(Subject user, int resourceErrorId)
          Deletes the given resource error, effectively removing it from its resource's list of errors.
 java.util.List<java.lang.Integer> deleteResources(Subject user, int[] resourceIds)
          This will delete the resources with the given ID along with all of their child resources.
 void deleteSingleResourceInNewTransaction(Subject user, int resourceId)
          Deletes the given resource (but not its children) in a new transaction.
 PageList<Resource> findAvailableResourcesForDashboardPortlet(Subject user, java.lang.Integer typeId, ResourceCategory category, int[] excludeIds, PageControl pageControl)
           
 PageList<Resource> findAvailableResourcesForRepo(Subject user, int repoId, java.lang.String search, ResourceCategory category, PageControl pageControl)
           
 PageList<Resource> findAvailableResourcesForResourceGroup(Subject user, int groupId, ResourceType type, ResourceCategory category, java.lang.String nameFilter, int[] excludeIds, PageControl pageControl)
           
 java.util.List<AutoGroupComposite> findChildrenAutoGroups(Subject user, int parentResourceId)
           
 java.util.List<AutoGroupComposite> findChildrenAutoGroups(Subject user, int parentResourceId, int[] resourceTypeIds)
           
 java.util.List<java.lang.Integer> findChildrenResourceIds(int parentResourceId, InventoryStatus status)
           
 PageList<Resource> findChildResources(Subject subject, int parentResourceId, PageControl pageControl)
           
 PageList<Resource> findChildResources(Subject user, Resource parent, PageControl pageControl)
           
 PageList<Resource> findChildResourcesByCategoryAndInventoryStatus(Subject user, Resource parent, ResourceCategory category, InventoryStatus status, PageControl pageControl)
           
 java.util.List<java.lang.Integer> findExplicitResourceIdsByResourceGroup(int resourceGroupId)
           
 PageList<Resource> findExplicitResourcesByResourceGroup(Subject user, ResourceGroup group, PageControl pageControl)
           
 PageList<ResourceWithAvailability> findExplicitResourceWithAvailabilityByResourceGroup(Subject subject, ResourceGroup group, PageControl pageControl)
           
 java.util.List<ResourceIdFlyWeight> findFlyWeights(int[] resourceIds)
           
 java.util.List<java.lang.Integer> findImplicitResourceIdsByResourceGroup(int resourceGroupId)
           
 PageList<Resource> findImplicitResourcesByResourceGroup(Subject user, ResourceGroup group, PageControl pageControl)
           
 PageList<ResourceWithAvailability> findImplicitResourceWithAvailabilityByResourceGroup(Subject subject, ResourceGroup group, PageControl pageControl)
           
 java.util.List<RecentlyAddedResourceComposite> findRecentlyAddedPlatforms(Subject user, long ctime, int maxItems)
          Gets a list of platforms that were recently added (committed) to inventory.
 java.util.List<RecentlyAddedResourceComposite> findRecentlyAddedServers(Subject user, long ctime, int platformId)
          Gets a list of servers that are children of the given platform that were recently added (committed) to inventory.
 PageList<Resource> findResourceByIds(Subject subject, int[] resourceIds, boolean attachParentResource, PageControl pageControl)
           
 PageList<Resource> findResourceByParentAndInventoryStatus(Subject user, Resource parent, InventoryStatus inventoryStatus, PageControl pageControl)
           
 PageList<ResourceComposite> findResourceCompositeForParentAndTypeAndCategory(Subject user, ResourceCategory category, int resourceTypeId, Resource parentResource, PageControl pageControl)
          Get a Resource Composite for Resources limited by the given parameters
 PageList<ResourceComposite> findResourceComposites(Subject user, ResourceCategory category, java.lang.String typeName, int parentResourceId, java.lang.String searchString, PageControl pageControl)
           
 PageList<ResourceComposite> findResourceComposites(Subject user, ResourceCategory category, java.lang.String typeName, java.lang.String pluginName, Resource parentResource, java.lang.String searchString, boolean attachParentResource, PageControl pageControl)
          This finder query can be used to find resources with various combinations of attributes in their composite form.
 java.util.List<ResourceError> findResourceErrors(Subject user, int resourceId, ResourceErrorType errorType)
          Returns the errors of the given type that have occurred for the given resource.
 PageList<ResourceHealthComposite> findResourceHealth(Subject user, int[] resourceIds, PageControl pc)
          Gets the "health" of a set of resources, where the health composite gives you the resource's availability status and the number of alerts it has emitted.
 java.util.List<ResourceInstallCount> findResourceInstallCounts(Subject subject, boolean groupByVersions)
           
 java.util.List<Resource> findResourceLineage(Subject subject, int resourceId)
          #see {@link ResourceManagerRemote#findResourceLineage(Subject, int)
 java.util.List<AutoGroupComposite> findResourcesAutoGroups(Subject subject, int[] resourceIds)
           
 java.util.List<Resource> findResourcesByAgent(Subject user, int agentId, PageControl unlimitedInstance)
          Load the entire list of resources under an agent.
 PageList<Resource> findResourcesByCategory(Subject user, ResourceCategory category, InventoryStatus inventoryStatus, PageControl pageControl)
           
 java.util.List<Resource> findResourcesByCompatibleGroup(Subject user, int compatibleGroupId, PageControl pageControl)
           
 PageList<Resource> findResourcesByCriteria(Subject subject, ResourceCriteria criteria)
           
 java.util.List<ResourceWithAvailability> findResourcesByParentAndType(Subject user, Resource parent, ResourceType type)
           
 PageList<Resource> findResourcesByType(Subject user, ResourceType resourceType, PageControl pageControl)
           
 java.util.List<java.lang.Integer> findResourcesMarkedForAsyncDeletion(Subject user)
           
 ResourceAvailabilitySummary getAvailabilitySummary(Subject user, int resourceId)
           
 ResourceAvailability getLiveResourceAvailability(Subject subject, int resourceId)
          #see {@link ResourceManagerRemote#getLiveResourceAvailability(Subject, int)
 Resource getParentResource(int resourceId)
          Returns the parent of the Resource with the specified id, or null if the Resource does not have a parent (i.e.
 Resource getParentResource(Subject subject, int resourceId)
           
 Resource getPlatform(Agent agent)
          Returns the platform Resource associated with the specified Agent.
 Resource getResource(Subject subject, int resourceId)
          #see {@link ResourceManagerRemote#getResource(Subject, int)
 AutoGroupComposite getResourceAutoGroup(Subject user, int resourceId)
           
 Resource getResourceById(Subject user, int resourceId)
           
 Resource getResourceByParentAndKey(Subject user, Resource parent, java.lang.String key, java.lang.String plugin, java.lang.String typeName)
           
 int getResourceCountByCategory(Subject user, ResourceCategory category, InventoryStatus status)
           
 int getResourceCountByTypeAndIds(Subject user, ResourceType type, int[] resourceIds)
           
 java.util.List<java.lang.Integer> getResourceIdLineage(int resourceId)
           
 java.util.List<Resource> getResourceLineage(int resourceId)
          Returns the lineage of the Resource with the specified id.
 java.util.Map<java.lang.Integer,InventoryStatus> getResourceStatuses(int rootResourceId, boolean descendents)
           
 Resource getResourceTree(int rootResourceId, boolean recursive)
           
 Resource getRootResourceForResource(int resourceId)
          Looks up the root of a subtree in the inventory.
 Resource setResourceStatus(Subject user, Resource resource, InventoryStatus newStatus, boolean setDescendents)
          Changes the inventory status of the specified resource and optionally its descendants to the provided inventory status if the user is authorized to do so.
 void uninventoryResources(Subject subject, int[] resourceIds)
          #see {@link ResourceManagerRemote#uninventoryResources(Subject, int)
 Resource updateResource(Subject user, Resource resource)
          Update an existing Resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceManagerBean

public ResourceManagerBean()
Method Detail

createResource

public void createResource(Subject user,
                           Resource resource,
                           int parentId)
                    throws ResourceAlreadyExistsException
Description copied from interface: ResourceManagerLocal
Create a new Resource.

Specified by:
createResource in interface ResourceManagerLocal
Parameters:
user - the user creating the resource
resource - the resource to be created
parentId - set to -1 to imply that this is a root resource, which has no parent
Throws:
ResourceAlreadyExistsException - if an equivalent resource already exists

updateResource

public Resource updateResource(Subject user,
                               Resource resource)
Description copied from interface: ResourceManagerLocal
Update an existing Resource.

Specified by:
updateResource in interface ResourceManagerLocal
Parameters:
user - the user updating the resource
resource - the resource to be updated
Returns:
the updated (attached) resource

deleteResources

public java.util.List<java.lang.Integer> deleteResources(Subject user,
                                                         int[] resourceIds)
Description copied from interface: ResourceManagerLocal
This will delete the resources with the given ID along with all of their child resources. This method will not create its own transaction; each individual child resource as well as the top level resources identified with the given IDs will be deleted in their own transaction. This will ensure that resources are deleting in the proper order (for example, if a given resource is actually a child of one of the other given resources, this method ensures the deletion occurs properly).

Specified by:
deleteResources in interface ResourceManagerLocal
Parameters:
user - the user deleting the resource
resourceIds - the ID of the resource to be deleted
Returns:
the list of all resources that were deleted - in effect, this will contain resourceIds and their childrens' IDs

deleteResource

public java.util.List<java.lang.Integer> deleteResource(Subject user,
                                                        int resourceId)
Description copied from interface: ResourceManagerLocal
This will delete the resource with the given ID along with all of its child resources. This method will not create its own transaction; each individual child resource as well as the top level resource identified with the given ID will be deleted in its own transaction.

Specified by:
deleteResource in interface ResourceManagerLocal
Parameters:
user - the user deleting the resource
resourceId - the ID of the resource to be deleted
Returns:
the list of all resources that were deleted - in effect, this will contain resourceId and its children's IDs

deleteSingleResourceInNewTransaction

public void deleteSingleResourceInNewTransaction(Subject user,
                                                 int resourceId)
Description copied from interface: ResourceManagerLocal
Deletes the given resource (but not its children) in a new transaction. This is normally used only within this manager bean itself. Clients normally should call ResourceManagerLocal.deleteResource(Subject, int). If you call this method, make sure you have a specific reason for it; check to see if calling ResourceManagerLocal.deleteResource(Subject, int) would not be more appropriate.

Specified by:
deleteSingleResourceInNewTransaction in interface ResourceManagerLocal
Parameters:
user - the user deleting the resource

bulkNativeQueryDeleteInNewTransaction

public boolean bulkNativeQueryDeleteInNewTransaction(Subject subject,
                                                     java.lang.String nativeQueryString,
                                                     java.util.List<java.lang.Integer> resourceIds)
Specified by:
bulkNativeQueryDeleteInNewTransaction in interface ResourceManagerLocal

bulkNamedQueryDeleteInNewTransaction

public boolean bulkNamedQueryDeleteInNewTransaction(Subject subject,
                                                    java.lang.String namedQuery,
                                                    java.util.List<java.lang.Integer> resourceIds)
Specified by:
bulkNamedQueryDeleteInNewTransaction in interface ResourceManagerLocal

setResourceStatus

public Resource setResourceStatus(Subject user,
                                  Resource resource,
                                  InventoryStatus newStatus,
                                  boolean setDescendents)
Description copied from interface: ResourceManagerLocal
Changes the inventory status of the specified resource and optionally its descendants to the provided inventory status if the user is authorized to do so.

Specified by:
setResourceStatus in interface ResourceManagerLocal
Parameters:
user - user doing the resource status changing
resource - the Resource to change
newStatus - the new status to change it to
setDescendents - if true, all descendent resources will also have their status set
Returns:
an updated copy of the resource

getResourceById

public Resource getResourceById(Subject user,
                                int resourceId)
Specified by:
getResourceById in interface ResourceManagerLocal

getResourceByParentAndKey

@Nullable
public Resource getResourceByParentAndKey(Subject user,
                                                   Resource parent,
                                                   java.lang.String key,
                                                   java.lang.String plugin,
                                                   java.lang.String typeName)
Specified by:
getResourceByParentAndKey in interface ResourceManagerLocal
Returns:
the resource, or null if no such resource exists

findResourcesByParentAndType

public java.util.List<ResourceWithAvailability> findResourcesByParentAndType(Subject user,
                                                                             Resource parent,
                                                                             ResourceType type)
Specified by:
findResourcesByParentAndType in interface ResourceManagerLocal

getParentResource

@Nullable
public Resource getParentResource(int resourceId)
Description copied from interface: ResourceManagerLocal
Returns the parent of the Resource with the specified id, or null if the Resource does not have a parent (i.e. is a platform).

Specified by:
getParentResource in interface ResourceManagerLocal
Parameters:
resourceId - the id of a Resource in inventory
Returns:
the parent of the Resource with the specified id, or null if the Resource does not have a parent

getResourceIdLineage

public java.util.List<java.lang.Integer> getResourceIdLineage(int resourceId)
Specified by:
getResourceIdLineage in interface ResourceManagerLocal

getResourceLineage

public java.util.List<Resource> getResourceLineage(int resourceId)
Description copied from interface: ResourceManagerLocal
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.

Specified by:
getResourceLineage in interface ResourceManagerLocal
Parameters:
resourceId - the id of a Resource in inventory
Returns:
the lineage of the Resource with the specified id

getRootResourceForResource

@NotNull
public Resource getRootResourceForResource(int resourceId)
Description copied from interface: ResourceManagerLocal
Looks up the root of a subtree in the inventory. This will generally find the platform on which a resource is running.

Specified by:
getRootResourceForResource in interface ResourceManagerLocal
Parameters:
resourceId - the resource to find the root parent of
Returns:
the root of the supplied resource's tree

findResourceByParentAndInventoryStatus

public PageList<Resource> findResourceByParentAndInventoryStatus(Subject user,
                                                                 Resource parent,
                                                                 InventoryStatus inventoryStatus,
                                                                 PageControl pageControl)
Specified by:
findResourceByParentAndInventoryStatus in interface ResourceManagerLocal

findChildResources

public PageList<Resource> findChildResources(Subject user,
                                             Resource parent,
                                             PageControl pageControl)

findChildrenResourceIds

public java.util.List<java.lang.Integer> findChildrenResourceIds(int parentResourceId,
                                                                 InventoryStatus status)
Specified by:
findChildrenResourceIds in interface ResourceManagerLocal

findChildResourcesByCategoryAndInventoryStatus

public PageList<Resource> findChildResourcesByCategoryAndInventoryStatus(Subject user,
                                                                         Resource parent,
                                                                         ResourceCategory category,
                                                                         InventoryStatus status,
                                                                         PageControl pageControl)
Specified by:
findChildResourcesByCategoryAndInventoryStatus in interface ResourceManagerLocal

findResourcesByCategory

public PageList<Resource> findResourcesByCategory(Subject user,
                                                  ResourceCategory category,
                                                  InventoryStatus inventoryStatus,
                                                  PageControl pageControl)
Specified by:
findResourcesByCategory in interface ResourceManagerLocal
See Also:
ResourceManagerRemote#findResourcesByCategory(Subject, ResourceCategory, InventoryStatus, PageControl)

findResourceComposites

public PageList<ResourceComposite> findResourceComposites(Subject user,
                                                          ResourceCategory category,
                                                          java.lang.String typeName,
                                                          int parentResourceId,
                                                          java.lang.String searchString,
                                                          PageControl pageControl)
Specified by:
findResourceComposites in interface ResourceManagerLocal
Specified by:
findResourceComposites in interface ResourceManagerRemote

findResourceComposites

public PageList<ResourceComposite> findResourceComposites(Subject user,
                                                          ResourceCategory category,
                                                          java.lang.String typeName,
                                                          java.lang.String pluginName,
                                                          Resource parentResource,
                                                          java.lang.String searchString,
                                                          boolean attachParentResource,
                                                          PageControl pageControl)
This finder query can be used to find resources with various combinations of attributes in their composite form. Except for the user parameter, the other parameters can be left null so that the query will not filter by that attribute.

Specified by:
findResourceComposites in interface ResourceManagerLocal
Parameters:
user -
category - Limit the search to a given ResourceCategory
type - Limit the search to to a given ResourceType
parentResource - Limit the search to children of a given parent resource
searchString -
pageControl -
Returns:
See Also:
ResourceManagerRemote.findResourceComposites(Subject, ResourceCategory, String, int, String, PageControl)

findResourceCompositeForParentAndTypeAndCategory

public PageList<ResourceComposite> findResourceCompositeForParentAndTypeAndCategory(Subject user,
                                                                                    ResourceCategory category,
                                                                                    int resourceTypeId,
                                                                                    Resource parentResource,
                                                                                    PageControl pageControl)
Get a Resource Composite for Resources limited by the given parameters

Specified by:
findResourceCompositeForParentAndTypeAndCategory in interface ResourceManagerLocal
Parameters:
user - User executing the query
category - Category this query should be limited to
resourceTypeId - the PK of the desired resource type or -1 if no limit
parentResource - the desired parent resource or null if no limit
pageControl -
Returns:

findResourcesByType

public PageList<Resource> findResourcesByType(Subject user,
                                              ResourceType resourceType,
                                              PageControl pageControl)

getResourceCountByCategory

public int getResourceCountByCategory(Subject user,
                                      ResourceCategory category,
                                      InventoryStatus status)
Specified by:
getResourceCountByCategory in interface ResourceManagerLocal

getResourceCountByTypeAndIds

public int getResourceCountByTypeAndIds(Subject user,
                                        ResourceType type,
                                        int[] resourceIds)
Specified by:
getResourceCountByTypeAndIds in interface ResourceManagerLocal

findResourcesMarkedForAsyncDeletion

public java.util.List<java.lang.Integer> findResourcesMarkedForAsyncDeletion(Subject user)
Specified by:
findResourcesMarkedForAsyncDeletion in interface ResourceManagerLocal

findRecentlyAddedPlatforms

public java.util.List<RecentlyAddedResourceComposite> findRecentlyAddedPlatforms(Subject user,
                                                                                 long ctime,
                                                                                 int maxItems)
Description copied from interface: ResourceManagerLocal
Gets a list of platforms that were recently added (committed) to inventory.

Specified by:
findRecentlyAddedPlatforms in interface ResourceManagerLocal
ctime - the oldest time (epoch mills) that a platform had to have been added for it to be returned
maxItems - the maximum number of items to return within the timeframe
Returns:
list of all platforms that were added since or at ctime

findRecentlyAddedServers

public java.util.List<RecentlyAddedResourceComposite> findRecentlyAddedServers(Subject user,
                                                                               long ctime,
                                                                               int platformId)
Description copied from interface: ResourceManagerLocal
Gets a list of servers that are children of the given platform that were recently added (committed) to inventory.

Specified by:
findRecentlyAddedServers in interface ResourceManagerLocal
ctime - the oldest time (epoch mills) that a server had to have been added for it to be returned
Returns:
list of all servers (that are children of the given platforms) that were added since or at ctime

getResourceAutoGroup

public AutoGroupComposite getResourceAutoGroup(Subject user,
                                               int resourceId)
Specified by:
getResourceAutoGroup in interface ResourceManagerLocal

findResourcesAutoGroups

public java.util.List<AutoGroupComposite> findResourcesAutoGroups(Subject subject,
                                                                  int[] resourceIds)
Specified by:
findResourcesAutoGroups in interface ResourceManagerLocal

findChildrenAutoGroups

@NotNull
public java.util.List<AutoGroupComposite> findChildrenAutoGroups(Subject user,
                                                                         int parentResourceId,
                                                                         int[] resourceTypeIds)
Specified by:
findChildrenAutoGroups in interface ResourceManagerLocal

findChildrenAutoGroups

public java.util.List<AutoGroupComposite> findChildrenAutoGroups(Subject user,
                                                                 int parentResourceId)
Specified by:
findChildrenAutoGroups in interface ResourceManagerLocal

findExplicitResourcesByResourceGroup

public PageList<Resource> findExplicitResourcesByResourceGroup(Subject user,
                                                               ResourceGroup group,
                                                               PageControl pageControl)
Specified by:
findExplicitResourcesByResourceGroup in interface ResourceManagerLocal

findExplicitResourceIdsByResourceGroup

public java.util.List<java.lang.Integer> findExplicitResourceIdsByResourceGroup(int resourceGroupId)
Specified by:
findExplicitResourceIdsByResourceGroup in interface ResourceManagerLocal

findImplicitResourceIdsByResourceGroup

public java.util.List<java.lang.Integer> findImplicitResourceIdsByResourceGroup(int resourceGroupId)
Specified by:
findImplicitResourceIdsByResourceGroup in interface ResourceManagerLocal

findFlyWeights

public java.util.List<ResourceIdFlyWeight> findFlyWeights(int[] resourceIds)
Specified by:
findFlyWeights in interface ResourceManagerLocal

findImplicitResourcesByResourceGroup

public PageList<Resource> findImplicitResourcesByResourceGroup(Subject user,
                                                               ResourceGroup group,
                                                               PageControl pageControl)
Specified by:
findImplicitResourcesByResourceGroup in interface ResourceManagerLocal

findExplicitResourceWithAvailabilityByResourceGroup

public PageList<ResourceWithAvailability> findExplicitResourceWithAvailabilityByResourceGroup(Subject subject,
                                                                                              ResourceGroup group,
                                                                                              PageControl pageControl)
Specified by:
findExplicitResourceWithAvailabilityByResourceGroup in interface ResourceManagerLocal

findImplicitResourceWithAvailabilityByResourceGroup

public PageList<ResourceWithAvailability> findImplicitResourceWithAvailabilityByResourceGroup(Subject subject,
                                                                                              ResourceGroup group,
                                                                                              PageControl pageControl)
Specified by:
findImplicitResourceWithAvailabilityByResourceGroup in interface ResourceManagerLocal

findResourceHealth

public PageList<ResourceHealthComposite> findResourceHealth(Subject user,
                                                            int[] resourceIds,
                                                            PageControl pc)
Description copied from interface: ResourceManagerLocal
Gets the "health" of a set of resources, where the health composite gives you the resource's availability status and the number of alerts it has emitted. Note that even though this takes a subject - it is assumed the caller is authorized to see the given resources and no authz checks will be made. This method takes a subject in case, in the future, we decide this implementation needs to perform authz checks.

This method is here to support the favorites portlet in the dashboard, where the favorites are stored as user preferences - and they can't make it into the preferences unless the user had access to see those resources in the first place, hence, no additional authorizations need to be made here.

Specified by:
findResourceHealth in interface ResourceManagerLocal
Returns:
the health information on the resources

findAvailableResourcesForResourceGroup

public PageList<Resource> findAvailableResourcesForResourceGroup(Subject user,
                                                                 int groupId,
                                                                 ResourceType type,
                                                                 ResourceCategory category,
                                                                 java.lang.String nameFilter,
                                                                 int[] excludeIds,
                                                                 PageControl pageControl)
Specified by:
findAvailableResourcesForResourceGroup in interface ResourceManagerLocal

findAvailableResourcesForRepo

public PageList<Resource> findAvailableResourcesForRepo(Subject user,
                                                        int repoId,
                                                        java.lang.String search,
                                                        ResourceCategory category,
                                                        PageControl pageControl)
Specified by:
findAvailableResourcesForRepo in interface ResourceManagerLocal

findAvailableResourcesForDashboardPortlet

public PageList<Resource> findAvailableResourcesForDashboardPortlet(Subject user,
                                                                    java.lang.Integer typeId,
                                                                    ResourceCategory category,
                                                                    int[] excludeIds,
                                                                    PageControl pageControl)
Specified by:
findAvailableResourcesForDashboardPortlet in interface ResourceManagerLocal

findResourceByIds

public PageList<Resource> findResourceByIds(Subject subject,
                                            int[] resourceIds,
                                            boolean attachParentResource,
                                            PageControl pageControl)
Specified by:
findResourceByIds in interface ResourceManagerLocal

getResourceTree

public Resource getResourceTree(int rootResourceId,
                                boolean recursive)
Specified by:
getResourceTree in interface ResourceManagerLocal
See Also:
ResourceManagerRemote#getResourceTree(int)

findResourceErrors

@NotNull
public java.util.List<ResourceError> findResourceErrors(Subject user,
                                                                int resourceId,
                                                                ResourceErrorType errorType)
Description copied from interface: ResourceManagerLocal
Returns the errors of the given type that have occurred for the given resource.

Specified by:
findResourceErrors in interface ResourceManagerLocal
Parameters:
user - the user asking to see the errors
resourceId - the resource whose errors are to be returned
errorType - the type of errors to return
Returns:
the list of resource errors

addResourceError

public void addResourceError(ResourceError resourceError)
Description copied from interface: ResourceManagerLocal
Indicates an error occurred on a resource. The given error will be associated with the resource found in the error.

Specified by:
addResourceError in interface ResourceManagerLocal
Parameters:
resourceError - encapsulates all information about the error

clearResourceConfigError

public void clearResourceConfigError(int resourceId)
Description copied from interface: ResourceManagerLocal
Clears errors of type ResourceErrorType.INVALID_PLUGIN_CONFIGURATION

Specified by:
clearResourceConfigError in interface ResourceManagerLocal
Parameters:
resourceId - id of the resource

deleteResourceError

public void deleteResourceError(Subject user,
                                int resourceErrorId)
Description copied from interface: ResourceManagerLocal
Deletes the given resource error, effectively removing it from its resource's list of errors.

Specified by:
deleteResourceError in interface ResourceManagerLocal
Parameters:
user - the user deleting the resource error
resourceErrorId - identifies the resource error to delete

getResourceStatuses

public java.util.Map<java.lang.Integer,InventoryStatus> getResourceStatuses(int rootResourceId,
                                                                            boolean descendents)
Specified by:
getResourceStatuses in interface ResourceManagerLocal

getPlatform

public Resource getPlatform(Agent agent)
Description copied from interface: ResourceManagerLocal
Returns the platform Resource associated with the specified Agent.

Specified by:
getPlatform in interface ResourceManagerLocal
Parameters:
agent - an Agent
Returns:
the platform Resource associated with the specified Agent

getAvailabilitySummary

public ResourceAvailabilitySummary getAvailabilitySummary(Subject user,
                                                          int resourceId)
Specified by:
getAvailabilitySummary in interface ResourceManagerLocal

findResourcesByAgent

public java.util.List<Resource> findResourcesByAgent(Subject user,
                                                     int agentId,
                                                     PageControl unlimitedInstance)
Description copied from interface: ResourceManagerLocal
Load the entire list of resources under an agent. Tries to do so in as few queries as possible while prefectching the information necessary to create a tree view of the platform inventory. This includes resource type and subcategory information as well as current availability and structure. This method also returns placesholder LockedResourcerce objects for resources that a user should not have visibility to in order to keep the tree a directed graph.

Specified by:
findResourcesByAgent in interface ResourceManagerLocal
Parameters:
user - user accessing the tree
agentId - the agent id of the platform to return inventory for
unlimitedInstance - the filter for the resources
Returns:
the list of all resources on a platform

findResourcesByCompatibleGroup

public java.util.List<Resource> findResourcesByCompatibleGroup(Subject user,
                                                               int compatibleGroupId,
                                                               PageControl pageControl)
Specified by:
findResourcesByCompatibleGroup in interface ResourceManagerLocal

getResource

public Resource getResource(Subject subject,
                            int resourceId)
Description copied from interface: ResourceManagerLocal
#see {@link ResourceManagerRemote#getResource(Subject, int)

Specified by:
getResource in interface ResourceManagerLocal
Specified by:
getResource in interface ResourceManagerRemote
Parameters:
subject - The logged in user's subject.
resourceId - the id of a Resource in inventory.
Returns:
the resource

getLiveResourceAvailability

public ResourceAvailability getLiveResourceAvailability(Subject subject,
                                                        int resourceId)
Description copied from interface: ResourceManagerLocal
#see {@link ResourceManagerRemote#getLiveResourceAvailability(Subject, int)

Specified by:
getLiveResourceAvailability in interface ResourceManagerLocal
Specified by:
getLiveResourceAvailability in interface ResourceManagerRemote
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.

findResourceLineage

public java.util.List<Resource> findResourceLineage(Subject subject,
                                                    int resourceId)
Description copied from interface: ResourceManagerLocal
#see {@link ResourceManagerRemote#findResourceLineage(Subject, int)

Specified by:
findResourceLineage in interface ResourceManagerLocal
Specified by:
findResourceLineage in interface ResourceManagerRemote
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

uninventoryResources

public void uninventoryResources(Subject subject,
                                 int[] resourceIds)
Description copied from interface: ResourceManagerLocal
#see {@link ResourceManagerRemote#uninventoryResources(Subject, int)

Specified by:
uninventoryResources in interface ResourceManagerLocal
Specified by:
uninventoryResources in interface ResourceManagerRemote
Parameters:
subject - The logged in user's subject.
resourceIds - The resources to uninventory.

findResourceInstallCounts

public java.util.List<ResourceInstallCount> findResourceInstallCounts(Subject subject,
                                                                      boolean groupByVersions)
Specified by:
findResourceInstallCounts in interface ResourceManagerLocal

findResourcesByCriteria

public PageList<Resource> findResourcesByCriteria(Subject subject,
                                                  ResourceCriteria criteria)
Specified by:
findResourcesByCriteria in interface ResourceManagerLocal
Specified by:
findResourcesByCriteria in interface ResourceManagerRemote

getParentResource

public Resource getParentResource(Subject subject,
                                  int resourceId)
Specified by:
getParentResource in interface ResourceManagerLocal
Specified by:
getParentResource in interface ResourceManagerRemote

findChildResources

public PageList<Resource> findChildResources(Subject subject,
                                             int parentResourceId,
                                             PageControl pageControl)
Specified by:
findChildResources in interface ResourceManagerLocal
Specified by:
findChildResources in interface ResourceManagerRemote


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