Java Doc for MBeanExporter.java in  » J2EE » spring-framework-2.5 » org » springframework » jmx » export » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » spring framework 2.5 » org.springframework.jmx.export 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.springframework.jmx.support.MBeanRegistrationSupport
      org.springframework.jmx.export.MBeanExporter

All known Subclasses:   org.springframework.jmx.export.annotation.AnnotationMBeanExporter,
MBeanExporter
public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExportOperations,BeanClassLoaderAware,BeanFactoryAware,InitializingBean,DisposableBean(Code)
JMX exporter that allows for exposing any Spring-managed bean to a JMX MBeanServer, without the need to define any JMX-specific information in the bean classes.

If the bean implements one of the JMX management interfaces, then MBeanExporter can simply register the MBean with the server automatically, through its autodetection process.

If the bean does not implement one of the JMX management interfaces, then MBeanExporter will create the management information using the supplied MBeanInfoAssembler implementation.

A list of MBeanExporterListener MBeanExporterListeners can be registered via the MBeanExporter.setListeners(MBeanExporterListener[]) listeners property, allowing application code to be notified of MBean registration and unregistration events.
author:
   Rob Harrop
author:
   Juergen Hoeller
author:
   Rick Evans
author:
   Mark Fisher
since:
   1.2
See Also:   MBeanExporter.setBeans
See Also:   MBeanExporter.setAutodetect
See Also:   MBeanExporter.setAssembler
See Also:   MBeanExporter.setListeners
See Also:   org.springframework.jmx.export.assembler.MBeanInfoAssembler
See Also:   MBeanExporterListener



Field Summary
final public static  intAUTODETECT_ALL
     Autodetection mode indicating that all autodetection mechanisms should be used.
final public static  intAUTODETECT_ASSEMBLER
     Autodetection mode indicating that only the MBeanInfoAssembler should be able to autodetect beans.
final public static  intAUTODETECT_MBEAN
     Autodetection mode indicating that only valid MBeans should be autodetected.
final public static  intAUTODETECT_NONE
     Autodetection mode indicating that no autodetection should be used.


Method Summary
protected  DynamicMBeanadaptMBeanIfPossible(Object bean)
     Build an adapted MBean for the given bean instance, if possible.
public  voidafterPropertiesSet()
     Start bean registration automatically when deployed in an ApplicationContext.
protected  ModelMBeancreateAndConfigureMBean(Object managedResource, String beanKey)
     Creates an MBean that is configured with the appropriate management interface for the supplied managed resource.
protected  ModelMBeancreateModelMBean()
     Create an instance of a class that implements ModelMBean.

This method is called to obtain a ModelMBean instance to use when registering a bean.

public  voiddestroy()
     Unregisters all beans that this exported has exposed via JMX when the enclosing ApplicationContext is destroyed.
protected  ObjectNamegetObjectName(Object bean, String beanKey)
     Retrieve the ObjectName for a bean.
protected  booleanisBeanDefinitionLazyInit(ListableBeanFactory beanFactory, String beanName)
     Return whether the specified bean definition should be considered as lazy-init.
protected  booleanisMBean(Class beanClass)
     Determine whether the given bean class qualifies as an MBean as-is.
protected  voidonRegister(ObjectName objectName)
     Called when an MBean is registered.
protected  voidonUnregister(ObjectName objectName)
     Called when an MBean is unregistered.
protected  ObjectNameregisterBeanNameOrInstance(Object mapValue, String beanKey)
     Registers an individual bean with the MBeanExporter.setServer MBeanServer .

This method is responsible for deciding how a bean should be exposed to the MBeanServer.

protected  voidregisterBeans()
     Registers the defined beans with the MBeanServer .

Each bean is exposed to the MBeanServer via a ModelMBean.

public  ObjectNameregisterManagedResource(Object managedResource)
    
public  voidregisterManagedResource(Object managedResource, ObjectName objectName)
    
public  voidsetAssembler(MBeanInfoAssembler assembler)
     Set the implementation of the MBeanInfoAssembler interface to use for this exporter.
public  voidsetAutodetect(boolean autodetect)
     Set whether to autodetect MBeans in the bean factory that this exporter runs in.
