1 /***
2 * JFoxSOAF, Service-Oriented Application Framework
3 *
4 * Copyright (C) www.huihoo.org
5 *
6 * Distributable under GNU LGPL For more information, please visit:
7 * http://www.huihoo.org/jfox/jfoxsoaf
8 */
9
10 package org.huihoo.jfox.soaf.container;
11
12 /***
13 * "SimpleStandard" does not provide any specific constructors. However,
14 * "SimpleStandard" is JMX compliant with regards to contructors because the
15 * default contructor SimpleStandard() provided by the Java compiler is public.
16 *
17 * @author <a href="mailto:founder_chen@yahoo.com.cn">Peter Cheng </a>
18 * @version $Revision: 1.1 $ $Date: 2004/10/18 14:22:41 $
19 * @version Revision: 1.0
20 */
21
22 public class SimpleStandard implements SimpleStandardMBean {
23
24 private int nbChanges = 0;
25
26 /***
27 * ATTRIBUTES ACCESSIBLE FOR MANAGEMENT BY A JMX AGENT
28 */
29 private String state = "initial state";
30
31 /***
32 * PROPERTY NOT ACCESSIBLE FOR MANAGEMENT BY A JMX AGENT
33 * -----------------------------------------------------
34 */
35 private int nbResets = 0;
36
37 /***
38 * Getter: get the "State" attribute of the "SimpleStandard" standard MBean.
39 *
40 * @return the current value of the "State" attribute.
41 */
42 public String getState() {
43 return state;
44 }
45
46 /***
47 * Setter: set the "State" attribute of the "SimpleStandard" standard MBean.
48 *
49 * @param <VAR>s
50 * </VAR> the new value of the "State" attribute.
51 */
52 public void setState(String s) {
53 state = s;
54 nbChanges++;
55 }
56
57 /***
58 * Getter: get the "NbChanges" attribute of the "SimpleStandard" standard
59 * MBean.
60 *
61 * @return the current value of the "NbChanges" attribute.
62 */
63 public Integer getNbChanges() {
64 return new Integer(nbChanges);
65 }
66
67 /***
68 * Operation: reset to their initial values the "State" and "NbChanges"
69 * attributes of the "SimpleStandard" standard MBean.
70 */
71 public void reset() {
72 System.out.println("initial state");
73 state = "initial state";
74 nbChanges = 0;
75 nbResets++;
76 }
77
78 /***
79 * METHOD NOT EXPOSED FOR MANAGEMENT BY A JMX AGENT
80 */
81
82 /***
83 * Return the "NbResets" property. This method is not a Getter in the JMX
84 * sense because it is not exposed in the "SimpleStandardMBean" interface.
85 *
86 * @return the current value of the "NbResets" property.
87 */
88 public Integer getNbResets() {
89 return new Integer(nbResets);
90 }
91
92 }