org.jboss.weld.context
Class AbstractConversationContext<R,S>

java.lang.Object
  extended by org.jboss.weld.context.AbstractContext
      extended by org.jboss.weld.context.AbstractManagedContext
          extended by org.jboss.weld.context.AbstractBoundContext<R>
              extended by org.jboss.weld.context.AbstractConversationContext<R,S>
All Implemented Interfaces:
javax.enterprise.context.spi.Context, org.jboss.weld.context.BoundContext<R>, org.jboss.weld.context.ConversationContext, org.jboss.weld.context.ManagedContext
Direct Known Subclasses:
BoundConversationContextImpl, HttpConversationContextImpl

public abstract class AbstractConversationContext<R,S>
extends AbstractBoundContext<R>
implements org.jboss.weld.context.ConversationContext

The base of the conversation context, which can use a variety of storage forms

Author:
Pete Muir, George Sapountzis

Field Summary
static String CONVERSATIONS_ATTRIBUTE_NAME
           
 
Constructor Summary
AbstractConversationContext()
           
 
Method Summary
 void activate()
           
 void activate(String cid)
           
 boolean associate(R request)
           
protected  void associateRequest()
           
protected  void associateRequest(String cid)
           
protected abstract  BoundBeanStore createRequestBeanStore(NamingScheme namingScheme, R request)
           
protected abstract  BoundBeanStore createSessionBeanStore(NamingScheme namingScheme, S session)
           
 void deactivate()
           
 boolean destroy(S session)
           
protected  void destroyConversation(S session, String id)
           
 boolean dissociate(R request)
           
 String generateConversationId()
           
 long getConcurrentAccessTimeout()
           
 org.jboss.weld.context.ManagedConversation getConversation(String id)
           
 Collection<org.jboss.weld.context.ManagedConversation> getConversations()
           
 org.jboss.weld.context.ManagedConversation getCurrentConversation()
           
 long getDefaultTimeout()
           
 String getParameterName()
           
protected abstract  Object getRequestAttribute(R request, String name)
          Retrieve an attribute value from the request
 Class<? extends Annotation> getScope()
           
protected abstract  Object getSessionAttribute(R request, String name, boolean create)
          Get an attribute value from the session.
protected abstract  Object getSessionAttributeFromSession(S session, String name)
          Get an attribute value from the session.
protected abstract  S getSessionFromRequest(R request, boolean create)
           
 void invalidate()
           
protected abstract  void removeRequestAttribute(R request, String name)
          Remove an attribute from the request.
 void setConcurrentAccessTimeout(long timeout)
           
 void setDefaultTimeout(long timeout)
           
 void setParameterName(String cid)
           
protected abstract  void setRequestAttribute(R request, String name, Object value)
          Set an attribute in the request.
protected abstract  void setSessionAttribute(R request, String name, Object value, boolean create)
          Set an attribute in the session.
 
Methods inherited from class org.jboss.weld.context.AbstractBoundContext
cleanup, getBeanStore, setBeanStore
 
Methods inherited from class org.jboss.weld.context.AbstractManagedContext
isActive, setActive
 
Methods inherited from class org.jboss.weld.context.AbstractContext
destroy, get, get, getContextual, getId, getServiceRegistry
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.enterprise.context.spi.Context
get, get, isActive
 

Field Detail

CONVERSATIONS_ATTRIBUTE_NAME

public static final String CONVERSATIONS_ATTRIBUTE_NAME
Constructor Detail

AbstractConversationContext

public AbstractConversationContext()
Method Detail

getParameterName

public String getParameterName()
Specified by:
getParameterName in interface org.jboss.weld.context.ConversationContext

setParameterName

public void setParameterName(String cid)
Specified by:
setParameterName in interface org.jboss.weld.context.ConversationContext

setConcurrentAccessTimeout

public void setConcurrentAccessTimeout(long timeout)
Specified by:
setConcurrentAccessTimeout in interface org.jboss.weld.context.ConversationContext

getConcurrentAccessTimeout

public long getConcurrentAccessTimeout()
Specified by:
getConcurrentAccessTimeout in interface org.jboss.weld.context.ConversationContext

setDefaultTimeout

public void setDefaultTimeout(long timeout)
Specified by:
setDefaultTimeout in interface org.jboss.weld.context.ConversationContext

getDefaultTimeout

public long getDefaultTimeout()
Specified by:
getDefaultTimeout in interface org.jboss.weld.context.ConversationContext

associate

public boolean associate(R request)
Specified by:
associate in interface org.jboss.weld.context.BoundContext<R>

dissociate

public boolean dissociate(R request)
Specified by:
dissociate in interface org.jboss.weld.context.BoundContext<R>

activate

public void activate()
Specified by:
activate in interface org.jboss.weld.context.ConversationContext
Specified by:
activate in interface org.jboss.weld.context.ManagedContext
Overrides:
activate in class AbstractBoundContext<R>

associateRequest

protected void associateRequest()

associateRequest

protected void associateRequest(String cid)

activate

public void activate(String cid)
Specified by:
activate in interface org.jboss.weld.context.ConversationContext

deactivate

public void deactivate()
Specified by:
deactivate in interface org.jboss.weld.context.ManagedContext
Overrides:
deactivate in class AbstractBoundContext<R>

invalidate

public void invalidate()
Specified by:
invalidate in interface org.jboss.weld.context.ConversationContext
Specified by:
invalidate in interface org.jboss.weld.context.ManagedContext
Overrides:
invalidate in class AbstractManagedContext

destroy

public boolean destroy(S session)

destroyConversation

protected void destroyConversation(S session,
                                   String id)

generateConversationId

public String generateConversationId()
Specified by:
generateConversationId in interface org.jboss.weld.context.ConversationContext

getConversation

public org.jboss.weld.context.ManagedConversation getConversation(String id)
Specified by:
getConversation in interface org.jboss.weld.context.ConversationContext

getConversations

public Collection<org.jboss.weld.context.ManagedConversation> getConversations()
Specified by:
getConversations in interface org.jboss.weld.context.ConversationContext

getCurrentConversation

public org.jboss.weld.context.ManagedConversation getCurrentConversation()
Specified by:
getCurrentConversation in interface org.jboss.weld.context.ConversationContext

getScope

public Class<? extends Annotation> getScope()
Specified by:
getScope in interface javax.enterprise.context.spi.Context

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, other wise 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

createRequestBeanStore

protected abstract BoundBeanStore createRequestBeanStore(NamingScheme namingScheme,
                                                         R request)

createSessionBeanStore

protected abstract BoundBeanStore createSessionBeanStore(NamingScheme namingScheme,
                                                         S session)

getSessionFromRequest

protected abstract S getSessionFromRequest(R request,
                                           boolean create)


Copyright © 2013 Seam Framework. All Rights Reserved.