KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > jmx > simpleservice > SimpleService


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 org.jboss.test.jmx.simpleservice;
23
24 import org.jboss.system.ServiceMBeanSupport;
25
26 /**
27  * A simple mbean derived from ServiceMBean/ServiceMBeanSupport.
28  *
29  * @author <a HREF="mailto:dimitris@jboss.org">Dimitris Andreadis</a>
30  * @version $Revision: 37406 $
31  */

32 public class SimpleService extends ServiceMBeanSupport
33    implements SimpleServiceMBean
34 {
35    // Private Data --------------------------------------------------
36

37    /** A String attribute */
38    private String JavaDoc aString;
39   
40    private boolean createCalled;
41    private boolean startCalled;
42    private boolean stopCalled;
43    private boolean destroyCalled;
44    
45   // Constructors --------------------------------------------------
46

47   /**
48    * CTOR
49   **/

50   public SimpleService()
51   {
52      // empty
53
}
54
55   // Attributes -----------------------------------------------------
56

57   public void setAStringAttr(String JavaDoc s)
58   {
59      this.aString = s;
60   }
61   
62   public String JavaDoc getAStringAttr()
63   {
64      return aString;
65   }
66   
67   public boolean getCreateCalled()
68   {
69      return createCalled;
70   }
71   
72   public boolean getStartCalled()
73   {
74      return startCalled;
75   }
76   
77   public boolean getStopCalled()
78   {
79      return stopCalled;
80   }
81   
82   public boolean getDestroyCalled()
83   {
84      return destroyCalled;
85   }
86   
87   // Operations -----------------------------------------------------
88

89   public void resetLifecycleMemory()
90   {
91      createCalled = false;
92      startCalled = false;
93      stopCalled = false;
94      destroyCalled = false;
95   }
96   
97   // Lifecycle ------------------------------------------------------
98

99   protected void createService() throws Exception JavaDoc
100   {
101      createCalled = true;
102   }
103   
104   protected void startService() throws Exception JavaDoc
105   {
106      startCalled = true;
107   }
108   
109   protected void stopService()
110   {
111      stopCalled = true;
112   }
113   
114   protected void destroyService()
115   {
116      destroyCalled = true;
117   }
118   
119 }
120
Popular Tags