You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sk...@apache.org on 2007/11/30 13:17:20 UTC
svn commit: r599793 -
/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationUtils.java
Author: skitching
Date: Fri Nov 30 04:17:05 2007
New Revision: 599793
URL: http://svn.apache.org/viewvc?rev=599793&view=rev
Log:
Update javadoc only.
Modified:
myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationUtils.java
Modified: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationUtils.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationUtils.java?rev=599793&r1=599792&r2=599793&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationUtils.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationUtils.java Fri Nov 30 04:17:05 2007
@@ -54,9 +54,42 @@
}
/**
- * returns the bean instance of the bean you are working in which is seen by the "outer"
- * framework.
- * TODO: find better words to describe what this methods is good for, Simon?
+ * Return a reference to the most recently-invoked bean that is declared as being in
+ * a conversation scope.
+ * <p>
+ * When using an interceptor-based AOP framework, a bean that passes "this" to another
+ * object is bypassing any aspects. Any "callbacks" invoked via that reference
+ * will not apply the aspects that Orchestra has configured. This is particularly
+ * nasty when using Orchestra's persistence support as Orchestra uses an aspect to
+ * configure the correct "persistence context" for a bean when it is invoked.
+ * <p>
+ * Therefore, when a bean wishes to pass a reference to itself elsewhere then it should
+ * use this method rather than passing "this" directly. It is acknowledged that this is
+ * less than ideal as it does couple code to Orchestra.
+ */
+
+ /*
+ * An alternative to this is to use AOP "load-time-weaving", where a custom classloader
+ * uses a configuration file to apply the necessary interceptors directly to the class
+ * rather than using the scope manager (eg AbstractSpringOrchestraScope) to define the
+ * aspects as interceptors. In this case, the "this" reference is an object that has
+ * the interceptors attached so the problem does not occur. But the classes which are
+ * to be modified on class-load-time are determined by the orchestra configuration
+ * files which specify what beans are conversation-scoped. In the worst case, this
+ * information is actually held in annotations on the beans themselves, which means
+ * that the class is loaded before the information on how to weave it exists. The only
+ * solution here appears to be to instead weave every possible class that might be
+ * conversation-scoped (eg all those with @Scope annotation, or all those that are in
+ * a certain package). On object creation the aspect performs a "lookup" to find its
+ * conversation, and if none then does nothing.
+ * <p>
+ * TODO: Maybe what we want is instead getCurrentContext(bean), where bean is not
+ * necessarily a directly-configured conversational bean. Instead, this returns a new
+ * proxy for the bean (whatever it is) that will run the interceptors for the current
+ * conversation on entry/exit to that bean's methods. This then makes the method
+ * more generically useful, as it can wrap all sorts of objects rather than just
+ * the conversation-scoped beans themselves. This can only be done with interceptors,
+ * however, as the
*/
public static Object getCurrentBean()
{