public final class JMXUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
GET |
static String |
IS |
static String |
MBEAN_SERVER_DELEGATE |
static String |
MBEAN_SERVER_ID_ATTRIBUTE_NAME |
static String |
SET |
static String |
WILD_ALL
The wilcard property at the end of an ObjectName which indicates
that all properties should be matched.
|
static String |
WILD_PROP
The wilcard property at the end of an ObjectName which indicates
that it's an ObjectName pattern.
|
| Modifier and Type | Method and Description |
|---|---|
static MBeanInfo |
addNotificationInfos(MBeanInfo origInfo,
MBeanNotificationInfo[] notifs)
Add MBeanNotificationInfo into the MBeanInfo.
|
static Map<String,MBeanAttributeInfo> |
attributeInfosToMap(MBeanAttributeInfo[] attrInfos)
Convert an MBeanAttributeInfo[] to a Map where the keys are the Attribute names,
and the values are MBeanAttributeInfo.
|
static Map<String,Attribute> |
attributeListToAttributeMap(AttributeList attrs)
Convert an AttributeList to a Map where the keys are the Attribute names,
and the values are Attribute.
|
static Map<String,String> |
attributeListToStringMap(AttributeList attrs)
Convert an AttributeList to a Map where the keys are the Attribute names,
and the values are the Attribute values.
|
static Map<String,Object> |
attributeListToValueMap(AttributeList attrs)
Convert an AttributeList to a Map where the keys are the Attribute names,
and the values are the Attribute values.
|
static Notification |
cloneNotification(Notification in,
Object source) |
static String |
concatenateProps(String props1,
String props2) |
static String |
concatenateProps(String props1,
String props2,
String props3) |
static boolean |
domainMatches(String defaultDomain,
ObjectName pattern,
ObjectName candidate) |
static MBeanAttributeInfo[] |
filterAttributeInfos(MBeanAttributeInfo[] infos,
AttributeFilter filter) |
static Set<ObjectName> |
findByProperty(Set<ObjectName> objectNames,
String propertyKey,
String propertyValue)
Find all ObjectName(s) that contains the associated key and value
|
static Set<MBeanFeatureInfo> |
findInfoByName(MBeanFeatureInfo[] infos,
String name)
Find a feature by name (attribute name, operation name, etc) and return
all matches.
|
static String |
findKey(Set<String> candidateKeys,
ObjectName objectName)
Find the first key that is present in the ObjectName
|
static int |
findMBeanOperationInfo(MBeanInfo info,
String methodName,
String[] parameterTypes)
Find the index within the MBeanOperationInfo[] of the specified method with the
specified parameter types.
|
static MBeanOperationInfo |
findOperation(MBeanOperationInfo[] operations,
String operationName,
String[] types) |
static Set<MBeanOperationInfo> |
findOperations(MBeanOperationInfo[] operations,
String operationName) |
static ArrayList<MBeanAttributeInfo> |
generateAttributeInfos(Collection<Method> methodSet,
boolean read,
boolean write) |
static MBeanAttributeInfo[] |
generateMBeanAttributeInfos(Collection<Method> getterSetters,
Collection<Method> getters,
Collection<Method> setters) |
static MBeanOperationInfo[] |
generateMBeanOperationInfos(Collection<Method> methodSet) |
static MBeanParameterInfo[] |
generateSignature(Class[] sig) |
static String[] |
getAllAttributeNames(MBeanServerConnection conn,
ObjectName objectName) |
static Object |
getAttribute(MBeanServerConnection conn,
ObjectName o,
String attrName)
convenience function to avoid try/catch.
|
static MBeanAttributeInfo[] |
getAttributeInfos(MBeanServerConnection conn,
ObjectName objectName) |
static String |
getAttributeName(Method method) |
static String[] |
getAttributeNames(MBeanAttributeInfo[] infos)
Get a String[] of Attribute names.
|
static AttributeList |
getAttributesRobust(MBeanServerConnection conn,
ObjectName objectName,
String[] attrNames,
Set<String> problemNames)
Get the Attributes using getAttributes() if possible, but if exceptions
are encountered, attempt to get them one-by-one.
|
static String[] |
getKeyProperty(String key,
ObjectName[] objectNames) |
static String[] |
getKeyProperty(String key,
Set<ObjectName> objectNameSet) |
static Set<String> |
getKeyPropertySet(String key,
Set<ObjectName> objectNameSet) |
static MBeanAttributeInfo |
getMBeanAttributeInfo(MBeanAttributeInfo[] infos,
String attrName) |
static MBeanAttributeInfo |
getMBeanAttributeInfo(MBeanInfo mbeanInfo,
String attrName) |
static String |
getMBeanServerDelegateInfo(MBeanServer server) |
static MBeanServerDelegateMBean |
getMBeanServerDelegateMBean(MBeanServerConnection server) |
static ObjectName |
getMBeanServerDelegateObjectName() |
static String |
getMBeanServerID(MBeanServerConnection conn) |
static String |
getProp(ObjectName objectName,
String key) |
static String |
getProps(ObjectName objectName,
Set<String> propKeys) |
static String |
getProps(ObjectName objectName,
Set<String> propKeys,
boolean ignoreMissing) |
static String[] |
getSignature(MBeanParameterInfo[] infos) |
static <T extends Serializable> |
getUserDataMapString_Serializable(Notification notif)
Get a Map from the user data field of a Notification.
|
static String |
impactStr(int impact) |
static String |
interfaceName(MBeanInfo info) |
static MBeanInfo |
interfaceToMBeanInfo(Class theInterface) |
static boolean |
isGetAttribute(Method m) |
static boolean |
isGetAttributes(Method m) |
static boolean |
isGetter(MBeanOperationInfo info) |
static boolean |
isGetter(Method method)
Return true if the method is of the form isXyz() or getXyz()
(no parameters)
|
static boolean |
isIs(Method method)
Return true if the MBeanInfos have the same interface (for Attributes and
operations).
|
static boolean |
isIsOrGetter(Method method)
Return true if the method is of the form isXyz() or getXyz()
(no parameters)
|
static boolean |
isSetAttribute(Method m) |
static boolean |
isSetAttributes(Method m) |
static boolean |
isSetter(Method method) |
static void |
listenToMBeanServerDelegate(MBeanServerConnection conn,
NotificationListener listener,
NotificationFilter filter,
Object handback) |
static String |
makeProp(String name,
String value) |
static AttributeList |
mapToAttributeList(Map<String,Object> m)
Convert an Map to an Attribute list where the keys are the Attribute names,
and the values are objects.
|
static String |
mapToProps(Map<String,String> propsMap) |
static boolean |
matchesPattern(String defaultDomain,
ObjectName pattern,
ObjectName candidate) |
static DescriptorSupport |
mergeDescriptors(Descriptor src,
Descriptor dest)
Merge two descriptors.
|
static MBeanAttributeInfo[] |
mergeMBeanAttributeInfos(MBeanAttributeInfo[] infos1,
MBeanAttributeInfo[] infos2)
Merge two MBeanAttributeInfo[].
|
static MBeanConstructorInfo[] |
mergeMBeanConstructorInfos(MBeanConstructorInfo[] infos1,
MBeanConstructorInfo[] infos2)
Merge two MBeanOperationInfo[].
|
static MBeanNotificationInfo[] |
mergeMBeanNotificationInfos(MBeanNotificationInfo[] infos1,
MBeanNotificationInfo[] infos2)
Merge two MBeanNotificationInfo[].
|
static MBeanOperationInfo[] |
mergeMBeanOperationInfos(MBeanOperationInfo[] infos1,
MBeanOperationInfo[] infos2)
Merge two MBeanOperationInfo[].
|
static MBeanInfo |
newMBeanInfo(MBeanInfo origMBeanInfo,
MBeanAttributeInfo[] newAttrInfos)
Make a new MBeanInfo from an existing one, substituting MBeanAttributeInfo[]
|
static MBeanInfo |
newMBeanInfo(MBeanInfo origMBeanInfo,
MBeanOperationInfo[] newOps)
Make a new MBeanInfo from an existing one, substituting MBeanOperationInfo[]
|
static ObjectName |
newObjectName(ObjectName objectName,
String props) |
static ObjectName |
newObjectName(String name)
Create a new ObjectName, caller is guaranteeing that the name is
well-formed (a RuntimeException will be thrown if not).
|
static ObjectName |
newObjectName(String domain,
String props) |
static ObjectName |
newObjectNamePattern(String domain,
Map<String,String> props)
Build an ObjectName pattern.
|
static ObjectName |
newObjectNamePattern(String domain,
String props)
Build an ObjectName pattern.
|
static <T> T |
newProxyInstance(MBeanServerConnection conn,
ObjectName objectName,
Class<T> clazz)
Create a new proxy supporting Notifications
|
static <T> T |
newProxyInstance(MBeanServerConnection conn,
ObjectName objectName,
Class<T> clazz,
boolean notificationBroadcaster)
Type-safe; in JDK 5 generics aren't used
|
static ObjectName[] |
objectNameSetToArray(Set<ObjectName> objectNameSet)
Convert a Set of ObjectName into an array
|
static Set<ObjectName> |
queryAllInDomain(MBeanServerConnection conn,
String domain) |
static Set<ObjectName> |
queryAllInDomain(MBeanServer conn,
String domain) |
static Set<ObjectName> |
queryLocalMBeans(MBeanServer conn,
String domain,
String server) |
static Set<ObjectName> |
queryNames(MBeanServerConnection conn,
ObjectName pattern,
QueryExp exp)
The sole purpose of this method is to move compiler warnings here, thus
eliminating them from other call sites.
|
static Set<ObjectName> |
queryNames(MBeanServer server,
ObjectName pattern,
QueryExp exp)
The sole purpose of this method is to move compiler warnings here, thus
eliminating them from other call sites.
|
static <T extends MBeanFeatureInfo> |
remove(List<T> infos,
String name) |
static MBeanInfo |
removeAttributes(MBeanInfo origInfo,
String[] attributeNames) |
static ObjectName |
removeProperty(ObjectName objectName,
String key) |
static ObjectName |
setKeyProperty(ObjectName objectName,
String key,
String value)
Change or add a key property in an ObjectName.
|
static String |
toString(Descriptor d,
int indent) |
static String |
toString(MBeanAttributeInfo info,
int indent) |
static String |
toString(MBeanInfo info)
Produce a nice friendly text dump of the MBeanInfo; the standard toString() is unreadable.
|
static String |
toString(MBeanOperationInfo info,
int indent) |
static String |
toString(ObjectName objectName) |
static void |
unregisterAll(MBeanServerConnection conn) |
static void |
unregisterAll(MBeanServerConnection conn,
Set<ObjectName> allNames) |
public static final String MBEAN_SERVER_DELEGATE
public static final String MBEAN_SERVER_ID_ATTRIBUTE_NAME
public static final String WILD_PROP
public static final String WILD_ALL
public static final String GET
public static final String SET
public static final String IS
public static String toString(ObjectName objectName)
public static MBeanServerDelegateMBean getMBeanServerDelegateMBean(MBeanServerConnection server)
public static <T> T newProxyInstance(MBeanServerConnection conn, ObjectName objectName, Class<T> clazz)
Type-safe; in JDK 5 generics aren't used
public static <T> T newProxyInstance(MBeanServerConnection conn, ObjectName objectName, Class<T> clazz, boolean notificationBroadcaster)
public static ObjectName getMBeanServerDelegateObjectName()
public static String getMBeanServerDelegateInfo(MBeanServer server)
public static void listenToMBeanServerDelegate(MBeanServerConnection conn, NotificationListener listener, NotificationFilter filter, Object handback) throws IOException, InstanceNotFoundException
IOExceptionInstanceNotFoundExceptionpublic static String getMBeanServerID(MBeanServerConnection conn) throws IOException, ReflectionException, InstanceNotFoundException, AttributeNotFoundException, MBeanException
public static ObjectName newObjectName(String name)
Do not call this method if there is not 100% certainty of a well-formed name.
public static ObjectName newObjectName(ObjectName objectName, String props)
public static ObjectName newObjectName(String domain, String props)
public static ObjectName newObjectNamePattern(String domain, String props)
domain - the JMX domainprops - properties of the ObjectNamepublic static ObjectName newObjectNamePattern(String domain, Map<String,String> props)
domain - the JMX domainprops - properties of the ObjectNamepublic static ObjectName removeProperty(ObjectName objectName, String key)
public static ObjectName[] objectNameSetToArray(Set<ObjectName> objectNameSet)
objectNameSet - a Set of ObjectNamepublic static String[] getKeyProperty(String key, ObjectName[] objectNames)
key - the property name, within the ObjectNameobjectNames - public static String getProp(ObjectName objectName, String key)
objectName - key - public static String getProps(ObjectName objectName, Set<String> propKeys)
public static String getProps(ObjectName objectName, Set<String> propKeys, boolean ignoreMissing)
public static String[] getKeyProperty(String key, Set<ObjectName> objectNameSet)
key - the property name, within the ObjectNameobjectNameSet - public static Set<String> getKeyPropertySet(String key, Set<ObjectName> objectNameSet)
key - the property name, within the ObjectNameobjectNameSet - public static String findKey(Set<String> candidateKeys, ObjectName objectName)
candidateKeys - objectName - public static Set<ObjectName> findByProperty(Set<ObjectName> objectNames, String propertyKey, String propertyValue)
objectNames - propertyKey - propertyValue - public static ObjectName setKeyProperty(ObjectName objectName, String key, String value)
public static void unregisterAll(MBeanServerConnection conn, Set<ObjectName> allNames) throws IOException, MalformedObjectNameException, MBeanRegistrationException
public static void unregisterAll(MBeanServerConnection conn) throws IOException, MalformedObjectNameException, MBeanRegistrationException
public static String[] getAllAttributeNames(MBeanServerConnection conn, ObjectName objectName) throws IOException, ReflectionException, IntrospectionException, InstanceNotFoundException
public static MBeanAttributeInfo[] filterAttributeInfos(MBeanAttributeInfo[] infos, AttributeFilter filter)
public static String[] getAttributeNames(MBeanAttributeInfo[] infos)
infos - array of infospublic static MBeanAttributeInfo getMBeanAttributeInfo(MBeanAttributeInfo[] infos, String attrName)
infos - array of infosattrName - public static MBeanAttributeInfo getMBeanAttributeInfo(MBeanInfo mbeanInfo, String attrName)
mbeanInfo - attrName - public static MBeanAttributeInfo[] getAttributeInfos(MBeanServerConnection conn, ObjectName objectName) throws IOException, ReflectionException, IntrospectionException, InstanceNotFoundException
conn - objectName - IOExceptionReflectionExceptionIntrospectionExceptionInstanceNotFoundExceptionpublic static Map<String,Attribute> attributeListToAttributeMap(AttributeList attrs)
attrs - the AttributeListpublic static Map<String,Object> attributeListToValueMap(AttributeList attrs)
attrs - the AttributeListpublic static Map<String,String> attributeListToStringMap(AttributeList attrs)
attrs - the AttributeListpublic static Map<String,MBeanAttributeInfo> attributeInfosToMap(MBeanAttributeInfo[] attrInfos)
attrInfos - the AttributeListpublic static MBeanInfo removeAttributes(MBeanInfo origInfo, String[] attributeNames)
public static Set<MBeanFeatureInfo> findInfoByName(MBeanFeatureInfo[] infos, String name)
infos - infosname - namepublic static AttributeList mapToAttributeList(Map<String,Object> m)
m - public static AttributeList getAttributesRobust(MBeanServerConnection conn, ObjectName objectName, String[] attrNames, Set<String> problemNames) throws InstanceNotFoundException, IOException
conn - the connecitonobjectName - name of the object to accessattrNames - attribute namesproblemNames - optional Set to which problem names will be added.InstanceNotFoundExceptionIOExceptionpublic static boolean isIs(Method method)
public static boolean isGetter(Method method)
public static boolean isGetter(MBeanOperationInfo info)
public static Set<MBeanOperationInfo> findOperations(MBeanOperationInfo[] operations, String operationName)
public static MBeanOperationInfo findOperation(MBeanOperationInfo[] operations, String operationName, String[] types)
public static boolean isIsOrGetter(Method method)
public static boolean isSetter(Method method)
public static boolean isGetAttribute(Method m)
public static boolean isGetAttributes(Method m)
public static boolean isSetAttribute(Method m)
public static boolean isSetAttributes(Method m)
public static ArrayList<MBeanAttributeInfo> generateAttributeInfos(Collection<Method> methodSet, boolean read, boolean write)
public static MBeanAttributeInfo[] generateMBeanAttributeInfos(Collection<Method> getterSetters, Collection<Method> getters, Collection<Method> setters)
public static String[] getSignature(MBeanParameterInfo[] infos)
public static MBeanParameterInfo[] generateSignature(Class[] sig)
public static MBeanOperationInfo[] generateMBeanOperationInfos(Collection<Method> methodSet)
public static MBeanAttributeInfo[] mergeMBeanAttributeInfos(MBeanAttributeInfo[] infos1, MBeanAttributeInfo[] infos2)
infos1 - infos2 - public static MBeanNotificationInfo[] mergeMBeanNotificationInfos(MBeanNotificationInfo[] infos1, MBeanNotificationInfo[] infos2)
infos1 - infos2 - public static DescriptorSupport mergeDescriptors(Descriptor src, Descriptor dest)
public static MBeanInfo addNotificationInfos(MBeanInfo origInfo, MBeanNotificationInfo[] notifs)
origInfo - notifs - public static MBeanOperationInfo[] mergeMBeanOperationInfos(MBeanOperationInfo[] infos1, MBeanOperationInfo[] infos2)
infos1 - infos2 - public static MBeanConstructorInfo[] mergeMBeanConstructorInfos(MBeanConstructorInfo[] infos1, MBeanConstructorInfo[] infos2)
infos1 - infos2 - public static MBeanInfo newMBeanInfo(MBeanInfo origMBeanInfo, MBeanAttributeInfo[] newAttrInfos)
origMBeanInfo - newAttrInfos - public static MBeanInfo newMBeanInfo(MBeanInfo origMBeanInfo, MBeanOperationInfo[] newOps)
origMBeanInfo - newOps - public static int findMBeanOperationInfo(MBeanInfo info, String methodName, String[] parameterTypes)
parameterTypes is null, then the
first operation whose name matches is returned.info - methodName - parameterTypes - public static boolean domainMatches(String defaultDomain, ObjectName pattern, ObjectName candidate)
public static boolean matchesPattern(String defaultDomain, ObjectName pattern, ObjectName candidate)
public static Notification cloneNotification(Notification in, Object source)
public static Set<ObjectName> queryNames(MBeanServerConnection conn, ObjectName pattern, QueryExp exp) throws IOException
IOExceptionpublic static Set<ObjectName> queryAllInDomain(MBeanServerConnection conn, String domain) throws IOException
IOExceptionpublic static Set<ObjectName> queryAllInDomain(MBeanServer conn, String domain)
public static Set<ObjectName> queryLocalMBeans(MBeanServer conn, String domain, String server)
public static Set<ObjectName> queryNames(MBeanServer server, ObjectName pattern, QueryExp exp)
public static <T extends Serializable> Map<String,T> getUserDataMapString_Serializable(Notification notif)
public static Object getAttribute(MBeanServerConnection conn, ObjectName o, String attrName)
public static <T extends MBeanFeatureInfo> T remove(List<T> infos, String name)
public static String toString(Descriptor d, int indent)
public static String impactStr(int impact)
public static String toString(MBeanOperationInfo info, int indent)
public static String toString(MBeanAttributeInfo info, int indent)
Copyright © 2017. All rights reserved.