Class MBeanUtils


  • public class MBeanUtils
    extends java.lang.Object
    Public utility methods in support of the server side MBeans implementation.
    Author:
    Craig R. McClanahan, Amy Roh
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static StringManager sm  
    • Constructor Summary

      Constructors 
      Constructor Description
      MBeanUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static javax.management.DynamicMBean createMBean​(ContextEnvironment environment)
      Create, register, and return an MBean for this ContextEnvironment object.
      static javax.management.DynamicMBean createMBean​(ContextResource resource)
      Create, register, and return an MBean for this ContextResource object.
      static javax.management.DynamicMBean createMBean​(ContextResourceLink resourceLink)
      Create, register, and return an MBean for this ContextResourceLink object.
      static javax.management.ObjectName createObjectName​(java.lang.String domain, ContextEnvironment environment)
      Create an ObjectName for this Service object.
      static javax.management.ObjectName createObjectName​(java.lang.String domain, ContextResource resource)
      Create an ObjectName for this ContextResource object.
      static javax.management.ObjectName createObjectName​(java.lang.String domain, ContextResourceLink resourceLink)
      Create an ObjectName for this ContextResourceLink object.
      static Registry createRegistry()
      Create and configure (if necessary) and return the registry of managed object descriptions.
      static javax.management.MBeanServer createServer()
      Create and configure (if necessary) and return the MBeanServer with which we will be registering our DynamicMBean implementations.
      static void destroyMBean​(ContextEnvironment environment)
      Deregister the MBean for this ContextEnvironment object.
      static void destroyMBean​(ContextResource resource)
      Deregister the MBean for this ContextResource object.
      static void destroyMBean​(ContextResourceLink resourceLink)
      Deregister the MBean for this ContextResourceLink object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MBeanUtils

        public MBeanUtils()
    • Method Detail

      • createMBean

        public static javax.management.DynamicMBean createMBean​(ContextEnvironment environment)
                                                         throws java.lang.Exception
        Create, register, and return an MBean for this ContextEnvironment object.
        Parameters:
        environment - The ContextEnvironment to be managed
        Returns:
        a new MBean
        Throws:
        java.lang.Exception - if an MBean cannot be created or registered
      • createMBean

        public static javax.management.DynamicMBean createMBean​(ContextResource resource)
                                                         throws java.lang.Exception
        Create, register, and return an MBean for this ContextResource object.
        Parameters:
        resource - The ContextResource to be managed
        Returns:
        a new MBean
        Throws:
        java.lang.Exception - if an MBean cannot be created or registered
      • createMBean

        public static javax.management.DynamicMBean createMBean​(ContextResourceLink resourceLink)
                                                         throws java.lang.Exception
        Create, register, and return an MBean for this ContextResourceLink object.
        Parameters:
        resourceLink - The ContextResourceLink to be managed
        Returns:
        a new MBean
        Throws:
        java.lang.Exception - if an MBean cannot be created or registered
      • createObjectName

        public static javax.management.ObjectName createObjectName​(java.lang.String domain,
                                                                   ContextEnvironment environment)
                                                            throws javax.management.MalformedObjectNameException
        Create an ObjectName for this Service object.
        Parameters:
        domain - Domain in which this name is to be created
        environment - The ContextEnvironment to be named
        Returns:
        a new object name
        Throws:
        javax.management.MalformedObjectNameException - if a name cannot be created
      • createObjectName

        public static javax.management.ObjectName createObjectName​(java.lang.String domain,
                                                                   ContextResource resource)
                                                            throws javax.management.MalformedObjectNameException
        Create an ObjectName for this ContextResource object.
        Parameters:
        domain - Domain in which this name is to be created
        resource - The ContextResource to be named
        Returns:
        a new object name
        Throws:
        javax.management.MalformedObjectNameException - if a name cannot be created
      • createObjectName

        public static javax.management.ObjectName createObjectName​(java.lang.String domain,
                                                                   ContextResourceLink resourceLink)
                                                            throws javax.management.MalformedObjectNameException
        Create an ObjectName for this ContextResourceLink object.
        Parameters:
        domain - Domain in which this name is to be created
        resourceLink - The ContextResourceLink to be named
        Returns:
        a new object name
        Throws:
        javax.management.MalformedObjectNameException - if a name cannot be created
      • createRegistry

        public static Registry createRegistry()
        Create and configure (if necessary) and return the registry of managed object descriptions.
        Returns:
        the singleton registry
      • createServer

        public static javax.management.MBeanServer createServer()
        Create and configure (if necessary) and return the MBeanServer with which we will be registering our DynamicMBean implementations.
        Returns:
        the singleton MBean server
      • destroyMBean

        public static void destroyMBean​(ContextEnvironment environment)
                                 throws java.lang.Exception
        Deregister the MBean for this ContextEnvironment object.
        Parameters:
        environment - The ContextEnvironment to be managed
        Throws:
        java.lang.Exception - if an MBean cannot be deregistered
      • destroyMBean

        public static void destroyMBean​(ContextResource resource)
                                 throws java.lang.Exception
        Deregister the MBean for this ContextResource object.
        Parameters:
        resource - The ContextResource to be managed
        Throws:
        java.lang.Exception - if an MBean cannot be deregistered
      • destroyMBean

        public static void destroyMBean​(ContextResourceLink resourceLink)
                                 throws java.lang.Exception
        Deregister the MBean for this ContextResourceLink object.
        Parameters:
        resourceLink - The ContextResourceLink to be managed
        Throws:
        java.lang.Exception - if an MBean cannot be deregistered