geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject cvs commit: incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/jmx CollectionProxy.java ProxyMethodInterceptor.java SingleProxy.java
Date Mon, 19 Jan 2004 06:33:24 GMT
djencks     2004/01/18 22:33:24

  Modified:    modules/kernel/src/java/org/apache/geronimo/gbean/jmx
                        CollectionProxy.java ProxyMethodInterceptor.java
                        SingleProxy.java
  Log:
  make single and collection proxies work the same.  Dain, please review this
  
  Revision  Changes    Path
  1.7       +12 -2     incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/CollectionProxy.java
  
  Index: CollectionProxy.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/CollectionProxy.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- CollectionProxy.java	17 Jan 2004 16:59:20 -0000	1.6
  +++ CollectionProxy.java	19 Jan 2004 06:33:24 -0000	1.7
  @@ -64,6 +64,8 @@
   import java.util.Set;
   import java.util.HashSet;
   import java.util.ArrayList;
  +import java.lang.reflect.Method;
  +
   import javax.management.ObjectName;
   
   import org.apache.geronimo.gbean.WaitingException;
  @@ -77,6 +79,8 @@
   import net.sf.cglib.proxy.Enhancer;
   import net.sf.cglib.proxy.Factory;
   import net.sf.cglib.proxy.SimpleCallbacks;
  +import net.sf.cglib.proxy.CallbackFilter;
  +import net.sf.cglib.proxy.Callbacks;
   
   /**
    *
  @@ -131,7 +135,13 @@
           } else {
               enhancer.setSuperclass(type);
           }
  -        enhancer.setCallbackFilter(new InterfaceCallbackFilter(type));
  +        //enhancer.setCallbackFilter(new InterfaceCallbackFilter(type));
  +        enhancer.setCallbackFilter(new CallbackFilter() {
  +            public int accept(Method method) {
  +                return Callbacks.INTERCEPT;
  +            }
  +        });
  +
           enhancer.setCallbacks(new SimpleCallbacks());
           enhancer.setClassLoader(type.getClassLoader());
           factory = enhancer.create();
  
  
  
  1.3       +6 -1      incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/ProxyMethodInterceptor.java
  
  Index: ProxyMethodInterceptor.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/ProxyMethodInterceptor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ProxyMethodInterceptor.java	15 Jan 2004 00:45:54 -0000	1.2
  +++ ProxyMethodInterceptor.java	19 Jan 2004 06:33:24 -0000	1.3
  @@ -154,6 +154,10 @@
                   throw new IllegalStateException("Proxy is stopped");
               }
           }
  +        InvokeMBean invoker = methodTable[proxy.getSuperIndex()];
  +        if (invoker == null) {
  +            System.out.println("NO INVOKER FOR ");
  +        }
           return methodTable[proxy.getSuperIndex()].invoke(server, objectName, args);
       }
   
  @@ -207,6 +211,7 @@
               methodTable[getSuperIndex(fastClass, proxyType.getMethod("hashCode", null))]
= new HashCodeInvoke();
               methodTable[getSuperIndex(fastClass, proxyType.getMethod("toString", null))]
= new ToStringInvoke(proxyType.getName());
           } catch (Exception e) {
  +            System.out.println("Missing method for " + proxyType + " object name " + objectName);
               // this can not happen... all classes must implement equals, hashCode and toString
               throw new AssertionError(e);
           }
  
  
  
  1.5       +7 -3      incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/SingleProxy.java
  
  Index: SingleProxy.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/SingleProxy.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SingleProxy.java	15 Jan 2004 05:36:53 -0000	1.4
  +++ SingleProxy.java	19 Jan 2004 06:33:24 -0000	1.5
  @@ -120,8 +120,12 @@
           this.name = name;
           this.patterns = patterns;
           Enhancer enhancer = new Enhancer();
  -        enhancer.setSuperclass(Object.class);
  -        enhancer.setInterfaces(new Class[]{type});
  +        if (type.isInterface()) {
  +            enhancer.setSuperclass(Object.class);
  +            enhancer.setInterfaces(new Class[]{type});
  +        } else {
  +            enhancer.setSuperclass(type);
  +        }
           enhancer.setCallbackFilter(new CallbackFilter() {
               public int accept(Method method) {
                   return Callbacks.INTERCEPT;
  
  
  

Mime
View raw message