| org.apache.tomcat.util.modeler.RegistryMBean
All known Subclasses: org.apache.tomcat.util.modeler.Registry,
RegistryMBean | public interface RegistryMBean (Code) | | 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.
author: Craig R. McClanahan author: Costin Manolache since: 1.1 |
Method Summary | |
public int | getId(String domain, String name) Return an int ID for faster access. | public void | invoke(List mbeans, String operation, boolean failFirst) Invoke an operation on a set of mbeans. | public List | loadMBeans(Object source, ClassLoader cl) Load an extended mlet file. | public void | loadMetadata(Object source) Load descriptors. | public void | registerComponent(Object bean, String oname, String type) 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. | public void | stop() Reset all metadata cached by this registry. | public void | unregisterComponent(String oname) Unregister a component. |
getId | public int getId(String domain, String name)(Code) | | Return an int ID for faster access. Will be used for notifications
and for other operations we want to optimize.
Parameters: domain - Namespace Parameters: name - Type of the notification An unique id for the domain:name combination since: 1.1 |
invoke | public void invoke(List mbeans, String operation, boolean failFirst) throws Exception(Code) | | Invoke an operation on a set of mbeans.
Parameters: mbeans - List of ObjectNames Parameters: operation - Operation to perform. Typically "init" "start" "stop" or "destroy" Parameters: failFirst - Behavior in case of exceptions - if false we'll ignoreerrors throws: Exception - |
loadMBeans | public List loadMBeans(Object source, ClassLoader cl) throws Exception(Code) | | Load an extended mlet file. The source can be an URL, File or
InputStream.
All mbeans will be instantiated, registered and the attributes will be
set. The result is a list of ObjectNames.
Parameters: source - InputStream or URL of the file Parameters: cl - ClassLoader to be used to load the mbeans, or null to use thedefault JMX mechanism ( i.e. all registered loaders ) List of ObjectName for the loaded mbeans throws: Exception - since: 1.1 |
loadMetadata | public void loadMetadata(Object source) throws Exception(Code) | | Load descriptors. The source can be a File, URL pointing to an
mbeans-descriptors.xml.
Also ( experimental for now ) a ClassLoader - in which case META-INF/ will
be used.
Parameters: source - |
registerComponent | public void registerComponent(Object bean, String oname, String type) throws Exception(Code) | | 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 to be registered Parameters: oname - Name used for registration Parameters: type - The type of the mbean, as declared in mbeans-descriptors. Ifnull, the name of the class will be used. This can be used as a hint orby subclasses. since: 1.1 |
stop | public void stop()(Code) | | 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 |
unregisterComponent | public void unregisterComponent(String oname)(Code) | | Unregister a component. We'll first check if it is registered,
and mask all errors. This is mostly a helper.
Parameters: oname - since: 1.1 |
|
|