wt.jmx.core
Class StandardMBean

java.lang.Object
  extended by wt.jmx.core.StandardMBeanFix
      extended by wt.jmx.core.StandardMBean
All Implemented Interfaces:
DynamicMBean
Direct Known Subclasses:
SelfAwareMBean

public class StandardMBean
extends wt.jmx.core.StandardMBeanFix

This class is intended to serve the same purpose as StandardMBean, and support its public and protected API while addressing some gaps therein. Specifically, this class provides localized descriptions and operation parameter names when resource bundles produced by MBeanProcessorFactory are accessible. It also provides operation impact when this is conveyed via MBeanOperationImpact annotations. Further, it provides per-implementation class caching of MBeanInfo in addition to the per-instance caching provided by StandardMBean. Finally, it automatically uses the MBeanNotificationInfo produced by getNotificationInfo() for subclasses that implement NotificationBroadcaster.

Due to these improvements, this class should be used as the basis for all Windchill MBeans (apart from special cases like DynamicMBeanProxy).

Note: Though it may (or may not) be the case at this moment, no one should assume that this class does (or does not) extend javax.management.StandardMBean. They can rely on this class supporting the public and protected methods exposed by javax.management.StandardMBean and its base classes remaining exposed, however.

Do note, however, that this class explicitly does not support usage of setImplementation() from one thread while other threads may be calling methods on the same instance. Specifically, in the case that the instance's MBeanInfo is should change due to setImplementation() such changes may not occur. The authors of the JMX spec consider this particular usage scenario ill-advised and supporting this robustly has adverse performance implications. Therefore this practice is simply not supported by this class. This class should be considered thread safe as long as one completes any such use of setImplementation() prior to handing the instance to other threads, however.

Supported API: true

Extendable: true


Constructor Summary
protected StandardMBean(Class mbeanInterface)
          Pass through constructor.
  StandardMBean(Object implementation, Class mbeanInterface)
          Pass through constructor.
 
Method Summary
protected  void cacheMBeanInfo(MBeanInfo info)
          Cache MBeanInfo in this instance and in per implementation class cache as well.
protected  void cacheMBeanInfoInInstance(MBeanInfo info)
          Exposes javax.management.StandardMBean.cacheMBeanInfo() to subclasses so they can cache their MBeanInfo directly in this instance object without introducing another field.
protected  MBeanInfo createMBeanInfo(MBeanInfo baseClassMBeanInfo)
          This method is intended for sub-classes to override without worrying about caching policies, etc.
 void emailThisMBean(String addressesOrEmailList, String subject, boolean includeChildren)
          Note this implementation is provided for subclasses, but will not function unless subclassed such that a public getObjectName() method is provided that returns the ObjectName of this MBean and Emailer and Dumper MBeans have been instantiated and started for this MBean to use and are accessible via the local class loader.
protected  MBeanInfo getCachedInstanceMBeanInfo()
          Exposes javax.management.StandardMBean.getCachedMBeanInfo() to subclasses so they can access cached MBeanInfo directly in this instance object without introducing another field.
protected  MBeanInfo getCachedMBeanInfo()
          Get cached MBeanInfo.
protected  String getDescription(MBeanAttributeInfo info)
          See StandardMBean.
protected  String getDescription(MBeanInfo info)
          See StandardMBean.
protected  String getDescription(MBeanOperationInfo info)
          See StandardMBean.
protected  String getDescription(MBeanOperationInfo op, MBeanParameterInfo param, int sequence)
          See StandardMBean.
protected  int getImpact(MBeanOperationInfo info)
          See StandardMBean.
 MBeanInfo getMBeanInfo()
          Overriden to fix JDK StandardMBean's lack of proper getNotificationInfo() support.
protected  String getParameterName(MBeanOperationInfo op, MBeanParameterInfo param, int sequence)
          See StandardMBean.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardMBean

public StandardMBean(Object implementation,
                     Class mbeanInterface)
              throws NotCompliantMBeanException
Pass through constructor.

Supported API: true

Throws:
NotCompliantMBeanException

StandardMBean

protected StandardMBean(Class mbeanInterface)
                 throws NotCompliantMBeanException
Pass through constructor.

