org.rhq.enterprise.server.discovery
Class DiscoveryBossBean

java.lang.Object
  extended by org.rhq.enterprise.server.discovery.DiscoveryBossBean
All Implemented Interfaces:
DiscoveryBossLocal, DiscoveryBossRemote

public class DiscoveryBossBean
extends Object
implements DiscoveryBossLocal, DiscoveryBossRemote

SLSB that provides the interface point to the discovery subsystem for the UI layer and the discovery server service.

Author:
Ian Springer, Greg Hinkle

Constructor Summary
DiscoveryBossBean()
           
 
Method Summary
 org.rhq.core.domain.discovery.MergeResourceResponse addResource(org.rhq.core.domain.resource.Resource resource, int creatorSubjectId)
          Adds the specified resource to inventory, *auto-committing it*.
 List<org.rhq.core.domain.resource.Resource> getQueuedPlatformChildServers(org.rhq.core.domain.auth.Subject user, org.rhq.core.domain.resource.InventoryStatus status, org.rhq.core.domain.resource.Resource platform)
          Given a platform resource, this returns all of its child server resources that have been auto-discovered and have the given status.
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.resource.Resource> getQueuedPlatforms(org.rhq.core.domain.auth.Subject user, EnumSet<org.rhq.core.domain.resource.InventoryStatus> statuses, org.rhq.core.domain.util.PageControl pc)
          This returns all platform resources that either have the given status themselves or one or more of their child servers have that status.
 Map<org.rhq.core.domain.resource.Resource,List<org.rhq.core.domain.resource.Resource>> getQueuedPlatformsAndServers(org.rhq.core.domain.auth.Subject user, EnumSet<org.rhq.core.domain.resource.InventoryStatus> statuses, org.rhq.core.domain.util.PageControl pc)
          Like the above method, but can find ignored, commited or both
 Map<org.rhq.core.domain.resource.Resource,List<org.rhq.core.domain.resource.Resource>> getQueuedPlatformsAndServers(org.rhq.core.domain.auth.Subject user, org.rhq.core.domain.util.PageControl pc)
          Returns a map of platforms (the keys) and their servers (the values) that are in the auto-discovery queue but not yet imported into inventory.
 void ignoreResources(org.rhq.core.domain.auth.Subject subject, int[] resourceIds)
          Analogous to the GUI feature Ignore Resources in the auto discovery queue.
 void importResources(org.rhq.core.domain.auth.Subject subject, int[] resourceIds)
          Analogous to the GUI feature Import Resources in the auto discovery queue.
 org.rhq.core.domain.resource.Resource manuallyAddResource(org.rhq.core.domain.auth.Subject subject, int resourceTypeId, int parentResourceId, org.rhq.core.domain.configuration.Configuration pluginConfiguration)
          Manually Add the resource of the specified type to inventory using the specified plugin configuration (i.e.
 org.rhq.core.domain.discovery.MergeResourceResponse manuallyAddResource(org.rhq.core.domain.auth.Subject user, org.rhq.core.domain.resource.ResourceType resourceType, int parentResourceId, org.rhq.core.domain.configuration.Configuration pluginConfiguration)
          Manually add the resource of the specified type to inventory using the specified plugin configuration (i.e.
 org.rhq.core.domain.discovery.ResourceSyncInfo mergeInventoryReport(InventoryReport report)
          When agents send up results from their discovery components (which notifies the server about newly discovered resources), this method will eventually be called in order to process those inventory reports.
 void unignoreResources(org.rhq.core.domain.auth.Subject subject, int[] resourceIds)
          Analogous to the GUI feature Unignore Resources in the auto discovery queue.
 void updateAgentInventoryStatus(List<org.rhq.core.domain.resource.Resource> platforms, List<org.rhq.core.domain.resource.Resource> servers)
          Synchronize the agents inventory status for platforms, and then the servers, omitting servers under synced platforms since they will have been handled already.
 void updateAgentInventoryStatus(String platformsCsvList, String serversCsvList)
           
 void updateInventoryStatus(org.rhq.core.domain.auth.Subject user, org.rhq.core.domain.resource.InventoryStatus status, List<org.rhq.core.domain.resource.Resource> platforms, List<org.rhq.core.domain.resource.Resource> servers)
          Updates statuses according to the inventory rules.
 void updateInventoryStatus(org.rhq.core.domain.auth.Subject user, List<org.rhq.core.domain.resource.Resource> platforms, List<org.rhq.core.domain.resource.Resource> servers, org.rhq.core.domain.resource.InventoryStatus status)
          This method is used to change the inventory status of a set of platforms and servers (e.g.
 boolean updateResourceVersion(int resourceId, String version)
          Updates the version of the specified Resource in inventory, if it is indeed in inventory.
 Set<ResourceUpgradeResponse> upgradeResources(Set<ResourceUpgradeRequest> upgradeRequests)
          Upgrades the data of the resources according to the provided reports.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiscoveryBossBean

public DiscoveryBossBean()
Method Detail

mergeInventoryReport

public org.rhq.core.domain.discovery.ResourceSyncInfo mergeInventoryReport(InventoryReport report)
                                                                    throws InvalidInventoryReportException
Description copied from interface: DiscoveryBossLocal
When agents send up results from their discovery components (which notifies the server about newly discovered resources), this method will eventually be called in order to process those inventory reports.

Specified by:
mergeInventoryReport in interface DiscoveryBossLocal
Parameters:
report - the inventory report to be merged
Returns:
the server's response, which will include the true IDs for new resources that were found
Throws:
InvalidInventoryReportException - if the inventory report is invalid

getQueuedPlatformsAndServers

public Map<org.rhq.core.domain.resource.Resource,List<org.rhq.core.domain.resource.Resource>> getQueuedPlatformsAndServers(org.rhq.core.domain.auth.Subject user,
                                                                                                                           org.rhq.core.domain.util.PageControl pc)
Description copied from interface: DiscoveryBossLocal
Returns a map of platforms (the keys) and their servers (the values) that are in the auto-discovery queue but not yet imported into inventory. Note that only servers whose direct parent is the plaform will appear in the returned data. Embedded servers (i.e. servers that are children of other servers) will be automatically imported when you import their parent server.

Specified by:
getQueuedPlatformsAndServers in interface DiscoveryBossLocal
Parameters:
user - the user that wants to see the data
pc - used to define the size of the returned map - will determine how many platforms are returned
Returns:
the platforms and servers that need to be imported or ignored

getQueuedPlatformsAndServers

public Map<org.rhq.core.domain.resource.Resource,List<org.rhq.core.domain.resource.Resource>> getQueuedPlatformsAndServers(org.rhq.core.domain.auth.Subject user,
                                                                                                                           EnumSet<org.rhq.core.domain.resource.InventoryStatus> statuses,
                                                                                                                           org.rhq.core.domain.util.PageControl pc)
Description copied from interface: DiscoveryBossLocal
Like the above method, but can find ignored, commited or both

Specified by:
getQueuedPlatformsAndServers in interface DiscoveryBossLocal
Parameters:
user - the subject
statuses - the inventory status'
pc - page control
Returns:
the queued platforms and servers

getQueuedPlatforms

public org.rhq.core.domain.util.PageList<org.rhq.core.domain.resource.Resource> getQueuedPlatforms(org.rhq.core.domain.auth.Subject user,
                                                                                                   EnumSet<org.rhq.core.domain.resource.InventoryStatus> statuses,
                                                                                                   org.rhq.core.domain.util.PageControl pc)
Description copied from interface: DiscoveryBossLocal
This returns all platform resources that either have the given status themselves or one or more of their child servers have that status. Use this to find those platforms that need to be shown in the auto-discovery pages (i.e. those that need to be committed to inventory). Can use this to find platforms that have servers that are ignored.

Specified by:
getQueuedPlatforms in interface DiscoveryBossLocal
Parameters:
user - the user that wants to see the data
statuses - the statuses that platform or its child servers must have
pc - pagination controls
Returns:
the platforms
See Also:
DiscoveryBossLocal.getQueuedPlatformChildServers(org.rhq.core.domain.auth.Subject, org.rhq.core.domain.resource.InventoryStatus, org.rhq.core.domain.resource.Resource)

getQueuedPlatformChildServers

public List<org.rhq.core.domain.resource.Resource> getQueuedPlatformChildServers(org.rhq.core.domain.auth.Subject user,
                                                                                 org.rhq.core.domain.resource.InventoryStatus status,
                                                                                 org.rhq.core.domain.resource.Resource platform)
Description copied from interface: DiscoveryBossLocal
Given a platform resource, this returns all of its child server resources that have been auto-discovered and have the given status.

Specified by:
getQueuedPlatformChildServers in interface DiscoveryBossLocal
Parameters:
user - the user that wants to see the data
status - the status that platform or its child servers must have
platform - the resource whose auto-discovered child servers must have the given status
Returns:
the give platform's top-level server children that have the given status

updateInventoryStatus

public void updateInventoryStatus(org.rhq.core.domain.auth.Subject user,
                                  List<org.rhq.core.domain.resource.Resource> platforms,
                                  List<org.rhq.core.domain.resource.Resource> servers,
                                  org.rhq.core.domain.resource.InventoryStatus status)
Description copied from interface: DiscoveryBossLocal
This method is used to change the inventory status of a set of platforms and servers (e.g. when users import new resources into inventory).

Specified by:
updateInventoryStatus in interface DiscoveryBossLocal
Parameters:
user - the user that wants to change the status
platforms - identifies the platforms that are to be updated
servers - identifies the servers that are to be updated
status - the new status the given resources will have

updateAgentInventoryStatus

public void updateAgentInventoryStatus(List<org.rhq.core.domain.resource.Resource> platforms,
                                       List<org.rhq.core.domain.resource.Resource> servers)
Synchronize the agents inventory status for platforms, and then the servers, omitting servers under synced platforms since they will have been handled already. On status change request an agent sync on the affected resources. The agent will sync status and determine what other sync work needs to be performed.

Parameters:
platforms - the inventoried platforms
servers - the inventoried servers

updateAgentInventoryStatus

public void updateAgentInventoryStatus(String platformsCsvList,
                                       String serversCsvList)
Specified by:
updateAgentInventoryStatus in interface DiscoveryBossLocal

updateInventoryStatus

public void updateInventoryStatus(org.rhq.core.domain.auth.Subject user,
                                  org.rhq.core.domain.resource.InventoryStatus status,
                                  List<org.rhq.core.domain.resource.Resource> platforms,
                                  List<org.rhq.core.domain.resource.Resource> servers)
Updates statuses according to the inventory rules. This is used internally - never call this yourself without knowing what you do. See updateInventoryStatus(Subject, List, List, InventoryStatus) for the "public" version.

Specified by:
updateInventoryStatus in interface DiscoveryBossLocal
Parameters:
user - the user that wants to change the status
status - the new status the given resources will have
platforms - identifies the platforms that are to be updated
servers - identifies the servers that are to be updated

manuallyAddResource

public org.rhq.core.domain.resource.Resource manuallyAddResource(org.rhq.core.domain.auth.Subject subject,
                                                                 int resourceTypeId,
                                                                 int parentResourceId,
                                                                 org.rhq.core.domain.configuration.Configuration pluginConfiguration)
                                                          throws Exception
Description copied from interface: DiscoveryBossRemote
Manually Add the resource of the specified type to inventory using the specified plugin configuration (i.e. connection properties). This will not only create a new resource, but it will also ensure the resource component is activated (and thus connects to the managed resource).

Specified by:
manuallyAddResource in interface DiscoveryBossRemote
Parameters:
subject - the user making the request
resourceTypeId - the type of resource to be manually discovered
parentResourceId - the id of the resource that will be the parent of the manually discovered resource
pluginConfiguration - the properties that should be used to connect to the underlying managed resource
Returns:
The resource. Note that the resource may have existed already if given the provided pluginConfiguration leads to a previously defined resource.
Throws:
Exception - if connecting to the underlying managed resource failed due to invalid plugin configuration or if the manual discovery fails for any reason.

manuallyAddResource

@NotNull
public org.rhq.core.domain.discovery.MergeResourceResponse manuallyAddResource(org.rhq.core.domain.auth.Subject user,
                                                                                       org.rhq.core.domain.resource.ResourceType resourceType,
                                                                                       int parentResourceId,
                                                                                       org.rhq.core.domain.configuration.Configuration pluginConfiguration)
                                                                        throws InvalidPluginConfigurationClientException,
                                                                               PluginContainerException
Description copied from interface: DiscoveryBossLocal
Manually add the resource of the specified type to inventory using the specified plugin configuration (i.e. connection properties). This will not only create a new resource, but it will also ensure the resource component is activated (and thus connects to the managed resource). If an error occurs, but the caller can still process the results, the returned object will contain a ResourceError that is associated with the new resource (this occurs when the new resource was created but its component could not be activated).

Specified by:
manuallyAddResource in interface DiscoveryBossLocal
Parameters:
user - the user that wants to add the resource
resourceType - the type of resource to be manually discovered
parentResourceId - the id of the resource that will be the parent of the manually discovered resource
pluginConfiguration - the properties that should be used to connect to the underlying managed resource
Returns:
the newly discovered resource with any associated ResourceError that might have occurred during the activation of the resource
Throws:
InvalidPluginConfigurationClientException - if connecting to the underlying managed resource failed due to an invalid plugin configuration
PluginContainerException - if the manual discovery fails for any other reason

addResource

public org.rhq.core.domain.discovery.MergeResourceResponse addResource(org.rhq.core.domain.resource.Resource resource,
                                                                       int creatorSubjectId)
Description copied from interface: DiscoveryBossLocal
Adds the specified resource to inventory, *auto-committing it*.

Specified by:
addResource in interface DiscoveryBossLocal
Parameters:
resource - the resource to be merged
creatorSubjectId - the user who should be the owner of the new Resource
Returns:
a response containing the merged resource, as well as whether the resource already existed in inventory

updateResourceVersion

public boolean updateResourceVersion(int resourceId,
                                     String version)
Description copied from interface: DiscoveryBossLocal
Updates the version of the specified Resource in inventory, if it is indeed in inventory. If the resource is already in inventory and its version is already version, then this method does nothing and returns true.

Specified by:
updateResourceVersion in interface DiscoveryBossLocal
Parameters:
resourceId - the id of the Resource to be updated
version - the new version
Returns:
true if the Resource was in inventory and its version is now that of version. false if the Resource was not in inventory

upgradeResources

public Set<ResourceUpgradeResponse> upgradeResources(Set<ResourceUpgradeRequest> upgradeRequests)
Description copied from interface: DiscoveryBossLocal
Upgrades the data of the resources according to the provided reports. The server is free to ignore or modify the requests and will provide the true changes made to the resources on the server-side in the result of this method.

Specified by:
upgradeResources in interface DiscoveryBossLocal
Parameters:
upgradeRequests - contains the information about the upgrade of individual resources.
Returns:
details on what resources have been upgraded with what data.

importResources

public void importResources(org.rhq.core.domain.auth.Subject subject,
                            int[] resourceIds)
Description copied from interface: DiscoveryBossRemote
Analogous to the GUI feature Import Resources in the auto discovery queue. Note, to query for Resources with a specific InventoryStatus, see ResourceManagerRemote.findResourcesByCriteria(org.rhq.core.domain.auth.Subject, org.rhq.core.domain.criteria.ResourceCriteria).

Specified by:
importResources in interface DiscoveryBossRemote

ignoreResources

public void ignoreResources(org.rhq.core.domain.auth.Subject subject,
                            int[] resourceIds)
Description copied from interface: DiscoveryBossRemote
Analogous to the GUI feature Ignore Resources in the auto discovery queue. Note, to query for Resources with a specific InventoryStatus, see ResourceManagerRemote.findResourcesByCriteria(org.rhq.core.domain.auth.Subject, org.rhq.core.domain.criteria.ResourceCriteria).

Specified by:
ignoreResources in interface DiscoveryBossRemote

unignoreResources

public void unignoreResources(org.rhq.core.domain.auth.Subject subject,
                              int[] resourceIds)
Description copied from interface: DiscoveryBossRemote
Analogous to the GUI feature Unignore Resources in the auto discovery queue. Note, to query for Resources with a specific InventoryStatus, see ResourceManagerRemote.findResourcesByCriteria(org.rhq.core.domain.auth.Subject, org.rhq.core.domain.criteria.ResourceCriteria).

Specified by:
unignoreResources in interface DiscoveryBossRemote


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