public class

MetadataNamingStrategy

extends Object
implements InitializingBean ObjectNamingStrategy
java.lang.Object
   ↳ org.springframework.jmx.export.naming.MetadataNamingStrategy

Class Overview

An implementation of the ObjectNamingStrategy interface that reads the ObjectName from the source-level metadata. Falls back to the bean key (bean name) if no ObjectName can be found in source-level metadata.

Uses the JmxAttributeSource strategy interface, so that metadata can be read using any supported implementation. Out of the box, AnnotationJmxAttributeSource introspects a well-defined set of Java 5 annotations that come with Spring.

Summary

Public Constructors
MetadataNamingStrategy()
Create a new MetadataNamingStrategy which needs to be configured through the setAttributeSource(JmxAttributeSource) method.
MetadataNamingStrategy(JmxAttributeSource attributeSource)
Create a new MetadataNamingStrategy for the given JmxAttributeSource.
Public Methods
void afterPropertiesSet()
Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).
ObjectName getObjectName(Object managedBean, String beanKey)
Reads the ObjectName from the source-level metadata associated with the managed resource's Class.
void setAttributeSource(JmxAttributeSource attributeSource)
Set the implementation of the JmxAttributeSource interface to use when reading the source-level metadata.
void setDefaultDomain(String defaultDomain)
Specify the default domain to be used for generating ObjectNames when no source-level metadata has been specified.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.springframework.beans.factory.InitializingBean
From interface org.springframework.jmx.export.naming.ObjectNamingStrategy

Public Constructors

public MetadataNamingStrategy ()

Create a new MetadataNamingStrategy which needs to be configured through the setAttributeSource(JmxAttributeSource) method.

public MetadataNamingStrategy (JmxAttributeSource attributeSource)

Create a new MetadataNamingStrategy for the given JmxAttributeSource.

Parameters
attributeSource the JmxAttributeSource to use

Public Methods

public void afterPropertiesSet ()

Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).

This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.

public ObjectName getObjectName (Object managedBean, String beanKey)

Reads the ObjectName from the source-level metadata associated with the managed resource's Class.

Parameters
managedBean the bean that will be exposed under the returned ObjectName
beanKey the key associated with this bean in the beans map passed to the MBeanExporter
Returns
  • the ObjectName instance

public void setAttributeSource (JmxAttributeSource attributeSource)

Set the implementation of the JmxAttributeSource interface to use when reading the source-level metadata.

public void setDefaultDomain (String defaultDomain)

Specify the default domain to be used for generating ObjectNames when no source-level metadata has been specified.

The default is to use the domain specified in the bean name (if the bean name follows the JMX ObjectName syntax); else, the package name of the managed bean class.