org.opennms.netmgt.daemon
Class AbstractServiceDaemon

java.lang.Object
  extended by org.opennms.netmgt.daemon.AbstractServiceDaemon
All Implemented Interfaces:
Fiber, PausableFiber, SpringServiceDaemon, ServiceDaemon, org.springframework.beans.factory.InitializingBean
Direct Known Subclasses:
Actiond, Capsd, Collectd, Dhcpd, Discovery, Eventd, EventTranslator, Linkd, Notifd, PassiveStatusKeeper, Poller, Queued, RTCManager, Scriptd, Syslogd, Threshd, Tl1d, Trapd, Vacuumd, Vulnscand, Xmlrpcd

public abstract class AbstractServiceDaemon
extends Object
implements ServiceDaemon, SpringServiceDaemon

Author:
Mathew Brozowski, DJ Gregor

Field Summary
 
Fields inherited from interface org.opennms.core.fiber.PausableFiber
PAUSE_PENDING, PAUSED, RESUME_PENDING
 
Fields inherited from interface org.opennms.core.fiber.Fiber
RUNNING, START_PENDING, STARTING, STATUS_NAMES, STOP_PENDING, STOPPED
 
Constructor Summary
protected AbstractServiceDaemon(String name)
           
 
Method Summary
 void afterPropertiesSet()
           
protected  void debugf(String format, Object... args)
           
protected  void debugf(Throwable t, String format, Object... args)
           
protected  void errorf(String format, Object... args)
           
protected  void errorf(Throwable t, String format, Object... args)
           
protected  void fatalf(String format, Object... args)
           
protected  void fatalf(Throwable t, String format, Object... args)
           
 String getName()
           
 int getStatus()
           
 String getStatusText()
           
protected  void infof(String format, Object... args)
           
protected  void infof(Throwable t, String format, Object... args)
           
 void init()
           
protected  boolean isPaused()
           
protected  boolean isRunning()
           
protected  boolean isStarting()
           
protected  boolean isStartPending()
           
protected  Category log()
           
protected abstract  void onInit()
           
protected  void onPause()
           
protected  void onResume()
           
protected  void onStart()
           
protected  void onStop()
           
 void pause()
           
 void resume()
           
protected  void setStatus(int status)
           
 void start()
           
 String status()
           
 void stop()
          Stops the currently running service.
protected  void waitForStatus(int status)
           
protected  void waitForStatus(int status, long timeout)
           
protected  void warnf(String format, Object... args)
           
protected  void warnf(Throwable t, String format, Object... args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractServiceDaemon

protected AbstractServiceDaemon(String name)
Method Detail

afterPropertiesSet

public final void afterPropertiesSet()
                              throws Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception

onInit

protected abstract void onInit()

onPause

protected void onPause()

onResume

protected void onResume()

onStart

protected void onStart()

onStop

protected void onStop()

getName

public final String getName()
Specified by:
getName in interface Fiber

setStatus

protected void setStatus(int status)

waitForStatus

protected void waitForStatus(int status,
                             long timeout)
                      throws InterruptedException
Throws:
InterruptedException

waitForStatus

protected void waitForStatus(int status)
                      throws InterruptedException
Throws:
InterruptedException

getStatus

public int getStatus()
Specified by:
getStatus in interface Fiber

getStatusText

public String getStatusText()

status

public String status()
Specified by:
status in interface ServiceDaemon

isStartPending

protected boolean isStartPending()

isRunning

protected boolean isRunning()

isPaused

protected boolean isPaused()

isStarting

protected boolean isStarting()

log

protected Category log()

fatalf

protected void fatalf(String format,
                      Object... args)

fatalf

protected void fatalf(Throwable t,
                      String format,
                      Object... args)

errorf

protected void errorf(String format,
                      Object... args)

errorf

protected void errorf(Throwable t,
                      String format,
                      Object... args)

warnf

protected void warnf(String format,
                     Object... args)

warnf

protected void warnf(Throwable t,
                     String format,
                     Object... args)

infof

protected void infof(String format,
                     Object... args)

infof

protected void infof(Throwable t,
                     String format,
                     Object... args)

debugf

protected void debugf(String format,
                      Object... args)

debugf

protected void debugf(Throwable t,
                      String format,
                      Object... args)

init

public final void init()

pause

public final void pause()
Specified by:
pause in interface PausableFiber

resume

public final void resume()
Specified by:
resume in interface PausableFiber

start

public final void start()
Specified by:
start in interface Fiber
Specified by:
start in interface SpringServiceDaemon

stop

public final void stop()
Stops the currently running service. If the service is not running then the command is silently discarded.

Specified by:
stop in interface Fiber


Copyright © 2009. All Rights Reserved.