public  voidsetAutodetectMode(int autodetectMode)
     Sets the autodetection mode to use.
public  voidsetAutodetectModeName(String constantName)
     Sets the autodetection mode to use by name.
public  voidsetBeanClassLoader(ClassLoader classLoader)
    
public  voidsetBeanFactory(BeanFactory beanFactory)
     This callback is only required for resolution of bean names in the MBeanExporter.setBeans(java.util.Map) "beans" Map and for autodetection of MBeans (in the latter case, a ListableBeanFactory is required).
public  voidsetBeans(Map beans)
     Supply a Map of beans to be registered with the JMX MBeanServer.

The String keys are the basis for the creation of JMX object names. By default, a JMX ObjectName will be created straight from the given key.

public  voidsetEnsureUniqueRuntimeObjectNames(boolean ensureUniqueRuntimeObjectNames)
     Indicates whether Spring should ensure that ObjectName ObjectNames generated by the configured ObjectNamingStrategy for runtime-registered MBeans should be modified to ensure uniqueness for every instance of a managed Class.
public  voidsetExcludedBeans(String[] excludedBeans)
     Set the list of names for beans that should be excluded from autodetection.
public  voidsetExposeManagedResourceClassLoader(boolean exposeManagedResourceClassLoader)
     Indicates whether or not the managed resource should be exposed on the Thread.getContextClassLoader thread context ClassLoader before allowing any invocations on the MBean to occur. <ü>The default value is true, exposing a SpringModelMBean which performs thread context ClassLoader management.
public  voidsetListeners(MBeanExporterListener[] listeners)
     Set the MBeanExporterListeners that should be notified of MBean registration and unregistration events.
public  voidsetNamingStrategy(ObjectNamingStrategy namingStrategy)
     Set the implementation of the ObjectNamingStrategy interface to use for this exporter.
public  voidsetNotificationListenerMappings(Map listeners)
     Set the NotificationListener NotificationListeners to register with the javax.management.MBeanServer .

The key of each entry in the Map is a String representation of the javax.management.ObjectName or the bean name of the MBean the listener should be registered for.

public  voidsetNotificationListeners(NotificationListenerBean[] notificationListeners)
     Set the NotificationListenerBean NotificationListenerBeans containing the javax.management.NotificationListener NotificationListeners that will be registered with the MBeanServer .

Field Detail
AUTODETECT_ALL
final public static int AUTODETECT_ALL(Code)
Autodetection mode indicating that all autodetection mechanisms should be used.



AUTODETECT_ASSEMBLER
final public static int AUTODETECT_ASSEMBLER(Code)
Autodetection mode indicating that only the MBeanInfoAssembler should be able to autodetect beans.



AUTODETECT_MBEAN
final public static int AUTODETECT_MBEAN(Code)
Autodetection mode indicating that only valid MBeans should be autodetected.



AUTODETECT_NONE
final public static int AUTODETECT_NONE(Code)
Autodetection mode indicating that no autodetection should be used.





Method Detail
adaptMBeanIfPossible
protected DynamicMBean adaptMBeanIfPossible(Object bean) throws JMException(Code)
Build an adapted MBean for the given bean instance, if possible.

The default implementation builds a JMX 1.2 StandardMBean for the target's MBean/MXBean interface in case of an AOP proxy, delegating the interface's management operations to the proxy.
Parameters:
  bean - the original bean instance the adapted MBean, or null if not possible




afterPropertiesSet
public void afterPropertiesSet()(Code)
Start bean registration automatically when deployed in an ApplicationContext.
See Also:   MBeanExporter.registerBeans()



createAndConfigureMBean
protected ModelMBean createAndConfigureMBean(Object managedResource, String beanKey) throws MBeanExportException(Code)
Creates an MBean that is configured with the appropriate management interface for the supplied managed resource.
Parameters:
  managedResource - the resource that is to be exported as an MBean
Parameters:
  beanKey - the key associated with the managed bean
See Also:   MBeanExporter.createModelMBean()
See Also:   
See Also:   MBeanExporter.getMBeanInfo(Object,String)
See Also:   



