NoDescriptorRegistry (Apache Tomcat 9.0.37 API Documentation)

org.apache.tomcat.util.modeler

## Class NoDescriptorRegistry

- java.lang.Object
- - org.apache.tomcat.util.modeler.Registry
  - - org.apache.tomcat.util.modeler.NoDescriptorRegistry

- All Implemented Interfaces:
    MBeanRegistration, RegistryMBean

      public class NoDescriptorRegistry
      extends Registry

  An implementation of the MBean registry that effectively disables MBean registration. This is typically used when low memory footprint is a primary concern.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `NoDescriptorRegistry()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addManagedBean(ManagedBean bean)` Add a new bean metadata to the set of beans known to this registry.
    `ManagedBean` | `findManagedBean(Object bean, Class<?> beanClass, String type)` Find or load metadata.
    `ManagedBean` | `findManagedBean(String name)` Find and return the managed bean definition for the specified bean name, if any; otherwise return `null`.
    `int` | `getId(String domain, String name)` Return an int ID for faster access.
    `MBeanServer` | `getMBeanServer()` Factory method to create (if necessary) and return our `MBeanServer` instance.
    `MBeanOperationInfo` | `getMethodInfo(ObjectName oname, String opName)` Find the operation info for a method
    `String` | `getType(ObjectName oname, String attName)` Get the type of an attribute of the object, from the metadata.
    `void` | `invoke(List<ObjectName> mbeans, String operation, boolean failFirst)` Invoke a operation on a list of mbeans.
    `List<ObjectName>` | `load(String sourceType, Object source, String param)` Experimental.
    `void` | `loadDescriptors(String packageName, ClassLoader classLoader)` Lookup the component descriptor in the package and in the parent packages.
    `void` | `registerComponent(Object bean, ObjectName oname, String type)` Register a component
    `void` | `registerComponent(Object bean, String oname, String type)` Register a bean by creating a modeler mbean and adding it to the MBeanServer.
    `void` | `unregisterComponent(ObjectName oname)` Unregister a component.
    `void` | `unregisterComponent(String oname)` Unregister a component.

    - ### Methods inherited from class org.apache.tomcat.util.modeler.Registry

      `convertValue, disableRegistry, getMethodInfo, getRegistry, postDeregister, postRegister, preDeregister, preRegister, stop`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### NoDescriptorRegistry

          public NoDescriptorRegistry()

  - ### Method Detail

    - #### registerComponent

          public void registerComponent(Object bean,
                                        String oname,
                                        String type)
                                 throws Exception

      Description copied from class: `Registry`
      Register a bean by creating a modeler mbean and adding it to the MBeanServer. If metadata is not loaded, we'll look up and read a file named "mbeans-descriptors.ser" or "mbeans-descriptors.xml" in the same package or parent. If the bean is an instance of DynamicMBean. it's metadata will be converted to a model mbean and we'll wrap it - so modeler services will be supported If the metadata is still not found, introspection will be used to extract it automatically. If an mbean is already registered under this name, it'll be first unregistered. If the component implements MBeanRegistration, the methods will be called. If the method has a method "setRegistry" that takes a RegistryMBean as parameter, it'll be called with the current registry.
      Specified by:
        `registerComponent` in interface `RegistryMBean`
      Overrides:
        `registerComponent` in class `Registry`
      Parameters:
        `bean` - Object to be registered
        `oname` - Name used for registration
        `type` - The type of the mbean, as declared in mbeans-descriptors. If null, the name of the class will be used. This can be used as a hint or by subclasses.
      Throws:
        `Exception` - if a registration error occurred

    - #### unregisterComponent

          public void unregisterComponent(String oname)

      Description copied from class: `Registry`
      Unregister a component. We'll first check if it is registered, and mask all errors. This is mostly a helper.
      Specified by:
        `unregisterComponent` in interface `RegistryMBean`
      Overrides:
        `unregisterComponent` in class `Registry`
      Parameters:
        `oname` - Name used for unregistration

    - #### invoke

          public void invoke(List<ObjectName> mbeans,
                             String operation,
                             boolean failFirst)
                      throws Exception

      Description copied from class: `Registry`
      Invoke a operation on a list of mbeans. Can be used to implement lifecycle operations.
      Specified by:
        `invoke` in interface `RegistryMBean`
      Overrides:
        `invoke` in class `Registry`
      Parameters:
        `mbeans` - list of ObjectName on which we'll invoke the operations
        `operation` - Name of the operation ( init, start, stop, etc)
        `failFirst` - If false, exceptions will be ignored
      Throws:
        `Exception` - Error invoking operation

    - #### getId

          public int getId(String domain,
                           String name)

      Description copied from class: `Registry`
      Return an int ID for faster access. Will be used for notifications and for other operations we want to optimize.
      Specified by:
        `getId` in interface `RegistryMBean`
      Overrides:
        `getId` in class `Registry`
      Parameters:
        `domain` - Namespace
        `name` - Type of the notification
      Returns:
        A unique id for the domain:name combination

    - #### addManagedBean

          public void addManagedBean(ManagedBean bean)

      Description copied from class: `Registry`
      Add a new bean metadata to the set of beans known to this registry. This is used by internal components.
      Overrides:
        `addManagedBean` in class `Registry`
      Parameters:
        `bean` - The managed bean to be added

    - #### findManagedBean

          public ManagedBean findManagedBean(String name)

      Description copied from class: `Registry`
      Find and return the managed bean definition for the specified bean name, if any; otherwise return `null`.
      Overrides:
        `findManagedBean` in class `Registry`
      Parameters:
        `name` - Name of the managed bean to be returned. Since 1.1, both short names or the full name of the class can be used.
      Returns:
        the managed bean

    - #### getType

          public String getType(ObjectName oname,
                                String attName)

      Description copied from class: `Registry`
      Get the type of an attribute of the object, from the metadata.
      Overrides:
        `getType` in class `Registry`
      Parameters:
        `oname` - The bean name
        `attName` - The attribute name
      Returns:
        null if metadata about the attribute is not found

    - #### getMethodInfo

          public MBeanOperationInfo getMethodInfo(ObjectName oname,
                                                  String opName)

      Description copied from class: `Registry`
      Find the operation info for a method
      Overrides:
        `getMethodInfo` in class `Registry`
      Parameters:
        `oname` - The bean name
        `opName` - The operation name
      Returns:
        the operation info for the specified operation

    - #### findManagedBean

          public ManagedBean findManagedBean(Object bean,
                                             Class<?> beanClass,
                                             String type)
                                      throws Exception

      Description copied from class: `Registry`
      Find or load metadata.
      Overrides:
        `findManagedBean` in class `Registry`
      Parameters:
        `bean` - The bean
        `beanClass` - The bean class
        `type` - The registry type
      Returns:
        the managed bean
      Throws:
        `Exception` - An error occurred

    - #### load

          public List<ObjectName> load(String sourceType,
                                       Object source,
                                       String param)
                                throws Exception

      Description copied from class: `Registry`
      Experimental. Load descriptors.
      Overrides:
        `load` in class `Registry`
      Parameters:
        `sourceType` - The source type
        `source` - The bean
        `param` - A type to load
      Returns:
        List of descriptors
      Throws:
        `Exception` - Error loading descriptors

    - #### loadDescriptors

          public void loadDescriptors(String packageName,
                                      ClassLoader classLoader)

      Description copied from class: `Registry`
      Lookup the component descriptor in the package and in the parent packages.
      Overrides:
        `loadDescriptors` in class `Registry`
      Parameters:
        `packageName` - The package name
        `classLoader` - The class loader

    - #### registerComponent

          public void registerComponent(Object bean,
                                        ObjectName oname,
                                        String type)
                                 throws Exception

      Description copied from class: `Registry`
      Register a component
      Overrides:
        `registerComponent` in class `Registry`
      Parameters:
        `bean` - The bean
        `oname` - The object name
        `type` - The registry type
      Throws:
        `Exception` - Error registering component

    - #### unregisterComponent

          public void unregisterComponent(ObjectName oname)

      Description copied from class: `Registry`
      Unregister a component. This is just a helper that avoids exceptions by checking if the mbean is already registered
      Overrides:
        `unregisterComponent` in class `Registry`
      Parameters:
        `oname` - The bean name

    - #### getMBeanServer

          public MBeanServer getMBeanServer()

      Description copied from class: `Registry`
      Factory method to create (if necessary) and return our `MBeanServer` instance.
      Overrides:
        `getMBeanServer` in class `Registry`
      Returns:
        the MBean server

Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.