|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.myfaces.orchestra.conversation.spring.AbstractSpringOrchestraScope
public abstract class AbstractSpringOrchestraScope
Abstract basis class for all the Orchestra scopes.
A scope object has two quite different roles:
This base class handles item 1 above, and leaves item 2 to a subclass. The declaration of interface ConversationFactory needs to be on this class, however, as the createBean method needs to invoke it.
Constructor Summary | |
---|---|
AbstractSpringOrchestraScope()
|
Method Summary | |
---|---|
protected void |
assertSameScope(java.lang.String beanName,
Conversation conversation)
|
protected java.lang.String |
buildBeanName(java.lang.String name)
Strip off any Spring namespace (eg scopedTarget). |
java.lang.Object |
get(java.lang.String name,
org.springframework.beans.factory.ObjectFactory objectFactory)
This is invoked by Spring whenever someone calls getBean(name) on a bean-factory and the bean-definition for that bean has a scope attribute that maps to an instance of this class. |
protected java.lang.Object |
getBean(java.lang.String beanName,
org.springframework.beans.factory.ObjectFactory objectFactory)
See method get(name, objectFactory). |
protected Conversation |
getConversationForBean(java.lang.String beanName)
Get the conversation for the given beanName. |
java.lang.String |
getConversationId()
Return the conversation context id. |
protected java.lang.String |
getConversationNameForBean(java.lang.String beanName)
Get the conversation name associated with the beanName. |
protected void |
notifyAccessConversation(Conversation conversation)
|
void |
registerDestructionCallback(java.lang.String name,
java.lang.Runnable runnable)
Add the given runnable wrapped within an ConversationBindingListener to
the conversation map. |
java.lang.Object |
remove(java.lang.String name)
|
void |
setAdvices(org.aopalliance.aop.Advice[] advices)
The advices (interceptors) which will be applied to the conversation scoped bean. |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
Get an ApplicationContext injected by Spring. |
void |
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
Set the Conversation object to the bean if it implements the
ConversationAware interface. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.myfaces.orchestra.conversation.ConversationFactory |
---|
createConversation |
Constructor Detail |
---|
public AbstractSpringOrchestraScope()
Method Detail |
---|
public void setAdvices(org.aopalliance.aop.Advice[] advices)
public java.lang.String getConversationId()
Note: This conversationId is something spring requires. It has nothing to do with the Orchestra conversation id.
getConversationId
in interface org.springframework.beans.factory.config.Scope
public java.lang.Object get(java.lang.String name, org.springframework.beans.factory.ObjectFactory objectFactory)
First, the appropriate ConversationContext is retrieved.
Second, the appropriate Conversation is retrieved; if it does not yet exist then it is created and started. The conversation name is either specified on the bean-definition via a custom attribute, or defaults to the bean name.
Then if the bean already exists in the Conversation then it is returned. Otherwise a new instance is created, stored into the Conversation and returned.
When a bean is created, a proxy is actually created for it which has one or more AOP "advices" (ie method interceptors). The CurrentConversationAdvice class is always attached. Note that if the bean definition contains the aop:proxy tag (and most do) then the bean that spring creates is already a proxy, ie what is returned is a proxy of a proxy.
get
in interface org.springframework.beans.factory.config.Scope
protected java.lang.Object getBean(java.lang.String beanName, org.springframework.beans.factory.ObjectFactory objectFactory)
protected void assertSameScope(java.lang.String beanName, Conversation conversation)
protected void notifyAccessConversation(Conversation conversation)
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException
Conversation
object to the bean if it implements the
ConversationAware
interface.
setBeanFactory
in interface org.springframework.beans.factory.BeanFactoryAware
org.springframework.beans.BeansException
protected Conversation getConversationForBean(java.lang.String beanName)
protected java.lang.String getConversationNameForBean(java.lang.String beanName)
protected java.lang.String buildBeanName(java.lang.String name)
This method will simply strip off anything before the first dot.
public java.lang.Object remove(java.lang.String name)
remove
in interface org.springframework.beans.factory.config.Scope
public void registerDestructionCallback(java.lang.String name, java.lang.Runnable runnable)
ConversationBindingListener
to
the conversation map.
This ensures it will be called during conversation destroy.
registerDestructionCallback
in interface org.springframework.beans.factory.config.Scope
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
org.springframework.beans.BeansException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |