Class MetadataNamingStrategy
java.lang.Object
org.springframework.jmx.export.naming.MetadataNamingStrategy
- All Implemented Interfaces:
- InitializingBean,- ObjectNamingStrategy
public class MetadataNamingStrategy
extends Object
implements ObjectNamingStrategy, InitializingBean
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 annotations that come with Spring.
- Since:
- 1.2
- Author:
- Rob Harrop, Juergen Hoeller
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionCreate a newMetadataNamingStrategywhich needs to be configured through thesetAttributeSource(org.springframework.jmx.export.metadata.JmxAttributeSource)method.MetadataNamingStrategy(JmxAttributeSource attributeSource) Create a newMetadataNamingStrategyfor the givenJmxAttributeSource.
- 
Method SummaryModifier and TypeMethodDescriptionvoidInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.getObjectName(Object managedBean, @Nullable String beanKey) Reads theObjectNamefrom the source-level metadata associated with the managed resource'sClass.voidsetAttributeSource(JmxAttributeSource attributeSource) Set the implementation of theJmxAttributeSourceinterface to use when reading the source-level metadata.voidsetDefaultDomain(String defaultDomain) Specify the default domain to be used for generating ObjectNames when no source-level metadata has been specified.
- 
Constructor Details- 
MetadataNamingStrategypublic MetadataNamingStrategy()Create a newMetadataNamingStrategywhich needs to be configured through thesetAttributeSource(org.springframework.jmx.export.metadata.JmxAttributeSource)method.
- 
MetadataNamingStrategyCreate a newMetadataNamingStrategyfor the givenJmxAttributeSource.- Parameters:
- attributeSource- the JmxAttributeSource to use
 
 
- 
- 
Method Details- 
setAttributeSourceSet the implementation of theJmxAttributeSourceinterface to use when reading the source-level metadata.
- 
setDefaultDomainSpecify 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. 
- 
afterPropertiesSetpublic void afterPropertiesSet()Description copied from interface:InitializingBeanInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set. - Specified by:
- afterPropertiesSetin interface- InitializingBean
 
- 
getObjectNamepublic ObjectName getObjectName(Object managedBean, @Nullable String beanKey) throws MalformedObjectNameException Reads theObjectNamefrom the source-level metadata associated with the managed resource'sClass.- Specified by:
- getObjectNamein interface- ObjectNamingStrategy
- 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 ObjectNameinstance
- Throws:
- MalformedObjectNameException- if the resulting- ObjectNameis invalid
 
 
-