Methods Summary |
---|
java.lang.String | getName(int id)
return ( names[id] );
|
private static void | indexAddNotificationListenerMethod(java.lang.reflect.Method m)
final Class[] params = m.getParameterTypes(); //this is ordered list, has to have 4 elements.
//indexing on the second parameter - it can either be ObjectName or NotificationListener
if (params[1].getName().indexOf("ObjectName") != -1)
names[MBeanServerRequestMessage.ADD_NOTIFICATION_LISTENER_OBJECTNAME] = m.toString();
else {
assert (params[1].getName().indexOf("NotificationListener")) != -1;
names[MBeanServerRequestMessage.ADD_NOTIFICATION_LISTENERS] = m.toString();
}
|
private static void | indexCreateMBeanMethod(java.lang.reflect.Method m)
final Class[] params = m.getParameterTypes(); //this is ordered list, has to have 2, 3, 4 or 5 elements.
final int n = params.length;
if (n == 2)
names[MBeanServerRequestMessage.CREATE_MBEAN] = m.toString();
else if (n == 3)
names[MBeanServerRequestMessage.CREATE_MBEAN_LOADER] = m.toString();
else if (n == 4)
names[MBeanServerRequestMessage.CREATE_MBEAN_PARAMS] = m.toString();
else //has to be 5
names[MBeanServerRequestMessage.CREATE_MBEAN_LOADER_PARAMS] = m.toString();
|
private static void | indexMethod(java.lang.reflect.Method am)
final String m = am.getName();
if ("getAttribute".equals(m))
names[MBeanServerRequestMessage.GET_ATTRIBUTE] = am.toString();
else if ("getAttributes".equals(m))
names[MBeanServerRequestMessage.GET_ATTRIBUTES] = am.toString();
else if ("getDefaultDomain".equals(m))
names[MBeanServerRequestMessage.GET_DEFAULT_DOMAIN] = am.toString();
else if ("getDomains".equals(m))
names[MBeanServerRequestMessage.GET_DOMAINS] = am.toString();
else if ("getMBeanCount".equals(m))
names[MBeanServerRequestMessage.GET_MBEAN_COUNT] = am.toString();
else if ("getMBeanInfo".equals(m))
names[MBeanServerRequestMessage.GET_MBEAN_INFO] = am.toString();
else if ("getObjectInstance".equals(m))
names[MBeanServerRequestMessage.GET_OBJECT_INSTANCE] = am.toString();
else if ("invoke".equals(m))
names[MBeanServerRequestMessage.INVOKE] = am.toString();
else if ("isInstanceOf".equals(m))
names[MBeanServerRequestMessage.IS_INSTANCE_OF] = am.toString();
else if ("isRegistered".equals(m))
names[MBeanServerRequestMessage.IS_REGISTERED] = am.toString();
else if ("queryMBeans".equals(m))
names[MBeanServerRequestMessage.QUERY_MBEANS] = am.toString();
else if ("queryNames".equals(m))
names[MBeanServerRequestMessage.QUERY_NAMES] = am.toString();
else if ("setAttribute".equals(m))
names[MBeanServerRequestMessage.SET_ATTRIBUTE] = am.toString();
else if ("setAttributes".equals(m))
names[MBeanServerRequestMessage.SET_ATTRIBUTES] = am.toString();
else if ("unregisterMBean".equals(m))
names[MBeanServerRequestMessage.UNREGISTER_MBEAN] = am.toString();
else if ("addNotificationListener".equals(m))
indexAddNotificationListenerMethod(am);
else if ("createMBean".equals(m))
indexCreateMBeanMethod(am);
else if ("removeNotificationListener".equals(m))
indexRemoveNotificationListenerMethod(am);
|
private static void | indexRemoveNotificationListenerMethod(java.lang.reflect.Method m)
final Class[] params = m.getParameterTypes(); //this is ordered list, has to have 2, or 4 elements.
final int n = params.length;
if (n == 2) {
if (params[1].getName().indexOf("ObjectName") != -1)
names[MBeanServerRequestMessage.REMOVE_NOTIFICATION_LISTENER_OBJECTNAME] = m.toString();
else
names[MBeanServerRequestMessage.REMOVE_NOTIFICATION_LISTENER] = m.toString();
}
else {// has to be 4
if (params[1].getName().indexOf("ObjectName") != -1)
names[MBeanServerRequestMessage.REMOVE_NOTIFICATION_LISTENER_OBJECTNAME_FILTER_HANDBACK] = m.toString();
else
names[MBeanServerRequestMessage.REMOVE_NOTIFICATION_LISTENER_FILTER_HANDBACK] = m.toString();
}
|
private static void | initializeMethods()
try {
final Method[] methods = javax.management.MBeanServerConnection.class.getDeclaredMethods();
names = new String[methods.length];
for (int i = 0 ; i < methods.length ; i++) {
indexMethod(methods[i]);
}
}
catch(final Exception e) {
throw new RuntimeException (e);
}
|