|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.code.rees.scope.conversation.ConversationAdapter
public abstract class ConversationAdapter
This class is used to adapt/integrate the major components of the conversation management to control frameworks such as Struts2 and Spring MVC or any other framework.
By employing the adapter pattern, the conversation management aspects are separated from the details of the control framework and separated even from the underlying request and session mechanisms.
Makes use of ThreadLocal to make the current request's adapter
available through the static call
ConversationAdapter.getAdapter().
| Field Summary | |
|---|---|
protected static ThreadLocal<ConversationAdapter> |
conversationAdapter
|
protected ConversationPostProcessorWrapperFactory |
postProcessorFactory
|
protected Collection<ConversationPostProcessorWrapper> |
postProcessors
|
protected Map<String,String> |
viewContext
|
| Constructor Summary | |
|---|---|
ConversationAdapter()
|
|
| Method Summary | |
|---|---|
void |
addPostProcessor(ConversationPostProcessor postProcessor,
ConversationClassConfiguration conversationConfig,
String conversationId)
Add a ConversationPostProcessor that is guaranteed to be executed
after action execution by a call to executePostProcessors() |
abstract ConversationContext |
beginConversation(String conversationName,
long maxIdleTimeMillis)
begins a new conversation, returning the context for the new conversation |
static void |
cleanup()
clean up this resource once processing is completed for the request, static to guarantee that it references current thread's instance |
protected void |
doCleanup()
called by cleanup(), can be overridden to tweak |
abstract ConversationContext |
endConversation(String conversationName,
String conversationId)
Removes the conversation from the session, returning the context |
void |
executePostProcessors()
Executes all ConversationPostProcessors
that have been added using
addPostProcessor(ConversationPostProcessor, ConversationClassConfiguration, String) |
abstract Object |
getAction()
The controller instance, such as a Struts2 action class or a Spring MVC controller |
abstract String |
getActionId()
A string identifying the current action. |
static ConversationAdapter |
getAdapter()
Get the ThreadLocal ConversationAdapter associated with the
current request |
abstract ConversationContext |
getConversationContext(String conversationName,
String conversationId)
Returns a ConversationContext for the given name and ID |
abstract Map<String,String> |
getRequestContext()
Returns a map containing, at a minimum, conversation name/id key/value pairs for the current request. |
Map<String,String> |
getViewContext()
Returns a map that is used to place conversation name/id key/value pairs for placing in the view context (the view context being, for instance, a JSP). |
static void |
setAdapter(ConversationAdapter adapter)
Set the ThreadLocal ConversationAdapter for use with the current
request. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static ThreadLocal<ConversationAdapter> conversationAdapter
protected Map<String,String> viewContext
protected ConversationPostProcessorWrapperFactory postProcessorFactory
protected Collection<ConversationPostProcessorWrapper> postProcessors
| Constructor Detail |
|---|
public ConversationAdapter()
| Method Detail |
|---|
public abstract Object getAction()
public abstract String getActionId()
DefaultConversationArbitrator is the name of the controller
method being executed.
public abstract Map<String,String> getRequestContext()
public abstract ConversationContext beginConversation(String conversationName,
long maxIdleTimeMillis)
conversationName - maxIdleTimeMillis -
public abstract ConversationContext getConversationContext(String conversationName,
String conversationId)
conversationId -
public abstract ConversationContext endConversation(String conversationName,
String conversationId)
public Map<String,String> getViewContext()
public void addPostProcessor(ConversationPostProcessor postProcessor,
ConversationClassConfiguration conversationConfig,
String conversationId)
ConversationPostProcessor that is guaranteed to be executed
after action execution by a call to executePostProcessors()
postProcessor - conversationConfig - conversationId - public void executePostProcessors()
ConversationPostProcessors
that have been added using
addPostProcessor(ConversationPostProcessor, ConversationClassConfiguration, String)
public static void setAdapter(ConversationAdapter adapter)
ThreadLocal ConversationAdapter for use with the current
request. Called in the constructor to force new instances into the
ThreadLocal.
adapter - public static ConversationAdapter getAdapter()
ThreadLocal ConversationAdapter associated with the
current request
public static void cleanup()
protected void doCleanup()
cleanup(), can be overridden to tweak
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||