Top Description Fields Constructors Methods
org.springframework.jmx.export.naming

public Class MetadataNamingStrategy

extends Object
implements ObjectNamingStrategy, InitializingBean
Class Inheritance
All Implemented Interfaces
org.springframework.beans.factory.InitializingBean, org.springframework.jmx.export.naming.ObjectNamingStrategy
Imports
java.util.Hashtable, javax.management.MalformedObjectNameException, .ObjectName, org.springframework.aop.support.AopUtils, org.springframework.beans.factory.InitializingBean, org.springframework.jmx.export.metadata.JmxAttributeSource, .ManagedResource, org.springframework.jmx.support.ObjectNameManager, org.springframework.lang.Nullable, org.springframework.util.Assert, .ClassUtils, .StringUtils

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, org.springframework.jmx.export.annotation.AnnotationJmxAttributeSource introspects a well-defined set of annotations that come with Spring.

Authors
Rob Harrop, Juergen Hoeller
Since
1.2
See Also
ObjectNamingStrategy, org.springframework.jmx.export.annotation.AnnotationJmxAttributeSource

Field Summary

Modifier and TypeField and Description
private JmxAttributeSource
attributeSource

The JmxAttributeSource implementation to use for reading metadata.

private String
private static final char[]

Constructor Summary

AccessConstructor and Description
public
MetadataNamingStrategy()

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

public
MetadataNamingStrategy(JmxAttributeSource
the JmxAttributeSource to use
attributeSource
)

Create a new MetadataNamingStrategy for the given JmxAttributeSource.

Method Summary

Modifier and TypeMethod and Description
public void
afterPropertiesSet()

Implements org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Invoked by the containing BeanFactory after it has set all bean properties and satisfied BeanFactoryAware, ApplicationContextAware etc.

This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.

public ObjectName
getObjectName(Object
the bean that will be exposed under the returned ObjectName
managedBean
,
String
the key associated with this bean in the beans map passed to the MBeanExporter
beanKey
)

Implements org.springframework.jmx.export.naming.ObjectNamingStrategy.getObjectName.

Reads the ObjectName from the source-level metadata associated with the managed resource's Class.
private static String
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.

private static boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attributeSourceback to summary
private JmxAttributeSource attributeSource

The JmxAttributeSource implementation to use for reading metadata.

Annotations
@Nullable
defaultDomainback to summary
private String defaultDomain
Annotations
@Nullable
QUOTABLE_CHARSback to summary
private static final char[] QUOTABLE_CHARS

Constructor Detail

MetadataNamingStrategyback to summary
public MetadataNamingStrategy()

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

MetadataNamingStrategyback to summary
public MetadataNamingStrategy(JmxAttributeSource attributeSource)

Create a new MetadataNamingStrategy for the given JmxAttributeSource.

Parameters
attributeSource:JmxAttributeSource

the JmxAttributeSource to use

Method Detail

afterPropertiesSetback to summary
public void afterPropertiesSet()

Implements org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Doc from org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Invoked by the containing BeanFactory after it has set all bean properties and satisfied BeanFactoryAware, ApplicationContextAware etc.

This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.

Annotations
@Override
getObjectNameback to summary
public ObjectName getObjectName(Object managedBean, String beanKey) throws MalformedObjectNameException

Implements org.springframework.jmx.export.naming.ObjectNamingStrategy.getObjectName.

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

Parameters
managedBean:Object

Doc from org.springframework.jmx.export.naming.ObjectNamingStrategy.getObjectName.

the bean that will be exposed under the returned ObjectName

beanKey:String

Doc from org.springframework.jmx.export.naming.ObjectNamingStrategy.getObjectName.

the key associated with this bean in the beans map passed to the MBeanExporter

Returns:ObjectName

Doc from org.springframework.jmx.export.naming.ObjectNamingStrategy.getObjectName.

the ObjectName instance

Annotations
@Override
Exceptions
MalformedObjectNameException:

Doc from org.springframework.jmx.export.naming.ObjectNamingStrategy.getObjectName.

if the resulting ObjectName is invalid

quoteIfNecessaryback to summary
private static String quoteIfNecessary(String value)
setAttributeSourceback to summary
public void setAttributeSource(JmxAttributeSource attributeSource)

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

setDefaultDomainback to summary
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.

shouldQuoteback to summary
private static boolean shouldQuote(String value)