geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/jmx InterfaceCallbackFilter.java InvokeMBean.java MBeanProxyFactory.java
Date Sun, 09 Nov 2003 19:56:56 GMT
dain        2003/11/09 11:56:56

  Modified:    modules/kernel/src/java/org/apache/geronimo/kernel/jmx
                        InterfaceCallbackFilter.java InvokeMBean.java
                        MBeanProxyFactory.java
  Log:
  Changed proxy to correctly select mbean operation invoke or attribute get/set based
  on the MBeanInfo of the object
  
  Revision  Changes    Path
  1.2       +15 -6     incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/InterfaceCallbackFilter.java
  
  Index: InterfaceCallbackFilter.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/InterfaceCallbackFilter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InterfaceCallbackFilter.java	7 Nov 2003 17:32:11 -0000	1.1
  +++ InterfaceCallbackFilter.java	9 Nov 2003 19:56:55 -0000	1.2
  @@ -56,9 +56,11 @@
   package org.apache.geronimo.kernel.jmx;
   
   import java.lang.reflect.Method;
  +import java.util.HashSet;
  +import java.util.Set;
   
  -import net.sf.cglib.proxy.SimpleFilter;
   import net.sf.cglib.proxy.Callbacks;
  +import net.sf.cglib.proxy.SimpleFilter;
   
   /**
    *
  @@ -66,15 +68,22 @@
    * @version $Revision$ $Date$
    */
   public final class InterfaceCallbackFilter extends SimpleFilter {
  -    public InterfaceCallbackFilter() {
  +    private final Set methodSet;
  +    public InterfaceCallbackFilter(Class iface) {
           super(Callbacks.INTERCEPT);
  +        Method[] methods = iface.getMethods();
  +        methodSet = new HashSet(methods.length);
  +        for (int i = 0; i < methods.length; i++) {
  +            Method method = methods[i];
  +            methodSet.add(new MBeanOperationSignature(method));
  +        }
       }
   
       public int accept(Method method) {
  -        if(method.getDeclaringClass() == Object.class) {
  -            return Callbacks.NO_OP;
  +        if(methodSet.contains(new MBeanOperationSignature(method))) {
  +            return Callbacks.INTERCEPT;
           }
  -        return Callbacks.INTERCEPT;
  +        return Callbacks.NO_OP;
       }
   
   }
  
  
  
  1.3       +12 -3     incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/InvokeMBean.java
  
  Index: InvokeMBean.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/InvokeMBean.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- InvokeMBean.java	7 Nov 2003 18:06:02 -0000	1.2
  +++ InvokeMBean.java	9 Nov 2003 19:56:55 -0000	1.3
  @@ -70,7 +70,7 @@
    *
    * @version $Revision$ $Date$
    */
  -public final class InvokeMBean {
  +public class InvokeMBean {
       private final String name;
       private final String[] argumentTypes;
       private final Class[] declaredExceptions;
  @@ -78,6 +78,15 @@
       private final boolean isGetter;
       private final int expectedArguments;
   
  +    protected InvokeMBean(String name, String[] argumentTypes, Class[] declaredExceptions,
boolean attribute, boolean getter, int expectedArguments) {
  +        this.name = name;
  +        this.argumentTypes = argumentTypes;
  +        this.declaredExceptions = declaredExceptions;
  +        isAttribute = attribute;
  +        isGetter = getter;
  +        this.expectedArguments = expectedArguments;
  +    }
  +
       public InvokeMBean(Method method, boolean isAttribute, boolean isGetter) {
           this.isAttribute = isAttribute;
           this.isGetter = isGetter;
  @@ -101,7 +110,7 @@
           } else {
               name = method.getName();
           }
  -        
  +
           // conver the parameters to a MBeanServer friendly string array
           Class[] parameters = method.getParameterTypes();
           argumentTypes = new String[parameters.length];
  
  
  
  1.3       +2 -2      incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/MBeanProxyFactory.java
  
  Index: MBeanProxyFactory.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/MBeanProxyFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MBeanProxyFactory.java	7 Nov 2003 17:32:11 -0000	1.2
  +++ MBeanProxyFactory.java	9 Nov 2003 19:56:55 -0000	1.3
  @@ -95,7 +95,7 @@
           Factory factory = Enhancer.create(
                   Object.class,
                   new Class[]{iface},
  -                new InterfaceCallbackFilter(),
  +                new InterfaceCallbackFilter(iface),
                   new SimpleCallbacks());
   
           // build the method table
  
  
  

Mime
View raw message