|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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 IContextHandler s: 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 IContextHandler s: 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 |
---|
java.lang.String[] getDefaultContextTypes()
IContextHandler
s: 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.
void setContextStore(IContextStore contextStore)
IContextHandler
s: 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)
contextStore
- the context storevoid handleContextEvent(ContextEvent context)
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.
context
- the context event to be handled
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |