Search in sources :

Example 1 with ISessionEvent

use of org.iobserve.common.record.ISessionEvent in project iobserve-analysis by research-iobserve.

the class EntryCallSequence method execute.

@Override
protected void execute() {
    final ISessionEvent sessionEvent = this.sessionEventInputPort.receive();
    if (sessionEvent != null) {
        if (sessionEvent instanceof SessionStartEvent) {
            this.sessions.put(UserSession.createUserSessionId(sessionEvent), new UserSession(sessionEvent.getHostname(), sessionEvent.getSessionId()));
        }
        if (sessionEvent instanceof SessionEndEvent) {
            final UserSession session = this.sessions.get(UserSession.createUserSessionId(sessionEvent));
            if (session != null) {
                this.userSessionOutputPort.send(session);
                this.sessions.remove(sessionEvent.getSessionId());
            }
        }
    }
    final PayloadAwareEntryCallEvent event = this.entryCallInputPort.receive();
    if (event != null) {
        /**
         * add the event to the corresponding user session in case the user session is not yet
         * available, create one.
         */
        final String userSessionId = UserSession.createUserSessionId(event);
        UserSession userSession = this.sessions.get(userSessionId);
        if (userSession == null) {
            userSession = new UserSession(event.getHostname(), event.getSessionId());
            this.sessions.put(userSessionId, userSession);
        // TODO this should trigger a warning.
        }
        userSession.add(event, true);
    }
    this.removeExpiredSessions();
}
Also used : PayloadAwareEntryCallEvent(org.iobserve.stages.general.data.PayloadAwareEntryCallEvent) SessionStartEvent(org.iobserve.common.record.SessionStartEvent) SessionEndEvent(org.iobserve.common.record.SessionEndEvent) UserSession(org.iobserve.analysis.session.data.UserSession) ISessionEvent(org.iobserve.common.record.ISessionEvent)

Aggregations

UserSession (org.iobserve.analysis.session.data.UserSession)1 ISessionEvent (org.iobserve.common.record.ISessionEvent)1 SessionEndEvent (org.iobserve.common.record.SessionEndEvent)1 SessionStartEvent (org.iobserve.common.record.SessionStartEvent)1 PayloadAwareEntryCallEvent (org.iobserve.stages.general.data.PayloadAwareEntryCallEvent)1