Package org.glassfish.gmbal
Class AMXClient
- java.lang.Object
-
- org.glassfish.gmbal.AMXClient
-
- All Implemented Interfaces:
AMXMBeanInterface
public class AMXClient extends java.lang.Object implements AMXMBeanInterface
This class implements a generic AMXMBeanInterface MBean which is connected to a possibly remote MBeanServerConnection (note that MBeanServer isA MBeanServerConnection, so we can actually create an AMXClientImpl simply by using the MBeanServer from the mom: this is useful for testing).Note that this version of the AMXMBeanInterface API provides a generic get/set API that is identical to DynamicMBean, except that it only throws unchecked exceptions. This is far more convenient in practice than the JMX-standard checked exceptions.
-
-
Field Summary
Fields Modifier and Type Field Description static javax.management.ObjectName
NULL_OBJECTNAME
Special object name used to represent a NULL objectName result.private javax.management.ObjectName
oname
private javax.management.MBeanServerConnection
server
-
Constructor Summary
Constructors Constructor Description AMXClient(javax.management.MBeanServerConnection server, javax.management.ObjectName oname)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
private <T> T
fetchAttribute(java.lang.String name, java.lang.Class<T> type)
java.lang.Object
getAttribute(java.lang.String attribute)
javax.management.AttributeList
getAttributes(java.lang.String[] attributes)
AMXClient[]
getChildren()
Containment hierarchy: Get all AMXMBeanInterface contained by this one, in no particular order.javax.management.MBeanInfo
getMBeanInfo()
java.util.Map<java.lang.String,?>
getMeta()
Get all metadata about this MBean.java.lang.String
getName()
Usually the same as the ObjectName 'name' property, but can differ if the actual name contains characters that must be escaped for an ObjectName and/or if the MBean has a mutable name attribute.AMXClient
getParent()
"go up one level": the MBean containing this one, can be null for rootint
hashCode()
java.lang.Object
invoke(java.lang.String actionName, java.lang.Object[] params, java.lang.String[] signature)
private AMXClient
makeAMX(javax.management.ObjectName on)
private AMXClient[]
makeAMXArray(javax.management.ObjectName[] onames)
private static javax.management.ObjectName
makeObjectName(java.lang.String str)
javax.management.ObjectName
objectName()
void
setAttribute(java.lang.String name, java.lang.Object value)
void
setAttribute(javax.management.Attribute attribute)
javax.management.AttributeList
setAttributes(javax.management.AttributeList attributes)
java.lang.String
toString()
-
-
-
Method Detail
-
makeObjectName
private static javax.management.ObjectName makeObjectName(java.lang.String str)
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
fetchAttribute
private <T> T fetchAttribute(java.lang.String name, java.lang.Class<T> type)
-
makeAMX
private AMXClient makeAMX(javax.management.ObjectName on)
-
getName
public java.lang.String getName()
Description copied from interface:AMXMBeanInterface
Usually the same as the ObjectName 'name' property, but can differ if the actual name contains characters that must be escaped for an ObjectName and/or if the MBean has a mutable name attribute. The type property can be obtained from the ObjectName- Specified by:
getName
in interfaceAMXMBeanInterface
-
getMeta
public java.util.Map<java.lang.String,?> getMeta()
Description copied from interface:AMXMBeanInterface
Get all metadata about this MBean.- Specified by:
getMeta
in interfaceAMXMBeanInterface
- Returns:
- The descriptor, which will be a ModelMBeanInfoSupport instance.
-
getParent
public AMXClient getParent()
Description copied from interface:AMXMBeanInterface
"go up one level": the MBean containing this one, can be null for root- Specified by:
getParent
in interfaceAMXMBeanInterface
- Returns:
- The container of this MBean (null if already at root).
-
getChildren
public AMXClient[] getChildren()
Description copied from interface:AMXMBeanInterface
Containment hierarchy: Get all AMXMBeanInterface contained by this one, in no particular order. Valid only if isContainer(). Note that using an array sidesteps Map/Set/OpenType issues- Specified by:
getChildren
in interfaceAMXMBeanInterface
- Returns:
- All children of this AMXMBeanInterface MBean.
-
makeAMXArray
private AMXClient[] makeAMXArray(javax.management.ObjectName[] onames)
-
getAttribute
public java.lang.Object getAttribute(java.lang.String attribute)
-
setAttribute
public void setAttribute(java.lang.String name, java.lang.Object value)
-
setAttribute
public void setAttribute(javax.management.Attribute attribute)
-
getAttributes
public javax.management.AttributeList getAttributes(java.lang.String[] attributes)
-
setAttributes
public javax.management.AttributeList setAttributes(javax.management.AttributeList attributes)
-
invoke
public java.lang.Object invoke(java.lang.String actionName, java.lang.Object[] params, java.lang.String[] signature) throws javax.management.MBeanException, javax.management.ReflectionException
- Throws:
javax.management.MBeanException
javax.management.ReflectionException
-
getMBeanInfo
public javax.management.MBeanInfo getMBeanInfo()
-
objectName
public javax.management.ObjectName objectName()
-
-