KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mx4j > MBeanDescriptionAdapter


1 /*
2  * Copyright (C) The MX4J Contributors.
3  * All rights reserved.
4  *
5  * This software is distributed under the terms of the MX4J License version 1.0.
6  * See the terms of the MX4J License in the documentation provided with this software.
7  */

8
9 package mx4j;
10
11 import java.lang.reflect.Constructor JavaDoc;
12 import java.lang.reflect.Method JavaDoc;
13
14 /**
15  * Default implementation for the MBeanDescription interface.
16  *
17  * @version $Revision: 1.5 $
18  */

19 public class MBeanDescriptionAdapter implements MBeanDescription
20 {
21    public String JavaDoc getMBeanDescription()
22    {
23       return "Manageable Bean";
24    }
25
26    public String JavaDoc getConstructorDescription(Constructor JavaDoc ctor)
27    {
28       return "Constructor exposed for management";
29    }
30
31    public String JavaDoc getConstructorParameterName(Constructor JavaDoc ctor, int index)
32    {
33       switch (index)
34       {
35          case 0:
36             return "param1";
37          case 1:
38             return "param2";
39          case 2:
40             return "param3";
41          case 3:
42             return "param4";
43          default:
44             return "param" + (index + 1);
45       }
46    }
47
48    public String JavaDoc getConstructorParameterDescription(Constructor JavaDoc ctor, int index)
49    {
50       switch (index)
51       {
52          case 0:
53             return "Constructor's parameter n. 1";
54          case 1:
55             return "Constructor's parameter n. 2";
56          case 2:
57             return "Constructor's parameter n. 3";
58          case 3:
59             return "Constructor's parameter n. 4";
60          default:
61             return "Constructor's parameter n. " + (index + 1);
62       }
63    }
64
65    public String JavaDoc getAttributeDescription(String JavaDoc attribute)
66    {
67       return "Attribute exposed for management";
68    }
69
70    public String JavaDoc getOperationDescription(Method JavaDoc operation)
71    {
72       return "Operation exposed for management";
73    }
74
75    public String JavaDoc getOperationParameterName(Method JavaDoc method, int index)
76    {
77       switch (index)
78       {
79          case 0:
80             return "param1";
81          case 1:
82             return "param2";
83          case 2:
84             return "param3";
85          case 3:
86             return "param4";
87          default:
88             return "param" + (index + 1);
89       }
90    }
91
92    public String JavaDoc getOperationParameterDescription(Method JavaDoc method, int index)
93    {
94       switch (index)
95       {
96          case 0:
97             return "Operation's parameter n. 1";
98          case 1:
99             return "Operation's parameter n. 2";
100          case 2:
101             return "Operation's parameter n. 3";
102          case 3:
103             return "Operation's parameter n. 4";
104          default:
105             return "Operation's parameter n. " + (index + 1);
106       }
107    }
108 }
109
Popular Tags