Class MBeanHelper
java.lang.Object
clazzfish.monitor.jmx.MBeanHelper
Deprecated, for removal: This API element is subject to removal in a future version.
This class simplifies the use of JMX and MBeans a little bit.
Originally it was part of the PatternTesting project.
- Author:
- oliver
-
Method Summary
Modifier and TypeMethodDescriptionstatic TabularDataSupport
createTabularDataSupport
(CompositeType rowType, String[] itemNames) Deprecated, for removal: This API element is subject to removal in a future version.Creates aTabularDataSupport
object.static ObjectName
getAsObjectName
(Class<?> mbeanClass) Deprecated, for removal: This API element is subject to removal in a future version.Gets a class asObjectName
.static ObjectName
getAsObjectName
(String name) Deprecated, for removal: This API element is subject to removal in a future version.Gets a class asObjectName
.static Object
getAttribute
(String mbeanName, String attributeName) Deprecated, for removal: This API element is subject to removal in a future version.Gets the attribute.static Object
getAttribute
(ObjectName mbean, String attributeName) Deprecated, for removal: This API element is subject to removal in a future version.Gets the attribute.static String
getMBeanName
(Class<?> cl) Deprecated, for removal: This API element is subject to removal in a future version.Converts the class name into a MBean name.static String
getMBeanName
(Class<?> cl, int level) Deprecated, for removal: This API element is subject to removal in a future version.Converts the class name into a MBean name.static String
getMBeanName
(Object mbean) Deprecated, for removal: This API element is subject to removal in a future version.Gets an MBean name for the given object.static String
getMBeanName
(Object mbean, int level) Deprecated, for removal: This API element is subject to removal in a future version.Gets an MBean name for the given object.static String
getMBeanName
(String name) Deprecated, for removal: This API element is subject to removal in a future version.Because it is not so easy to construct a correct MBean name.static ObjectInstance
getObjectInstance
(String name) Deprecated, for removal: This API element is subject to removal in a future version.Gets the object instance.static ObjectInstance
getObjectInstance
(ObjectName mbeanName) Deprecated, for removal: This API element is subject to removal in a future version.Gets the object instance.static boolean
isRegistered
(Object obj) Deprecated, for removal: This API element is subject to removal in a future version.Checks if is registered.static boolean
isRegistered
(String mbeanName) Deprecated, for removal: This API element is subject to removal in a future version.Checks if is registered.static boolean
isRegistered
(ObjectName name) Deprecated, for removal: This API element is subject to removal in a future version.Checks if is registered.static void
registerMBean
(Object mbean) Deprecated, for removal: This API element is subject to removal in a future version.Register the given object as MBean.static void
registerMBean
(String mbeanName, Object mbean) Deprecated, for removal: This API element is subject to removal in a future version.Register the given object as MBean.static void
registerMBean
(ObjectName name, Object mbean) Deprecated, for removal: This API element is subject to removal in a future version.Register m bean.static void
unregisterMBean
(String mbeanName) Deprecated, for removal: This API element is subject to removal in a future version.Unregister an MBean.static void
unregisterMBean
(ObjectName name) Deprecated, for removal: This API element is subject to removal in a future version.Unregister an MBean.
-
Method Details
-
getMBeanName
-
getMBeanName
-
getMBeanName
Deprecated, for removal: This API element is subject to removal in a future version.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 "2" (see
getMBeanName(Object, int)
. This means you will find all MBeans from PatternTesting Runtime under the node "clazzfish.monitor" if you open your JMX console (e.g. the 'jconsole' from the JDK).- Parameters:
cl
- e.g. my.good.bye.World- Returns:
- a valid MBean name e.g. "my:type=good,good=bye,name=World"
- See Also:
-
getMBeanName
Deprecated, for removal: This API element is subject to removal in a future version.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.- Returns:
- a valid MBean name e.g. "my.good:type=bye,name=World"
- Since:
- 1.4.3
-
getMBeanName
Deprecated, for removal: This API element is subject to removal in a future version.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
Deprecated, for removal: This API element is subject to removal in a future version.Gets a class asObjectName
.- Parameters:
name
- the name- Returns:
- name as object name
- Since:
- 1.6
-
getAsObjectName
Deprecated, for removal: This API element is subject to removal in a future version.Gets a class asObjectName
.- Parameters:
mbeanClass
- the mbean class- Returns:
- class as object name
- Since:
- 1.6
-
registerMBean
Deprecated, for removal: This API element is subject to removal in a future version.Register the given object as MBean.- Parameters:
mbean
- the mbean- Throws:
JMException
- if registration fails
-
registerMBean
-
registerMBean
Deprecated, for removal: This API element is subject to removal in a future version.Register m bean.- Parameters:
name
- the namembean
- the mbean
-
unregisterMBean
Deprecated, for removal: This API element is subject to removal in a future version.Unregister an MBean.- Parameters:
mbeanName
- the mbean name
-
unregisterMBean
Deprecated, for removal: This API element is subject to removal in a future version.Unregister an MBean.- Parameters:
name
- the name
-
isRegistered
Deprecated, for removal: This API element is subject to removal in a future version.Checks if is registered.- Parameters:
mbeanName
- the mbean name- Returns:
- true, if is registered
-
isRegistered
Deprecated, for removal: This API element is subject to removal in a future version.Checks if is registered.- Parameters:
name
- the name- Returns:
- true, if is registered
- Since:
- 1.6
-
isRegistered
Deprecated, for removal: This API element is subject to removal in a future version.Checks if is registered.- Parameters:
obj
- the obj- Returns:
- true, if is registered
-
getObjectInstance
Deprecated, for removal: This API element is subject to removal in a future version.Gets the object instance.- Parameters:
name
- the name- Returns:
- the object instance
- Throws:
InstanceNotFoundException
- the instance not found exception
-
getObjectInstance
public static ObjectInstance getObjectInstance(ObjectName mbeanName) throws InstanceNotFoundException Deprecated, for removal: This API element is subject to removal in a future version.Gets the object instance.- Parameters:
mbeanName
- the mbean name- Returns:
- the object instance
- Throws:
InstanceNotFoundException
- the instance not found exception
-
getAttribute
Deprecated, for removal: This API element is subject to removal in a future version.Gets the attribute.- Parameters:
mbeanName
- the mbean nameattributeName
- the attribute name- Returns:
- the attribute
- Throws:
InstanceNotFoundException
- the instance not found exceptionJMException
- the jM exception
-
getAttribute
Deprecated, for removal: This API element is subject to removal in a future version.Gets the attribute.- Parameters:
mbean
- the mbeanattributeName
- the attribute name- Returns:
- the attribute
- Throws:
InstanceNotFoundException
- the instance not found exceptionJMException
- the jM exception
-
createTabularDataSupport
public static TabularDataSupport createTabularDataSupport(CompositeType rowType, String[] itemNames) throws OpenDataException Deprecated, for removal: This API element is subject to removal in a future version.Creates aTabularDataSupport
object.- Parameters:
rowType
- the row typeitemNames
- the item names- Returns:
- the tabular data support
- Throws:
OpenDataException
- the open data exception
-
MBeanFinder