NamingResourcesMBean (Apache Tomcat 10.1.57 API Documentation)
Description: declaration: package: org.apache.catalina.mbeans, class: NamingResourcesMBean

# Class NamingResourcesMBean

java.lang.Object
org.apache.tomcat.util.modeler.BaseModelMBean
org.apache.catalina.mbeans.NamingResourcesMBean

All Implemented Interfaces:
  `DynamicMBean, MBeanRegistration, ModelMBeanNotificationBroadcaster, NotificationBroadcaster`

public class NamingResourcesMBean extends BaseModelMBean
A ModelMBean implementation for the `org.apache.catalina.deploy.NamingResourcesImpl` component.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final ManagedBean`
  `managed`
  The `ManagedBean` information describing this MBean.
  `protected final Registry`
  `registry`
  The configuration information registry for our managed beans.

  ### Fields inherited from class BaseModelMBean

  `attributeBroadcaster, generalBroadcaster, managedBean, oname, resource, resourceType`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `NamingResourcesMBean()`
  Default constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `addEnvironment(String envName, String type, String value)`
  Add an environment entry for this web application.
  `String`
  `addResource(String resourceName, String type)`
  Add a resource reference for this web application.
  `String`
  `addResourceLink(String resourceLinkName, String type)`
  Add a resource link reference for this web application.
  `String[]`
  `getEnvironments()`
  Return the MBean Names of the set of defined environment entries for this web application
  `String[]`
  `getResourceLinks()`
  Return the MBean Names of all the defined resource link references for this application.
  `String[]`
  `getResources()`
  Return the MBean Names of all the defined resource references for this application.
  `void`
  `removeEnvironment(String envName)`
  Remove any environment entry with the specified name.
  `void`
  `removeResource(String resourceName)`
  Remove any resource reference with the specified name.
  `void`
  `removeResourceLink(String resourceLinkName)`
  Remove any resource link reference with the specified name.

  ### Methods inherited from class BaseModelMBean

  `addAttributeChangeNotificationListener, addNotificationListener, getAttribute, getAttributes, getClassName, getJmxName, getManagedResource, getMBeanInfo, getModelerType, getNotificationInfo, getObjectName, invoke, postDeregister, postRegister, preDeregister, preRegister, removeAttributeChangeNotificationListener, removeNotificationListener, sendAttributeChangeNotification, sendAttributeChangeNotification, sendNotification, sendNotification, setAttribute, setAttributes, setManagedBean, setManagedResource, toString`

  ### Methods inherited from class Object

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

- ## Field Details

  - ### registry

    protected final Registry registry
    The configuration information registry for our managed beans.

  - ### managed

    protected final ManagedBean managed
    The `ManagedBean` information describing this MBean.

- ## Constructor Details

  - ### NamingResourcesMBean

    public NamingResourcesMBean()
    Default constructor.

- ## Method Details

  - ### getEnvironments

    public String[] getEnvironments()
    Return the MBean Names of the set of defined environment entries for this web application
    Returns:
      an array of object names as strings

  - ### getResources

    public String[] getResources()
    Return the MBean Names of all the defined resource references for this application.
    Returns:
      an array of object names as strings

  - ### getResourceLinks

    public String[] getResourceLinks()
    Return the MBean Names of all the defined resource link references for this application.
    Returns:
      an array of object names as strings

  - ### addEnvironment

    public String addEnvironment(String envName, String type, String value) throws MalformedObjectNameException
    Add an environment entry for this web application.
    Parameters:
      `envName` - New environment entry name
      `type` - The type of the new environment entry
      `value` - The value of the new environment entry
    Returns:
      the object name of the new environment entry
    Throws:
      `MalformedObjectNameException` - if the object name was invalid

  - ### addResource

    public String addResource(String resourceName, String type) throws MalformedObjectNameException
    Add a resource reference for this web application.
    Parameters:
      `resourceName` - New resource reference name
      `type` - New resource reference type
    Returns:
      the object name of the new resource
    Throws:
      `MalformedObjectNameException` - if the object name was invalid

  - ### addResourceLink

    public String addResourceLink(String resourceLinkName, String type) throws MalformedObjectNameException
    Add a resource link reference for this web application.
    Parameters:
      `resourceLinkName` - New resource link reference name
      `type` - New resource link reference type
    Returns:
      the object name of the new resource link
    Throws:
      `MalformedObjectNameException` - if the object name was invalid

  - ### removeEnvironment

    public void removeEnvironment(String envName)
    Remove any environment entry with the specified name.
    Parameters:
      `envName` - Name of the environment entry to remove

  - ### removeResource

    public void removeResource(String resourceName)
    Remove any resource reference with the specified name.
    Parameters:
      `resourceName` - Name of the resource reference to remove

  - ### removeResourceLink

    public void removeResourceLink(String resourceLinkName)
    Remove any resource link reference with the specified name.
    Parameters:
      `resourceLinkName` - Name of the resource link reference to remove