Package org.apache.webbeans.spi

Examples of org.apache.webbeans.spi.ContextsService


     *
     * @return the current context, or <code>null</code> if no standard context exists for the given scopeType
     */
    public Context getStandardContext(Class<? extends Annotation> scopeType)
    {
        ContextsService contextService = getContextsService();

        return contextService.getCurrentContext(scopeType);
    }
View Full Code Here


    /**
     * Activate context.
     */
    public void activateContext(Class<? extends Annotation> scopeType)
    {
        ContextsService contextService = getContextsService();
        contextService.activateContext(scopeType);
    }
View Full Code Here

    /**
     * Deactivate context.
     */
    public void deActivateContext(Class<? extends Annotation> scopeType)
    {
        ContextsService contextService = getContextsService();
        contextService.deActivateContext(scopeType);
    }
View Full Code Here

            //Transient, so we need to look this up again during restore.
            webBeansContext = WebBeansContext.getInstance();
           
            if (sessionContext != null)
            {
                ContextsService contextsService = webBeansContext.getContextsService();
                contextsService.activateContext(SessionScoped.class);
            }
            if (conversationContextMap != null && !conversationContextMap.isEmpty())
            {
                ConversationManager conversationManager = webBeansContext.getConversationManager();
                java.util.Iterator<Conversation> it = conversationContextMap.keySet().iterator();
View Full Code Here

     * @param scopeType scope type
     * @return true if also creates context.
     */
    private int activateContexts(Class<? extends Annotation> scopeType)
    {
        ContextsService service = ServiceLoader.getService(ContextsService.class);
        Context ctx = service.getCurrentContext(scopeType);
       
        if(scopeType == RequestScoped.class)
        {
            if(ctx != null && !ctx.isActive())
            {
                ContextFactory.activateContext(scopeType);
                return 0;
            }
            else if(ctx == null)
            {
                ContextFactory.initRequestContext(null);
                return 1;
            }
           
        }
       
        ctx = service.getCurrentContext(scopeType);
        if(ctx != null && !ctx.isActive())
        {
            ContextFactory.activateContext(scopeType);
            return 0;
        }
View Full Code Here

        final WebBeansContext webBeansContext = beanContext.getModuleContext().getAppContext().getWebBeansContext();
        if (webBeansContext == null) {
            return;
        }

        final ContextsService contextsService = webBeansContext.getContextsService();

        final Context requestContext = contextsService.getCurrentContext(RequestScoped.class);

        if (requestContext == null) {
            contextsService.startContext(RequestScoped.class, null);
            newContext.set(DestroyContext.class, new DestroyContext(contextsService, newContext));
        }
    }
View Full Code Here

    }

    public void after() throws Exception {
        if (assembler != null) {
            final ContextsService contextsService = appContext.getWebBeansContext().getContextsService();
            contextsService.endContext(SessionScoped.class, session);
            contextsService.endContext(RequestScoped.class, null);
            contextsService.endContext(ConversationScoped.class, null);

            try {
                assembler.destroyApplication(appInfo.path);
            } catch (Exception e) {
                // no-op
View Full Code Here

            context.remove();
        } else if (Context.CHANGE_SESSION_ID_EVENT.endsWith(event.getType())) {
            final String[] ids = (String[]) event.getData();

            final WebBeansContext wbc = WebBeansContext.currentInstance();
            final ContextsService cs = wbc.getContextsService();
            if (CdiAppContextsService.class.isInstance(cs) && ids.length > 0) {
                ((CdiAppContextsService) cs).updateSessionIdMapping(ids[0], ids[1]);
            }
        }
    }
View Full Code Here

    @Override
    public void startContexts() throws Exception
    {
        logger.log(Level.FINE, "starting all OWB Contexts");
        WebBeansContext webBeansContext = WebBeansContext.currentInstance();
        ContextsService contextsService = webBeansContext.getContextsService();

        contextsService.startContext(Singleton.class, servletContext);
        contextsService.startContext(ApplicationScoped.class, servletContext);
        contextsService.startContext(SessionScoped.class, session);
        contextsService.startContext(ConversationScoped.class, null);
        contextsService.startContext(RequestScoped.class, null);
    }
View Full Code Here

    @Override
    public void startApplicationScope() throws Exception
    {
        logger.log(Level.FINE, "starting the OWB ApplicationContext");
        WebBeansContext webBeansContext = WebBeansContext.currentInstance();
        ContextsService contextsService = webBeansContext.getContextsService();

        contextsService.startContext(ApplicationScoped.class, servletContext);
    }
View Full Code Here

TOP

Related Classes of org.apache.webbeans.spi.ContextsService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.