1   /***
2    * @(#)SimpleStandard.java
3    * 
4    * JFoxSOAF, Service-Oriented Application Framework
5    * 
6    * Copyright(c) JFoxSOAF Team
7    * 
8    * Licensed under the GNU LGPL, Version 2.1 (the "License"); 
9    * you may not use this file except in compliance with the License. 
10   * You may obtain a copy of the License at  
11   * 
12   * http://www.gnu.org/copyleft/lesser.html
13   * 
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS, 
16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
17   * See the License for the specific language governing permissions and 
18   * limitations under the License. 
19   * 
20   * For more information, please visit:
21   * http://www.jfox.cn/confluence/display/JFoxSOAF/Home
22   * http://www.huihoo.org/jfox/jfoxsoaf
23   */
24  
25  package org.huihoo.jfox.soaf.container;
26  
27  /***
28   * "SimpleStandard" does not provide any specific constructors. However,
29   * "SimpleStandard" is JMX compliant with regards to contructors because the
30   * default contructor SimpleStandard() provided by the Java compiler is public.
31   * 
32   * @author <a href="mailto:founder_chen@yahoo.com.cn">Peter Cheng </a>
33   * @version $Revision: 1.3 $ $Date: 2005/01/17 14:10:49 $
34   * @version Revision: 1.0
35   */
36  
37  public class SimpleStandard implements SimpleStandardMBean {
38  
39      private int nbChanges = 0;
40  
41      /***
42       * ATTRIBUTES ACCESSIBLE FOR MANAGEMENT BY A JMX AGENT
43       */
44      private String state = "initial state";
45  
46      /***
47       * PROPERTY NOT ACCESSIBLE FOR MANAGEMENT BY A JMX AGENT
48       * -----------------------------------------------------
49       */
50      private int nbResets = 0;
51  
52      /***
53       * Getter: get the "State" attribute of the "SimpleStandard" standard MBean.
54       * 
55       * @return the current value of the "State" attribute.
56       */
57      public String getState() {
58          return state;
59      }
60  
61      /***
62       * Setter: set the "State" attribute of the "SimpleStandard" standard MBean.
63       * 
64       * @param <VAR>s </VAR> the new value of the "State" attribute.
65       */
66      public void setState(String s) {
67          state = s;
68          nbChanges++;
69      }
70  
71      /***
72       * Getter: get the "NbChanges" attribute of the "SimpleStandard" standard
73       * MBean.
74       * 
75       * @return the current value of the "NbChanges" attribute.
76       */
77      public Integer getNbChanges() {
78          return new Integer(nbChanges);
79      }
80  
81      /***
82       * Operation: reset to their initial values the "State" and "NbChanges"
83       * attributes of the "SimpleStandard" standard MBean.
84       */
85      public void reset() {
86          System.out.println("initial state");
87          state = "initial state";
88          nbChanges = 0;
89          nbResets++;
90      }
91  
92      /***
93       * METHOD NOT EXPOSED FOR MANAGEMENT BY A JMX AGENT
94       */
95  
96      /***
97       * Return the "NbResets" property. This method is not a Getter in the JMX
98       * sense because it is not exposed in the "SimpleStandardMBean" interface.
99       * 
100      * @return the current value of the "NbResets" property.
101      */
102     public Integer getNbResets() {
103         return new Integer(nbResets);
104     }
105 
106 }