org.rhq.plugins.jmx
Class MBeanResourceDiscoveryComponent<T extends JMXComponent>

java.lang.Object
  extended by org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent<T>
All Implemented Interfaces:
ResourceDiscoveryComponent<T>

public class MBeanResourceDiscoveryComponent<T extends JMXComponent>
extends Object
implements ResourceDiscoveryComponent<T>

This is meant to be a generic discovery component for MBeans. In order to use it you configure your resource descriptor to use this class for discovery and then provide a plugin configuration default value for the "objectName" property that has a default value of the form defined by ObjectNameQueryUtility. Also, setting default configurations values for nameTemplate and descriptionTemplate according to the message format also defined by ObjectNameQueryUtility also lets you customize the detected resources name and description according to a variable replacement strategy. Additionally, any mapped variables found will be set as configuration properties in their own right.

Author:
Greg Hinkle

Field Summary
static String PROPERTY_DESCRIPTION_TEMPLATE
          Not required when using this discovery component.
static String PROPERTY_NAME_TEMPLATE
          Not required when using this discovery component.
static String PROPERTY_OBJECT_NAME
          Required when using this discovery component.
 
Constructor Summary
MBeanResourceDiscoveryComponent()
           
 
Method Summary
 Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<T> context)
           
 Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<T> context, boolean skipUnknownProps)
          Same as discoverResources(ResourceDiscoveryContext) with additional param.
 Set<DiscoveredResourceDetails> performDiscovery(Configuration pluginConfiguration, JMXComponent parentResourceComponent, ResourceType resourceType)
          Performs the actual discovery through MBeans.
 Set<DiscoveredResourceDetails> performDiscovery(Configuration pluginConfiguration, JMXComponent parentResourceComponent, ResourceType resourceType, boolean skipUnknownProps)
          Performs the actual discovery through MBeans.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_OBJECT_NAME

public static final String PROPERTY_OBJECT_NAME
Required when using this discovery component. The value of this property is the query for retrieving the MBeans.

See Also:
Constant Field Values

PROPERTY_NAME_TEMPLATE

public static final String PROPERTY_NAME_TEMPLATE
Not required when using this discovery component. If this is specified, it will be used in the generation of the resource name. Any variables specified for replacement (via the {name} syntax) will be substituted prior to setting the resource name. Through this mechanism, unique names can be created for each resource discovered of the same resource type.

See Also:
Constant Field Values

PROPERTY_DESCRIPTION_TEMPLATE

public static final String PROPERTY_DESCRIPTION_TEMPLATE
Not required when using this discovery component. Similar to PROPERTY_NAME_TEMPLATE, unique descriptions can be generated per resource using this template.

See Also:
Constant Field Values
Constructor Detail

MBeanResourceDiscoveryComponent

public MBeanResourceDiscoveryComponent()
Method Detail

discoverResources

public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<T> context)
Specified by:
discoverResources in interface ResourceDiscoveryComponent<T extends JMXComponent>

discoverResources

public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<T> context,
                                                        boolean skipUnknownProps)
Same as discoverResources(ResourceDiscoveryContext) with additional param.

Parameters:
skipUnknownProps - Should we skip over MBeans that have unknown properties in their ObjectName

performDiscovery

public Set<DiscoveredResourceDetails> performDiscovery(Configuration pluginConfiguration,
                                                       JMXComponent parentResourceComponent,
                                                       ResourceType resourceType)
Performs the actual discovery through MBeans.

Parameters:
pluginConfiguration - plugin configuration for the resource type being discovered; used to grab values that govern the MBean query and resource details generation
parentResourceComponent - parent resource of the resource being discovered
resourceType - type of resource being discovered
Returns:
set describing the resources discovered; empty set if no resources are found

performDiscovery

public Set<DiscoveredResourceDetails> performDiscovery(Configuration pluginConfiguration,
                                                       JMXComponent parentResourceComponent,
                                                       ResourceType resourceType,
                                                       boolean skipUnknownProps)
Performs the actual discovery through MBeans.

Parameters:
pluginConfiguration - plugin configuration for the resource type being discovered; used to grab values that govern the MBean query and resource details generation
parentResourceComponent - parent resource of the resource being discovered
resourceType - type of resource being discovered
skipUnknownProps - Should we skip over MBeans that have unknown properties in their ObjectName
Returns:
set describing the resources discovered; empty set if no resources are found


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