FileDocCategorySizeDatePackage
MBeanIntrospectorTester.javaAPI DocGlassfish v2 API4907Fri May 04 22:33:56 BST 2007com.sun.enterprise.admin.server.core.jmx.tester

MBeanIntrospectorTester

public class MBeanIntrospectorTester extends Object

Fields Summary
Constructors Summary
Methods Summary
private static voidcheckNonPrimitive(java.lang.String str)

        Class c = Class.forName(str);
        MBeanIntrospector intr = new MBeanIntrospector(c);
        String msg = " Type = ";
        msg += intr.isStandardMBean() ? "isStandard" :
                        intr.isDynamicMBean() ? "isDynamic" : "Don't know";
        Debug.println(str + msg);
        Debug.println("Management interface = " + 
            intr.getMBeanInterfaceClass().getName());
    
private static voidcheckPrimitive(java.lang.String str)

        Class c = null;
        if (str.equals("int"))          { c = int.class;        }
        else if (str.equals("boolean")) { c = boolean.class;    }
        else if (str.equals("short"))   { c = short.class;      }
        else if (str.equals("byte"))    { c = byte.class;       }
        else if (str.equals("char"))    { c = char.class;       }
        else if (str.equals("float"))   { c = float.class;      }
        else if (str.equals("long"))    { c = long.class;       }
        else if (str.equals("double"))  { c = double.class;     }

        new MBeanIntrospector(c);
    
private static booleanisPrimitive(java.lang.String str)

        return (str.equals("int")       ||
                str.equals("boolean")   ||
                str.equals("short")     ||
                str.equals("byte")      ||
                str.equals("char")      ||
                str.equals("float")     ||
                str.equals("long")      ||
                str.equals("double"));
    
public static voidmain(java.lang.String[] args)

        BufferedReader reader = new BufferedReader(new FileReader(args[0]));
        String str;
        long begin = System.currentTimeMillis();
        while ((str = reader.readLine()) != null)
        {
            str = str.trim();
            if (isPrimitive(str))
            {
                try
                {
                    checkPrimitive(str);
                    Debug.println("Test failed : " + str);
                }
                catch (NotCompliantMBeanException e)
                {
                }
            }
            else
            {
                try
                {
                    checkNonPrimitive(str);
                }
                catch (NotCompliantMBeanException e)
                {
                    Debug.println("Not Compliant : " + str);
                }
            }
        }
        long end = System.currentTimeMillis();
        //Debug.println("Time lapse = " + (end - begin));
        reader.close();