Methods Summary |
---|
private void | createAttributes()This will only give the attributes in getX or setX style.
Inheritence is not supported in here.
Vector attrVector = new Vector();
Method[] declMethods = new Introspector(mClass).getDeclaredConcretePublicMethods();
Method[] getters = this.getGetters(declMethods);
Method[] setters = this.getSetters(declMethods);
for (int i = 0 ; i < getters.length ; i ++)
{
MBeanAttributeInfo attr = null;
String methodName = getters[i].getName();
String attrName = getAttributeNameFromGetter(methodName);
Method getter = findAttrIn(attrName, getters);
Method setter = findAttrIn(attrName, setters);
boolean isReadable = ( getter != null );
boolean isWritable = ( setter != null );
boolean isIs = false;
attr = new MBeanAttributeInfo(attrName, null, attrName,
isReadable, isWritable, isIs);
attrVector.add(attr);
}
mAttributes = new MBeanAttributeInfo[attrVector.size()];
attrVector.toArray(mAttributes);
|
private void | createConstructors()
Constructor[] ctors = mClass.getConstructors();
mConstructors = new MBeanConstructorInfo[ctors.length];
for (int i = 0 ; i < ctors.length ; i++)
{
String ctorDesc = ctors[i].getName();
MBeanConstructorInfo ctorInfo =
new MBeanConstructorInfo(ctorDesc, ctors[i]);
mConstructors[i] = ctorInfo;
}
|
private void | createMBeanInfo()
mMBeanInfo = new MBeanInfo(mClass.getName(),
mClass.getName(),
mAttributes, mConstructors, mOperations, mNotifications);
|
private void | createNotifications()
|
private void | createOperations()
Collection excludeList = new Vector();
excludeList.add("java.lang.Object");
excludeList.add("com.sun.enterprise.admin.server.core.mbean.config.AdminBase");
Introspector reflector = new Introspector(mClass);
Method[] methods = reflector.getCallableInstanceMethods(excludeList);
Vector oprVector = new Vector();
for (int i = 0 ; i < methods.length ; i++)
{
String name = methods[i].getName();
boolean isGetter = name.startsWith(kGetterPrefix);
boolean isSetter = name.startsWith(kSetterPrefix);
if (!isGetter && !isSetter)
{
oprVector.add(new MBeanOperationInfo(name, methods[i]));
}
}
mOperations = new MBeanOperationInfo[oprVector.size()];
oprVector.toArray (mOperations);
|
private java.lang.reflect.Method | findAttrIn(java.lang.String attrName, java.lang.reflect.Method[] methods)
Method matcher = null;
boolean found = false;
for (int i = 0 ; i < methods.length ; i++)
{
String methodName = methods[i].getName();
if (methodName.endsWith(attrName))
{
matcher = methods[i];
break;
}
}
return ( matcher );
|
private java.lang.String | getAttributeNameFromGetter(java.lang.String getterName)
int getStartsAt = getterName.indexOf(kGetterPrefix);
int attributeStartsAt = getStartsAt + kGetterPrefix.length();
return ( getterName.substring (attributeStartsAt) );
|
private java.lang.reflect.Method[] | getGetters(java.lang.reflect.Method[] methods)
Vector getters = new Vector();
for (int i = 0 ; i < methods.length ; i++)
{
String methodName = methods[i].getName();
if (methodName.startsWith (kGetterPrefix))
{
getters.add (methods[i]);
}
}
Method[] getterMethods = new Method[getters.size()];
return ( (Method[]) getters.toArray (getterMethods) );
|
public javax.management.MBeanAttributeInfo[] | getMBeanAttributes()
return ( mAttributes );
|
public javax.management.MBeanConstructorInfo[] | getMBeanConstructors()
return ( mConstructors );
|
public javax.management.MBeanInfo | getMBeanInfo()
return ( mMBeanInfo );
|
public javax.management.MBeanOperationInfo[] | getMBeanOperations()Returns only the public methods in the given MBean. These are the
operations that can be called on this MBean with invoke method.
return ( mOperations );
|
private java.lang.reflect.Method[] | getSetters(java.lang.reflect.Method[] methods)
Vector setters = new Vector();
for (int i = 0 ; i < methods.length ; i++)
{
String methodName = methods[i].getName();
if (methodName.startsWith (kSetterPrefix))
{
setters.add (methods[i]);
}
}
Method[] setterMethods = new Method[setters.size()];
return ( (Method[]) setters.toArray (setterMethods) );
|