Package wt.jmx.core

Class StandardMBean

All Implemented Interfaces:
DynamicMBean, MBeanRegistration
Direct Known Subclasses:
ContextMonitor, Request, SelfAwareMBean

public class StandardMBean extends StandardMBean
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 MBeanInterfaceProcessor 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.

Finally note that the Descriptor of the MBeanInfo produced by this class will denote "immutableInfo" as "true" by default. Subclasses will need to override this if their MBeanInfo is actually mutable.

Supported API: true

Extendable: true

  • Constructor Details

    • StandardMBean

      public StandardMBean(T implementation, Class<T> mbeanInterface) throws NotCompliantMBeanException
      Pass through constructor.

      Supported API: true
      Throws:
      NotCompliantMBeanException
    • StandardMBean

      public StandardMBean(T implementation, Class<T> mbeanInterface, boolean isMXBean)
      Pass through constructor.

      Supported API: true
    • StandardMBean

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

      Supported API: true
      Throws:
      NotCompliantMBeanException
    • StandardMBean

      protected StandardMBean(Class<?> mbeanInterface, boolean isMXBean)
      Pass through constructor.

      Supported API: true
  • Method Details

    • getAttributes

      public AttributeList getAttributes(String[] attributes)
      Overriden as StandardMBean does not otherwise necessarily delegate this object's getAttribute() method, whereas various subclasses of this class depend upon such behavior and such behavior seems like most logical and consistent all around.

      Supported API: true
      Specified by:
      getAttributes in interface DynamicMBean
      Overrides:
      getAttributes in class StandardMBean
    • setAttributes

      public AttributeList setAttributes(AttributeList attributes)
      Overriden as StandardMBean does not otherwise necessarily delegate this object's setAttribute() method, whereas various subclasses of this class depend upon such behavior and such behavior seems like most logical and consistent all around.

      Supported API: true
      Specified by:
      setAttributes in interface DynamicMBean
      Overrides:
      setAttributes in class StandardMBean
    • 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 StandardMBean
    • 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 StandardMBean
    • 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 StandardMBean
    • getDescription

      protected String getDescription(MBeanInfo info)
      See StandardMBean.

      Supported API: true
      Overrides:
      getDescription in class StandardMBean
    • getDescription

      protected String getDescription(MBeanAttributeInfo info)
      See StandardMBean.

      Supported API: true
      Overrides:
      getDescription in class StandardMBean
    • getDescription

      protected String getDescription(MBeanOperationInfo info)
      See StandardMBean.

      Supported API: true
      Overrides:
      getDescription in class StandardMBean
    • getDescription

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

      Supported API: true
      Overrides:
      getDescription in class StandardMBean
    • getParameterName

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

      Supported API: true
      Overrides:
      getParameterName in class StandardMBean
    • getImpact

      protected int getImpact(MBeanOperationInfo info)
      See StandardMBean.

      Supported API: true
      Overrides:
      getImpact in class StandardMBean