Save This Page
Home » apache-tomcat-6.0.26-src » org.apache » tomcat » util » modeler » [javadoc | source]
org.apache.tomcat.util.modeler
public class: Registry [javadoc | source]
java.lang.Object
   org.apache.tomcat.util.modeler.Registry

All Implemented Interfaces:
    RegistryMBean, MBeanRegistration

Registry 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. This class is itself an mbean. IMPORTANT: public methods not marked with @since x.x are experimental or internal. Should not be used.
Constructor:
 public Registry() 
Method from org.apache.tomcat.util.modeler.Registry Summary:
addManagedBean,   convertValue,   findManagedBean,   findManagedBean,   findManagedBean,   findManagedBeans,   findManagedBeans,   getId,   getMBeanServer,   getMethodInfo,   getRegistry,   getRegistry,   getServer,   getType,   invoke,   load,   loadCachedDescriptors,   loadDescriptors,   loadDescriptors,   loadDescriptors,   loadMBeans,   loadMetadata,   loadRegistry,   postDeregister,   postRegister,   preDeregister,   preRegister,   registerComponent,   registerComponent,   registerComponent,   removeManagedBean,   resetMetadata,   setMBeanServer,   setServer,   setUseContextClassLoader,   stop,   unregisterComponent,   unregisterComponent,   unregisterComponent,   unregisterRegistry
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.tomcat.util.modeler.Registry Detail:
 public  void addManagedBean(ManagedBean bean) 
    Add a new bean metadata to the set of beans known to this registry. This is used by internal components.
 public Object convertValue(String type,
    String value) 
    EXPERIMENTAL Convert a string to object, based on type. Used by several components. We could provide some pluggability. It is here to keep things consistent and avoid duplication in other tasks
 public ManagedBean findManagedBean(String name) 
    Find and return the managed bean definition for the specified bean name, if any; otherwise return null.
 public ManagedBean findManagedBean(Class beanClass,
    String type) throws Exception 
 public ManagedBean findManagedBean(Object bean,
    Class beanClass,
    String type) throws Exception 
    Find or load metadata.
 public String[] findManagedBeans() 
    Return the set of bean names for all managed beans known to this registry.
 public String[] findManagedBeans(String group) 
    Return the set of bean names for all managed beans known to this registry that belong to the specified group.
 public synchronized 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.
 public synchronized MBeanServer getMBeanServer() 
    Factory method to create (if necessary) and return our MBeanServer instance.
 public MBeanOperationInfo getMethodInfo(ObjectName oname,
    String opName) 
    Find the operation info for a method
 public static synchronized Registry getRegistry() 
Deprecated! Not - enough info - use the method that takes CL and domain

    Get a "singelton" registry, or one per thread if setUseContextLoader was called
 public static synchronized Registry getRegistry(Object key,
    Object guard) 
    Factory method to create (if necessary) and return our Registry instance. Use this method to obtain a Registry - all other static methods are deprecated and shouldn't be used. The current version uses a static - future versions could use the thread class loader.
 public static MBeanServer getServer() 
Deprecated! Use - the instance method

    Factory method to create (if necessary) and return our MBeanServer instance.
 public String getType(ObjectName oname,
    String attName) 
    Get the type of an attribute of the object, from the metadata.
 public  void invoke(List mbeans,
    String operation,
    boolean failFirst) throws Exception 
    Invoke a operation on a list of mbeans. Can be used to implement lifecycle operations.
 public List load(String sourceType,
    Object source,
    String param) throws Exception 
Deprecated! bad - interface, mixing of metadata and mbeans

    Experimental.
 public  void loadCachedDescriptors(Object source) throws Exception 
Deprecated! Loaded - automatically or using a File or Url ending in .ser

    Load the registry from a cached .ser file. This is typically 2-3 times faster than parsing the XML.
 public  void loadDescriptors(Object source) throws Exception 
    Load the registry from the XML input found in the specified input stream.
 public  void loadDescriptors(String packageName,
    ClassLoader classLoader) 
    Lookup the component descriptor in the package and in the parent packages.
 public  void loadDescriptors(String sourceType,
    Object source,
    String param) throws Exception 
Deprecated!
    Experimental. Will become private, some code may still use it
 public List loadMBeans(Object source,
    ClassLoader cl) throws Exception 
    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.
 public  void loadMetadata(Object source) throws Exception 
    Load descriptors. The source can be a File or URL or InputStream for the descriptors file. In the case of File and URL, if the extension is ".ser" a serialized version will be loaded. This method should be used to explicitely load metadata - but this is not required in most cases. The registerComponent() method will find metadata in the same pacakge.
 public static  void loadRegistry(InputStream stream) throws Exception 
Deprecated! use - normal class method instead

    Load the registry from the XML input found in the specified input stream.
 public  void postDeregister() 
 public  void postRegister(Boolean registrationDone) 
 public  void preDeregister() throws Exception 
 public ObjectName preRegister(MBeanServer server,
    ObjectName name) throws Exception 
 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.
 public  void registerComponent(Object bean,
    ObjectName oname,
    String type) throws Exception 
    Register a component XXX make it private
 public  void registerComponent(Object bean,
    String domain,
    String type,
    String name) throws Exception 
Deprecated! - - may still be used in code using pre-1.1 builds

 public  void removeManagedBean(ManagedBean bean) 
    Remove an existing bean from the set of beans known to this registry.
 public  void resetMetadata() 
 public  void setMBeanServer(MBeanServer server) 
    Set the MBeanServer to be utilized for our registered management beans.
 public static  void setServer(MBeanServer mbeanServer) 
Deprecated! Use - the instance method

    Set the MBeanServer to be utilized for our registered management beans.
 public static  void setUseContextClassLoader(boolean enable) 
    Allow containers to isolate apps. Can be called only once. It is highly recommended you call this method if using Registry in a container environment. The default is false for backward compatibility
 public  void stop() 
    Lifecycle method - clean up the registry metadata. Called from resetMetadata().
 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.
 public  void unregisterComponent(ObjectName oname) 
    Unregister a component. This is just a helper that avoids exceptions by checking if the mbean is already registered
 public  void unregisterComponent(String domain,
    String name) 
 public  void unregisterRegistry(ClassLoader loader) 
    Called by a registry or by the container to unload a loader