|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sag.osami.context.recorder.storage.SortedRecordingData
public class SortedRecordingData
This class is used as an intermediate target for recorded context events. This is necessary due to the fact that context events may be "handled" (and
therefore recorded) in non-chronological order (depending on the thread scheduling of the context handler worker threads), while chronological order is
preferable when replaying a recording. Therefore, this class maintains some additional sorting information and is able to rewrite the recording into a
RecordingContainer
in the correct order efficiently.
Objects of this class are intended to be used once and then thrown away (upon rewriting to a container). In particular, (re)starting a recording after rewriting will fail.
This class does all of the necessary context handler (de)registering.
Constructor Summary | |
---|---|
SortedRecordingData(IContextStore ctxStore)
|
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. |
int |
getEventsCount()
|
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) |
void |
startRecording()
|
void |
stopRecording()
|
void |
writeToContainer(java.io.OutputStream target)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SortedRecordingData(IContextStore ctxStore) throws java.io.IOException
java.io.IOException
Method Detail |
---|
public java.lang.String[] getDefaultContextTypes()
IContextHandler
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.
getDefaultContextTypes
in interface IContextHandler
public void setContextStore(IContextStore contextStore)
IContextHandler
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)
setContextStore
in interface IContextHandler
contextStore
- the context storepublic void handleContextEvent(ContextEvent context)
IContextHandler
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.
handleContextEvent
in interface IContextHandler
context
- the context event to be handledpublic void startRecording()
public void stopRecording()
public int getEventsCount()
public void writeToContainer(java.io.OutputStream target) throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |