01: /*
02: * Copyright (C) The MX4J Contributors.
03: * All rights reserved.
04: *
05: * This software is distributed under the terms of the MX4J License version 1.0.
06: * See the terms of the MX4J License in the documentation provided with this software.
07: */
08:
09: package mx4j;
10:
11: import java.lang.reflect.Constructor;
12: import java.lang.reflect.Method;
13:
14: /**
15: * Default implementation for the MBeanDescription interface.
16: *
17: * @version $Revision: 1.5 $
18: */
19: public class MBeanDescriptionAdapter implements MBeanDescription {
20: public String getMBeanDescription() {
21: return "Manageable Bean";
22: }
23:
24: public String getConstructorDescription(Constructor ctor) {
25: return "Constructor exposed for management";
26: }
27:
28: public String getConstructorParameterName(Constructor ctor,
29: int index) {
30: switch (index) {
31: case 0:
32: return "param1";
33: case 1:
34: return "param2";
35: case 2:
36: return "param3";
37: case 3:
38: return "param4";
39: default:
40: return "param" + (index + 1);
41: }
42: }
43:
44: public String getConstructorParameterDescription(Constructor ctor,
45: int index) {
46: switch (index) {
47: case 0:
48: return "Constructor's parameter n. 1";
49: case 1:
50: return "Constructor's parameter n. 2";
51: case 2:
52: return "Constructor's parameter n. 3";
53: case 3:
54: return "Constructor's parameter n. 4";
55: default:
56: return "Constructor's parameter n. " + (index + 1);
57: }
58: }
59:
60: public String getAttributeDescription(String attribute) {
61: return "Attribute exposed for management";
62: }
63:
64: public String getOperationDescription(Method operation) {
65: return "Operation exposed for management";
66: }
67:
68: public String getOperationParameterName(Method method, int index) {
69: switch (index) {
70: case 0:
71: return "param1";
72: case 1:
73: return "param2";
74: case 2:
75: return "param3";
76: case 3:
77: return "param4";
78: default:
79: return "param" + (index + 1);
80: }
81: }
82:
83: public String getOperationParameterDescription(Method method,
84: int index) {
85: switch (index) {
86: case 0:
87: return "Operation's parameter n. 1";
88: case 1:
89: return "Operation's parameter n. 2";
90: case 2:
91: return "Operation's parameter n. 3";
92: case 3:
93: return "Operation's parameter n. 4";
94: default:
95: return "Operation's parameter n. " + (index + 1);
96: }
97: }
98: }
|