createModelMBean
protected ModelMBean createModelMBean() throws MBeanException(Code)
Create an instance of a class that implements ModelMBean.

This method is called to obtain a ModelMBean instance to use when registering a bean. This method is called once per bean during the registration phase and must return a new instance of ModelMBean a new instance of a class that implements ModelMBean
throws:
  javax.management.MBeanException - if creation of the ModelMBean failed




destroy
public void destroy()(Code)
Unregisters all beans that this exported has exposed via JMX when the enclosing ApplicationContext is destroyed.



getObjectName
protected ObjectName getObjectName(Object bean, String beanKey) throws MalformedObjectNameException(Code)
Retrieve the ObjectName for a bean.

If the bean implements the SelfNaming interface, then the ObjectName will be retrieved using SelfNaming.getObjectName(). Otherwise, the configured ObjectNamingStrategy is used.
Parameters:
  bean - the name of the bean in the BeanFactory
Parameters:
  beanKey - the key associated with the bean in the beans map the ObjectName for the supplied bean
throws:
  javax.management.MalformedObjectNameException - if the retrieved ObjectName is malformed




isBeanDefinitionLazyInit
protected boolean isBeanDefinitionLazyInit(ListableBeanFactory beanFactory, String beanName)(Code)
Return whether the specified bean definition should be considered as lazy-init.
Parameters:
  beanFactory - the bean factory that is supposed to contain the bean definition
Parameters:
  beanName - the name of the bean to check
See Also:   org.springframework.beans.factory.config.ConfigurableListableBeanFactory.getBeanDefinition
See Also:   org.springframework.beans.factory.config.BeanDefinition.isLazyInit



isMBean
protected boolean isMBean(Class beanClass)(Code)
Determine whether the given bean class qualifies as an MBean as-is.

The default implementation delegates to JmxUtils.isMBean , which checks for javax.management.DynamicMBean classes as well as classes with corresponding "*MBean" interface (Standard MBeans) or corresponding "*MXBean" interface (Java 6 MXBeans).
Parameters:
  beanClass - the bean class to analyze whether the class qualifies as an MBean
See Also:   org.springframework.jmx.support.JmxUtils.isMBean(Class)




onRegister
protected void onRegister(ObjectName objectName)(Code)
Called when an MBean is registered. Notifies all registered MBeanExporterListener MBeanExporterListeners of the registration event.

Please note that if an MBeanExporterListener throws a (runtime) exception when notified, this will essentially interrupt the notification process and any remaining listeners that have yet to be notified will not (obviously) receive the MBeanExporterListener.mbeanRegistered(javax.management.ObjectName) callback.
Parameters:
  objectName - the ObjectName of the registered MBean




onUnregister
protected void onUnregister(ObjectName objectName)(Code)
Called when an MBean is unregistered. Notifies all registered MBeanExporterListener MBeanExporterListeners of the unregistration event.

Please note that if an MBeanExporterListener throws a (runtime) exception when notified, this will essentially interrupt the notification process and any remaining listeners that have yet to be notified will not (obviously) receive the MBeanExporterListener.mbeanUnregistered(javax.management.ObjectName) callback.
Parameters:
  objectName - the ObjectName of the unregistered MBean




registerBeanNameOrInstance
protected ObjectName registerBeanNameOrInstance(Object mapValue, String beanKey) throws MBeanExportException(Code)
Registers an individual bean with the MBeanExporter.setServer MBeanServer .

This method is responsible for deciding how a bean should be exposed to the MBeanServer. Specifically, if the supplied mapValue is the name of a bean that is configured for lazy initialization, then a proxy to the resource is registered with the MBeanServer so that the the lazy load behavior is honored. If the bean is already an MBean then it will be registered directly with the MBeanServer without any intervention. For all other beans or bean names, the resource itself is registered with the MBeanServer directly.
Parameters:
  mapValue - the value configured for this bean in the beans map;may be either the String name of a bean, or the bean itself
Parameters:
  beanKey - the key associated with this bean in the beans map the ObjectName under which the resource was registered
throws:
  MBeanExportException - if the export failed
