org.openscience.nmrshiftdb.daemons
Class AbstractDaemon

java.lang.Object
  extended by org.openscience.nmrshiftdb.daemons.AbstractDaemon
All Implemented Interfaces:
java.lang.Runnable, org.apache.jetspeed.daemon.Daemon
Direct Known Subclasses:
AbstractDaemonWithoutServletConfig, AbstractDaemonWithServletConfig

public abstract class AbstractDaemon
extends java.lang.Object
implements org.apache.jetspeed.daemon.Daemon

An abstract daemon. You should not use this class to implement a daemon. but AbstractDaemonWith(out)ServletConfig. This makes sure that the appropriate run-method is called from DaemonThread.

Author:
Stefan Kuhn

Field Summary
private  org.apache.jetspeed.daemon.DaemonConfig config
           
private  org.apache.jetspeed.daemon.DaemonEntry entry
           
private  int result
           
private  int status
           
 
Fields inherited from interface org.apache.jetspeed.daemon.Daemon
RESULT_FAILED, RESULT_PROCESSING, RESULT_SUCCESS, RESULT_UNKNOWN, STATUS_NOT_PROCESSED, STATUS_NOT_STARTED, STATUS_PROCESSED, STATUS_PROCESSING, STATUS_STARTED, STATUS_UNKNOWN
 
Constructor Summary
AbstractDaemon()
           
 
Method Summary
 org.apache.jetspeed.daemon.DaemonConfig getDaemonConfig()
           
 org.apache.jetspeed.daemon.DaemonEntry getDaemonEntry()
           
 java.lang.String getMessage()
           
 int getResult()
           
 int getStatus()
          Return the status for this Daemon
 void init(org.apache.jetspeed.daemon.DaemonConfig config, org.apache.jetspeed.daemon.DaemonEntry entry)
          Init this Daemon from the DaemonFactory
abstract  void run()
           
abstract  void run(javax.servlet.ServletConfig servcon)
          Does the task
 void setResult(int result)
           
 void setStatus(int status)
          Set the status for this Daemon
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

status

private int status

result

private int result

config

private org.apache.jetspeed.daemon.DaemonConfig config

entry

private org.apache.jetspeed.daemon.DaemonEntry entry
Constructor Detail

AbstractDaemon

public AbstractDaemon()
Method Detail

run

public abstract void run()
Specified by:
run in interface java.lang.Runnable

run

public abstract void run(javax.servlet.ServletConfig servcon)
                  throws java.lang.Exception
Does the task

Throws:
java.lang.Exception

init

public void init(org.apache.jetspeed.daemon.DaemonConfig config,
                 org.apache.jetspeed.daemon.DaemonEntry entry)
Init this Daemon from the DaemonFactory

Specified by:
init in interface org.apache.jetspeed.daemon.Daemon
See Also:
Daemon.init(org.apache.jetspeed.daemon.DaemonConfig, org.apache.jetspeed.daemon.DaemonEntry)

getDaemonConfig

public org.apache.jetspeed.daemon.DaemonConfig getDaemonConfig()
Specified by:
getDaemonConfig in interface org.apache.jetspeed.daemon.Daemon

getDaemonEntry

public org.apache.jetspeed.daemon.DaemonEntry getDaemonEntry()
Specified by:
getDaemonEntry in interface org.apache.jetspeed.daemon.Daemon

getStatus

public int getStatus()
Return the status for this Daemon

Specified by:
getStatus in interface org.apache.jetspeed.daemon.Daemon
See Also:
Daemon.STATUS_NOT_PROCESSED, Daemon.STATUS_PROCESSED, Daemon.STATUS_PROCESSING

setStatus

public void setStatus(int status)
Set the status for this Daemon

Specified by:
setStatus in interface org.apache.jetspeed.daemon.Daemon
See Also:
Daemon.STATUS_NOT_PROCESSED, Daemon.STATUS_PROCESSED, Daemon.STATUS_PROCESSING

getResult

public int getResult()
Specified by:
getResult in interface org.apache.jetspeed.daemon.Daemon
See Also:
Daemon.getResult()

setResult

public void setResult(int result)
Specified by:
setResult in interface org.apache.jetspeed.daemon.Daemon
See Also:
Daemon.setResult(int result)

getMessage

public java.lang.String getMessage()
Specified by:
getMessage in interface org.apache.jetspeed.daemon.Daemon
See Also:
Daemon.getMessage()