Class MBeanFinder
java.lang.Object
clazzfish.monitor.jmx.MBeanFinder
-
Method Summary
Modifier and TypeMethodDescriptionstatic TabularDataSupportcreateTabularDataSupport(CompositeType rowType, String[] itemNames) Creates aTabularDataSupportobject.static ObjectInstanceFinds an MBean with the given names.static ObjectNamegetAsObjectName(Class<?> mbeanClass) Gets a class asObjectName.static ObjectNamegetAsObjectName(String name) Gets a class asObjectName.static StringgetMBeanName(Class<?> cl) Converts the class name into a MBean name.static StringgetMBeanName(Class<?> cl, int level) Converts the class name into a MBean name.static StringgetMBeanName(Object mbean) Gets an MBean name for the given object.static StringgetMBeanName(String name) Because it is not so easy to construct a correct MBean name.static booleanisRegistered(String mbeanName) Checks if is registered.static booleanisRegistered(ObjectName name) Checks if is registered.static voidregisterMBean(Object mbean) Register the given object as MBean.static voidregisterMBean(String mbeanName, Object mbean) Register the given object as MBean.static voidregisterMBean(ObjectName name, Object mbean) Register m bean.static voidunregisterMBean(ObjectName name) Unregister an MBean.
-
Method Details
-
getMBeanName
-
getMBeanName
Converts the class name into a MBean name. For a hierachical structure of the registered MBeans take a look at Java Management Extensions (JMX) - Best Practices.The default level for an MBean is since 1.4.3 now set to "1". This means you will find all MBeans ClazzFish under the node "clazzfish" if you open your JMX console (e.g. the 'jconsole' from the JDK).
- Parameters:
cl- a class, e.g. my.good.bye.World- Returns:
- a valid MBean name, e.g. "my:type=good,good=bye,name=World"
- See Also:
-
getMBeanName
Converts the class name into a MBean name. For a hierachical structure of the registered MBeans take a look at Java Management Extensions (JMX) - Best Practices.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 Worldif the given class is "my.good.by.World".
- Parameters:
cl- e.g. my.good.bye.Worldlevel- the level, e.g. 2- Returns:
- a valid MBean name e.g. "my.good:type=bye,name=World"
-
getMBeanName
Because it is not so easy to construct a correct MBean name. So this method helps to translate a simple name into an MBean name.If the given name is already a a valid MBean name it will be returned untouched.
- Parameters:
name- e.g. "one.two.For"- Returns:
- e.g. "one:type=two,name=For"
- Since:
- 1.6
-
getAsObjectName
Gets a class asObjectName.- Parameters:
name- the name- Returns:
- name as object name
- Since:
- 1.6
-
getAsObjectName
Gets a class asObjectName.- Parameters:
mbeanClass- the mbean class- Returns:
- class as object name
- Since:
- 1.6
-
registerMBean
Register the given object as MBean.- Parameters:
mbean- the MBean for registration
-
registerMBean
-
registerMBean
Register m bean.- Parameters:
name- the namembean- the mbean
-
unregisterMBean
Unregister an MBean.- Parameters:
name- the name
-
isRegistered
Checks if is registered.- Parameters:
mbeanName- the mbean name- Returns:
- true, if is registered
-
isRegistered
Checks if is registered.- Parameters:
name- the name- Returns:
- true, if is registered
- Since:
- 1.6
-
createTabularDataSupport
public static TabularDataSupport createTabularDataSupport(CompositeType rowType, String[] itemNames) throws OpenDataException Creates aTabularDataSupportobject.- Parameters:
rowType- the row typeitemNames- the item names- Returns:
- the tabular data support
- Throws:
OpenDataException- if an element's value of itemNames is not an item name defined in rowType.
-
findMBean
Finds an MBean with the given names.- Parameters:
mbeanNames- names of the MBeans to be looked for- Returns:
- an instance of the MBean or null if no one is found
-