See Also:   MBeanExporter.setBeans
See Also:   MBeanExporter.registerBeanInstance
See Also:   MBeanExporter.registerLazyInit




registerBeans
protected void registerBeans()(Code)
Registers the defined beans with the MBeanServer .

Each bean is exposed to the MBeanServer via a ModelMBean. The actual implemetation of the ModelMBean interface used depends on the implementation of the ModelMBeanProvider interface that is configured. By default the RequiredModelMBean class that is supplied with all JMX implementations is used.

The management interface produced for each bean is dependent on the MBeanInfoAssembler implementation being used. The ObjectName given to each bean is dependent on the implementation of the ObjectNamingStrategy interface being used.




registerManagedResource
public ObjectName registerManagedResource(Object managedResource) throws MBeanExportException(Code)



registerManagedResource
public void registerManagedResource(Object managedResource, ObjectName objectName) throws MBeanExportException(Code)



setAssembler
public void setAssembler(MBeanInfoAssembler assembler)(Code)
Set the implementation of the MBeanInfoAssembler interface to use for this exporter. Default is a SimpleReflectiveMBeanInfoAssembler.

The passed-in assembler can optionally implement the AutodetectCapableMBeanInfoAssembler interface, which enables it to participate in the exporter's MBean autodetection process.
See Also:   org.springframework.jmx.export.assembler.SimpleReflectiveMBeanInfoAssembler
See Also:   org.springframework.jmx.export.assembler.AutodetectCapableMBeanInfoAssembler
See Also:   org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler
See Also:   MBeanExporter.setAutodetect




setAutodetect
public void setAutodetect(boolean autodetect)(Code)
Set whether to autodetect MBeans in the bean factory that this exporter runs in. Will also ask an AutodetectCapableMBeanInfoAssembler if available.

This feature is turned off by default. Explicitly specify true here to enable autodetection.
See Also:   MBeanExporter.setAssembler
See Also:   AutodetectCapableMBeanInfoAssembler
See Also:   MBeanExporter.isMBean




setAutodetectMode
public void setAutodetectMode(int autodetectMode)(Code)
Sets the autodetection mode to use.
exception:
  IllegalArgumentException - if the supplied value is notone of the AUTODETECT_ constants
See Also:   MBeanExporter.setAutodetectModeName(String)
See Also:   MBeanExporter.AUTODETECT_ALL
See Also:   MBeanExporter.AUTODETECT_ASSEMBLER
See Also:   MBeanExporter.AUTODETECT_MBEAN
See Also:   MBeanExporter.AUTODETECT_NONE



setAutodetectModeName
public void setAutodetectModeName(String constantName)(Code)
Sets the autodetection mode to use by name.
exception:
  IllegalArgumentException - if the supplied value is not resolvableto one of the AUTODETECT_ constants or is null
See Also:   MBeanExporter.setAutodetectMode(int)
See Also:   MBeanExporter.AUTODETECT_ALL
See Also:   MBeanExporter.AUTODETECT_ASSEMBLER
See Also:   MBeanExporter.AUTODETECT_MBEAN
See Also:   MBeanExporter.AUTODETECT_NONE



setBeanClassLoader
public void setBeanClassLoader(ClassLoader classLoader)(Code)



setBeanFactory
public void setBeanFactory(BeanFactory beanFactory)(Code)
This callback is only required for resolution of bean names in the MBeanExporter.setBeans(java.util.Map) "beans" Map and for autodetection of MBeans (in the latter case, a ListableBeanFactory is required).
See Also:   MBeanExporter.setBeans
See Also:   MBeanExporter.setAutodetect
throws:
  IllegalArgumentException - if the supplied beanFactory is not a ListableBeanFactory.



setBeans
public void setBeans(Map beans)(Code)
Supply a Map of beans to be registered with the JMX MBeanServer.

The String keys are the basis for the creation of JMX object names. By default, a JMX ObjectName will be created straight from the given key. This can be customized through specifying a custom NamingStrategy.

Both bean instances and bean names are allowed as values. Bean instances are typically linked in through bean references. Bean names will be resolved as beans in the current factory, respecting lazy-init markers (that is, not triggering initialization of such beans).
Parameters:
  beans - Map with JMX names as keys and bean instances or bean namesas values
