org.rhq.core.pluginapi.inventory
Class DiscoveredResourceDetails

java.lang.Object
  extended by org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails

public class DiscoveredResourceDetails
extends Object

This contains all the details for a resource that was discovered by a ResourceDiscoveryComponent.

Note that any newly discovered resource must have a unique resource key as compared to other sibling resources. That is to say, a parent resource's children must have unique resource keys (the children cannot share keys). A corollary to this is that if a discovery component "re-discovers" a resource, the discovery component must ensure that it assigns the same key to that re-discovered resource (i.e. resource keys must be consistent and stable across multiple discoveries of that same resource). As an example, if you discover a resource "foo" and assign it a resource key of "fooKey"; then the next time that "foo" resource is discovered again, the discovery component must ensure that it discovers it with the resource key "fooKey" again.


Constructor Summary
DiscoveredResourceDetails(ResourceType resourceType, String resourceKey, String resourceName, String resourceVersion, String resourceDescription, Configuration pluginConfiguration, ProcessInfo processInfo)
          This creates a new instance that provides details for a newly discovered resource.
 
Method Summary
 boolean equals(Object o)
           
 Configuration getPluginConfiguration()
          Returns the discovered resource's plugin configuration.
 ProcessInfo getProcessInfo()
          Returns the information on the operating system process in which the resource is running.
 String getResourceDescription()
          Gets the simple description of the resource, which may or may not be an internationalized string
 String getResourceKey()
          The discovered resource's key where the key must be unique among the resource's sibling resources; that is, a parent's direct child resources must all have unique resource keys, but those keys need not be unique across the entire inventory of all resources.
 String getResourceName()
          The name of the discovered resource, which is used mainly for UI display purposes.
 ResourceType getResourceType()
          The type of resource that was discovered.
 String getResourceVersion()
          The discovered resource's version string (which may have any form or syntax that is appropriate for the resource and may be null)
 int hashCode()
           
 void setPluginConfiguration(Configuration pluginConfiguration)
          Defines the discovered resource's plugin configuration.
 void setResourceDescription(String resourceDescription)
          Sets a simple description of the resource, which may or may not be an internationalized string
 void setResourceKey(String resourceKey)
          Sets the discovered resource's unique key.
 void setResourceName(String resourceName)
          Sets the name of the discovered resource, which is used mainly for UI display purposes.
 void setResourceVersion(String resourceVersion)
          Sets the discovered resource's version string (which may have any form or syntax that is appropriate for the resource and may be null which correlates to an empty version string).
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DiscoveredResourceDetails

public DiscoveredResourceDetails(ResourceType resourceType,
                                 String resourceKey,
                                 String resourceName,
                                 String resourceVersion,
                                 String resourceDescription,
                                 Configuration pluginConfiguration,
                                 ProcessInfo processInfo)
This creates a new instance that provides details for a newly discovered resource.

Both resource key and resource name must be non-null; otherwise, an exception is thrown. If resource version or resource description are null, their values will be set to an empty string.

Parameters:
resourceType - the type of resource that was discovered (must not be null)
resourceKey - the discovered resource's key where the key must be unique among the resource's sibling resources; that is, a parent's direct child resources must all have unique resource keys, but those keys need not be unique across the entire inventory of all resources (must not be null)
resourceName - the name of the discovered resource, used mainly for UI display purposes (must not be null)
resourceVersion - the discovered resource's version string (which may have any form or syntax appropriate for the resource and may be null)
resourceDescription - a simple description of the discovered resource, which may or may not be an internationalized string (may be null)
pluginConfiguration - the discovered resource's plugin configuration that will be used by the plugin to connect to it (may be null, which means the new resource will just use the default plugin configuration as defined by its resource type)
processInfo - information on the process in which the newly discovered resource is running (this may be null if unknown or not applicable)
Throws:
IllegalArgumentException - if the resource type, key or name is null or one of the String values are too long
Method Detail

getResourceType

public ResourceType getResourceType()
The type of resource that was discovered.

Returns:
new resource's type (will not be null)

getResourceKey

public String getResourceKey()
The discovered resource's key where the key must be unique among the resource's sibling resources; that is, a parent's direct child resources must all have unique resource keys, but those keys need not be unique across the entire inventory of all resources.

Returns:
resource's unique key (will not be null)

setResourceKey

public void setResourceKey(String resourceKey)
Sets the discovered resource's unique key. The key must be unique among the resource's sibling resources; that is, a parent's direct child resources must all have unique resource keys, but those keys need not be unique across the entire inventory of all resources.

Parameters:
resourceKey - the discovered resource's key (must not be null)
Throws:
IllegalArgumentException - if resourceKey is null or too long

getResourceName

public String getResourceName()
The name of the discovered resource, which is used mainly for UI display purposes. This has no uniqueness requirements (that is, resources can have the same names; this is true even for sibling resources).

Returns:
resource's name (will not be null)

setResourceName

public void setResourceName(String resourceName)
Sets the name of the discovered resource, which is used mainly for UI display purposes. The name can be anything (other than null); it has no uniqueness requirements (that is, even sibling resources can have the same name).

Parameters:
resourceName - the discovered resource's name (must not be null)
Throws:
IllegalArgumentException - if resourceName is null

getResourceVersion

public String getResourceVersion()
The discovered resource's version string (which may have any form or syntax that is appropriate for the resource and may be null)

Returns:
resource version string

setResourceVersion

public void setResourceVersion(String resourceVersion)
Sets the discovered resource's version string (which may have any form or syntax that is appropriate for the resource and may be null which correlates to an empty version string).

Parameters:
resourceVersion - the discovered resource's version string (may be null, which correlates to an empty string)
Throws:
IllegalArgumentException - if the version string is too long

getResourceDescription

public String getResourceDescription()
Gets the simple description of the resource, which may or may not be an internationalized string

Returns:
discovered resource's simple description string (may be null)

setResourceDescription

public void setResourceDescription(String resourceDescription)
Sets a simple description of the resource, which may or may not be an internationalized string

Parameters:
resourceDescription - the discovered resource's description (may be null, which correlates to an empty string)
Throws:
IllegalArgumentException - if the description string is too long

getPluginConfiguration

public Configuration getPluginConfiguration()
Returns the discovered resource's plugin configuration. If this was never set before, a copy of the default plugin configuration, as defined in the resource type's default template, is returned.

Returns:
copy of the resource's default plugin configuration

getProcessInfo

public ProcessInfo getProcessInfo()
Returns the information on the operating system process in which the resource is running.

Returns:
resource's process information or null if not known

setPluginConfiguration

public void setPluginConfiguration(Configuration pluginConfiguration)
Defines the discovered resource's plugin configuration. You normally call getPluginConfiguration() first to get a copy of the resource's default plugin configuration, and then modify that default configuration with custom values.

If you never need to customize or change a discovered resource's plugin configuration, you will not have to call this method. The plugin container will simply use the default plugin configuration from the resource's type.

Parameters:
pluginConfiguration - the discovered resource's new plugin configuration
See Also:
setPluginConfiguration(Configuration)

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2008-2009 RHQ Project Advisory Board (Red Hat, Inc.). All Rights Reserved.