Class MBeanFinder
java.lang.Object
clazzfish.monitor.jmx.MBeanFinder
-
Method Summary
Modifier and TypeMethodDescriptionstatic TabularDataSupport
createTabularDataSupport
(CompositeType rowType, String[] itemNames) Creates aTabularDataSupport
object.static ObjectInstance
Finds an MBean with the given names.static ObjectName
getAsObjectName
(Class<?> mbeanClass) Gets a class asObjectName
.static ObjectName
getAsObjectName
(String name) Gets a class asObjectName
.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
(String name) Because it is not so easy to construct a correct MBean name.static boolean
isRegistered
(String mbeanName) Checks if is registered.static boolean
isRegistered
(ObjectName name) Checks if is registered.static void
registerMBean
(Object mbean) Register the given object as MBean.static void
registerMBean
(String mbeanName, Object mbean) Register the given object as MBean.static void
registerMBean
(ObjectName name, Object mbean) Register m bean.static void
unregisterMBean
(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 World
if 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 aTabularDataSupport
object.- 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
-