geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject cvs commit: incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/service GeronimoMBeanInfo.java
Date Mon, 17 Nov 2003 00:47:17 GMT
chirino     2003/11/16 16:47:17

  Modified:    modules/kernel/src/java/org/apache/geronimo/kernel/service
                        GeronimoMBeanInfo.java
  Log:
  Added a few methods that makes it easier to add Operatiosn to the GMBean.
  
  Revision  Changes    Path
  1.10      +27 -1     incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/service/GeronimoMBeanInfo.java
  
  Index: GeronimoMBeanInfo.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/service/GeronimoMBeanInfo.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- GeronimoMBeanInfo.java	16 Nov 2003 23:32:29 -0000	1.9
  +++ GeronimoMBeanInfo.java	17 Nov 2003 00:47:17 -0000	1.10
  @@ -57,6 +57,7 @@
   
   import java.lang.reflect.Method;
   import java.lang.reflect.Modifier;
  +import java.util.ArrayList;
   import java.util.Collections;
   import java.util.HashMap;
   import java.util.HashSet;
  @@ -315,6 +316,31 @@
           operations.add(operationInfo);
       }
   
  +    public void addOperationsDeclaredIn(Class clazz) {
  +        if (immutable) {
  +            throw new IllegalStateException("Data is no longer mutable");
  +        }        
  +        Method[] methods = clazz.getDeclaredMethods();
  +        for (int i = 0; i < methods.length; i++) {
  +            addOperationFor(methods[i]);
  +        }
  +    }
  +
  +    public void addOperationFor(Method method) {
  +        if (immutable) {
  +            throw new IllegalStateException("Data is no longer mutable");
  +        }        
  +        ArrayList l = new ArrayList();
  +        Class[] classes = method.getParameterTypes();
  +        for (int j = 0; j < classes.length; j++) {
  +            Class class1 = classes[j];
  +            l.add(new GeronimoParameterInfo("arg"+(j+1), class1, ""));
  +        }
  +        GeronimoParameterInfo params[] = new GeronimoParameterInfo[l.size()];
  +        l.toArray(params);            
  +        addOperationInfo(new GeronimoOperationInfo(method.getName(), params, MBeanOperationInfo.ACTION,
""));
  +    }
  +    
       public Set getNotificationsSet() {
           return Collections.unmodifiableSet(notifications);
       }
  
  
  

Mime
View raw message