org.isam.exehda.services.ctxm
Class CtxManagerImplNode

java.lang.Object
  |
  +--org.isam.exehda.services.AbstractService
        |
        +--org.isam.exehda.services.ctxm.CtxManagerImplNode
All Implemented Interfaces:
Collector.MonitoringConsumer, ContextManager, java.lang.Runnable, Service

public class CtxManagerImplNode
extends AbstractService
implements ContextManager, Collector.MonitoringConsumer, java.lang.Runnable


Nested Class Summary
 
Nested classes inherited from class org.isam.exehda.services.ContextManager
ContextManager.Context, ContextManager.ContextListener, ContextManager.ContextState
 
Field Summary
 
Fields inherited from interface org.isam.exehda.services.ContextManager
SERVICE_NAME
 
Constructor Summary
CtxManagerImplNode()
           
 
Method Summary
 void addContextListener(ContextManager.ContextListener l, ContextManager.Context ctx)
          Registers a listener for events on the given context element.
 ContextManager.Context createContext(java.lang.String xmlDesc)
          Creates/registers a new context element.
 void releaseContext(ContextManager.Context ctx)
          Notifies the ContextManager that the given context element is not needed anymore.
 void removeContextListener(ContextManager.ContextListener l, ContextManager.Context ctx)
          Removes a previously registered context listener.
 void run()
          ContextManager's main thread.
 void start()
           
 void stop()
           
 void update(long timeStamp, Collector.MonitoringData[] data)
          Callback for monitoring data (from MonitoringConsumer interface.
 
Methods inherited from class org.isam.exehda.services.AbstractService
log, log, log, log, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CtxManagerImplNode

public CtxManagerImplNode()
Method Detail

start

public void start()
Specified by:
start in interface Service

stop

public void stop()
Specified by:
stop in interface Service

createContext

public ContextManager.Context createContext(java.lang.String xmlDesc)
Description copied from interface: ContextManager
Creates/registers a new context element. The context manager is responsible for allocating resources and enabling the necessary sensor to produce that context information. Sample context definition:

           <context n="context1">
             <states>
               <state n="stt1"/>
               <state n="stt2"/>
               <state n="stt3"/>
             </states>

             <index>
               <switch>
                  <sensor n="s1" scale="10.0"/>
                  <sensor n="s2" scale="3.3" />
                  <composite type="sum">
                     <sensor n="s1" scale="10.0"/>
                     <sensor n="s2" scale="3.3" />
                  </composite>
               </switch>
             </index>

             <ranges>
               <range ub="-1" state="stt1"/>
               <range lb="-1" ub="1" state="stt2"/>
               <range lb="1" state="stt3"/>
               <default state="stt1"/>
             </ranges>
           </context>
           
 

Specified by:
createContext in interface ContextManager
Parameters:
xmlDesc - a String value
Returns:
a Context value

releaseContext

public void releaseContext(ContextManager.Context ctx)
Description copied from interface: ContextManager
Notifies the ContextManager that the given context element is not needed anymore. The ContextManager is allowed to release resources used to produce that context information.

Specified by:
releaseContext in interface ContextManager
Parameters:
ctx - a Context value

addContextListener

public void addContextListener(ContextManager.ContextListener l,
                               ContextManager.Context ctx)
Description copied from interface: ContextManager
Registers a listener for events on the given context element.

Specified by:
addContextListener in interface ContextManager
Parameters:
l - the call back
ctx - the context element of interest

removeContextListener

public void removeContextListener(ContextManager.ContextListener l,
                                  ContextManager.Context ctx)
Description copied from interface: ContextManager
Removes a previously registered context listener.

Specified by:
removeContextListener in interface ContextManager
Parameters:
l - a ContextListener value
ctx - a Context value

update

public void update(long timeStamp,
                   Collector.MonitoringData[] data)
Callback for monitoring data (from MonitoringConsumer interface.

Specified by:
update in interface Collector.MonitoringConsumer
Parameters:
timeStamp - a long value
data - a MonitoringData[] value

run

public void run()
ContextManager's main thread.

Specified by:
run in interface java.lang.Runnable