Package org.apache.webbeans.conversation

Examples of org.apache.webbeans.conversation.ConversationManager


            if(!JSFUtil.isOwbApplication())
            {
                return;
            }
           
            ConversationManager conversationManager = ConversationManager.getInstance();
            Conversation conversation = conversationManager.getConversationBeanReference();

            if (conversation.isTransient())
            {
                logger.debug("Destroying the conversation context with cid : [{0}]", conversation.getId());
                ContextFactory.destroyConversationContext();                                                   
View Full Code Here


        if (phaseEvent.getPhaseId().equals(PhaseId.RESTORE_VIEW) && JSFUtil.isOwbApplication())
        {
            //It looks for cid parameter in the JSF request.
            //If request contains cid, then it must restore conversation
            //Otherwise create NonexistentException
            ConversationManager conversationManager = ConversationManager.getInstance();
            Conversation conversation = conversationManager.getConversationBeanReference();
            String cid = JSFUtil.getConversationId();

            if (conversation.isTransient())
            {
                logger.debug("Creating a new transitional conversation with cid : [{0}]", conversation.getId());
                ContextFactory.initConversationContext(null);

                //Not restore, throw exception
                if(cid != null && !cid.equals(""))
                {
                    throw new NonexistentConversationException("Propogated conversation with cid=" + cid + " is not restored. It creates a new transient conversation.");
                }
            }
            else
            {
                logger.debug("Restoring conversation with cid : [{0}]", conversation.getId());

                //Conversation must be used by one thread at a time
                ConversationImpl owbConversation = (ConversationImpl)conversation;
                if(!owbConversation.getInUsed().compareAndSet(false, true))
                {
                    ContextFactory.initConversationContext(null);
                    //Throw Busy exception
                    throw new BusyConversationException("Propogated conversation with cid=" + cid + " is used by other request. It creates a new transient conversation");
                }
                else
                {
                    ConversationContext conversationContext = conversationManager.getConversationContext(conversation);
                    ContextFactory.initConversationContext(conversationContext);
                }
            }
        }
    }
View Full Code Here

            return delegate.getActionURL(context, viewId);
        }
       
        String url = delegate.getActionURL(context, viewId);

        ConversationManager conversationManager = ConversationManager.getInstance();
        Conversation conversation = conversationManager.getConversationBeanReference();
        if (conversation != null && !conversation.isTransient())
        {
            url = JSFUtil.getRedirectViewIdWithCid(url, conversation.getId());
        }
View Full Code Here

            if (queryString.contains("?cid=") || queryString.contains("&cid="))
            {
                return url;
            }
        }
        ConversationManager conversationManager = ConversationManager.getInstance();
        Conversation conversation = conversationManager.getConversationBeanReference();
        if (conversation != null && !conversation.isTransient())
        {
            url = JSFUtil.getRedirectViewIdWithCid(url, conversation.getId());
        }
        return url;
View Full Code Here

        // get the session context
        SessionContextManager sessionManager = SessionContextManager.getInstance();
        sessionContext = sessionManager.getSessionContextWithSessionId(session.getId());

        // get all conversation contexts
        ConversationManager conversationManager = ConversationManager.getInstance();
        conversationContextMap = conversationManager.getConversationMapWithSessionId(session.getId());
    }
View Full Code Here

                sessionManager.addNewSessionContext(sessionId, sessionContext);
                sessionContext.setActive(true);
            }
            if (conversationContextMap != null && !conversationContextMap.isEmpty())
            {
                ConversationManager conversationManager = ConversationManager.getInstance();
                java.util.Iterator<Conversation> it = conversationContextMap.keySet().iterator();
                while(it.hasNext())
                {
                    Conversation c = it.next();
                    ConversationContext cc = conversationContextMap.get(c);
                    conversationManager.addConversationContext(c, cc);
                }
            }
        }
        catch (Exception e)
        {
View Full Code Here

        {
            logger.debug("Destroying a session with session id : [{0}]", event.getSession().getId());
        }
        this.lifeCycle.getContextService().endContext(SessionScoped.class, event.getSession());

        ConversationManager conversationManager = ConversationManager.getInstance();
        conversationManager.destroyConversationContextWithSessionId(event.getSession().getId());
    }
View Full Code Here

            if(!JSFUtil.isOwbApplication())
            {
                return;
            }
           
            ConversationManager conversationManager = ConversationManager.getInstance();
            Conversation conversation = conversationManager.getConversationBeanReference();

            if (conversation.isTransient())
            {
                logger.debug("Destroying the conversation context with cid : [{0}]", conversation.getId());
                ContextFactory.destroyConversationContext();                                                   
View Full Code Here

        if (phaseEvent.getPhaseId().equals(PhaseId.RESTORE_VIEW) && JSFUtil.isOwbApplication())
        {
            //It looks for cid parameter in the JSF request.
            //If request contains cid, then it must restore conversation
            //Otherwise create NonexistentException
            ConversationManager conversationManager = ConversationManager.getInstance();
            Conversation conversation = conversationManager.getConversationBeanReference();
            String cid = JSFUtil.getConversationId();

            if (conversation.isTransient())
            {
                logger.debug("Creating a new transitional conversation with cid : [{0}]", conversation.getId());
                ContextFactory.initConversationContext(null);

                //Not restore, throw exception
                if(cid != null && !cid.equals(""))
                {
                    throw new NonexistentConversationException("Propogated conversation with cid=" + cid + " is not restored. It creates a new transient conversation.");
                }
            }
            else
            {
                logger.debug("Restoring conversation with cid : [{0}]", conversation.getId());

                //Conversation must be used by one thread at a time
                ConversationImpl owbConversation = (ConversationImpl)conversation;
                if(!owbConversation.getInUsed().compareAndSet(false, true))
                {
                    ContextFactory.initConversationContext(null);
                    //Throw Busy exception
                    throw new BusyConversationException("Propogated conversation with cid=" + cid + " is used by other request. It creates a new transient conversation");
                }
                else
                {
                    ConversationContext conversationContext = conversationManager.getConversationContext(conversation);
                    ContextFactory.initConversationContext(conversationContext);
                }
            }
        }
    }
View Full Code Here

        {
            logger.debug("Destroying a session with session id : [{0}]", event.getSession().getId());
        }
        this.lifeCycle.getContextService().endContext(SessionScoped.class, event.getSession());

        ConversationManager conversationManager = ConversationManager.getInstance();
        conversationManager.destroyConversationContextWithSessionId(event.getSession().getId());
    }
View Full Code Here

TOP

Related Classes of org.apache.webbeans.conversation.ConversationManager

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.