com.sag.osami.api.context
Interface IContextHandler

All Known Subinterfaces:
ISerializedContextHandler
All Known Implementing Classes:
ContextStoreUI, SortedRecordingData

public interface IContextHandler

This interface is the central extension point of systems dealing with context events.

Conceptually every component which processes or generates new context events has to implement this interface and register itself in the ContextStore (e.g. by IContextStore.registerHandler(IContextHandler)).

Then, receiving events is accomplished through the handleContextEvent(ContextEvent) method, whereas creating new context events is achieved by calling IContextStore.newContextEvent(String, String, Object, java.util.Date).

OSGi notice: In OSGi environments, all IContextHandlers which are registered in the service registry will be automatically registered in the ContextStore as well.


Method Summary
 java.lang.String[] getDefaultContextTypes()
          This method is necessary for the ContextStore service tracking mechanism which tracks all registered IContextHandlers: the returned string array should contain the types of the context events which this handler should receive after (OSGi service) registering.
 void handleContextEvent(ContextEvent context)
          This method processes received context events.
 void setContextStore(IContextStore contextStore)
          This method is necessary for the ContextStore service tracking mechanism which tracks all registered IContextHandlers: by passing the reference to the context store as a parameter, the handler obtains access to the context store (and should store the reference as a local member variable for further use)
 

Method Detail

getDefaultContextTypes

java.lang.String[] getDefaultContextTypes()
This method is necessary for the ContextStore service tracking mechanism which tracks all registered IContextHandlers: the returned string array should contain the types of the context events which this handler should receive after (OSGi service) registering.

However, the types handled by a context handler may be modified during runtime, e.g. by using IContextStore.registerHandlerForContextType(IContextHandler, String).

If the handler acts as a producer only, a null-returning dummy implementation suffices.


setContextStore

void setContextStore(IContextStore contextStore)
This method is necessary for the ContextStore service tracking mechanism which tracks all registered IContextHandlers: by passing the reference to the context store as a parameter, the handler obtains access to the context store (and should store the reference as a local member variable for further use)

Parameters:
contextStore - the context store

handleContextEvent

void handleContextEvent(ContextEvent context)
This method processes received context events. If the handler acts as a producer only, an empty dummy implementation suffices.

Since version 1.1.0, the handling logic of context handlers (i.e. this method) is executed in separate context handling worker threads, thereby decoupling the handling execution time from the rest of the system. Hence, it is not necessary (and not advisable) to implement own threading in this method.

Parameters:
context - the context event to be handled