|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tomcat.util.modeler.Registry
public class Registry
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 Summary | |
---|---|
Registry()
|
Method Summary | |
---|---|
void |
addManagedBean(ManagedBean bean)
Add a new bean metadata to the set of beans known to this registry. |
java.lang.Object |
convertValue(java.lang.String type,
java.lang.String value)
EXPERIMENTAL Convert a string to object, based on type. |
ManagedBean |
findManagedBean(java.lang.Class beanClass,
java.lang.String type)
|
ManagedBean |
findManagedBean(java.lang.Object bean,
java.lang.Class beanClass,
java.lang.String type)
Find or load metadata. |
ManagedBean |
findManagedBean(java.lang.String name)
Find and return the managed bean definition for the specified bean name, if any; otherwise return null . |
java.lang.String[] |
findManagedBeans()
Return the set of bean names for all managed beans known to this registry. |
java.lang.String[] |
findManagedBeans(java.lang.String group)
Return the set of bean names for all managed beans known to this registry that belong to the specified group. |
int |
getId(java.lang.String domain,
java.lang.String name)
Return an int ID for faster access. |
javax.management.MBeanServer |
getMBeanServer()
Factory method to create (if necessary) and return our MBeanServer instance. |
javax.management.MBeanOperationInfo |
getMethodInfo(javax.management.ObjectName oname,
java.lang.String opName)
Find the operation info for a method |
static Registry |
getRegistry()
Deprecated. Not enough info - use the method that takes CL and domain |
static Registry |
getRegistry(java.lang.Object key,
java.lang.Object guard)
Factory method to create (if necessary) and return our Registry instance. |
static javax.management.MBeanServer |
getServer()
Deprecated. Use the instance method |
java.lang.String |
getType(javax.management.ObjectName oname,
java.lang.String attName)
Get the type of an attribute of the object, from the metadata. |
void |
invoke(java.util.List mbeans,
java.lang.String operation,
boolean failFirst)
Invoke a operation on a list of mbeans. |
java.util.List |
load(java.lang.String sourceType,
java.lang.Object source,
java.lang.String param)
Deprecated. bad interface, mixing of metadata and mbeans |
void |
loadCachedDescriptors(java.lang.Object source)
Deprecated. Loaded automatically or using a File or Url ending in .ser |
void |
loadDescriptors(java.lang.Object source)
Load the registry from the XML input found in the specified input stream. |
void |
loadDescriptors(java.lang.String packageName,
java.lang.ClassLoader classLoader)
Lookup the component descriptor in the package and in the parent packages. |
void |
loadDescriptors(java.lang.String sourceType,
java.lang.Object source,
java.lang.String param)
Deprecated. |
java.util.List |
loadMBeans(java.lang.Object source,
java.lang.ClassLoader cl)
Load an extended mlet file. |
void |
loadMetadata(java.lang.Object source)
Load descriptors. |
static void |
loadRegistry(java.io.InputStream stream)
Deprecated. use normal class method instead |
void |
postDeregister()
|
void |
postRegister(java.lang.Boolean registrationDone)
|
void |
preDeregister()
|
javax.management.ObjectName |
preRegister(javax.management.MBeanServer server,
javax.management.ObjectName name)
|
void |
registerComponent(java.lang.Object bean,
javax.management.ObjectName oname,
java.lang.String type)
Register a component XXX make it private |
void |
registerComponent(java.lang.Object bean,
java.lang.String oname,
java.lang.String type)
Register a bean by creating a modeler mbean and adding it to the MBeanServer. |
void |
registerComponent(java.lang.Object bean,
java.lang.String domain,
java.lang.String type,
java.lang.String name)
Deprecated. - may still be used in code using pre-1.1 builds |
void |
removeManagedBean(ManagedBean bean)
Remove an existing bean from the set of beans known to this registry. |
void |
resetMetadata()
|
void |
setMBeanServer(javax.management.MBeanServer server)
Set the MBeanServer to be utilized for our
registered management beans. |
static void |
setServer(javax.management.MBeanServer mbeanServer)
Deprecated. Use the instance method |
static void |
setUseContextClassLoader(boolean enable)
Allow containers to isolate apps. |
void |
stop()
Lifecycle method - clean up the registry metadata. |
void |
unregisterComponent(javax.management.ObjectName oname)
Unregister a component. |
void |
unregisterComponent(java.lang.String oname)
Unregister a component. |
void |
unregisterComponent(java.lang.String domain,
java.lang.String name)
|
void |
unregisterRegistry(java.lang.ClassLoader loader)
Called by a registry or by the container to unload a loader |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Registry()
Method Detail |
---|
public static Registry getRegistry(java.lang.Object key, java.lang.Object guard)
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.
key
- Support for application isolation. If null, the context class
loader will be used ( if setUseContextClassLoader is called ) or the
default registry is returned.guard
- Prevent access to the registry by untrusted componentspublic static void setUseContextClassLoader(boolean enable)
enable
- public void stop()
stop
in interface RegistryMBean
public java.util.List loadMBeans(java.lang.Object source, java.lang.ClassLoader cl) throws java.lang.Exception
loadMBeans
in interface RegistryMBean
source
- InputStream or URL of the filecl
- ClassLoader to be used to load the mbeans, or null to use the
default JMX mechanism ( i.e. all registered loaders )
java.lang.Exception
public void loadMetadata(java.lang.Object source) throws java.lang.Exception
loadMetadata
in interface RegistryMBean
source
-
java.lang.Exception
public void registerComponent(java.lang.Object bean, java.lang.String oname, java.lang.String type) throws java.lang.Exception
registerComponent
in interface RegistryMBean
bean
- Object to be registeredoname
- Name used for registrationtype
- 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.
java.lang.Exception
public void unregisterComponent(java.lang.String oname)
unregisterComponent
in interface RegistryMBean
oname
- public void invoke(java.util.List mbeans, java.lang.String operation, boolean failFirst) throws java.lang.Exception
invoke
in interface RegistryMBean
mbeans
- list of ObjectName on which we'll invoke the operationsoperation
- Name of the operation ( init, start, stop, etc)failFirst
- If false, exceptions will be ignored
java.lang.Exception
public int getId(java.lang.String domain, java.lang.String name)
getId
in interface RegistryMBean
domain
- Namespacename
- Type of the notification
public void addManagedBean(ManagedBean bean)
bean
- The managed bean to be addedpublic ManagedBean findManagedBean(java.lang.String name)
null
.
name
- Name of the managed bean to be returned. Since 1.1, both
short names or the full name of the class can be used.public java.lang.String[] findManagedBeans()
public java.lang.String[] findManagedBeans(java.lang.String group)
group
- Name of the group of interest, or null
to select beans that do not belong to a grouppublic void removeManagedBean(ManagedBean bean)
bean
- The managed bean to be removedpublic static javax.management.MBeanServer getServer()
MBeanServer
instance.
public static void setServer(javax.management.MBeanServer mbeanServer)
MBeanServer
to be utilized for our
registered management beans.
mbeanServer
- The new MBeanServer
instancepublic static void loadRegistry(java.io.InputStream stream) throws java.lang.Exception
stream
- InputStream containing the registry configuration
information
java.lang.Exception
- if any parsing or processing error occurspublic static Registry getRegistry()
public java.lang.String getType(javax.management.ObjectName oname, java.lang.String attName)
oname
- attName
-
public javax.management.MBeanOperationInfo getMethodInfo(javax.management.ObjectName oname, java.lang.String opName)
oname
- opName
-
public void unregisterComponent(javax.management.ObjectName oname)
oname
- public javax.management.MBeanServer getMBeanServer()
MBeanServer
instance.
public ManagedBean findManagedBean(java.lang.Object bean, java.lang.Class beanClass, java.lang.String type) throws java.lang.Exception
java.lang.Exception
public java.lang.Object convertValue(java.lang.String type, java.lang.String value)
type
- Fully qualified class name of the resulting valuevalue
- String value to be converted
public java.util.List load(java.lang.String sourceType, java.lang.Object source, java.lang.String param) throws java.lang.Exception
sourceType
- source
- param
-
java.lang.Exception
public void registerComponent(java.lang.Object bean, javax.management.ObjectName oname, java.lang.String type) throws java.lang.Exception
bean
- oname
- type
-
java.lang.Exception
public void loadDescriptors(java.lang.String packageName, java.lang.ClassLoader classLoader)
packageName
- public void loadDescriptors(java.lang.String sourceType, java.lang.Object source, java.lang.String param) throws java.lang.Exception
sourceType
- source
- param
-
java.lang.Exception
public javax.management.ObjectName preRegister(javax.management.MBeanServer server, javax.management.ObjectName name) throws java.lang.Exception
preRegister
in interface javax.management.MBeanRegistration
java.lang.Exception
public void postRegister(java.lang.Boolean registrationDone)
postRegister
in interface javax.management.MBeanRegistration
public void preDeregister() throws java.lang.Exception
preDeregister
in interface javax.management.MBeanRegistration
java.lang.Exception
public void postDeregister()
postDeregister
in interface javax.management.MBeanRegistration
public void unregisterRegistry(java.lang.ClassLoader loader)
loader
- public ManagedBean findManagedBean(java.lang.Class beanClass, java.lang.String type) throws java.lang.Exception
java.lang.Exception
public void setMBeanServer(javax.management.MBeanServer server)
MBeanServer
to be utilized for our
registered management beans.
server
- The new MBeanServer
instancepublic void resetMetadata()
public void loadDescriptors(java.lang.Object source) throws java.lang.Exception
source
- Source to be used to load. Can be an InputStream or URL.
java.lang.Exception
- if any parsing or processing error occurspublic void registerComponent(java.lang.Object bean, java.lang.String domain, java.lang.String type, java.lang.String name) throws java.lang.Exception
java.lang.Exception
public void unregisterComponent(java.lang.String domain, java.lang.String name)
public void loadCachedDescriptors(java.lang.Object source) throws java.lang.Exception
source
- Source to be used to load. Can be an InputStream or URL.
java.lang.Exception
- if any parsing or processing error occurs
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |