org.isam.exehda.services
Interface ContextManager

All Known Implementing Classes:
CtxManagerImplNode

public interface ContextManager

Context Recognition Service. The ContextManager takes as input a context definition in XML. It then proceeds registering itself within the Collector service and accomplishing any necessary sensor parameter configuration. The raw-level data gathered from the collector's sensors is then filtered in order to produce high-level context information. The whole application execution context is built up from a a set of context elements (Context objects) and its associated states (ContextState objects).

Version:
$Date: 2004/12/31 21:18:31 $ $Revision: 1.3 $
Author:
last modified by $Author: lucc $
To do:
describe the context definition language

Nested Class Summary
static class ContextManager.Context
          Represents a context element.
static interface ContextManager.ContextListener
          Call-back interface for receiving context element change events.
static class ContextManager.ContextState
          Describes a context element's state.
 
Field Summary
static java.lang.String SERVICE_NAME
           
 
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.
 

Field Detail

SERVICE_NAME

public static final java.lang.String SERVICE_NAME
See Also:
Constant Field Values
Method Detail

createContext

public ContextManager.Context createContext(java.lang.String xmlDesc)
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>
           
 

Parameters:
xmlDesc - a String value
Returns:
a Context value

releaseContext

public void releaseContext(ContextManager.Context ctx)
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.

Parameters:
ctx - a Context value

addContextListener

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

Parameters:
l - the call back
ctx - the context element of interest

removeContextListener

public void removeContextListener(ContextManager.ContextListener l,
                                  ContextManager.Context ctx)
Removes a previously registered context listener.

Parameters:
l - a ContextListener value
ctx - a Context value