See Also:   MBeanExporter.setNamingStrategy
See Also:   org.springframework.jmx.export.naming.KeyNamingStrategy
See Also:   javax.management.ObjectName.ObjectName(String)




setEnsureUniqueRuntimeObjectNames
public void setEnsureUniqueRuntimeObjectNames(boolean ensureUniqueRuntimeObjectNames)(Code)
Indicates whether Spring should ensure that ObjectName ObjectNames generated by the configured ObjectNamingStrategy for runtime-registered MBeans should be modified to ensure uniqueness for every instance of a managed Class.

The default value is true.
See Also:   JmxUtils.appendIdentityToObjectName(javax.management.ObjectNameObject)




setExcludedBeans
public void setExcludedBeans(String[] excludedBeans)(Code)
Set the list of names for beans that should be excluded from autodetection.



setExposeManagedResourceClassLoader
public void setExposeManagedResourceClassLoader(boolean exposeManagedResourceClassLoader)(Code)
Indicates whether or not the managed resource should be exposed on the Thread.getContextClassLoader thread context ClassLoader before allowing any invocations on the MBean to occur. <ü>The default value is true, exposing a SpringModelMBean which performs thread context ClassLoader management. Switch this flag off to expose a standard JMX javax.management.modelmbean.RequiredModelMBean .



setListeners
public void setListeners(MBeanExporterListener[] listeners)(Code)
Set the MBeanExporterListeners that should be notified of MBean registration and unregistration events.
See Also:   MBeanExporterListener



setNamingStrategy
public void setNamingStrategy(ObjectNamingStrategy namingStrategy)(Code)
Set the implementation of the ObjectNamingStrategy interface to use for this exporter. Default is a KeyNamingStrategy.
See Also:   org.springframework.jmx.export.naming.KeyNamingStrategy
See Also:   org.springframework.jmx.export.naming.MetadataNamingStrategy



setNotificationListenerMappings
public void setNotificationListenerMappings(Map listeners)(Code)
Set the NotificationListener NotificationListeners to register with the javax.management.MBeanServer .

The key of each entry in the Map is a String representation of the javax.management.ObjectName or the bean name of the MBean the listener should be registered for. Specifying an asterisk (*) for a key will cause the listener to be associated with all MBeans registered by this class at startup time.

The value of each entry is the javax.management.NotificationListener to register. For more advanced options such as registering javax.management.NotificationFilter NotificationFilters and handback objects see MBeanExporter.setNotificationListeners(NotificationListenerBean[]) .
throws:
  IllegalArgumentException - if the supplied listeners Map is null.




setNotificationListeners
public void setNotificationListeners(NotificationListenerBean[] notificationListeners)(Code)
Set the NotificationListenerBean NotificationListenerBeans containing the javax.management.NotificationListener NotificationListeners that will be registered with the MBeanServer .
See Also:   MBeanExporter.setNotificationListenerMappings(java.util.Map)
See Also:   NotificationListenerBean



Fields inherited from org.springframework.jmx.support.MBeanRegistrationSupport
final public static int REGISTRATION_FAIL_ON_EXISTING(Code)(Java Doc)
final public static int REGISTRATION_IGNORE_EXISTING(Code)(Java Doc)
final public static int REGISTRATION_REPLACE_EXISTING(Code)(Java Doc)
final protected Log logger(Code)(Java Doc)
protected Set registeredBeans(Code)(Java Doc)
protected MBeanServer server(Code)(Java Doc)

Methods inherited from org.springframework.jmx.support.MBeanRegistrationSupport
protected void doRegister(Object mbean, ObjectName objectName) throws JMException(Code)(Java Doc)
protected void onRegister(ObjectName objectName)(Code)(Java Doc)
protected void onUnregister(ObjectName objectName)(Code)(Java Doc)
public void setRegistrationBehavior(int registrationBehavior)(Code)(Java Doc)
public void setRegistrationBehaviorName(String registrationBehavior)(Code)(Java Doc)
public void setServer(MBeanServer server)(Code)(Java Doc)
protected void unregisterBeans()(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.