# Interface MBeanServerForwarder

All Superinterfaces:
  `MBeanServer, MBeanServerConnection`

public interface MBeanServerForwarder extends MBeanServer

An object of this class implements the MBeanServer interface and wraps another object that also implements that interface. Typically, an implementation of this interface performs some action in some or all methods of the `MBeanServer` interface before and/or after forwarding the method to the wrapped object. Examples include security checking and logging.

Since:
  1.5

## Method Summary

Modifier and Type
Method
Description
`MBeanServer`
`getMBeanServer()`
Returns the MBeanServer object to which requests will be forwarded.
`void`
`setMBeanServer(MBeanServer mbs)`
Sets the MBeanServer object to which requests will be forwarded after treatment by this object.

### Methods declared in interface MBeanServer

`addNotificationListener, addNotificationListener, createMBean, createMBean, createMBean, createMBean, deserialize, deserialize, deserialize, getAttribute, getAttributes, getClassLoader, getClassLoaderFor, getClassLoaderRepository, getDefaultDomain, getDomains, getMBeanCount, getMBeanInfo, getObjectInstance, instantiate, instantiate, instantiate, instantiate, invoke, isInstanceOf, isRegistered, queryMBeans, queryNames, registerMBean, removeNotificationListener, removeNotificationListener, removeNotificationListener, removeNotificationListener, setAttribute, setAttributes, unregisterMBean`
Modifier and Type
Method
Description
`void`
`addNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback)`
Adds a listener to a registered MBean.
`void`
`addNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback)`
Adds a listener to a registered MBean.
`ObjectInstance`
`createMBean(String className, ObjectName name)`
Instantiates and registers an MBean in the MBean server.
`ObjectInstance`
`createMBean(String className, ObjectName name, Object[] params, String[] signature)`
Instantiates and registers an MBean in the MBean server.
`ObjectInstance`
`createMBean(String className, ObjectName name, ObjectName loaderName)`
Instantiates and registers an MBean in the MBean server.
`ObjectInstance`
`createMBean(String className, ObjectName name, ObjectName loaderName, Object[] params, String[] signature)`
Instantiates and registers an MBean in the MBean server.
`default ObjectInputStream`
`deserialize(String className, byte[] data)`
Deprecated.
Use `MBeanServer.getClassLoaderRepository()` to obtain the class loader repository and use it to deserialize.
`default ObjectInputStream`
`deserialize(String className, ObjectName loaderName, byte[] data)`
Deprecated.
Use `getClassLoader` to obtain the class loader for deserialization.
`default ObjectInputStream`
`deserialize(ObjectName name, byte[] data)`
Deprecated.
Use `getClassLoaderFor` to obtain the appropriate class loader for deserialization.
`Object`
`getAttribute(ObjectName name, String attribute)`
Gets the value of a specific attribute of a named MBean.
`AttributeList`
`getAttributes(ObjectName name, String[] attributes)`
Retrieves the values of several attributes of a named MBean.
`ClassLoader`
`getClassLoader(ObjectName loaderName)`
Return the named `ClassLoader`.
`ClassLoader`
`getClassLoaderFor(ObjectName mbeanName)`
Return the `ClassLoader` that was used for loading the class of the named MBean.
`ClassLoaderRepository`
`getClassLoaderRepository()`
Return the ClassLoaderRepository for this MBeanServer.
`String`
`getDefaultDomain()`
Returns the default domain used for naming the MBean.
`String[]`
`getDomains()`
Returns the list of domains in which any MBean is currently registered.
`Integer`
`getMBeanCount()`
Returns the number of MBeans registered in the MBean server.
`MBeanInfo`
`getMBeanInfo(ObjectName name)`
This method discovers the attributes and operations that an MBean exposes for management.
`ObjectInstance`
`getObjectInstance(ObjectName name)`
Gets the `ObjectInstance` for a given MBean registered with the MBean server.
`Object`
`instantiate(String className)`
Instantiates an object using the list of all class loaders registered in the MBean server's `Class Loader Repository`.
`Object`
`instantiate(String className, Object[] params, String[] signature)`
Instantiates an object using the list of all class loaders registered in the MBean server `Class Loader Repository`.
`Object`
`instantiate(String className, ObjectName loaderName)`
Instantiates an object using the class Loader specified by its `ObjectName`.
`Object`
`instantiate(String className, ObjectName loaderName, Object[] params, String[] signature)`
Instantiates an object.
`Object`
`invoke(ObjectName name, String operationName, Object[] params, String[] signature)`
Invokes an operation on an MBean.
`boolean`
`isInstanceOf(ObjectName name, String className)`
Returns true if the MBean specified is an instance of the specified class, false otherwise.
`boolean`
`isRegistered(ObjectName name)`
Checks whether an MBean, identified by its object name, is already registered with the MBean server.
`Set<ObjectInstance>`
`queryMBeans(ObjectName name, QueryExp query)`
Gets MBeans controlled by the MBean server.
`Set<ObjectName>`
`queryNames(ObjectName name, QueryExp query)`
Gets the names of MBeans controlled by the MBean server.
`ObjectInstance`
`registerMBean(Object object, ObjectName name)`
Registers a pre-existing object as an MBean with the MBean server.
`void`
`removeNotificationListener(ObjectName name, NotificationListener listener)`
Removes a listener from a registered MBean.
`void`
`removeNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback)`
Removes a listener from a registered MBean.
`void`
`removeNotificationListener(ObjectName name, ObjectName listener)`
Removes a listener from a registered MBean.
`void`
`removeNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback)`
Removes a listener from a registered MBean.
`void`
`setAttribute(ObjectName name, Attribute attribute)`
Sets the value of a specific attribute of a named MBean.
`AttributeList`
`setAttributes(ObjectName name, AttributeList attributes)`
Sets the values of several attributes of a named MBean.
`void`
`unregisterMBean(ObjectName name)`
Unregisters an MBean from the MBean server.

## Method Details

### getMBeanServer

MBeanServer getMBeanServer()
Returns the MBeanServer object to which requests will be forwarded.

Returns:
  the MBeanServer object to which requests will be forwarded, or null if there is none.
See Also:
  - `setMBeanServer(MBeanServer)`

### setMBeanServer

void setMBeanServer(MBeanServer mbs)
Sets the MBeanServer object to which requests will be forwarded after treatment by this object.

Parameters:
  `mbs` - the MBeanServer object to which requests will be forwarded.
Throws:
  `IllegalArgumentException` - if this object is already forwarding to an MBeanServer object or if `mbs` is null or if `mbs` is identical to this object.
See Also:
  - `getMBeanServer()`