KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > jmx > JBossXMLExample


1 /*
2  * Copyright (c) 2001, 2002 The XDoclet team
3  * All rights reserved.
4  */

5
6 package test.jmx;
7
8 import javax.management.ObjectName JavaDoc;
9
10
11 /**
12     * JBossXMLExample.java Created: Sun Feb 17 23:10:04 2002
13     *
14     * @author <a HREF="mailto:d_jencks@users.sourceforge.net">David Jencks</a>
15     * @version
16     * @jmx.mbean
17     * name="jboss.test.xdoclet:service=Sample"
18     * currencyTimeLimit="10"
19     * description="sample for jboss xmbean.dtd"
20     * persistLocation="pl1"
21     * persistName="JBossXMLExample1"
22     * persistPeriod="10"
23     * persistPolicy="Never"
24     * state-action-on-update="RESTART"
25     * display-name="Sample xmbean for jboss"
26     * persistence-manager="org.jboss.mx.persistence.ObjectStreamPersistenceManager"
27     * @jmx.descriptor
28     * name="classdescriptor"
29     * value="classdescriptorvalue"
30     * @jmx.notification
31     * currencyTimeLimit="20"
32     * description="first notification"
33     * name="javax.management.SomeEvent"
34     * notificationType="xd.example.first,xd.example.second"
35     * persistLocation="pl2"
36     * persistName="JBossXMLExample2"
37     * persistPeriod="20"
38     * persistPolicy="Never"
39     * @jmx.notification
40     * description="second notification"
41     * name="javax.management.SomeOtherEvent"
42     * notificationType="xd.example.third,xd.example.fourth"
43     *
44     * @jmx.managed-attribute
45     * name="ArtificialAttribute"
46     * description="artificial attribute not impemeneted in class"
47     * type="java.lang.String"
48     *
49     * @jmx.managed-operation
50     * name="artificialOperation"
51     * description="artificial operation not implemented in class"
52     * return-type="java.lang.String"
53     * interceptor-classes="org.jboss.TestMBeanInterceptor"
54     * @jmx.managed-parameter
55     * managed-operation="artificialOperation"
56     * name="firstParam"
57     * type="java.lang.Integer"
58     * @jmx.managed-parameter
59     * managed-operation="artificialOperation"
60     * name="secondParam"
61     * type="java.lang.String"
62     *
63     * @jboss.service servicefile="jboss"
64     * @jboss.xmbean
65     *
66     * @jboss.depends object-name="jmx.test:service=Test1"
67     * @jboss.depends object-name="jmx.test:service=Test2"
68     */

69
70 public class JBossXMLExample
71 {
72
73    private String JavaDoc string;
74    private Integer JavaDoc id;
75    private ObjectName JavaDoc ref;
76
77    /**
78     * Creates a new <code>JBossXMLExample</code> instance.
79     *
80     * @jmx:managed-constructor description="default constructor"
81     */

82    public JBossXMLExample ()
83    {
84
85    }
86
87    /**
88     * Creates a new <code>JBossXMLExample</code> instance.
89     *
90     * @param string a <code>String</code> value
91     * @param id an <code>Integer</code> value
92     * @jmx:managed-constructor servicefile="jboss"
93     * @jmx.managed-parameter name="stringParam" type="java.lang.String" value="Hi"
94     * @jmx.managed-parameter name="intParam" type="java.lang.Integer" value="3"
95     */

96    public JBossXMLExample (String JavaDoc string, Integer JavaDoc id)
97    {
98       this.string = string;
99       this.id = id;
100    }
101
102
103    /**
104     * Get the String value.
105     *
106     * @return the String value.
107     * @jmx.managed-attribute
108     * access="read-only"
109     * currencyTimeLimit="30"
110     * description="string attribute"
111     * persistPeriod="30"
112     * persistPolicy="Never"
113     * value="this is a string"
114     * @jmx.descriptor
115     * name="attributedescriptor"
116     * value="attributedescriptorvalue"
117     */

118    public String JavaDoc getString()
119    {
120       return string;
121    }
122
123    /**
124     * Get the Strings value.
125     *
126     * @return the Strings value.
127     * @jmx.managed-attribute
128     * access="read-only"
129     * currencyTimeLimit="30"
130     * description="strings attribute"
131     * persistPeriod="30"
132     * persistPolicy="Never"
133     * value="these are strings"
134     * @jmx.descriptor
135     * name="attributedescriptor"
136     * value="attributedescriptorvalue"
137     */

138   public String JavaDoc[][] getStrings()
139   {
140     return new String JavaDoc[][]{ new String JavaDoc[] {"one", "two", "three"},
141                          new String JavaDoc[] {"uno", "dos", "tres"}};
142   }
143
144    /**
145     * Set the String value.
146     *
147     * @param newString The new String value.
148     * @jmx.managed-attribute
149     */

150    public void setString(String JavaDoc newString)
151    {
152       this.string = newString;
153    }
154
155
156    /**
157     * Get the Id value.
158     *
159     * @return the Id value.
160     * @param newId The new Id value.
161     * @jmx.managed-attribute
162     * access="write-only"
163     * currencyTimeLimit="40"
164     * description="id attribute"
165     * persistPeriod="40"
166     * persistPolicy="Never"
167     * value="5"
168     */

169    public Integer JavaDoc getId()
170    {
171       return id;
172    }
173
174    /**
175     * Set the Id value.
176     *
177     * @jmx.managed-attribute
178     */

179    public void setId(Integer JavaDoc newId)
180    {
181       this.id = newId;
182    }
183
184    Integer JavaDoc value;
185
186    /**
187     * Get the Value value.
188     *
189     * @return the Value value.
190     * @jmx.managed-attribute
191     * access="read-write"
192     * currencyTimeLimit="50"
193     * description="id attribute"
194     * persistPeriod="50"
195     * persistPolicy="Never"
196     * state-action-on-update="KEEP_RUNNING"
197     */

198    public Integer JavaDoc getValue()
199    {
200       return value;
201    }
202
203    /**
204     * Set the Value value.
205     *
206     * @param newValue The new Value value.
207     */

208    public void setValue(Integer JavaDoc newValue)
209    {
210       this.value = newValue;
211    }
212
213
214    /**
215     * Get the Ref value.
216     *
217     * @return the Ref value.
218     * @jmx.managed-attribute
219     * access="read-write"
220     * description="Object Name attribute"
221     * value="xdoclet.test:service=RefTest"
222     */

223    public ObjectName JavaDoc getRef()
224    {
225       return ref;
226    }
227
228    /**
229     * Set the Ref value.
230     *
231     * @param newRef The new Ref value.
232     * @jmx.managed-attribute
233     */

234    public void setRef(ObjectName JavaDoc newRef)
235    {
236       this.ref = newRef;
237    }
238
239
240
241    /**
242     * Does something.
243     *
244     * @param p1 a <code>String</code> value
245     * @param p2 an <code>Integer</code> value
246     * @jmx.managed-operation
247     * description="operation with 2 arguments"
248     * impact="INFO"
249     * @jmx.managed-parameter name="stringParam1" type="java.lang.String" description="first string param"
250     * @jmx.managed-parameter name="integerParam2" type="java.lang.Integer" description="other param"
251     * @jmx.descriptor
252     * name="operationdescriptor"
253     * value="operationdescriptorvalue"
254     */

255    public String JavaDoc doSomething(String JavaDoc p1, Integer JavaDoc p2)
256    {
257       return p1 + p2;
258    }
259
260 }// JBossXMLExample
261

262 /*
263 This breaks the build of the samples
264
265 class PackageLevelClass {
266 }
267 */

268
Popular Tags