jsr.daemon
Class GenericDaemon

java.lang.Object
  |
  +--jsr.daemon.GenericDaemon
All Implemented Interfaces:
Daemon, DaemonConfig, ExtendedLogging, Logging
Direct Known Subclasses:
PausableDaemon

public abstract class GenericDaemon
extends java.lang.Object
implements Daemon, DaemonConfig, ExtendedLogging

abstract generic daemon base class to be subclassed by daemons All singleton accesses are synchronized via this daemon instance if applicable.


Constructor Summary
GenericDaemon()
          default constructor for this daemon
 
Method Summary
 void addListener(DaemonListener listener)
          method for binding a listener to this daemon
abstract  void destroy()
          destruction method for this daemon method is launched via the control interface and has to be subclassed
protected  void down(java.lang.Throwable throwable)
          method for indicating the activity state of this daemon used by this daemon for managing its own activity state after calling down initialization is required for getting this daemon active again
protected  void finalize()
          finalizer method for this daemon
 java.lang.Object getAttribute(java.lang.String name)
          method getAttribute() of the configuration interface
 java.util.Enumeration getAttributeNames()
          method getAttributeNames() of the configuration interface
 DaemonConfig getDaemonConfig()
          access method for obtaining the application configuration interface of this daemon interface methods are also available via this daemon class
protected  DaemonContext getDaemonContext()
          access to the service provider context interface of this daemon method is called by the container for supplying resources to be accessed via the configuration
protected  DaemonControl getDaemonControl()
          access to the service provider control interface of this daemon method is called by the container for controlling the life state of this daemon
 java.lang.String getDaemonInfo()
          descriptive information supplied by this daemon the class name of this daemon is supplied as the default implementation
 java.lang.String getDaemonName()
          method getDaemonName() of the configuration interface
protected  DaemonEventHandler getEventHandler()
          method for accessing the event handler of this daemon
abstract  void init()
          initialization method for this daemon method is launched via the control interface and has to be subclassed
 boolean isActive()
          life state indication of this daemon state is managed by the container and/or by this daemon
 void log(java.lang.String message)
          method for logging output of this daemon logging resources are supplied via the daemon context
 void log(java.lang.String message, java.lang.Throwable throwable)
          method for logging extended output of this daemon logging resources are supplied via the daemon context
 void removeListener(DaemonListener listener)
          method for unbinding a listener from this daemon
protected  void setActive(boolean active, java.lang.Throwable throwable)
          method for managing the activity state of this daemon
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericDaemon

public GenericDaemon()
default constructor for this daemon
Method Detail

init

public abstract void init()
                   throws DaemonException
initialization method for this daemon method is launched via the control interface and has to be subclassed
Specified by:
init in interface Daemon
Throws:
DaemonException - thrown by this daemon if initialization fails

destroy

public abstract void destroy()
destruction method for this daemon method is launched via the control interface and has to be subclassed
Specified by:
destroy in interface Daemon

getDaemonContext

protected DaemonContext getDaemonContext()
access to the service provider context interface of this daemon method is called by the container for supplying resources to be accessed via the configuration
Returns:
service provider context interface of this daemon

getDaemonControl

protected DaemonControl getDaemonControl()
access to the service provider control interface of this daemon method is called by the container for controlling the life state of this daemon
Returns:
service provider control interface of this daemon

getEventHandler

protected DaemonEventHandler getEventHandler()
method for accessing the event handler of this daemon
Returns:
event handler of this daemon

setActive

protected final void setActive(boolean active,
                               java.lang.Throwable throwable)
method for managing the activity state of this daemon
Parameters:
active - flag indicating the current activity state
throwable - a throwable for indicating a possible exception

down

protected void down(java.lang.Throwable throwable)
method for indicating the activity state of this daemon used by this daemon for managing its own activity state after calling down initialization is required for getting this daemon active again
Parameters:
throwable - a throwable for indicating a possible exception

isActive

public boolean isActive()
life state indication of this daemon state is managed by the container and/or by this daemon
Specified by:
isActive in interface Daemon
Returns:
true if and only if the implementing daemon is active

addListener

public void addListener(DaemonListener listener)
method for binding a listener to this daemon
Parameters:
listener - the daemon listener to be bound

removeListener

public void removeListener(DaemonListener listener)
method for unbinding a listener from this daemon
Parameters:
listener - the daemon listener to be unbound

getDaemonInfo

public java.lang.String getDaemonInfo()
descriptive information supplied by this daemon the class name of this daemon is supplied as the default implementation
Specified by:
getDaemonInfo in interface Daemon
Returns:
description of this daemon

finalize

protected void finalize()
                 throws java.lang.Throwable
finalizer method for this daemon
Overrides:
finalize in class java.lang.Object

getDaemonConfig

public DaemonConfig getDaemonConfig()
access method for obtaining the application configuration interface of this daemon interface methods are also available via this daemon class
Specified by:
getDaemonConfig in interface Daemon
Returns:
configuration interface of this daemon

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
method getAttribute() of the configuration interface
Specified by:
getAttribute in interface DaemonConfig
Parameters:
name - the name of the attribute to be retrieved
Returns:
value of the attribute

getAttributeNames

public java.util.Enumeration getAttributeNames()
method getAttributeNames() of the configuration interface
Specified by:
getAttributeNames in interface DaemonConfig
Returns:
enumeration of the attribute names available

getDaemonName

public java.lang.String getDaemonName()
method getDaemonName() of the configuration interface
Specified by:
getDaemonName in interface DaemonConfig
Returns:
name of this daemon set via the context

log

public void log(java.lang.String message)
method for logging output of this daemon logging resources are supplied via the daemon context
Specified by:
log in interface Logging
Parameters:
message - the message to be logged via an underlying logging resource

log

public void log(java.lang.String message,
                java.lang.Throwable throwable)
method for logging extended output of this daemon logging resources are supplied via the daemon context
Specified by:
log in interface ExtendedLogging
Parameters:
message - the message to be logged via an underlying logging resource
throwable - additional throwable with its stack trace to be logged