Top Description Methods
org.apache.tomcat.util.modeler

public Interface RegistryMBean

Known Direct Implementers
org.apache.tomcat.util.modeler.Registry
Imports
java.util.List, javax.management.ObjectName

Interface for modeler MBeans. This is the main entry point into modeler. It provides methods to create and manipulate model mbeans and simplify their use. Starting with version 1.1, this is no longer a singleton and the static methods are strongly deprecated. In a container environment we can expect different applications to use different registries.
Authors
Craig R. McClanahan, Costin Manolache
Since
1.1

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

A unique id for the domain:name combination
getId
(String
Namespace
domain
,
String
Type of the notification
name
)

Return an int ID for faster access.

public void
invoke(List<ObjectName>
List of ObjectNames
mbeans
,
String
Operation to perform. Typically "init" "start" "stop" or "destroy"
operation
,
boolean
Behavior in case of exceptions - if false we'll ignore errors
failFirst
)

Invoke an operation on a set of mbeans.

public void
registerComponent(Object
Object to be registered
bean
,
String
Name used for registration
oname
,
String
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.
type
)

Register a bean by creating a modeler mbean and adding it to the MBeanServer.

public void
stop()

Reset all metadata cached by this registry.

public void
unregisterComponent(String
The name used by the bean
oname
)

Unregister a component.

Method Detail

getIdback to summary
public int getId(String domain, String name)

Return an int ID for faster access. Will be used for notifications and for other operations we want to optimize.

Parameters
domain:String

Namespace

name:String

Type of the notification

Returns:int

A unique id for the domain:name combination

Since
1.1
invokeback to summary
public void invoke(List<ObjectName> mbeans, String operation, boolean failFirst) throws Exception

Invoke an operation on a set of mbeans.

Parameters
mbeans:List<ObjectName>

List of ObjectNames

operation:String

Operation to perform. Typically "init" "start" "stop" or "destroy"

failFirst:boolean

Behavior in case of exceptions - if false we'll ignore errors

Exceptions
Exception:
Error invoking operation
registerComponentback to summary
public void registerComponent(Object bean, String oname, String type) throws Exception

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.

Parameters
bean:Object

Object to be registered

oname:String

Name used for registration

type:String

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.

Exceptions
Exception:
Error registering MBean
Since
1.1
stopback to summary
public void stop()

Reset all metadata cached by this registry. Should be called to support reloading. Existing mbeans will not be affected or modified. It will be called automatically if the Registry is unregistered.

Since
1.1
unregisterComponentback to summary
public void unregisterComponent(String oname)

Unregister a component. We'll first check if it is registered, and mask all errors. This is mostly a helper.

Parameters
oname:String

The name used by the bean

Since
1.1