Supported API: true

Throws:
NotCompliantMBeanException
Method Detail

emailThisMBean

public void emailThisMBean(String addressesOrEmailList,
                           String subject,
                           boolean includeChildren)
                    throws Exception
Note this implementation is provided for subclasses, but will not function unless subclassed such that a public getObjectName() method is provided that returns the ObjectName of this MBean and Emailer and Dumper MBeans have been instantiated and started for this MBean to use and are accessible via the local class loader.

It should be clear that this is really a convenience method for calling Dumper's emailMBeans() operation (always applying the default XSLT styling and not compressing) with this MBean's ObjectName and appending ",*" to this if 'includeChildren' is true.

Supported API: true

Throws:
Exception

getMBeanInfo

public MBeanInfo getMBeanInfo()
Overriden to fix JDK StandardMBean's lack of proper getNotificationInfo() support.

Note: To override/augment/amend this MBeanInfo, but still use this classes' per-class caching strategy, override createMBeanInfo() instead. On the other hand, to use a different, overlaid caching strategy override this routine and call this implementation to get the base standard MBean info.

Supported API: true

Specified by:
getMBeanInfo in interface DynamicMBean
Overrides:
getMBeanInfo in class wt.jmx.core.StandardMBeanFix

createMBeanInfo

protected MBeanInfo createMBeanInfo(MBeanInfo baseClassMBeanInfo)
This method is intended for sub-classes to override without worrying about caching policies, etc.

No cache access should be performed herein. Also, in general, the first line of an override of this method should be

baseClassMBeanInfo = super.createMBeanInfo( baseClassMBeanInfo );
unless one has a good reason to override additions/adjustments made by super classes.

Supported API: true


getCachedInstanceMBeanInfo

protected MBeanInfo getCachedInstanceMBeanInfo()
Exposes javax.management.StandardMBean.getCachedMBeanInfo() to subclasses so they can access cached MBeanInfo directly in this instance object without introducing another field. See also cacheMBeanInfoInInstance().

Supported API: true


getCachedMBeanInfo

protected MBeanInfo getCachedMBeanInfo()
Get cached MBeanInfo. Note this class caches MBeanInfo per implementation class and this will be checked if the given instance does not have its own cached MBeanInfo.

Supported API: true

Overrides:
getCachedMBeanInfo in class wt.jmx.core.StandardMBeanFix

cacheMBeanInfoInInstance

protected void cacheMBeanInfoInInstance(MBeanInfo info)
Exposes javax.management.StandardMBean.cacheMBeanInfo() to subclasses so they can cache their MBeanInfo directly in this instance object without introducing another field. See also getCachedInstanceMBeanInfo() to access the result.

Supported API: true


cacheMBeanInfo

protected void cacheMBeanInfo(MBeanInfo info)
Cache MBeanInfo in this instance and in per implementation class cache as well.

Supported API: true

Overrides:
cacheMBeanInfo in class wt.jmx.core.StandardMBeanFix

getDescription

protected String getDescription(MBeanInfo info)
See StandardMBean.

Supported API: true

Overrides:
getDescription in class wt.jmx.core.StandardMBeanFix

getDescription

protected String getDescription(MBeanAttributeInfo info)
See StandardMBean.

Supported API: true

Overrides:
getDescription in class wt.jmx.core.StandardMBeanFix

getDescription

protected String getDescription(MBeanOperationInfo info)
See StandardMBean.

Supported API: true

Overrides:
getDescription in class wt.jmx.core.StandardMBeanFix

getDescription

protected String getDescription(MBeanOperationInfo op,
                                MBeanParameterInfo param,
                                int sequence)
See StandardMBean.

Supported API: true

Overrides:
getDescription in class wt.jmx.core.StandardMBeanFix

getParameterName

protected String getParameterName(MBeanOperationInfo op,
                                  MBeanParameterInfo param,
                                  int sequence)
See StandardMBean.

Supported API: true

Overrides:
getParameterName in class wt.jmx.core.StandardMBeanFix

getImpact

protected int getImpact(MBeanOperationInfo info)
See StandardMBean.

Supported API: true

Overrides:
getImpact in class wt.jmx.core.StandardMBeanFix