|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectpatterntesting.runtime.jmx.MBeanHelper
public class MBeanHelper
This class simplifies the use of JMX and MBeans a little bit.
| Method Summary | |
|---|---|
static TabularDataSupport |
createTabularDataSupport(CompositeType rowType,
String[] itemNames)
Creates a TabularDataSupport object. |
static Object |
getAttribute(ObjectName mbean,
String attributeName)
Gets the attribute. |
static Object |
getAttribute(String mbeanName,
String attributeName)
Gets the attribute. |
static String |
getMBeanName(Class<?> cl)
Converts the class name into a MBean name. |
static String |
getMBeanName(Class<?> cl,
int level)
Converts the class name into a MBean name. |
static String |
getMBeanName(Object mbean)
Gets an MBean name for the given object. |
static String |
getMBeanName(Object mbean,
int level)
Gets an MBean name for the given object. |
static ObjectInstance |
getObjectInstance(ObjectName mbeanName)
Gets the object instance. |
static ObjectInstance |
getObjectInstance(String name)
Gets the object instance. |
static boolean |
isRegistered(Object obj)
Checks if is registered. |
static boolean |
isRegistered(String mbeanName)
Checks if is registered. |
static void |
registerMBean(Object mbean)
Register the given object as MBean. |
static void |
registerMBean(ObjectName name,
Object mbean)
Register m bean. |
static void |
registerMBean(String mbeanName,
Object mbean)
Register the given object as MBean. |
static void |
unregisterMBean(String mbeanName)
Unregister m bean. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static String getMBeanName(Object mbean)
mbean - the mbean
public static String getMBeanName(Object mbean,
int level)
mbean - the mbeanlevel - the level
public static String getMBeanName(Class<?> cl)
The default level for an MBean is since 1.4.3 now set to "2" (see
getMBeanName(Object, int). This means you will find all MBeans
from PatternTesting Runtime under the node "patterntesting.runtime"
if you open your JMX console (e.g. the 'jconsole' from the JDK).
cl - e.g. my.good.bye.World
getMBeanName(Class, int)
public static String getMBeanName(Class<?> cl,
int level)
With the 2nd parameter (level) you can control the root element. If you set it i.e. to 2 the result in the jconsole would look like:
my.good
bye
World
if the given class is "my.good.by.World".
cl - e.g. my.good.bye.Worldlevel - the level, e.g.
public static void registerMBean(Object mbean)
throws JMException
mbean - the mbean
JMException - if registration fails
public static void registerMBean(String mbeanName,
Object mbean)
mbeanName - the mbean namembean - the mbean
public static void registerMBean(ObjectName name,
Object mbean)
name - the namembean - the mbeanpublic static void unregisterMBean(String mbeanName)
mbeanName - the mbean namepublic static boolean isRegistered(String mbeanName)
mbeanName - the mbean name
public static boolean isRegistered(Object obj)
obj - the obj
public static ObjectInstance getObjectInstance(String name)
throws InstanceNotFoundException
name - the name
InstanceNotFoundException - the instance not found exception
public static ObjectInstance getObjectInstance(ObjectName mbeanName)
throws InstanceNotFoundException
mbeanName - the mbean name
InstanceNotFoundException - the instance not found exception
public static Object getAttribute(String mbeanName,
String attributeName)
throws InstanceNotFoundException,
JMException
mbeanName - the mbean nameattributeName - the attribute name
InstanceNotFoundException - the instance not found exception
JMException - the jM exception
public static Object getAttribute(ObjectName mbean,
String attributeName)
throws InstanceNotFoundException,
JMException
mbean - the mbeanattributeName - the attribute name
InstanceNotFoundException - the instance not found exception
JMException - the jM exception
public static TabularDataSupport createTabularDataSupport(CompositeType rowType,
String[] itemNames)
throws OpenDataException
TabularDataSupport object.
rowType - the row typeitemNames - the item names
OpenDataException - the open data exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||