[jboss-cvs] jboss-seam/src/main/org/jboss/seam/intercept ...

Gavin King gavin.king at jboss.com
Mon Mar 5 23:35:42 EST 2007


  User: gavin   
  Date: 07/03/05 23:35:42

  Modified:    src/main/org/jboss/seam/intercept   
                        RootInvocationContext.java JavaBeanInterceptor.java
                        ClientSideInterceptor.java
  Log:
  JBSEAM-989
  
  Revision  Changes    Path
  1.4       +3 -17     jboss-seam/src/main/org/jboss/seam/intercept/RootInvocationContext.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: RootInvocationContext.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/intercept/RootInvocationContext.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- RootInvocationContext.java	1 Nov 2006 02:54:02 -0000	1.3
  +++ RootInvocationContext.java	6 Mar 2007 04:35:40 -0000	1.4
  @@ -4,8 +4,6 @@
   import java.util.HashMap;
   import java.util.Map;
   
  -import net.sf.cglib.proxy.MethodProxy;
  -
   /**
    * InvocationContext for use with CGLIB-based interceptors.
    * 
  @@ -18,31 +16,19 @@
      private final Method method;
      private Object[] params;
      private final Map contextData = new HashMap();
  -   private final MethodProxy methodProxy;
   
  -   public RootInvocationContext(Object bean, Method method, Object[] params, MethodProxy methodProxy)
  +   public RootInvocationContext(Object bean, Method method, Object[] params)
      {
         this.bean = bean;
         this.method = method;
         this.params = params;
  -      this.methodProxy = methodProxy;
  -   }
  -   
  -   public RootInvocationContext(Object bean, Method method, Object[] params)
  -   {
  -      this(bean, method, params, null);
      }
      
      public Object proceed() throws Exception
      {
  -      if (methodProxy==null)
  -      {
  -         throw new UnsupportedOperationException();
  -      }
  -      
         try
         {
  -         return methodProxy.invoke(bean, params);
  +         return method.invoke(bean, params);
         }
         catch (Error e)
         {
  
  
  
  1.13      +12 -15    jboss-seam/src/main/org/jboss/seam/intercept/JavaBeanInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: JavaBeanInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/intercept/JavaBeanInterceptor.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -b -r1.12 -r1.13
  --- JavaBeanInterceptor.java	26 Feb 2007 21:31:05 -0000	1.12
  +++ JavaBeanInterceptor.java	6 Mar 2007 04:35:40 -0000	1.13
  @@ -1,13 +1,12 @@
  -//$Id: JavaBeanInterceptor.java,v 1.12 2007/02/26 21:31:05 gavin Exp $
  +//$Id: JavaBeanInterceptor.java,v 1.13 2007/03/06 04:35:40 gavin Exp $
   package org.jboss.seam.intercept;
   
   import java.lang.reflect.Method;
   
  -import javax.servlet.http.HttpSessionEvent;
  +import javassist.util.proxy.MethodHandler;
  +import javassist.util.proxy.ProxyObject;
   
  -import net.sf.cglib.proxy.Factory;
  -import net.sf.cglib.proxy.MethodInterceptor;
  -import net.sf.cglib.proxy.MethodProxy;
  +import javax.servlet.http.HttpSessionEvent;
   
   import org.jboss.seam.Component;
   import org.jboss.seam.ComponentType;
  @@ -21,7 +20,7 @@
    * @author Gavin King
    */
   public class JavaBeanInterceptor extends RootInterceptor
  -      implements MethodInterceptor
  +      implements MethodHandler
   {
      private static final long serialVersionUID = -771725005103740533L;
      
  @@ -37,8 +36,7 @@
         init(component);
      }
   
  -   public Object intercept(final Object proxy, final Method method, final Object[] params,
  -         final MethodProxy methodProxy) throws Throwable
  +   public Object invoke(final Object proxy, final Method method, final Method proceed, final Object[] params) throws Throwable
      {
   
         if ( params!=null )
  @@ -48,7 +46,7 @@
               String methodName = method.getName();
               if ( "finalize".equals(methodName) ) 
               {
  -               return methodProxy.invokeSuper(proxy, params);
  +               return proceed.invoke (proxy, params);
               }
               else if ( "writeReplace".equals(methodName) )
               {
  @@ -86,7 +84,7 @@
            dirty = true;
         }
            
  -      Object result = interceptInvocation(method, params, methodProxy);
  +      Object result = interceptInvocation(method, params);
         return result==bean ? proxy : result;
   
      }
  @@ -148,10 +146,9 @@
         invokeAndHandle(context, EventType.POST_ACTIVATE);
      }
   
  -   private Object interceptInvocation(final Method method, final Object[] params, 
  -         final MethodProxy methodProxy) throws Exception
  +   private Object interceptInvocation(final Method method, final Object[] params) throws Exception
      {
  -      return invoke( new RootInvocationContext(bean, method, params, methodProxy), EventType.AROUND_INVOKE );
  +      return invoke( new RootInvocationContext(bean, method, params), EventType.AROUND_INVOKE );
      }
      
      // TODO: copy/paste from ClientSide interceptor
  @@ -170,12 +167,12 @@
         {
            if (comp==null)
            {
  -            Factory proxy = Component.createProxyFactory( 
  +            ProxyObject proxy = Component.createProxyFactory( 
                     ComponentType.JAVA_BEAN, 
                     beanClass, 
                     Component.getBusinessInterfaces(beanClass)
                  ).newInstance();
  -            proxy.setCallback(0, this);
  +            proxy.setHandler(this);
               return proxy;
            }
            else
  
  
  
  1.11      +11 -13    jboss-seam/src/main/org/jboss/seam/intercept/ClientSideInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ClientSideInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/intercept/ClientSideInterceptor.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -b -r1.10 -r1.11
  --- ClientSideInterceptor.java	9 Feb 2007 03:44:22 -0000	1.10
  +++ ClientSideInterceptor.java	6 Mar 2007 04:35:42 -0000	1.11
  @@ -1,11 +1,10 @@
  -//$Id: ClientSideInterceptor.java,v 1.10 2007/02/09 03:44:22 gavin Exp $
  +//$Id: ClientSideInterceptor.java,v 1.11 2007/03/06 04:35:42 gavin Exp $
   package org.jboss.seam.intercept;
   
   import java.lang.reflect.Method;
   
  -import net.sf.cglib.proxy.Factory;
  -import net.sf.cglib.proxy.MethodInterceptor;
  -import net.sf.cglib.proxy.MethodProxy;
  +import javassist.util.proxy.MethodHandler;
  +import javassist.util.proxy.ProxyObject;
   
   import org.jboss.seam.Component;
   import org.jboss.seam.ComponentType;
  @@ -19,7 +18,7 @@
    * @author Gavin King
    */
   public class ClientSideInterceptor extends RootInterceptor 
  -      implements MethodInterceptor
  +      implements MethodHandler
   {
      private static final long serialVersionUID = -1578313703571846699L;
      
  @@ -34,22 +33,21 @@
         init(component);
      }
      
  -   public Object intercept(final Object proxy, final Method method, final Object[] params,
  -         final MethodProxy methodProxy) throws Throwable
  +   public Object invoke(final Object proxy, final Method method, final Method proceed, final Object[] params) throws Throwable
      {
         String methodName = method.getName();
         if ( params!=null && params.length==0 )
         {
            if ( "finalize".equals(methodName) )
            {
  -            return methodProxy.invokeSuper(proxy, params);
  +            return proceed.invoke(proxy, params);
            }
            else if ( "writeReplace".equals(methodName) )
            {
               return this;
            }
         }
  -      Object result = invoke( createInvocationContext(method, params, methodProxy), EventType.AROUND_INVOKE );
  +      Object result = invoke( createInvocationContext(method, params), EventType.AROUND_INVOKE );
         return sessionBeanReturnedThis(result) ? proxy : result;
      }
   
  @@ -60,9 +58,9 @@
            );
      }
   
  -   private RootInvocationContext createInvocationContext(final Method method, final Object[] params, final MethodProxy methodProxy)
  +   private RootInvocationContext createInvocationContext(final Method method, final Object[] params)
      {
  -      return new RootInvocationContext(bean, method, params, methodProxy)
  +      return new RootInvocationContext(bean, method, params)
         {
            @Override
            public Object proceed() throws Exception
  @@ -97,12 +95,12 @@
         {
            if (comp==null)
            {
  -            Factory proxy = Component.createProxyFactory( 
  +            ProxyObject proxy = Component.createProxyFactory( 
                     ComponentType.STATEFUL_SESSION_BEAN, 
                     beanClass, 
                     Component.getBusinessInterfaces(beanClass)
                  ).newInstance();
  -            proxy.setCallback(0, this);
  +            proxy.setHandler(this);
               return proxy;
            }
            else
  
  
  



More information about the jboss-cvs-commits mailing list