Package org.apache.webbeans.spi

Examples of org.apache.webbeans.spi.ContextsService


        }
    }

    public static void destroyConversationContext()
    {
        ContextsService contextService = getContextsService();
        contextService.endContext(ConversationScoped.class, null);
    }
View Full Code Here


     * @throws ContextNotActiveException if context is not active
     * @throws IllegalArgumentException if the type is not a standard context
     */
    public static Context getStandardContext(ContextTypes type) throws ContextNotActiveException
    {
        ContextsService contextService = getContextsService();
        return getStandardContext(contextService, type);
    }
View Full Code Here

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

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

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

    /**
     * Deactivate context.
     */
    public static void deActivateContext(Class<? extends Annotation> scopeType)
    {
        ContextsService contextService = getContextsService();
        contextService.deActivateContext(scopeType);
    }
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

     * @return the ContextService for the current ClassLoader
     */
    private static ContextsService getContextsService()
    {
        ClassLoader cl = WebBeansUtil.getCurrentClassLoader();
        ContextsService cs = contextServices.get(cl);
        if (cs == null)
        {
            cs = ServiceLoader.getService(ContextsService.class);
            contextServices.put(cl, cs);
        }
View Full Code Here

   
    public static void initRequestContext(Object request)
    {
        try
        {
            ContextsService contextService = getContextsService();
            contextService.startContext(RequestScoped.class, request);
        }
        catch (Exception e)
        {
            logger.error(e);
        }
View Full Code Here

        return new CustomContextImpl(context);
    }
   
    public static void destroyRequestContext(Object request)
    {
        ContextsService contextService = getContextsService();
        contextService.endContext(RequestScoped.class, request);
    }
View Full Code Here

    public static void initSessionContext(Object session)
    {
        try
        {
            ContextsService contextService = getContextsService();
            contextService.startContext(SessionScoped.class, session);
        }
        catch (Exception e)
        {
            logger.error(e);
        }
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.