001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.test.jmx.simpleservice;
023:
024: import org.jboss.system.ServiceMBeanSupport;
025:
026: /**
027: * A simple mbean derived from ServiceMBean/ServiceMBeanSupport
028: * that does *not* expose jbossInternalLifecycle(String)
029: *
030: * @author <a href="mailto:dimitris@jboss.org">Dimitris Andreadis</a>
031: * @version $Revision: 57211 $
032: */
033: public class SimpleService2 extends ServiceMBeanSupport implements
034: SimpleService2MBean {
035: // Private Data --------------------------------------------------
036:
037: /** A String attribute */
038: private String aString;
039:
040: private boolean createCalled;
041: private boolean startCalled;
042: private boolean stopCalled;
043: private boolean destroyCalled;
044:
045: // Constructors --------------------------------------------------
046:
047: /**
048: * CTOR
049: **/
050: public SimpleService2() {
051: // empty
052: }
053:
054: // Attributes -----------------------------------------------------
055:
056: public void setAStringAttr(String s) {
057: this .aString = s;
058: }
059:
060: public String getAStringAttr() {
061: return aString;
062: }
063:
064: public boolean getCreateCalled() {
065: return createCalled;
066: }
067:
068: public boolean getStartCalled() {
069: return startCalled;
070: }
071:
072: public boolean getStopCalled() {
073: return stopCalled;
074: }
075:
076: public boolean getDestroyCalled() {
077: return destroyCalled;
078: }
079:
080: // Operations -----------------------------------------------------
081:
082: public void resetLifecycleMemory() {
083: createCalled = false;
084: startCalled = false;
085: stopCalled = false;
086: destroyCalled = false;
087: }
088:
089: // Lifecycle ------------------------------------------------------
090:
091: protected void createService() throws Exception {
092: createCalled = true;
093: }
094:
095: protected void startService() throws Exception {
096: startCalled = true;
097: }
098:
099: protected void stopService() {
100: stopCalled = true;
101: }
102:
103: protected void destroyService() {
104: destroyCalled = true;
105: }
106:
107: }
|