|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The interface used to access the MBean server instances.
MBeanServerFactory
,
ClassLoaderRepository
Method Summary | |
void |
addNotificationListener(ObjectName name,
NotificationListener listener,
NotificationFilter filter,
Object handback)
Add a notification listener to an MBean. |
void |
addNotificationListener(ObjectName name,
ObjectName listener,
NotificationFilter filter,
Object handback)
Add a notification listener to an 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. |
ObjectInputStream |
deserialize(ObjectName name,
byte[] data)
Deprecated. use getClassLoaderFor(ObjectName) to obtain the
appropriate classloader for deserialization |
ObjectInputStream |
deserialize(String className,
byte[] data)
Deprecated. use getClassLoaderFor(ObjectName) to obtain the
appropriate classloader for deserialization |
ObjectInputStream |
deserialize(String className,
ObjectName loaderName,
byte[] data)
Deprecated. use getClassLoaderFor(ObjectName) to obtain the
appropriate classloader for deserialization |
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. |
Object |
instantiate(String className)
Instantiates an object using the default loader repository and default no-args constructor. |
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. |
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 an mbean. |
void |
removeNotificationListener(ObjectName name,
NotificationListener listener)
Removes a listener from an mbean. |
void |
removeNotificationListener(ObjectName name,
NotificationListener listener,
NotificationFilter filter,
Object handback)
Removes a listener from an mbean. |
void |
removeNotificationListener(ObjectName name,
ObjectName listener)
Removes a listener from an mbean. |
void |
removeNotificationListener(ObjectName name,
ObjectName listener,
NotificationFilter filter,
Object handback)
Removes a listener from an 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. |
Method Detail |
public ObjectInstance createMBean(String className, ObjectName name) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException
Uses the default contructor.
createMBean
in interface MBeanServerConnection
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
MBeanException
- for any exception thrown by the MBean's constructor
NotCompliantMBeanException
- if the class name does not correspond to
a valid MBean
RuntimeOperationsException
- wrapping an IllegalArgumentException for a
null class name, the ObjectName could not be determined or it is a patternpublic ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException
The MBean is loaded using the passed classloader. Uses the default contructor.
createMBean
in interface MBeanServerConnection
className
- the class name of the mbeanloaderName
- an MBean that implements a classloadername
- 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
MBeanException
- for any exception thrown by the MBean's constructor
InstanceNotFoundException
- if the loaderName is not a classloader registered
in the MBeanServer
NotCompliantMBeanException
- if the class name does not correspond to
a valid MBean
RuntimeOperationsException
- wrapping an IllegalArgumentException for a
null class name, the ObjectName could not be determined or it is a patternpublic ObjectInstance createMBean(String className, ObjectName name, Object[] params, String[] signature) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException
Uses the specified constructor.
createMBean
in interface MBeanServerConnection
className
- the class name of the mbeanparams
- the parameters for the constructorsignature
- the signature of the constructorname
- 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
MBeanException
- for any exception thrown by the MBean's constructor
NotCompliantMBeanException
- if the class name does not correspond to
a valid MBean
RuntimeOperationsException
- wrapping an IllegalArgumentException for a
null class name, the ObjectName could not be determined or it is a patternpublic ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName, Object[] params, String[] signature) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException
The MBean is loaded using the passed classloader. Uses the specified constructor.
createMBean
in interface MBeanServerConnection
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
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
MBeanException
- for any exception thrown by the MBean's constructor
InstanceNotFoundException
- if the loaderName is not a classloader registered
in the MBeanServer
NotCompliantMBeanException
- if the class name does not correspond to
a valid MBean
RuntimeOperationsException
- wrapping an IllegalArgumentException for a
null class name, the ObjectName could not be determined or it is a patternpublic ObjectInstance registerMBean(Object object, ObjectName name) throws InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException
object
- the mbean implementation to registername
- the object name of the mbean to register
InstanceAlreadyExistsException
- if the object name is already registered
in the MBeanServer
MBeanRegistrationException
- for any exception thrown by the
MBean's preDeregister
NotCompliantMBeanException
- if the class name does not correspond to
a valid MBean
RuntimeOperationsException
- wrapping an IllegalArgumentException for a
null name, or trying to register a JMX implementation MBeanpublic void unregisterMBean(ObjectName name) throws InstanceNotFoundException, MBeanRegistrationException
unregisterMBean
in interface MBeanServerConnection
name
- the object name of the mbean to unregister
InstanceNotFoundException
- if the mbean is not registered
in the MBeanServer
MBeanRegistrationException
- for any exception thrown by the
MBean's preDeregister
RuntimeOperationsException
- wrapping an IllegalArgumentException for a
null name, or trying to unregister a JMX implementation MBeanpublic ObjectInstance getObjectInstance(ObjectName name) throws InstanceNotFoundException
getObjectInstance
in interface MBeanServerConnection
name
- the object name of the mbean
InstanceNotFoundException
- if the mbean is not registered
in the MBeanServerpublic Set queryMBeans(ObjectName name, QueryExp query)
queryMBeans
in interface MBeanServerConnection
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)
queryNames
in interface MBeanServerConnection
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)
isRegistered
in interface MBeanServerConnection
name
- the object name of the mbean
RuntimeOperationsException
- wrapping an IllegalArgumentException for a
null namepublic Integer getMBeanCount()
getMBeanCount
in interface MBeanServerConnection
public Object getAttribute(ObjectName name, String attribute) throws MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException
getAttribute
in interface MBeanServerConnection
name
- the object name of the mbeanattribute
- the attribute name of the value to retrieve
ReflectionException
- for an exception invoking the mbean
MBeanException
- for any exception thrown by the mbean
InstanceNotFoundException
- if the mbean is not registered
AttributeNotFoundException
- if the mbean has no such attribute
RuntimeOperationsException
- wrapping an IllegalArgumentException for a
null name or attributepublic AttributeList getAttributes(ObjectName name, String[] attributes) throws InstanceNotFoundException, ReflectionException
getAttributes
in interface MBeanServerConnection
name
- the object name of the mbeanattributes
- the attribute names of the values to retrieve
ReflectionException
- for an exception invoking the mbean
InstanceNotFoundException
- if the mbean is not registered
RuntimeOperationsException
- wrapping an IllegalArgumentException for a
null name or attributespublic void setAttribute(ObjectName name, Attribute attribute) throws InstanceNotFoundException, AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException
setAttribute
in interface MBeanServerConnection
name
- the object name of the mbeanattribute
- the attribute name and value to set
ReflectionException
- for an exception invoking the mbean
MBeanException
- for any exception thrown by the mbean
InstanceNotFoundException
- if the mbean is not registered
AttributeNotFoundException
- if the mbean has no such attribute
InvalidAttributeValueException
- if the new value has an incorrect type
RuntimeOperationsException
- wrapping an IllegalArgumentException for a
null name or attributepublic AttributeList setAttributes(ObjectName name, AttributeList attributes) throws InstanceNotFoundException, ReflectionException
setAttributes
in interface MBeanServerConnection
name
- the object name of the mbeanattributes
- the attribute names and values to set
ReflectionException
- for an exception invoking the mbean
InstanceNotFoundException
- if the mbean is not registered
RuntimeOperationsException
- wrapping an IllegalArgumentException for a
null name or attributespublic Object invoke(ObjectName name, String operationName, Object[] params, String[] signature) throws InstanceNotFoundException, MBeanException, ReflectionException
invoke
in interface MBeanServerConnection
name
- the object name of the mbeanoperationName
- the operation to performparams
- the parameterssignature
- the signature of the operation
ReflectionException
- for an exception invoking the mbean
MBeanException
- for any exception thrown by the mbean
InstanceNotFoundException
- if the mbean is not registeredpublic String getDefaultDomain()
getDefaultDomain
in interface MBeanServerConnection
public String[] getDomains()
getDomains
in interface MBeanServerConnection
public void addNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException
addNotificationListener
in interface MBeanServerConnection
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 MBeanServerConnection
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 registered
RuntimeOperationsException
- wrapping an IllegalArgumentException for a
null listener or the listener does not implement the Notification Listener interfacepublic void removeNotificationListener(ObjectName name, ObjectName listener) throws InstanceNotFoundException, ListenerNotFoundException
All registrations of the listener are removed.
removeNotificationListener
in interface MBeanServerConnection
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, ObjectName listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException, ListenerNotFoundException
Only the listener that was registered with the same filter and handback is removed.
removeNotificationListener
in interface MBeanServerConnection
name
- the name of the MBean broadcasting notificationslistener
- the object name of listener to removefilter
- the filter of the listener to remove
InstanceNotFoundException
- if the broadcaster or listener is not registered
ListenerNotFoundException
- if the listener, filter, handback
is not registered against the broadcasterpublic void removeNotificationListener(ObjectName name, NotificationListener listener) throws InstanceNotFoundException, ListenerNotFoundException
All registrations of the listener are removed.
removeNotificationListener
in interface MBeanServerConnection
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, NotificationListener listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException, ListenerNotFoundException
Only the listener that was registered with the same filter and handback is removed.
removeNotificationListener
in interface MBeanServerConnection
name
- the name of the MBean broadcasting notificationslistener
- the listener to removefilter
- the filter of the listener to remove
InstanceNotFoundException
- if the broadcaster is not registered
ListenerNotFoundException
- if the listener, filter, handback
is not registered against the broadcasterpublic MBeanInfo getMBeanInfo(ObjectName name) throws InstanceNotFoundException, IntrospectionException, ReflectionException
getMBeanInfo
in interface MBeanServerConnection
name
- the name of the mbean
IntrospectionException
- for any error during instrospection
InstanceNotFoundException
- if the mbean is not registered
ReflectionException
- for any error trying to invoke the operation on the mbeanpublic boolean isInstanceOf(ObjectName name, String className) throws InstanceNotFoundException
isInstanceOf
in interface MBeanServerConnection
name
- the name of the mbeanclassName
- the class name to check
InstanceNotFoundException
- if the mbean is not registeredpublic Object instantiate(String className) throws ReflectionException, MBeanException
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.
RuntimeMBeanException
- If the class constructor threw a runtime
exception. This exception wraps the actual exception thrown.
RuntimeErrorException
- If the class constructor threw an error.
This exception wraps the actual error thrown.
RuntimeOperationsException
- If the className is null.
Wraps an IllegalArgumentException instance.DefaultLoaderRepository
public Object instantiate(String className, ObjectName loaderName) throws ReflectionException, MBeanException, InstanceNotFoundException
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.
MBeanException
- If the object constructor threw a checked exception
during the initialization. This exception wraps the actual exception
thrown.
InstanceNotFoundException
- if the specified class loader was not
registered to the agent
RuntimeMBeanException
- If the class constructor raised a runtime
exception. This exception wraps the actual exception thrown.
RuntimeErrorException
- If the class constructor raised an error.
This exception wraps the actual error thrown.
RuntimeOperationsException
- if the className is null.
Wraps an IllegalArgumentException instance.public Object instantiate(String className, Object[] params, String[] signature) throws ReflectionException, MBeanException
className
- class to instantiateparams
- argument values for the constructor callsignature
- signature of the constructor as fully qualified class names
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 raised a checked exception
during the initialization. This exception wraps the actual exception
thrown.
RuntimeMBeanException
- If the class constructor raised a runtime
exception. This exception wraps the actual exception thrown.
RuntimeErrorException
- If the class constructor raised an error.
This exception wraps the actual error thrown.
RuntimeOperationsException
- if the className is null.
Wraps an IllegalArgumentException instance.DefaultLoaderRepository
public Object instantiate(String className, ObjectName loaderName, Object[] params, String[] signature) throws ReflectionException, MBeanException, InstanceNotFoundException
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
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 raised a checked exception
during the initialization. This exception wraps the actual exception thrown.
InstanceNotFoundException
- if the specified class loader was not
registered to the agent.
RuntimeMBeanException
- If the class constructor raised a runtime
exception. This exception wraps the actual exception thrown.
RuntimeErrorException
- If the class constructor raised an error.
This exception wraps the actual error thrown.
RuntimeOperationsException
- if the className argument is null.
Wraps an IllegalArgumentException instance.public ObjectInputStream deserialize(ObjectName name, byte[] data) throws InstanceNotFoundException, OperationsException
getClassLoaderFor(ObjectName)
to obtain the
appropriate classloader for deserialization
public ObjectInputStream deserialize(String className, byte[] data) throws OperationsException, ReflectionException
getClassLoaderFor(ObjectName)
to obtain the
appropriate classloader for deserialization
public ObjectInputStream deserialize(String className, ObjectName loaderName, byte[] data) throws InstanceNotFoundException, OperationsException, ReflectionException
getClassLoaderFor(ObjectName)
to obtain the
appropriate classloader for deserialization
public ClassLoader getClassLoaderFor(ObjectName name) throws InstanceNotFoundException
name
- the object name of the mbean
InstanceNotFoundException
- when the mbean is not registeredpublic ClassLoader getClassLoader(ObjectName name) throws InstanceNotFoundException
name
- the object name of the classloader
InstanceNotFoundException
- when the mbean is not registeredpublic ClassLoaderRepository getClassLoaderRepository()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |