org.apache.myfaces.orchestra.conversation.spring
Class PersistenceContextConversationInterceptor
java.lang.Object
org.apache.myfaces.orchestra.conversation.spring.PersistenceContextConversationInterceptor
- All Implemented Interfaces:
- org.aopalliance.aop.Advice, org.aopalliance.intercept.Interceptor, org.aopalliance.intercept.MethodInterceptor
public class PersistenceContextConversationInterceptor
- extends java.lang.Object
- implements org.aopalliance.intercept.MethodInterceptor
Maintain the appropriate persistence state for the current call-stack.
This class is a MethodInterceptor (an AOP Advice) which should be configured to intercept
calls to all conversation-scoped beans. It ensures that the appropriate PersistenceContext
object for this conversation is placed into the default location, by invoking the
bind method on the persistence context object. Typically the bind method stores
the persistence context into a thread-local variable, but that is implementation-specific.
When Spring code retrieves the persistence context in order to inject it into a bean,
it then finds the correct context for the conversation that is associated with the
nearest conversation-scoped bean in the callstack.
If no PersistenceContext yet exists for the conversation associated with the bean
that is being invoked then one is created using PersistenceContextFactory
.
A reference to the PersistenceContext
is put into the conversation attribute
map wrapped in an PersistenceContextCloser
so that when the conversation
ends a callback occurs on it which closes the underlying object.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
REQUEST_ATTRIBUTE
public static final java.lang.String REQUEST_ATTRIBUTE
PersistenceContextConversationInterceptor
public PersistenceContextConversationInterceptor()
setPersistenceContextFactory
public void setPersistenceContextFactory(PersistenceContextFactory persistenceContextFactory)
invoke
public java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation methodInvocation)
throws java.lang.Throwable
- Specified by:
invoke
in interface org.aopalliance.intercept.MethodInterceptor
- Throws:
java.lang.Throwable
Copyright © 2009 The Apache Software Foundation. All Rights Reserved.