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, AsteriskGateway, Capsd, Collectd, Correlator, Dhcpd, Discovery, Eventd, EventTranslator, EventTranslator, JettyServer, Linkd, Notifd, Notifd, PassiveStatusd, PassiveStatusKeeper, Poller, QoSD, QoSDimpl2, QoSDrx, QoSDrx, Queued, RTCManager, Scriptd, SnmpPoller, Syslogd, Threshd, Threshd, Tl1d, Trapd, Vacuumd, Vulnscand, Xmlrpcd

public abstract class AbstractServiceDaemon
extends Object
implements ServiceDaemon, SpringServiceDaemon

Abstract AbstractServiceDaemon class.

Version:
$Id: $
Author:
Mathew Brozowski, DJ Gregor, 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)
          Constructor for AbstractServiceDaemon.
 
Method Summary
 void afterPropertiesSet()
          afterPropertiesSet
protected  void debugf(String format, Object... args)
          debugf
protected  void debugf(Throwable t, String format, Object... args)
          debugf
protected  void errorf(String format, Object... args)
          errorf
protected  void errorf(Throwable t, String format, Object... args)
          errorf
protected  void fatalf(String format, Object... args)
          fatalf
protected  void fatalf(Throwable t, String format, Object... args)
          fatalf
 String getName()
          getName
 int getStatus()
          getStatus
 String getStatusText()
          getStatusText
protected  void infof(String format, Object... args)
          infof
protected  void infof(Throwable t, String format, Object... args)
          infof
 void init()
          init
protected  boolean isPaused()
          isPaused
protected  boolean isRunning()
          isRunning
protected  boolean isStarting()
          isStarting
protected  boolean isStartPending()
          isStartPending
protected  ThreadCategory log()
          log
protected abstract  void onInit()
          onInit
protected  void onPause()
          onPause
protected  void onResume()
          onResume
protected  void onStart()
          onStart
protected  void onStop()
          onStop
 void pause()
          pause
 void resume()
          resume
protected  void setStatus(int status)
          setStatus
 void start()
          start
 String status()
          status
 void stop()
          Stops the currently running service.
protected  void waitForStatus(int status)
          waitForStatus
protected  void waitForStatus(int status, long timeout)
          waitForStatus
protected  void warnf(String format, Object... args)
          warnf
protected  void warnf(Throwable t, String format, Object... args)
          warnf
 
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)

Constructor for AbstractServiceDaemon.

Parameters:
name - a String object.
Method Detail

afterPropertiesSet

public final void afterPropertiesSet()
                              throws Exception

afterPropertiesSet

Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception - if any.

onInit

protected abstract void onInit()

onInit


onPause

protected void onPause()

onPause


onResume

protected void onResume()

onResume


onStart

protected void onStart()

onStart


onStop

protected void onStop()

onStop


getName

public final String getName()

getName

Specified by:
getName in interface Fiber
Returns:
a String object.

setStatus

protected void setStatus(int status)

setStatus

Parameters:
status - a int.

waitForStatus

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

waitForStatus

Parameters:
status - a int.
timeout - a long.
Throws:
InterruptedException - if any.

waitForStatus

protected void waitForStatus(int status)
                      throws InterruptedException

waitForStatus

Parameters:
status - a int.
Throws:
InterruptedException - if any.

getStatus

public int getStatus()

getStatus

Specified by:
getStatus in interface Fiber
Returns:
a int.

getStatusText

public String getStatusText()

getStatusText

Returns:
a String object.

status

public String status()

status

Specified by:
status in interface ServiceDaemon
Returns:
a String object.

isStartPending

protected boolean isStartPending()

isStartPending

Returns:
a boolean.

isRunning

protected boolean isRunning()

isRunning

Returns:
a boolean.

isPaused

protected boolean isPaused()

isPaused

Returns:
a boolean.

isStarting

protected boolean isStarting()

isStarting

Returns:
a boolean.

log

protected ThreadCategory log()

log

Returns:
a ThreadCategory object.

fatalf

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

fatalf

Parameters:
format - a String object.
args - a Object object.

fatalf

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

fatalf

Parameters:
t - a Throwable object.
format - a String object.
args - a Object object.

errorf

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

errorf

Parameters:
format - a String object.
args - a Object object.

errorf

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

errorf

Parameters:
t - a Throwable object.
format - a String object.
args - a Object object.

warnf

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

warnf

Parameters:
format - a String object.
args - a Object object.

warnf

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

warnf

Parameters:
t - a Throwable object.
format - a String object.
args - a Object object.

infof

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

infof

Parameters:
format - a String object.
args - a Object object.

infof

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

infof

Parameters:
t - a Throwable object.
format - a String object.
args - a Object object.

debugf

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

debugf

Parameters:
format - a String object.
args - a Object object.

debugf

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

debugf

Parameters:
t - a Throwable object.
format - a String object.
args - a Object object.

init

public final void init()

init


pause

public final void pause()

pause

Specified by:
pause in interface PausableFiber

resume

public final void resume()

resume

Specified by:
resume in interface PausableFiber

start

public final void start()

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 © 2011. All Rights Reserved.