Class AbstractConversationContext<R,​S>

    • Field Detail

      • CONVERSATIONS_ATTRIBUTE_NAME

        public static final String CONVERSATIONS_ATTRIBUTE_NAME
      • DESTRUCTION_QUEUE_ATTRIBUTE_NAME

        public static final String DESTRUCTION_QUEUE_ATTRIBUTE_NAME
    • Constructor Detail

      • AbstractConversationContext

        public AbstractConversationContext​(String contextId,
                                           org.jboss.weld.bootstrap.api.ServiceRegistry services)
    • Method Detail

      • setParameterName

        public void setParameterName​(String cid)
        Description copied from interface: ConversationContext
        Set the name of the parameter used to propagate the conversation id
        Specified by:
        setParameterName in interface ConversationContext
        Parameters:
        cid - the name of the conversation id parameter
      • setConcurrentAccessTimeout

        public void setConcurrentAccessTimeout​(long timeout)
        Description copied from interface: ConversationContext
        Set the concurrent access timeout
        Specified by:
        setConcurrentAccessTimeout in interface ConversationContext
        Parameters:
        timeout - the timeout (in ms) for the concurrent access lock
      • getDefaultTimeout

        public long getDefaultTimeout()
        Description copied from interface: ConversationContext
        Get the default inactivity timeout. This may have been overridden on a per conversation basis.
        Specified by:
        getDefaultTimeout in interface ConversationContext
        Returns:
        the default inactivity timeout (in ms)
      • dissociate

        public boolean dissociate​(R request)
        Description copied from interface: BoundContext
        Dissociate the context from the storage (for this thread). The context will only dissociate from the same storage it associated with.
        Specified by:
        dissociate in interface BoundContext<R>
        Overrides:
        dissociate in class AbstractBoundContext<R>
        Parameters:
        request - the external storage
        Returns:
        true if the storage was dissociated
      • copyConversationIdGeneratorAndConversationsToSession

        protected void copyConversationIdGeneratorAndConversationsToSession()
      • sessionCreated

        public void sessionCreated()
      • associateRequestWithNewConversation

        protected void associateRequestWithNewConversation()
      • activate

        public void activate​(String cid)
        Description copied from interface: ConversationContext
        Activate the conversation context, using the id provided to attempt to restore a long-running conversation
        Specified by:
        activate in interface ConversationContext
        Parameters:
        cid - if the cid is null, a transient conversation will be created, otherwise the conversation will be restored
      • initialize

        protected void initialize​(String cid)
      • conversationPromotedToLongRunning

        public void conversationPromotedToLongRunning​(ConversationImpl conversation)
      • destroy

        public boolean destroy​(S session)
      • destroyConversation

        protected void destroyConversation​(S session,
                                           String id,
                                           boolean fireEvents)
      • getConversations

        public Collection<ManagedConversation> getConversations()
        Description copied from interface: ConversationContext
        Get conversations currently known to the context. This will include any non transient conversations, as well as any conversations which were previously long running and have been made transient during this request.
        Specified by:
        getConversations in interface ConversationContext
        Returns:
        a collection containing the conversations
      • getScope

        public Class<? extends Annotation> getScope()
        Description copied from interface: Context
        Get the scope type of the context object.
        Specified by:
        getScope in interface Context
        Returns:
        the scope
      • setSessionAttribute

        protected abstract void setSessionAttribute​(R request,
                                                    String name,
                                                    Object value,
                                                    boolean create)
        Set an attribute in the session.
        Parameters:
        request - the request to set the session attribute in
        name - the name of the attribute
        value - the value of the attribute
        create - if false, the attribute will only be set if the session already exists, otherwise it will always be set
        Throws:
        IllegalStateException - if create is true, and the session can't be created
      • getSessionAttribute

        protected abstract Object getSessionAttribute​(R request,
                                                      String name,
                                                      boolean create)
        Get an attribute value from the session.
        Parameters:
        request - the request to get the session attribute from
        name - the name of the attribute
        create - if false, the attribute will only be retrieved if the session already exists, other wise it will always be retrieved
        Returns:
        attribute
        Throws:
        IllegalStateException - if create is true, and the session can't be created
      • getSessionAttributeFromSession

        protected abstract Object getSessionAttributeFromSession​(S session,
                                                                 String name)
        Get an attribute value from the session.
        Parameters:
        session - the session to get the session attribute from
        name - the name of the attribute
        Returns:
        attribute
        Throws:
        IllegalStateException - if create is true, and the session can't be created
      • removeRequestAttribute

        protected abstract void removeRequestAttribute​(R request,
                                                       String name)
        Remove an attribute from the request.
        Parameters:
        request - the request to remove the attribute from
        name - the name of the attribute
      • setRequestAttribute

        protected abstract void setRequestAttribute​(R request,
                                                    String name,
                                                    Object value)
        Set an attribute in the request.
        Parameters:
        request - the request to set the attribute from
        name - the name of the attribute
        value - the value of the attribute
      • getRequestAttribute

        protected abstract Object getRequestAttribute​(R request,
                                                      String name)
        Retrieve an attribute value from the request
        Parameters:
        request - the request to get the attribute from
        name - the name of the attribute to get
        Returns:
        the value of the attribute
      • getSessionFromRequest

        protected abstract S getSessionFromRequest​(R request,
                                                   boolean create)
      • getNamingSchemePrefix

        protected abstract String getNamingSchemePrefix()
      • isAssociated

        protected boolean isAssociated()
        Check if the context is currently associated
        Returns:
        true if the context is associated
      • getRequest

        protected R getRequest()
        Get the associated store
        Returns:
        the request
      • getSessionAttributeNames

        protected abstract Iterator<String> getSessionAttributeNames​(S session)