KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > jmx > compliance > standard > support > MyStandardMBean


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

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