Package javax.enterprise.context.spi

Examples of javax.enterprise.context.spi.Context


                }
            }
            else // normal scope 
            {
                // The EjbBeanProxyHandler may not have actually obtained an EJB for this normal-scope Bean.
                Context webbeansContext = BeanManagerImpl.getManager().getContext(this.getScope());
                Object ejbInstance = webbeansContext.get(this);
                if (ejbInstance != null)
                {
                    destroyStatefulSessionBeanInstance(instance, ejbInstance);
                }
            }
View Full Code Here


    {
        if(OpenWebBeansConfiguration.getInstance().isUseJSF2Extensions())
        {
            try
            {
                Context context = (Context)ClassUtil.getClassFromName("org.apache.webbeans.jsf.scopes.ViewScopedContext").newInstance();
                afterBeanDiscovery.addContext(context);  
               
            }
            catch(Exception e)
            {
View Full Code Here

    private Context lazyStartSessionContext()
    {

        logger.debug(">lazyStartSessionContext");

        Context webContext = null;
        Context context = getCurrentContext(RequestScoped.class);
        if (context instanceof ServletRequestContext)
        {
            ServletRequestContext requestContext = (ServletRequestContext) context;
            HttpServletRequest servletRequest = requestContext.getServletRequest();
            if (null != servletRequest)
View Full Code Here

            }
            else
            {
                BeanManagerImpl manager = BeanManagerImpl.getManager();
                specializedComponent = (AbstractOwbBean<Object>)WebBeansUtil.getMostSpecializedBean(manager, baseComponent);       
                Context context = null;
                try
                {
                    context = manager.getContext(specializedComponent.getScope());
                }
                catch (ContextNotActiveException cnae)
                {
                    // this may happen if we try to e.g. send an event to a @ConversationScoped bean from a ServletListener
                    logger.info(OWBLogConst.INFO_0010, bean);
                    return;
                }
               
                creationalContext = manager.createCreationalContext(specializedComponent);
               
                // on Reception.IF_EXISTS: ignore this bean if a the contextual instance doesn't already exist
                if (ifExist && context.get(specializedComponent) == null)
                {
                    return;
                }
               
                // on Reception.ALWAYS we must get a contextual reference if we didn't find the contextual instance
View Full Code Here

   
    private void initiateBeanBag(OwbBean<Object> bean, CreationalContext<Object> creationalContext)
    {
        try
        {
            Context webbeansContext = getBeanManager().getContext(bean.getScope());
            if (webbeansContext instanceof AbstractContext)
            {
                AbstractContext owbContext = (AbstractContext)webbeansContext;
                owbContext.initContextualBag(bean, creationalContext);
            }           
View Full Code Here

    protected Object getContextualInstance()
    {
        Object webbeansInstance = null;

        //Context of the bean
        Context webbeansContext = getBeanManager().getContext(this.bean.getScope());
       
        //Already saved in context?
        webbeansInstance = webbeansContext.get(this.bean);
        if (webbeansInstance != null)
        {
            // voila, we are finished if we found an existing contextual instance
            return webbeansInstance;
        }

        // finally, we create a new contextual instance
        webbeansInstance = webbeansContext.get((Contextual<Object>)this.bean, getContextualCreationalContext());

        if (webbeansInstance == null)
        {
            throw new UnproxyableResolutionException("Cannot find a contextual instance of bean " + bean.toString());
        }
View Full Code Here

    {
        CreationalContext<Object> creationalContext = null;
       
        OwbBean<Object> contextual = (OwbBean<Object>)this.bean;
        //Context of the bean
        Context webbeansContext = getBeanManager().getContext(bean.getScope());
        if (webbeansContext instanceof AbstractContext)
        {
            AbstractContext owbContext = (AbstractContext)webbeansContext;
            creationalContext = owbContext.getCreationalContext(contextual);
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
    {
        Context context = null;
        ContextsService contextService = getContextsService();
        switch (type.getCardinal())
        {
            case 0:
                context = contextService.getCurrentContext(RequestScoped.class);
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)
    {
        Context context = null;

        if (scopeType.equals(RequestScoped.class))
        {
            context = getStandardContext(ContextTypes.REQUEST);
        }
View Full Code Here

   
    @SuppressWarnings("unchecked")
    protected T createInstance(CreationalContext<T> creationalContext)
    {
        Context context = BeanManagerImpl.getManager().getContext(getScope());
        Object actualInstance = context.get((Bean<Object>)this.delegateBean, (CreationalContext<Object>)creationalContext);
        T proxy = (T)JavassistProxyFactory.createDependentScopedBeanProxy(this.delegateBean, actualInstance, creationalContext);
       
        return proxy;
    }
View Full Code Here

TOP

Related Classes of javax.enterprise.context.spi.Context

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.