|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.mx.server.MBeanServerImpl
MBean server implementation. The MBean server behaviour can be configured by setting the following system properties:
LOADER_REPOSITORY_CLASS_PROPERTY
)MBEAN_REGISTRY_CLASS_PROPERTY
)REQUIRED_MODELMBEAN_CLASS_PROPERTY
)DEFAULT_LOADER_REPOSITORY_CLASS
).
The default registry is
(DEFAULT_MBEAN_REGISTRY_CLASS
).
The RequiredModelMBean uses XMBean implementation by default
(DEFAULT_REQUIRED_MODELMBEAN_CLASS
).
MBeanServer
,
RequiredModelMBean
,
ServerConstants
,
LoaderRepository
,
UnifiedLoaderRepository3
,
XMBean
Field Summary | |
protected MBeanServer |
outer
The wrapping MBeanServer |
protected MBeanRegistry |
registry
Registry used by this server to map MBean object names to resource references. |
Fields inherited from interface org.jboss.mx.service.ServiceConstants |
JBOSSMX_DOMAIN, JBOSSMX_XMBEAN_DTD_1_0, JBOSSMX_XMBEAN_DTD_1_1, JBOSSMX_XMBEAN_DTD_1_2, MBEAN_LOADER_DTD_1_0, PERSISTENCE_TIMER, PUBLIC_JBOSSMX_XMBEAN_DTD_1_0, PUBLIC_JBOSSMX_XMBEAN_DTD_1_1, PUBLIC_JBOSSMX_XMBEAN_DTD_1_2 |
Constructor Summary | |
MBeanServerImpl(String defaultDomain,
MBeanServer outer,
MBeanServerDelegate delegate)
Creates an MBean server implementation with a given default domain name and registers the mandatory server delegate MBean to the server ( MBEAN_SERVER_DELEGATE ). |
Method Summary | |
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)
Create an MBean registered using the given object name. |
ObjectInstance |
createMBean(String className,
ObjectName name,
Object[] params,
String[] signature)
Create an MBean registered using the given object name. |
ObjectInstance |
createMBean(String className,
ObjectName name,
ObjectName loaderName)
Create an MBean registered using the given object name. |
ObjectInstance |
createMBean(String className,
ObjectName name,
ObjectName loaderName,
Object[] params,
String[] signature)
Create an MBean registered using the given object name. |
protected MBeanRegistry |
createRegistry(String defaultDomain)
|
ObjectInputStream |
deserialize(ObjectName name,
byte[] data)
Deprecated. |
ObjectInputStream |
deserialize(String className,
byte[] data)
Deprecated. |
ObjectInputStream |
deserialize(String className,
ObjectName loaderName,
byte[] data)
Deprecated. |
Object |
getAttribute(ObjectName name,
String attribute)
Retrieve a value from an MBean. |
AttributeList |
getAttributes(ObjectName name,
String[] attributes)
Retrieve a list of values from an MBean. |
ClassLoader |
getClassLoader(ObjectName name)
Retrieve the classloader registered as an MBean |
ClassLoader |
getClassLoaderFor(ObjectName name)
Retrieve the classloader for an mbean |
ClassLoaderRepository |
getClassLoaderRepository()
Retrieve the classloader repository for this mbean server |
String |
getDefaultDomain()
Retrieve the default domain of the mbeanserver. |
String[] |
getDomains()
Retrieve the domains of the mbeanserver. |
Integer |
getMBeanCount()
Retrieve the number of mbeans registered in the server. |
MBeanInfo |
getMBeanInfo(ObjectName name)
Retrieves the jmx metadata for an mbean |
ObjectInstance |
getObjectInstance(ObjectName name)
Retrieve an MBean's registration information. |
protected void |
handleInstantiateExceptions(Throwable t,
String className)
Handles errors thrown during class instantiation |
Object |
instantiate(String className)
Instantiates an object using the default loader repository and default no-args constructor. |
protected Object |
instantiate(String className,
ClassLoader cl,
Object[] params,
String[] signature)
Instantiate an object, the passed classloader is set as the thread's context classloader for the duration of this method. |
Object |
instantiate(String className,
Object[] params,
String[] signature)
Instantiates an object using the default loader repository and a given constructor. |
Object |
instantiate(String className,
ObjectName loaderName)
Instantiates an object using the given class loader. |
Object |
instantiate(String className,
ObjectName loaderName,
Object[] params,
String[] signature)
Instantiates an object using the given class loader. |
Object |
invoke(ObjectName name,
String operationName,
Object[] params,
String[] signature)
Invokes an operation on an mbean. |
boolean |
isInstanceOf(ObjectName name,
String className)
Tests whether an mbean can be cast to the given type |
boolean |
isRegistered(ObjectName name)
Test whether an mbean is registered. |
protected boolean |
queryMBean(ObjectName objectName,
QueryExp queryExp)
Query an MBean against the query |
Set |
queryMBeans(ObjectName name,
QueryExp query)
Retrieve a set of Object instances |
Set |
queryNames(ObjectName name,
QueryExp query)
Retrieve a set of Object names |
ObjectInstance |
registerMBean(Object object,
ObjectName name)
Registers a pre-existing object as an MBean with the MBean server. |
protected ObjectInstance |
registerMBean(Object object,
ObjectName name,
ClassLoader cl)
Register an MBean |
protected ObjectInstance |
registerMBean(Object mbean,
ObjectName name,
ObjectName loaderName)
Register an MBean |
void |
releaseServer()
|
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)
Set a value for an MBean. |
AttributeList |
setAttributes(ObjectName name,
AttributeList attributes)
Set a list of values for an MBean. |
void |
unregisterMBean(ObjectName name)
Unregisters an mbean. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected MBeanServer outer
protected MBeanRegistry registry
Constructor Detail |
public MBeanServerImpl(String defaultDomain, MBeanServer outer, MBeanServerDelegate delegate)
MBEAN_SERVER_DELEGATE
).
defaultDomain
- default domain nameouter
- the wrapping MBeanServer, passed to MBeans
at registration.delegate
- the delegate to use
for Notifications.Method Detail |
public Object instantiate(String className) throws ReflectionException, MBeanException
MBeanServer
instantiate
in interface MBeanServer
className
- Class to instantiate. Must have a public no-args
constructor. Cannot contain a null reference.
ReflectionException
- If there was an error while trying to invoke
the class's constructor or the given class was not found. This
exception wraps the actual exception thrown.
MBeanException
- If the object constructor threw a checked exception
during the initialization. This exception wraps the actual
exception thrown.DefaultLoaderRepository
public Object instantiate(String className, Object[] params, String[] signature) throws ReflectionException, MBeanException
MBeanServer
instantiate
in interface MBeanServer
className
- class to instantiateparams
- argument values for the constructor callsignature
- signature of the constructor as fully qualified class names
MBeanException
- If the object constructor raised a checked exception
during the initialization. This exception wraps the actual exception
thrown.
ReflectionException
- If there was an error while trying to invoke
the class's constructor or the given class was not found. This
exception wraps the actual exception thrown.DefaultLoaderRepository
public Object instantiate(String className, ObjectName loaderName) throws ReflectionException, MBeanException, InstanceNotFoundException
MBeanServer
instantiate
in interface MBeanServer
className
- Class to instantiate. Must have a public no args constructor.
Cannot contain a null reference.loaderName
- Object name of a class loader that has been registered to the server.
If null, the class loader of the MBean server is used.
ReflectionException
- If there was an error while trying to invoke
the class's constructor or the given class was not found. This
exception wraps the actual exception thrown.
InstanceNotFoundException
- if the specified class loader was not
registered to the agent
MBeanException
- If the object constructor threw a checked exception
during the initialization. This exception wraps the actual exception
thrown.public Object instantiate(String className, ObjectName loaderName, Object[] params, String[] signature) throws ReflectionException, MBeanException, InstanceNotFoundException
MBeanServer
instantiate
in interface MBeanServer
className
- class to instantiateloaderName
- object name of a registered class loader in the agent.params
- argument values for the constructor callsignature
- signature of the constructor as fully qualified class name strings
MBeanException
- If the object constructor raised a checked exception
during the initialization. This exception wraps the actual exception thrown.
ReflectionException
- If there was an error while trying to invoke the
class's constructor or the given class was not found. this exception
wraps the actual exception thrown.
InstanceNotFoundException
- if the specified class loader was not
registered to the agent.public ObjectInstance createMBean(String className, ObjectName name) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException
MBeanServer
Uses the default contructor.
createMBean
in interface MBeanServer
className
- the class name of the mbeanname
- the object name for registration, can be null
ReflectionException
- for class not found or an exception
invoking the contructor
InstanceAlreadyExistsException
- for an MBean already registered
with the passed or generated ObjectName
MBeanRegistrationException
- for any exception thrown by the
MBean's preRegister
NotCompliantMBeanException
- if the class name does not correspond to
a valid MBean
MBeanException
- for any exception thrown by the MBean's constructorpublic ObjectInstance createMBean(String className, ObjectName name, Object[] params, String[] signature) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException
MBeanServer
Uses the specified constructor.
createMBean
in interface MBeanServer
className
- the class name of the mbeanparams
- the parameters for the constructorsignature
- the signature of the constructor
NotCompliantMBeanException
- if the class name does not correspond to
a valid MBean
MBeanException
- for any exception thrown by the MBean's constructor
InstanceAlreadyExistsException
- for an MBean already registered
with the passed or generated ObjectName
ReflectionException
- for class not found or an exception
invoking the contructor
MBeanRegistrationException
- for any exception thrown by the
MBean's preRegisterpublic ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException
MBeanServer
The MBean is loaded using the passed classloader. Uses the default contructor.
createMBean
in interface MBeanServer
className
- the class name of the mbeanloaderName
- an MBean that implements a classloadername
- the object name for registration, can be null
MBeanException
- for any exception thrown by the MBean's constructor
ReflectionException
- for class not found or an exception
invoking the contructor
InstanceAlreadyExistsException
- for an MBean already registered
with the passed or generated ObjectName
InstanceNotFoundException
- if the loaderName is not a classloader registered
in the MBeanServer
MBeanRegistrationException
- for any exception thrown by the
MBean's preRegister
NotCompliantMBeanException
- if the class name does not correspond to
a valid MBeanpublic ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName, Object[] params, String[] signature) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException
MBeanServer
The MBean is loaded using the passed classloader. Uses the specified constructor.
createMBean
in interface MBeanServer
className
- the class name of the mbeanloaderName
- an MBean that implements a classloadername
- the object name for registration, can be nullparams
- the parameters for the constructorsignature
- the signature of the constructor
NotCompliantMBeanException
- if the class name does not correspond to
a valid MBean
MBeanRegistrationException
- for any exception thrown by the
MBean's preRegister
InstanceNotFoundException
- if the loaderName is not a classloader registered
in the MBeanServer
InstanceAlreadyExistsException
- for an MBean already registered
with the passed or generated ObjectName
ReflectionException
- for class not found or an exception
invoking the contructor
MBeanException
- for any exception thrown by the MBean's constructorpublic ObjectInstance registerMBean(Object object, ObjectName name) throws InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException
registerMBean
in interface MBeanServer
object
- the mbean implementation to registername
- the object name of the mbean to register
NotCompliantMBeanException
- if the class name does not correspond to
a valid MBean
MBeanRegistrationException
- for any exception thrown by the
MBean's preDeregister
InstanceAlreadyExistsException
- if the object name is already registered
in the MBeanServerpublic void unregisterMBean(ObjectName name) throws InstanceNotFoundException, MBeanRegistrationException
MBeanServer
unregisterMBean
in interface MBeanServer
name
- the object name of the mbean to unregister
MBeanRegistrationException
- for any exception thrown by the
MBean's preDeregister
InstanceNotFoundException
- if the mbean is not registered
in the MBeanServerpublic ObjectInstance getObjectInstance(ObjectName name) throws InstanceNotFoundException
MBeanServer
getObjectInstance
in interface MBeanServer
name
- the object name of the mbean
InstanceNotFoundException
- if the mbean is not registered
in the MBeanServerpublic Set queryMBeans(ObjectName name, QueryExp query)
MBeanServer
queryMBeans
in interface MBeanServer
name
- an ObjectName pattern, can be null for all mbeansquery
- a query expression to further filter the mbeans, can be null
for no querypublic Set queryNames(ObjectName name, QueryExp query)
MBeanServer
queryNames
in interface MBeanServer
name
- an ObjectName pattern, can be null for all mbeansquery
- a query expression to further filter the mbeans, can be null
for no querypublic boolean isRegistered(ObjectName name)
MBeanServer
isRegistered
in interface MBeanServer
name
- the object name of the mbean
public Integer getMBeanCount()
MBeanServer
getMBeanCount
in interface MBeanServer
public Object getAttribute(ObjectName name, String attribute) throws MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException
MBeanServer
getAttribute
in interface MBeanServer
name
- the object name of the mbeanattribute
- the attribute name of the value to retrieve
MBeanException
- for any exception thrown by the mbean
ReflectionException
- for an exception invoking the mbean
InstanceNotFoundException
- if the mbean is not registered
AttributeNotFoundException
- if the mbean has no such attributepublic AttributeList getAttributes(ObjectName name, String[] attributes) throws InstanceNotFoundException, ReflectionException
MBeanServer
getAttributes
in interface MBeanServer
name
- the object name of the mbeanattributes
- the attribute names of the values to retrieve
InstanceNotFoundException
- if the mbean is not registered
ReflectionException
- for an exception invoking the mbeanpublic void setAttribute(ObjectName name, Attribute attribute) throws InstanceNotFoundException, AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException
MBeanServer
setAttribute
in interface MBeanServer
name
- the object name of the mbeanattribute
- the attribute name and value to set
AttributeNotFoundException
- if the mbean has no such attribute
MBeanException
- for any exception thrown by the mbean
InvalidAttributeValueException
- if the new value has an incorrect type
ReflectionException
- for an exception invoking the mbean
InstanceNotFoundException
- if the mbean is not registeredpublic AttributeList setAttributes(ObjectName name, AttributeList attributes) throws InstanceNotFoundException, ReflectionException
MBeanServer
setAttributes
in interface MBeanServer
name
- the object name of the mbeanattributes
- the attribute names and values to set
InstanceNotFoundException
- if the mbean is not registered
ReflectionException
- for an exception invoking the mbeanpublic Object invoke(ObjectName name, String operationName, Object[] params, String[] signature) throws InstanceNotFoundException, MBeanException, ReflectionException
MBeanServer
invoke
in interface MBeanServer
name
- the object name of the mbeanoperationName
- the operation to performparams
- the parameterssignature
- the signature of the operation
InstanceNotFoundException
- if the mbean is not registered
ReflectionException
- for an exception invoking the mbean
MBeanException
- for any exception thrown by the mbeanpublic MBeanInfo getMBeanInfo(ObjectName name) throws InstanceNotFoundException, IntrospectionException, ReflectionException
MBeanServer
getMBeanInfo
in interface MBeanServer
name
- the name of the mbean
ReflectionException
- for any error trying to invoke the operation on the mbean
InstanceNotFoundException
- if the mbean is not registered
IntrospectionException
- for any error during instrospectionpublic String getDefaultDomain()
MBeanServer
getDefaultDomain
in interface MBeanServer
public String[] getDomains()
MBeanServer
getDomains
in interface MBeanServer
public void addNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException
addNotificationListener
in interface MBeanServer
name
- the name of the MBean broadcasting notificationslistener
- the listener to addfilter
- a filter to preprocess notificationshandback
- a object to add to any notifications
InstanceNotFoundException
- if the broadcaster is not registeredpublic void addNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException
addNotificationListener
in interface MBeanServer
name
- the name of the MBean broadcasting notificationslistener
- the object name listener to addfilter
- a filter to preprocess notificationshandback
- a object to add to any notifications
InstanceNotFoundException
- if the broadcaster or listener is not registeredpublic void removeNotificationListener(ObjectName name, NotificationListener listener) throws InstanceNotFoundException, ListenerNotFoundException
removeNotificationListener
in interface MBeanServer
name
- the name of the MBean broadcasting notificationslistener
- the listener to remove
InstanceNotFoundException
- if the broadcaster is not registered
ListenerNotFoundException
- if the listener is not registered against the broadcasterpublic void removeNotificationListener(ObjectName name, ObjectName listener) throws InstanceNotFoundException, ListenerNotFoundException
removeNotificationListener
in interface MBeanServer
name
- the name of the MBean broadcasting notificationslistener
- the object name of the listener to remove
InstanceNotFoundException
- if the broadcaster or listener is not registered
ListenerNotFoundException
- if the listener is not registered against the broadcasterpublic void removeNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException, ListenerNotFoundException
removeNotificationListener
in interface MBeanServer
name
- the name of the MBean broadcasting notificationslistener
- the listener to removefilter
- the filter of the listener to remove
ListenerNotFoundException
- if the listener, filter, handback
is not registered against the broadcaster
InstanceNotFoundException
- if the broadcaster is not registeredpublic void removeNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException, ListenerNotFoundException
removeNotificationListener
in interface MBeanServer
name
- the name of the MBean broadcasting notificationslistener
- the object name of listener to removefilter
- the filter of the listener to remove
ListenerNotFoundException
- if the listener, filter, handback
is not registered against the broadcaster
InstanceNotFoundException
- if the broadcaster or listener is not registeredpublic boolean isInstanceOf(ObjectName name, String className) throws InstanceNotFoundException
MBeanServer
isInstanceOf
in interface MBeanServer
name
- the name of the mbeanclassName
- the class name to check
InstanceNotFoundException
- if the mbean is not registeredpublic ObjectInputStream deserialize(ObjectName name, byte[] data) throws InstanceNotFoundException, OperationsException
deserialize
in interface MBeanServer
public ObjectInputStream deserialize(String className, byte[] data) throws OperationsException, ReflectionException
deserialize
in interface MBeanServer
public ObjectInputStream deserialize(String className, ObjectName loaderName, byte[] data) throws InstanceNotFoundException, OperationsException, ReflectionException
deserialize
in interface MBeanServer
public ClassLoader getClassLoaderFor(ObjectName name) throws InstanceNotFoundException
MBeanServer
getClassLoaderFor
in interface MBeanServer
name
- the object name of the mbean
InstanceNotFoundException
- when the mbean is not registeredpublic ClassLoader getClassLoader(ObjectName name) throws InstanceNotFoundException
MBeanServer
getClassLoader
in interface MBeanServer
name
- The ObjectName of the ClassLoader. May be null, in which case
the MBean server's own ClassLoader is returned.
InstanceNotFoundException
public ClassLoaderRepository getClassLoaderRepository()
getClassLoaderRepository
in interface MBeanServer
public void releaseServer()
protected Object instantiate(String className, ClassLoader cl, Object[] params, String[] signature) throws ReflectionException, MBeanException
className
- the class name of the object to instantiatecl
- the thread classloader, pass null to use the ClassLoaderRepositoryparams
- the parameters for the constructorsignature
- the signature of the constructor
ReflectionException
- wraps a ClassCastException or
any Exception trying to invoke the constructor
MBeanException
- wraps any exception thrown by the constructor
RuntimeOperationsException
- Wraps an IllegalArgument for a
null classNameprotected void handleInstantiateExceptions(Throwable t, String className) throws ReflectionException, MBeanException
ReflectionException
MBeanException
protected ObjectInstance registerMBean(Object mbean, ObjectName name, ObjectName loaderName) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException
The classloader is used as the thread context classloader during access to the mbean and it's interceptors
mbean
- the mbean to registername
- the object name to registerloaderName
- the object name of a class loader also used as
as the MBeans TCL
InstanceAlreadyExistsException
- when already registered
MBeanRegistrationException
- when
preRegister(MBeanServer, ObjectName) throws an exception
NotCompliantMBeanException
- when the object is not an MBean
ReflectionException
MBeanException
InstanceNotFoundException
protected ObjectInstance registerMBean(Object object, ObjectName name, ClassLoader cl) throws InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException
The classloader is used as the thread context classloader during access to the mbean and it's interceptors
object
- the mbean to registername
- the object name to registercl
- the thread classloader, pass null for the current one
InstanceAlreadyExistsException
- when already registered
MBeanRegistrationException
- when
preRegister(MBeanServer, ObjectName) throws an exception
NotCompliantMBeanException
- when the object is not an MBeanprotected boolean queryMBean(ObjectName objectName, QueryExp queryExp)
objectName
- the object name of the mbean to checkqueryExp
- the query expression to test
protected MBeanRegistry createRegistry(String defaultDomain)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |