Search in sources :

Example 1 with ContextsService

use of org.apache.webbeans.spi.ContextsService in project deltaspike by apache.

the class OpenWebBeansContextControl method startSessionScope.

private void startSessionScope() {
    ContextsService contextsService = getContextsService();
    Object mockSession = null;
    if (isServletApiAvailable()) {
        mockSession = mockSessions.get();
        if (mockSession == null) {
            // we simply use the ThreadName as 'sessionId'
            mockSession = OwbHelper.getMockSession(Thread.currentThread().getName());
            mockSessions.set(mockSession);
        }
    }
    contextsService.startContext(SessionScoped.class, mockSession);
}
Also used : ContextsService(org.apache.webbeans.spi.ContextsService)

Example 2 with ContextsService

use of org.apache.webbeans.spi.ContextsService in project deltaspike by apache.

the class OpenWebBeansContextControl method startApplicationScope.

private void startApplicationScope() {
    ContextsService contextsService = getContextsService();
    Object mockServletContext = null;
    if (isServletApiAvailable()) {
        mockServletContext = OwbHelper.getMockServletContext();
    }
    contextsService.startContext(ApplicationScoped.class, mockServletContext);
}
Also used : ContextsService(org.apache.webbeans.spi.ContextsService)

Example 3 with ContextsService

use of org.apache.webbeans.spi.ContextsService in project deltaspike by apache.

the class OpenWebBeansContextControl method startRequestScope.

private void startRequestScope() {
    ContextsService contextsService = getContextsService();
    contextsService.startContext(RequestScoped.class, null);
}
Also used : ContextsService(org.apache.webbeans.spi.ContextsService)

Example 4 with ContextsService

use of org.apache.webbeans.spi.ContextsService in project deltaspike by apache.

the class OpenWebBeansContextControl method stopSingletonScope.

/*
     * stop scopes
     */
private void stopSingletonScope() {
    ContextsService contextsService = getContextsService();
    Object mockServletContext = null;
    if (isServletApiAvailable()) {
        mockServletContext = OwbHelper.getMockServletContext();
    }
    contextsService.endContext(Singleton.class, mockServletContext);
}
Also used : ContextsService(org.apache.webbeans.spi.ContextsService)

Example 5 with ContextsService

use of org.apache.webbeans.spi.ContextsService in project deltaspike by apache.

the class OpenWebBeansContextControl method stopRequestScope.

private void stopRequestScope() {
    ContextsService contextsService = getContextsService();
    contextsService.endContext(RequestScoped.class, null);
}
Also used : ContextsService(org.apache.webbeans.spi.ContextsService)

Aggregations

ContextsService (org.apache.webbeans.spi.ContextsService)19 RequestScoped (javax.enterprise.context.RequestScoped)4 WebBeansContext (org.apache.webbeans.config.WebBeansContext)4 Test (org.junit.Test)4 AppContext (org.apache.openejb.AppContext)3 BeanContext (org.apache.openejb.BeanContext)3 IOException (java.io.IOException)2 CountDownLatch (java.util.concurrent.CountDownLatch)2 AtomicReference (java.util.concurrent.atomic.AtomicReference)2 SessionScoped (javax.enterprise.context.SessionScoped)2 Context (javax.enterprise.context.spi.Context)2 JMSContext (javax.jms.JMSContext)2 JMSRuntimeException (javax.jms.JMSRuntimeException)2 Context (javax.naming.Context)2 InitialContext (javax.naming.InitialContext)2 NamingException (javax.naming.NamingException)2 OpenEJBException (org.apache.openejb.OpenEJBException)2 OpenEJBRuntimeException (org.apache.openejb.OpenEJBRuntimeException)2 WebContext (org.apache.openejb.core.WebContext)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1