org.datamanager.tools.kernelproxy
Class InterfaceWorker

java.lang.Object
  |
  +--org.datamanager.kernel.Simpleton
        |
        +--org.datamanager.tools.kernelproxy.InterfaceWorker
Direct Known Subclasses:
AddEntityWorker, AddEventWorker, AttachEntityWorker, CreateAttributeWorker, CreateEntityWorker, DetachEntityWorker, GetAttributesWorker, GetBasesWorker, GetEntityValueWorker, GetNameWorker, RemoveEntityWorker, SearchWorker, SetEntityValueWorker, SubscriptionWorker

public abstract class InterfaceWorker
extends Simpleton

An abstract class that can be used to interact with the kernel. An InterfaceWorker is a Simpleton (so it has a kernel thread) that can cause events in the kernel. Essentially, a new InterfaceWorker is created. Its contents must be registered by the user, so that the thread is run. The results of the operation be then be retrieved through a get() method call. example: AddEntityWorker worker = new AddEntityWorker(entity); registerWorker(worker); Object value = worker.get();

Author:
Gordon Murphy, gpmurphy@indiana.edu
, Bryan Dawson, bdawson@indiana.edu
See Also:
Simpleton, KernelProxy

Nested Class Summary
 
Nested classes inherited from class org.datamanager.kernel.Simpleton
Simpleton.Information, Simpleton.Priority
 
Constructor Summary
InterfaceWorker()
          Starts a thread that will call the construct method and then exit.
 
Method Summary
protected abstract  Object construct()
          Computes the value to be returned by the get method.
 Object get()
          Returns the value created by the construct method.
 Simpleton.Information getInformation()
          Reports Simpleton.Information about this Simpleton.
protected  Object getValue()
          Gets the value produced by the worker thread, or null if it hasn't been constructed yet.
 void process()
          Calls construct() in the subclasses.
 
Methods inherited from class org.datamanager.kernel.Simpleton
clone, getPriority, setInformation, setPriority, start
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InterfaceWorker

public InterfaceWorker()
Starts a thread that will call the construct method and then exit.

Method Detail

getValue

protected Object getValue()
Gets the value produced by the worker thread, or null if it hasn't been constructed yet.


construct

protected abstract Object construct()
                             throws DataManagerException
Computes the value to be returned by the get method.

DataManagerException

get

public Object get()
Returns the value created by the construct method. Returns null if either the constructing thread or the current thread was interrupted before a value was produced.


process

public void process()
Calls construct() in the subclasses.

Specified by:
process in class Simpleton

getInformation

public Simpleton.Information getInformation()
Description copied from class: Simpleton
Reports Simpleton.Information about this Simpleton.

Overrides:
getInformation in class Simpleton


See the Helium Website