KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > compliance > standard > support > MyStandardMBean


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7
8 package test.compliance.standard.support;
9
10 import javax.management.MBeanInfo;
11 import javax.management.MBeanAttributeInfo;
12 import javax.management.MBeanConstructorInfo;
13 import javax.management.MBeanOperationInfo;
14 import javax.management.MBeanParameterInfo;
15 import javax.management.StandardMBean;
16
17 public class MyStandardMBean
18    extends StandardMBean
19    implements MyManagementInterface
20 {
21    public static final String MBEAN_CLASSNAME = "MBEAN_CLASSNAME";
22    public static final String MBEAN_DESCRIPTION = "MBEAN_DESCRIPTION";
23    public static final String MBEAN_ATTRIBUTE_DESCRIPTION = "MBEAN_ATTRIBUTE_DESCRIPTION";
24    public static final String MBEAN_CONSTRUCTOR_DESCRIPTION = "MBEAN_CONSTRUCTOR_DESCRIPTION";
25    public static final String MBEAN_OPERATION_DESCRIPTION = "MBEAN_OPERATION_DESCRIPTION";
26    public static final String MBEAN_PARAMETER = "MBEAN_PARAMETER";
27    public static final String MBEAN_PARAMETER_DESCRIPTION = "MBEAN_PARAMETER_DESCRIPTION";
28
29    public MyStandardMBean()
30       throws Exception
31    {
32       super(MyManagementInterface.class);
33    }
34
35    public MyStandardMBean(String param1, String param2)
36       throws Exception
37    {
38       super(MyManagementInterface.class);
39    }
40
41    public String getAnAttribute()
42    {
43       return null;
44    }
45
46    public void setAnAttribute(String value)
47    {
48    }
49
50    public void anOperation(String param1, String param2)
51    {
52    }
53
54    protected String getClassName(MBeanInfo info)
55    {
56       return MBEAN_CLASSNAME;
57    }
58
59    protected String getDescription(MBeanInfo info)
60    {
61       return MBEAN_DESCRIPTION;
62    }
63
64    protected String getDescription(MBeanAttributeInfo info)
65    {
66       return MBEAN_ATTRIBUTE_DESCRIPTION + info.getName();
67    }
68
69    protected String getDescription(MBeanConstructorInfo info)
70    {
71       return MBEAN_CONSTRUCTOR_DESCRIPTION + info.getSignature().length;
72    }
73
74    protected String getDescription(MBeanOperationInfo info)
75    {
76       return MBEAN_OPERATION_DESCRIPTION + info.getName();
77    }
78
79    protected String getDescription(MBeanConstructorInfo info, MBeanParameterInfo param, int sequence)
80    {
81       return MBEAN_PARAMETER_DESCRIPTION + sequence;
82    }
83
84    protected String getDescription(MBeanOperationInfo info, MBeanParameterInfo param, int sequence)
85    {
86       return MBEAN_PARAMETER_DESCRIPTION + info.getName() + sequence;
87    }
88
89    protected String getParameterName(MBeanConstructorInfo info, MBeanParameterInfo param, int sequence)
90    {
91       return MBEAN_PARAMETER + sequence;
92    }
93
94    protected String getParameterName(MBeanOperationInfo info, MBeanParameterInfo param, int sequence)
95    {
96       return MBEAN_PARAMETER + info.getName() + sequence;
97    }
98
99    protected int getImpact(MBeanOperationInfo info)
100    {
101       return MBeanOperationInfo.ACTION;
102    }
103 }
104
Popular Tags