KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > implementation > util > support > ResourceOverride


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 test.implementation.util.support;
23
24 import javax.management.modelmbean.ModelMBeanInfo JavaDoc;
25 import javax.management.modelmbean.ModelMBeanInfoSupport JavaDoc;
26 import javax.management.modelmbean.ModelMBeanAttributeInfo JavaDoc;
27 import javax.management.modelmbean.ModelMBeanOperationInfo JavaDoc;
28 import javax.management.MBeanParameterInfo JavaDoc;
29
30 /**
31  * Overrides and exposes java.lang.Object methods in the management
32  * interface.
33  *
34  * @author <a HREF="mailto:juha@jboss.org">Juha Lindfors</a>.
35  * @version $Revision: 37459 $
36  */

37 public class ResourceOverride
38 {
39    
40    // Attributes ----------------------------------------------------
41

42    private String JavaDoc state = null;
43    
44    
45    // Constructors --------------------------------------------------
46
public ResourceOverride(String JavaDoc state)
47    {
48       this.state = state;
49    }
50    
51    public ResourceOverride() {}
52    
53    
54    // Public --------------------------------------------------------
55

56    public ModelMBeanInfo JavaDoc getMBeanInfo()
57    {
58       ModelMBeanAttributeInfo JavaDoc[] attributes = new ModelMBeanAttributeInfo JavaDoc[]
59       {
60          new ModelMBeanAttributeInfo JavaDoc(
61                "AttributeName", "java.lang.String", "description",
62                false, true, false
63          ),
64          new ModelMBeanAttributeInfo JavaDoc(
65                "AttributeName2", "java.lang.String", "description",
66                true, true, false
67          )
68       };
69       
70       ModelMBeanOperationInfo JavaDoc[] operations = new ModelMBeanOperationInfo JavaDoc[]
71       {
72          new ModelMBeanOperationInfo JavaDoc(
73                "doOperation", "description", null, "java.lang.Object", 1
74          ),
75          
76          new ModelMBeanOperationInfo JavaDoc(
77                "toString", "toString override", null, "java.lang.String", 1
78          ),
79          
80          new ModelMBeanOperationInfo JavaDoc(
81                "equals", "equals override",
82                new MBeanParameterInfo JavaDoc[]
83                {
84                   new MBeanParameterInfo JavaDoc("object", "java.lang.Object", "object to compare to")
85                },
86                "boolean", 1
87          ),
88          
89          new ModelMBeanOperationInfo JavaDoc(
90                "hashCode", "hashCode override in resource", null, Integer.TYPE.getName(), 1
91          )
92       };
93       
94       ModelMBeanInfoSupport JavaDoc info = new ModelMBeanInfoSupport JavaDoc(
95             "test.implementation.util.support.Resource", "description",
96             attributes, null, operations, null
97       );
98       
99       return info;
100    }
101
102
103    public Object JavaDoc doOperation()
104    {
105       return "tamppi";
106    }
107
108    
109    // Object overrides ----------------------------------------------
110

111    public String JavaDoc toString()
112    {
113       return "Resource";
114    }
115    
116    public boolean equals(Object JavaDoc o)
117    {
118       return true;
119    }
120    
121    public int hashCode()
122    {
123       return 10;
124    }
125 }
126       
127
128
129
130
Popular Tags