plugins
Class AbstractPlugin

java.lang.Object
  extended byjava.lang.Thread
      extended byplugins.AbstractPlugin
All Implemented Interfaces:
Plugin, java.lang.Runnable, ServiceUser
Direct Known Subclasses:
GPSPlugin

public abstract class AbstractPlugin
extends java.lang.Thread
implements ServiceUser, Plugin

An abstract plugin. Every plugin has its own thread to enable parallel estimation of the PDFs. The thread blocks until it is triggered by the locator. A PDF is then calculated and returned by using the callback.


Field Summary
protected  java.util.Vector services
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
protected AbstractPlugin()
           
 
Method Summary
protected abstract  PDF createPdf(long timeout)
          calculate the current PDF.
protected abstract  void freeRessources()
          prepare to get deleted, so free all aquired ressource
abstract  java.util.Vector getRequiredServices()
          get a list of service objects of the appropriate type
 java.util.Vector getServices()
          check which services are currently assigned to the plugin
 void load()
          load the plugin, start the thread.
protected abstract  boolean needMoreServices()
          check if all required services where assigned to the plugin.
 void run()
          private
 void setServices(java.util.Vector services)
          assign a list of services to the plugin.
 void trigger(PDFDrain drain, long timeout, int handle)
          trigger the caclulation of the current PDF.
 void unload()
          unload the plugin, stop the thread.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, 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

services

protected java.util.Vector services
Constructor Detail

AbstractPlugin

protected AbstractPlugin()
Method Detail

trigger

public void trigger(PDFDrain drain,
                    long timeout,
                    int handle)
trigger the caclulation of the current PDF.

Specified by:
trigger in interface Plugin
Parameters:
drain - the callback object
timeout - the maximum absolut system time until the PDF must be returned
handle - a handle which is to be passed at callback

load

public void load()
load the plugin, start the thread.

Specified by:
load in interface Plugin

unload

public void unload()
unload the plugin, stop the thread.

Specified by:
unload in interface Plugin

setServices

public void setServices(java.util.Vector services)
assign a list of services to the plugin.

Specified by:
setServices in interface ServiceUser

getServices

public java.util.Vector getServices()
check which services are currently assigned to the plugin

Specified by:
getServices in interface ServiceUser

getRequiredServices

public abstract java.util.Vector getRequiredServices()
get a list of service objects of the appropriate type

Specified by:
getRequiredServices in interface ServiceUser

needMoreServices

protected abstract boolean needMoreServices()
check if all required services where assigned to the plugin.

Returns:
true if they were.

createPdf

protected abstract PDF createPdf(long timeout)
calculate the current PDF.


freeRessources

protected abstract void freeRessources()
prepare to get deleted, so free all aquired ressource


run

public void run()
private

Specified by:
run in interface java.lang.Runnable