org.springframework.jmx.export.metadata
Class AttributesJmxAttributeSource

java.lang.Object
  extended by org.springframework.jmx.export.metadata.AttributesJmxAttributeSource
All Implemented Interfaces:
InitializingBean, JmxAttributeSource

public class AttributesJmxAttributeSource
extends Object
implements JmxAttributeSource, InitializingBean

Implementation of the JmxAttributeSource interface that reads metadata via Spring's Attributes abstraction.

Typically used for reading in source-level attributes via Commons Attributes.

Since:
1.2
Author:
Rob Harrop
See Also:
Attributes, CommonsAttributes

Constructor Summary
AttributesJmxAttributeSource()
          Create a new AttributesJmxAttributeSource.
AttributesJmxAttributeSource(Attributes attributes)
          Create a new AttributesJmxAttributeSource.
 
Method Summary
 void afterPropertiesSet()
          Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).
 ManagedAttribute getManagedAttribute(Method method)
          If the specified method has a ManagedAttribute attribute, then it is returned.
 ManagedNotification[] getManagedNotifications(Class clazz)
          If the specified has ManagedNotification attributes these are returned, otherwise a zero-length array is returned.
 ManagedOperation getManagedOperation(Method method)
          If the specified method has a ManagedOperation attribute, then it is returned.
 ManagedOperationParameter[] getManagedOperationParameters(Method method)
          If the specified method has ManagedOperationParameter attributes, then these are returned, otherwise a zero length array is returned.
 ManagedResource getManagedResource(Class clazz)
          If the specified class has a ManagedResource attribute, then it is returned.
 void setAttributes(Attributes attributes)
          Set the Attributes implementation to use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttributesJmxAttributeSource

public AttributesJmxAttributeSource()
Create a new AttributesJmxAttributeSource.

See Also:
setAttributes(org.springframework.metadata.Attributes)

AttributesJmxAttributeSource

public AttributesJmxAttributeSource(Attributes attributes)
Create a new AttributesJmxAttributeSource.

Parameters:
attributes - the Attributes implementation to use
See Also:
CommonsAttributes
Method Detail

setAttributes

public void setAttributes(Attributes attributes)
Set the Attributes implementation to use.

See Also:
CommonsAttributes

afterPropertiesSet

public void afterPropertiesSet()
Description copied from interface: InitializingBean
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.

Specified by:
afterPropertiesSet in interface InitializingBean

getManagedResource

public ManagedResource getManagedResource(Class clazz)
If the specified class has a ManagedResource attribute, then it is returned. Otherwise returns null.

Specified by:
getManagedResource in interface JmxAttributeSource
Parameters:
clazz - the class to read the attribute data from
Returns:
the attribute, or null if not found
Throws:
InvalidMetadataException - if more than one attribute exists

getManagedAttribute

public ManagedAttribute getManagedAttribute(Method method)
                                     throws InvalidMetadataException
If the specified method has a ManagedAttribute attribute, then it is returned. Otherwise returns null.

Specified by:
getManagedAttribute in interface JmxAttributeSource
Parameters:
method - the method to read the attribute data from
Returns:
the attribute, or null if not found
Throws:
InvalidMetadataException - if more than one attribute exists, or if the supplied method does not represent a JavaBean property

getManagedOperation

public ManagedOperation getManagedOperation(Method method)
If the specified method has a ManagedOperation attribute, then it is returned. Otherwise return null.

Specified by:
getManagedOperation in interface JmxAttributeSource
Parameters:
method - the method to read the attribute data from
Returns:
the attribute, or null if not found
Throws:
InvalidMetadataException - if more than one attribute exists, or if the supplied method represents a JavaBean property

getManagedOperationParameters

public ManagedOperationParameter[] getManagedOperationParameters(Method method)
                                                          throws InvalidMetadataException
If the specified method has ManagedOperationParameter attributes, then these are returned, otherwise a zero length array is returned.

Specified by:
getManagedOperationParameters in interface JmxAttributeSource
Parameters:
method - the method to get the managed operation parameters for
Returns:
the array of ManagedOperationParameter objects
Throws:
InvalidMetadataException - if the number of ManagedOperationParameter attributes does not match the number of parameters in the method

getManagedNotifications

public ManagedNotification[] getManagedNotifications(Class clazz)
If the specified has ManagedNotification attributes these are returned, otherwise a zero-length array is returned.

Specified by:
getManagedNotifications in interface JmxAttributeSource
Parameters:
clazz - the Class to read the metadata from
Returns:
the notification information


Copyright © 2002-2008 The Spring Framework.