nl.astron.lofar.odtb.mom2otdbadapter.otdblistener
Class OTDBListener

java.lang.Object
  extended by java.lang.Thread
      extended by nl.astron.lofar.odtb.mom2otdbadapter.otdblistener.OTDBListener
All Implemented Interfaces:
java.lang.Runnable

public class OTDBListener
extends java.lang.Thread

Polls if there are changes in the OTDB database.

Author:
Bastiaan Verhoef

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
private  org.apache.commons.logging.Log log
           
private  int milliseconds
           
private  Queue queue
           
private  OTDBRepository repository
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
OTDBListener(Queue queue, int milliseconds, OTDBRepository repository)
          Constructor
 
Method Summary
protected  Task convertToTask(LofarObservation lofarObservation)
          Converts a observation to a task using the xml generation
 void run()
          Starts the OTDBListener and retrieves changes with an interval
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

private org.apache.commons.logging.Log log

milliseconds

private int milliseconds

queue

private Queue queue

repository

private OTDBRepository repository
Constructor Detail

OTDBListener

public OTDBListener(Queue queue,
                    int milliseconds,
                    OTDBRepository repository)
Constructor

Parameters:
queue - Queue where this listener add the tasks
milliseconds - interval (in milliseconds) between the retrieval of the changes
repository - OTDBRepository where this listener retrieves the changes
Method Detail

run

public void run()
Starts the OTDBListener and retrieves changes with an interval

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

convertToTask

protected Task convertToTask(LofarObservation lofarObservation)
Converts a observation to a task using the xml generation

Parameters:
lofarObservation -
Returns:
Task