Search in sources :

Example 1 with SessionEvent

use of org.eclipse.scout.rt.shared.session.SessionEvent in project scout.rt by eclipse.

the class AbstractObservableNotificationHandlerTest method testSessionStopped.

@Test
public void testSessionStopped() {
    final AbstractObservableNotificationHandler<Serializable> testHandler = createGlobalHandler();
    @SuppressWarnings("unchecked") INotificationListener<Serializable> l1 = mock(INotificationListener.class);
    testHandler.addListener(m_testSession1, l1);
    SessionEvent sessionStopEvent = new SessionEvent(m_testSession1, SessionEvent.TYPE_STOPPED);
    testHandler.sessionChanged(sessionStopEvent);
    assertEquals(0, testHandler.getListeners(m_testSession1).size());
}
Also used : Serializable(java.io.Serializable) SessionEvent(org.eclipse.scout.rt.shared.session.SessionEvent) Test(org.junit.Test)

Example 2 with SessionEvent

use of org.eclipse.scout.rt.shared.session.SessionEvent in project scout.rt by eclipse.

the class AbstractClientSession method start.

@Override
public void start(String sessionId) {
    Assertions.assertFalse(m_stopping, "Session cannot be started again");
    Assertions.assertNotNull(sessionId, "Session id must not be null");
    if (isActive()) {
        throw new IllegalStateException("session is active");
    }
    m_id = sessionId;
    interceptLoadSession();
    setActive(true);
    fireSessionChangedEvent(new SessionEvent(this, SessionEvent.TYPE_STARTED));
    LOG.info("Client session started [session={}, user={}]", this, getUserId());
}
Also used : SessionEvent(org.eclipse.scout.rt.shared.session.SessionEvent)

Example 3 with SessionEvent

use of org.eclipse.scout.rt.shared.session.SessionEvent in project scout.rt by eclipse.

the class AbstractClientSession method inactivateSession.

protected void inactivateSession() {
    try {
        ILogoutService logoutService = BEANS.opt(ILogoutService.class);
        if (logoutService != null) {
            logoutService.logout();
        }
    } finally {
        setActive(false);
        fireSessionChangedEvent(new SessionEvent(this, SessionEvent.TYPE_STOPPED));
        LOG.info("Client session stopped [session={}, user={}]", this, getUserId());
    }
}
Also used : ILogoutService(org.eclipse.scout.rt.shared.services.common.security.ILogoutService) SessionEvent(org.eclipse.scout.rt.shared.session.SessionEvent)

Example 4 with SessionEvent

use of org.eclipse.scout.rt.shared.session.SessionEvent in project scout.rt by eclipse.

the class AbstractServerSession method stop.

@Override
public void stop() {
    fireSessionChangedEvent(new SessionEvent(this, SessionEvent.TYPE_STOPPING));
    m_active = false;
    fireSessionChangedEvent(new SessionEvent(this, SessionEvent.TYPE_STOPPED));
    // Cancel globally registered RunMonitors of this session.
    BEANS.get(RunMonitorCancelRegistry.class).cancelAllBySessionId(getId());
    // Cancel running jobs of this session.
    Jobs.getJobManager().cancel(Jobs.newFutureFilterBuilder().andMatch(new SessionFutureFilter(this)).andMatchNotFuture(IFuture.CURRENT.get()).toFilter(), true);
    LOG.info("Server session stopped [session={}, user={}]", this, getUserId());
}
Also used : SessionEvent(org.eclipse.scout.rt.shared.session.SessionEvent) SessionFutureFilter(org.eclipse.scout.rt.shared.job.filter.future.SessionFutureFilter) RunMonitorCancelRegistry(org.eclipse.scout.rt.server.context.RunMonitorCancelRegistry)

Example 5 with SessionEvent

use of org.eclipse.scout.rt.shared.session.SessionEvent in project scout.rt by eclipse.

the class AbstractServerSession method start.

@Override
public final void start(String sessionId) {
    Assertions.assertNotNull(sessionId, "Session id must not be null");
    m_id = sessionId;
    Assertions.assertFalse(isActive(), "Session already started");
    assignUserId();
    interceptLoadSession();
    m_active = true;
    fireSessionChangedEvent(new SessionEvent(this, SessionEvent.TYPE_STARTED));
    LOG.info("Server session started [session={}, user={}]", this, getUserId());
}
Also used : SessionEvent(org.eclipse.scout.rt.shared.session.SessionEvent)

Aggregations

SessionEvent (org.eclipse.scout.rt.shared.session.SessionEvent)6 Serializable (java.io.Serializable)1 URISyntaxException (java.net.URISyntaxException)1 PlatformError (org.eclipse.scout.rt.platform.exception.PlatformError)1 ProcessingException (org.eclipse.scout.rt.platform.exception.ProcessingException)1 RunMonitorCancelRegistry (org.eclipse.scout.rt.server.context.RunMonitorCancelRegistry)1 SessionFutureFilter (org.eclipse.scout.rt.shared.job.filter.future.SessionFutureFilter)1 ILogoutService (org.eclipse.scout.rt.shared.services.common.security.ILogoutService)1 Test (org.junit.Test)1