[jboss-cvs] jboss-seam/src/main/org/jboss/seam ...
Gavin King
gavin.king at jboss.com
Fri Oct 13 00:04:48 EDT 2006
User: gavin
Date: 06/10/13 00:04:48
Modified: src/main/org/jboss/seam Component.java
Log:
make cglib interceptors properly serializable JBSEAM-332
Revision Changes Path
1.190 +22 -24 jboss-seam/src/main/org/jboss/seam/Component.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Component.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/Component.java,v
retrieving revision 1.189
retrieving revision 1.190
diff -u -b -r1.189 -r1.190
--- Component.java 13 Oct 2006 01:27:31 -0000 1.189
+++ Component.java 13 Oct 2006 04:04:48 -0000 1.190
@@ -32,7 +32,6 @@
import java.util.Locale;
import java.util.Map;
import java.util.Set;
-import java.util.concurrent.Semaphore;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
@@ -81,6 +80,7 @@
import org.jboss.seam.intercept.ClientSideInterceptor;
import org.jboss.seam.intercept.Interceptor;
import org.jboss.seam.intercept.JavaBeanInterceptor;
+import org.jboss.seam.intercept.Proxy;
import org.jboss.seam.interceptors.AsynchronousInterceptor;
import org.jboss.seam.interceptors.BijectionInterceptor;
import org.jboss.seam.interceptors.BusinessProcessInterceptor;
@@ -110,7 +110,7 @@
*
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
* @author Gavin King
- * @version $Revision: 1.189 $
+ * @version $Revision: 1.190 $
*/
@Scope(ScopeType.APPLICATION)
public class Component
@@ -905,7 +905,8 @@
SeamInterceptor.COMPONENT.set(this);
try
{
- return wrap( Naming.getInitialContext().lookup(jndiName) );
+ Object bean = Naming.getInitialContext().lookup(jndiName);
+ return wrap( bean, new ClientSideInterceptor(bean, this) );
}
finally
{
@@ -922,27 +923,23 @@
protected Object instantiateJavaBean() throws Exception
{
- if (interceptionType==InterceptionType.NEVER)
- {
Object bean = beanClass.newInstance();
initialize(bean);
- callPostConstructMethod(bean);
- return bean;
- }
- else
+ if (interceptionType!=InterceptionType.NEVER)
{
- Factory bean = getFactory().newInstance();
- initialize(bean);
- bean.setCallback( 0, new JavaBeanInterceptor(this) );
+ bean = wrap( bean, new JavaBeanInterceptor(bean, this) );
+ }
callPostConstructMethod(bean);
return bean;
}
- }
- private Object wrap(Object bean) throws Exception
+ /**
+ * Wrap a CGLIB interceptor around an instance of the component
+ */
+ public Object wrap(Object bean, MethodInterceptor interceptor) throws Exception
{
Factory proxy = getFactory().newInstance();
- proxy.setCallback( 0, new ClientSideInterceptor(bean, this) );
+ proxy.setCallback(0, interceptor);
return proxy;
}
@@ -1777,6 +1774,7 @@
{
interfaces.add(HttpSessionActivationListener.class);
}
+ interfaces.add(Proxy.class);
en.setInterfaces( interfaces.toArray( new Class[0] ) );
return (Class<Factory>) en.createClass();
}
More information about the jboss-cvs-commits
mailing list