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 2008/02/21 22:25:43 UTC
svn commit: r630002 -
/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/_SpringUtils.java
Author: skitching
Date: Thu Feb 21 13:25:42 2008
New Revision: 630002
URL: http://svn.apache.org/viewvc?rev=630002&view=rev
Log:
Provide method to drill down from proxy to real bean.
Modified:
myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/_SpringUtils.java
Modified: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/_SpringUtils.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/_SpringUtils.java?rev=630002&r1=630001&r2=630002&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/_SpringUtils.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/_SpringUtils.java Thu Feb 21 13:25:42 2008
@@ -20,6 +20,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.springframework.aop.TargetSource;
+import org.springframework.aop.framework.Advised;
import org.springframework.aop.framework.AopInfrastructureBean;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.aop.scope.DefaultScopedObject;
@@ -174,4 +176,21 @@
return pf.getProxy(cbf.getBeanClassLoader());
}
+
+ /**
+ * Given a proxy object, return the real underlying object that it currently refers to.
+ * <p>
+ * This method is currently experimental; it works for the current Spring implementation
+ * of Orchestra but at the current time it is not known whether this functionality can
+ * be implemented for all dependency-injection frameworks. If it does, then it might
+ * later make sense to promote this up to the public Orchestra API.
+ */
+ public static Object getRealBean(Object proxy) throws Exception
+ {
+ Advised advised = (Advised) proxy;
+ TargetSource targetSource = advised.getTargetSource();
+ Object real = targetSource.getTarget();
+
+ return real;
+ }
}