KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > admin > server > core > mbean > test > MBeanInfoBuilderTester


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.admin.server.core.mbean.test;
25
26 import javax.management.*;
27 import com.sun.enterprise.admin.server.core.mbean.meta.MBeanInfoBuilder;
28 import com.sun.enterprise.admin.util.*;
29
30 public class MBeanInfoBuilderTester
31 {
32
33     /**
34          Creates new MBeanInfoTester
35     */

36     
37     public MBeanInfoBuilderTester()
38     {
39     }
40
41     /**
42         @param args the command line arguments
43     */

44     
45     public static void main (String JavaDoc args[])
46     {
47         new MBeanInfoBuilderTester().test();
48     }
49
50     public void test()
51     {
52         String JavaDoc[] mbeanNames = new String JavaDoc[]{
53             "com.sun.enterprise.admin.server.core.mbean.test.ManagedTest",
54             "com.sun.enterprise.admin.server.core.mbean.config.ServerController",
55             "com.sun.enterprise.admin.server.core.mbean.config.ManagedServerInstance"
56         };
57         try
58         {
59             for (int i1 = 0 ; i1 < mbeanNames.length ; i1 ++)
60             {
61                 Class JavaDoc cl = Class.forName(mbeanNames[i1]);
62                 MBeanInfoBuilder builder = new MBeanInfoBuilder(cl);
63                 MBeanInfo mi = builder.getMBeanInfo ();
64                 MBeanAttributeInfo[] attrs = mi.getAttributes();
65                 for (int i = 0 ; i < attrs.length ; i++)
66                 {
67                     Logger.log("Attr: " + attrs[i].getName ());
68                 }
69                 MBeanOperationInfo[] operations = mi.getOperations();
70                 for (int i = 0 ; i < operations.length ; i++)
71                 {
72                     MBeanOperationInfo oper = operations[i];
73                     Logger.log("Oper: name = " + oper.getName());
74                     Logger.log("Signature: ");
75                     MBeanParameterInfo[] params = oper.getSignature ();
76                     for (int j = 0 ; j < params.length ; j++)
77                     {
78                         Logger.log("ParamType = " + params[j].getType());
79                     }
80
81                 }
82             }
83         }
84         catch(Exception JavaDoc e)
85         {
86             e.printStackTrace();
87         }
88     }
89 }
Popular Tags