Package: groovy.jmx.builder

## [Java] Class JmxBuilderModelMBean

- groovy.jmx.builder.JmxBuilderModelMBean

- All Implemented Interfaces and Traits:
    NotificationListener

      public class JmxBuilderModelMBean
      extends RequiredModelMBean
      implements NotificationListener

  The JmxBuilderModelMBean is the MBean class that proxies exported POGO/POJO inside the MBeanServer. When JmxBuilder exports an object instance, an instance of this class is created and exported inside the MBeanServer.

- - ### Constructor Summary

    Constructors
    Constructor and description
    `JmxBuilderModelMBean(Object objectRef)` Creates a model MBean for the supplied managed resource.
    `JmxBuilderModelMBean()` Creates an empty model MBean.
    `JmxBuilderModelMBean(ModelMBeanInfo mbi)` Creates a model MBean backed by the supplied metadata.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public void` | `addEventListeners(MBeanServer server, Map<String, Map<String, Object>> descriptor)` Sets up event listeners for this MBean as described in the descriptor.
    `` | `public void` | `addOperationCallListeners(Map<String, Map<String, Map<String, Object>>> descriptor)` Registers listeners for operation calls (i.e. method, getter, and setter calls) when invoked on this bean from the MBeanServer.
    `` | `public void` | `handleNotification(Notification note, Object handback)` Handles notifications received by this model MBean.
    `` | `public Object` | `invoke(String opName, Object[] opArgs, String[] signature)` Invokes the named operation and emits any configured call notifications.
    `` | `public void` | `setManagedResource(Object obj)` Updates the managed resource exposed by this model MBean.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class RequiredModelMBean` | `addAttributeChangeNotificationListener, addNotificationListener, equals, getAttribute, getAttributes, getClass, getMBeanInfo, getNotificationInfo, hashCode, invoke, load, notify, notifyAll, postDeregister, postRegister, preDeregister, preRegister, removeAttributeChangeNotificationListener, removeNotificationListener, removeNotificationListener, sendAttributeChangeNotification, sendAttributeChangeNotification, sendNotification, sendNotification, setAttribute, setAttributes, setManagedResource, setModelMBeanInfo, store, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### public JmxBuilderModelMBean(Object objectRef)

      Creates a model MBean for the supplied managed resource.

      throws:
        MBeanException if the resource cannot be registered
      throws:
        RuntimeOperationsException if the supplied resource is invalid
      throws:
        InstanceNotFoundException if the resource cannot be found
      throws:
        InvalidTargetObjectTypeException if the resource type is unsupported
      Parameters:
        `objectRef` - the resource to expose

    - #### public JmxBuilderModelMBean()

      Creates an empty model MBean.

      throws:
        MBeanException if initialization fails
      throws:
        RuntimeOperationsException if the MBean cannot be initialized

    - #### public JmxBuilderModelMBean(ModelMBeanInfo mbi)

      Creates a model MBean backed by the supplied metadata.

      throws:
        MBeanException if initialization fails
      throws:
        RuntimeOperationsException if the MBean cannot be initialized
      Parameters:
        `mbi` - the model MBean metadata

  - ### Method Detail

    - #### public void addEventListeners(MBeanServer server, Map<String, Map<String, Object>> descriptor)

      Sets up event listeners for this MBean as described in the descriptor. The descriptor contains a map with layout {item -> Map[event:"...", from:ObjectName, callback:&Closure],...,}

      Parameters:
        `server` - the MBeanServer is to be registered.
        `descriptor` - a map containing info about the event

    - #### public void addOperationCallListeners(Map<String, Map<String, Map<String, Object>>> descriptor)

      Registers listeners for operation calls (i.e. method, getter, and setter calls) when invoked on this bean from the MBeanServer. Descriptor should contain a map with layout `item -> [Map[methodListener:[target:"", tpe:"", callback:&Closure], ... ,]]`

      Parameters:
        `descriptor` - MetaMap descriptor containing description of operation call listeners

    - #### public void handleNotification(Notification note, Object handback)

      Handles notifications received by this model MBean.

      Parameters:
        `note` - the received notification
        `handback` - the handback object supplied at registration time

    - #### public Object invoke(String opName, Object[] opArgs, String[] signature)

      Invokes the named operation and emits any configured call notifications.

      throws:
        MBeanException if the invocation fails
      throws:
        ReflectionException if the method cannot be resolved
      Parameters:
        `opName` - the operation name
        `opArgs` - the invocation arguments
        `signature` - the argument signature
      Returns:
        the invocation result

    - #### public void setManagedResource(Object obj)

      Updates the managed resource exposed by this model MBean.

      Parameters:
        `obj` - the resource to expose