things.thinger.kernel.basic
Class KernalBasic_THINGProcessWrapper

java.lang.Object
  extended by java.lang.Thread
      extended by things.thinger.kernel.ThingsProcess
          extended by things.thinger.kernel.basic.KernalBasic_THINGProcessWrapper
All Implemented Interfaces:
java.lang.Runnable, Verbose, ExpressionInterface, ControlInterface, ProcessInterface, ResourceListener

public class KernalBasic_THINGProcessWrapper
extends ThingsProcess
implements ExpressionInterface

Things Process wrapper for THINGs. Act as the default expression interface.

Version:
1.0

Version History

EPG - Initial - 5 JUN 07
 
Author:
Erich P. Gatejen

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class things.thinger.kernel.ThingsProcess
DEFAULT_NAME, internalResult, myPostLogger, ssi
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
KernalBasic_THINGProcessWrapper(java.lang.Class<THING> thingClass, ExpressionInterface parentEi)
          Set the THING name.
 
Method Summary
 void constructThingsProcess()
          Complete construction.
 void destructThingsProcess()
          Destroy.
 void executeThingsProcess()
          This is the entry point for the actual processing
 void expressResult(RESULT theResult)
          Express a RESULT.
 WhoAmI getListenerId()
          Get the ID of the listener.
 java.lang.String getProcessName()
          Get process name.
 RESULT getResult()
          Get the latest result.
 void resourceRevocation(WhoAmI resourceID)
          The identified resource is in the process of being revoked.
 void resourceRevoked(WhoAmI resourceID)
          The identified resource bas been revoked.
 
Methods inherited from class things.thinger.kernel.ThingsProcess
acceptHalt, acceptPause, finalize, fix, forceFinalize, forceHalt, getCurrentState, getCurrentStateNumeric, getProcessId, getStartTime, getThingsState, init, isVerbose, release, releasePause, requestHalt, requestPause, run, screech, verboseOff, verboseOn
 
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, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KernalBasic_THINGProcessWrapper

public KernalBasic_THINGProcessWrapper(java.lang.Class<THING> thingClass,
                                       ExpressionInterface parentEi)
Set the THING name. It must have a name. This implementation will use the class name as the name until the underlying THING object is created.

Parameters:
thingClass - the loaded class to use.
parentEi - the expression interface. It can be a parent. If set to null, the wrapper will provide a expression into the system log.
Method Detail

getResult

public RESULT getResult()
                 throws ThingsException
Get the latest result. Overrides the basic implementation in the ThingsProcess.

Specified by:
getResult in interface ProcessInterface
Overrides:
getResult in class ThingsProcess
Returns:
the latest or the last result for the thread. It is completely up to the implementation how to implement this.
Throws:
ThingsException - for whatever reason. It may come from the THING itself.

executeThingsProcess

public void executeThingsProcess()
                          throws SystemException,
                                 java.lang.InterruptedException
This is the entry point for the actual processing

Specified by:
executeThingsProcess in class ThingsProcess
Throws:
SystemException
java.lang.InterruptedException

constructThingsProcess

public void constructThingsProcess()
                            throws SystemException
Complete construction. This will be called when the process is initialized.

Specified by:
constructThingsProcess in class ThingsProcess
Throws:
SystemException

destructThingsProcess

public void destructThingsProcess()
                           throws SystemException
Destroy. This will be called when the Process is finalizing.

Specified by:
destructThingsProcess in class ThingsProcess
Throws:
SystemException

getProcessName

public java.lang.String getProcessName()
Get process name. It does not have to be a unique ID.

Specified by:
getProcessName in interface ProcessInterface
Specified by:
getProcessName in class ThingsProcess
Returns:
the name as a String

resourceRevocation

public void resourceRevocation(WhoAmI resourceID)
                        throws SystemException,
                               java.lang.InterruptedException
The identified resource is in the process of being revoked. It is still possible for the resource listener to call the resource within the context of this thread and call.

Specified by:
resourceRevocation in interface ResourceListener
Parameters:
resourceID - the ID of the resource that is being revoked.
Throws:
SystemException
java.lang.InterruptedException
See Also:
WhoAmI

resourceRevoked

public void resourceRevoked(WhoAmI resourceID)
                     throws SystemException,
                            java.lang.InterruptedException
The identified resource bas been revoked. It is gone. Attempting to call it would be a very bad thing. The listener should remove the resource from it's internal lists..

Specified by:
resourceRevoked in interface ResourceListener
Parameters:
resourceID - the ID of the resource that has been revoked.
Throws:
SystemException
java.lang.InterruptedException
See Also:
WhoAmI

getListenerId

public WhoAmI getListenerId()
Get the ID of the listener.

Specified by:
getListenerId in interface ResourceListener
Returns:
The listener's ID.
See Also:
WhoAmI

expressResult

public void expressResult(RESULT theResult)
                   throws SystemException
Express a RESULT. Reliablility is up to the kernel; you will not get a receipt.

Specified by:
expressResult in interface ExpressionInterface
Parameters:
theResult - The result to express.
Throws:
SystemException
See Also:
RESULT


Things.