KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > jmx > JmxTestBean


1 /*
2  * Copyright 2002-2005 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5  * use this file except in compliance with the License. You may obtain a copy of
6  * the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13  * License for the specific language governing permissions and limitations under
14  * the License.
15  */

16
17 package org.springframework.jmx;
18
19 /**
20  * @@org.springframework.jmx.export.metadata.ManagedResource
21  * (description="My Managed Bean", objectName="spring:bean=test",
22  * log=true, logFile="jmx.log", currencyTimeLimit=15, persistPolicy="OnUpdate",
23  * persistPeriod=200, persistLocation="./foo", persistName="bar.jmx")
24  *
25  * @author Rob Harrop
26  */

27 public class JmxTestBean implements IJmxTestBean {
28
29     private String JavaDoc name;
30
31     private String JavaDoc nickName;
32
33     private int age;
34
35     private boolean isSuperman;
36
37     /**
38      * @@org.springframework.jmx.export.metadata.ManagedAttribute
39      * (description="The Age Attribute", currencyTimeLimit=15)
40      */

41     public int getAge() {
42         return age;
43     }
44
45     public void setAge(int age) {
46         this.age = age;
47     }
48
49     /**
50      * @@org.springframework.jmx.export.metadata.ManagedOperation(currencyTimeLimit=30)
51      */

52     public long myOperation() {
53         return 1L;
54     }
55
56     /**
57      * @@org.springframework.jmx.export.metadata.ManagedAttribute
58      * (description="The Name Attribute", currencyTimeLimit=20,
59      * defaultValue="bar", persistPolicy="OnUpdate")
60      */

61     public void setName(String JavaDoc name) {
62         this.name = name;
63     }
64
65     /**
66      * @@org.springframework.jmx.export.metadata.ManagedAttribute
67      * (defaultValue="foo", persistPeriod=300)
68      */

69     public String JavaDoc getName() {
70         return name;
71     }
72
73     /**
74      * @@org.springframework.jmx.export.metadata.ManagedAttribute(description="The Nick
75      * Name
76      * Attribute")
77      */

78     public String JavaDoc getNickName() {
79         return this.nickName;
80     }
81
82     public void setNickName(String JavaDoc nickName) {
83         this.nickName = nickName;
84     }
85
86     /**
87      * @@org.springframework.jmx.export.metadata.ManagedAttribute(description="The Is
88      * Superman
89      * Attribute")
90      */

91     public void setSuperman(boolean superman) {
92         this.isSuperman = superman;
93     }
94
95     public boolean isSuperman() {
96         return isSuperman;
97     }
98
99     /**
100      * @@org.springframework.jmx.export.metadata.ManagedOperation(description="Add Two
101      * Numbers
102      * Together")
103      * @@org.springframework.jmx.export.metadata.ManagedOperationParameter(index=0, name="x", description="Left operand")
104      * @@org.springframework.jmx.export.metadata.ManagedOperationParameter(index=1, name="y", description="Right operand")
105      */

106     public int add(int x, int y) {
107         return x + y;
108     }
109
110     /**
111      * Test method that is not exposed by the MetadataAssembler.
112      */

113     public void dontExposeMe() {
114         throw new RuntimeException JavaDoc();
115     }
116
117     protected void someProtectedMethod() {
118     }
119
120     private void somePrivateMethod() {
121     }
122
123     protected void getSomething() {
124     }
125
126     private void getSomethingElse() {
127     }
128
129 }
130
Popular Tags