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/12/05 12:55:42 UTC

svn commit: r601305 - /myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/OrchestraAdvisorBeanPostProcessor.java

Author: skitching
Date: Wed Dec  5 03:55:38 2007
New Revision: 601305

URL: http://svn.apache.org/viewvc?rev=601305&view=rev
Log:
Fix code to work with Spring2.0 as well as Spring2.5.

Modified:
    myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/OrchestraAdvisorBeanPostProcessor.java

Modified: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/OrchestraAdvisorBeanPostProcessor.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/OrchestraAdvisorBeanPostProcessor.java?rev=601305&r1=601304&r2=601305&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/OrchestraAdvisorBeanPostProcessor.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/OrchestraAdvisorBeanPostProcessor.java Wed Dec  5 03:55:38 2007
@@ -25,6 +25,8 @@
 import org.apache.myfaces.orchestra.conversation.Conversation;
 import org.apache.myfaces.orchestra.conversation.CurrentConversationAdvice;
 import org.springframework.aop.Advisor;
+import org.springframework.aop.Pointcut;
+import org.springframework.aop.PointcutAdvisor;
 import org.springframework.aop.TargetSource;
 import org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator;
 import org.springframework.beans.BeansException;
@@ -67,8 +69,14 @@
 	 * TODO: maybe it would be nice to allow an orchestra scope object to hold Advisors
 	 * as well as just Advices, so that users can configure specific code to run only
 	 * for specific methods of orchestra beans. 
+	 * <p>
+	 * NB: In Spring2.5, this class can simply implement Advisor, and it will be applied to
+	 * all methods. However in Spring2.0, class DefaultAdvisorChainFactory only accepts
+	 * PointcutAdvisor or IntroductionAdvisor, and silently ignores Advisor classes that
+	 * are not of those types. So here for Spring2.x compatibility we need to make this
+	 * class a PointcutAdvisor with a dummy pointcut that matches all methods...
 	 */
-	private static class SimpleAdvisor implements Advisor
+	private static class SimpleAdvisor implements PointcutAdvisor
 	{
 		private Advice advice;
 
@@ -86,7 +94,11 @@
 		{
 			return false;
 		}
-		
+
+		public Pointcut getPointcut()
+		{
+			return Pointcut.TRUE;
+		}
 	}
 
 	public OrchestraAdvisorBeanPostProcessor(ConfigurableApplicationContext appContext)