You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2003/11/26 03:10:08 UTC

cvs commit: incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/service GeronimoMBeanInfo.java GeronimoOperationInfo.java

djencks     2003/11/25 18:10:08

  Modified:    modules/kernel/src/java/org/apache/geronimo/kernel/service
                        GeronimoMBeanInfo.java GeronimoOperationInfo.java
  Log:
  Add more convenience ways of adding all ops from  a class to a target
  
  Revision  Changes    Path
  1.12      +12 -4     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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- GeronimoMBeanInfo.java	18 Nov 2003 02:23:35 -0000	1.11
  +++ GeronimoMBeanInfo.java	26 Nov 2003 02:10:08 -0000	1.12
  @@ -321,16 +321,24 @@
       }
   
       public void addOperationsDeclaredIn(Class clazz) {
  +        addOperationsDeclaredIn(clazz, DEFAULT_TARGET_NAME);
  +    }
  +
  +    public void addOperationFor(Method method) {
  +        addOperationFor(method, DEFAULT_TARGET_NAME);
  +    }
  +
  +    public void addOperationsDeclaredIn(Class clazz, String targetName) {
           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]);
  +            addOperationFor(methods[i], targetName);
           }
       }
   
  -    public void addOperationFor(Method method) {
  +    public void addOperationFor(Method method, String targetName) {
           if (immutable) {
               throw new IllegalStateException("Data is no longer mutable");
           }
  @@ -342,7 +350,7 @@
           }
           GeronimoParameterInfo params[] = new GeronimoParameterInfo[l.size()];
           l.toArray(params);
  -        addOperationInfo(new GeronimoOperationInfo(method.getName(), params, MBeanOperationInfo.ACTION, ""));
  +        addOperationInfo(new GeronimoOperationInfo(method.getName(), params, MBeanOperationInfo.ACTION, "", targetName));
       }
   
       public Set getNotificationsSet() {
  
  
  
  1.5       +7 -4      incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/service/GeronimoOperationInfo.java
  
  Index: GeronimoOperationInfo.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/service/GeronimoOperationInfo.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- GeronimoOperationInfo.java	14 Nov 2003 16:16:52 -0000	1.4
  +++ GeronimoOperationInfo.java	26 Nov 2003 02:10:08 -0000	1.5
  @@ -57,7 +57,6 @@
   
   import java.lang.reflect.Method;
   import java.util.Collections;
  -import java.util.LinkedList;
   import java.util.List;
   import java.util.Arrays;
   import java.util.ArrayList;
  @@ -68,7 +67,6 @@
   import org.apache.geronimo.kernel.service.GeronimoMBeanInfo;
   
   import net.sf.cglib.reflect.FastMethod;
  -import net.sf.cglib.reflect.FastClass;
   
   /**
    * Describes an operation on a GeronimoMBean.  This extension allows the properties to be mutable during setup,
  @@ -156,7 +154,7 @@
       private final int hashCode = System.identityHashCode(this);
   
       public GeronimoOperationInfo() {
  -        this(null, new GeronimoParameterInfo[] {}, 0, null);
  +        this(null);
       }
   
       public GeronimoOperationInfo(String name) {
  @@ -164,12 +162,17 @@
       }
   
       public GeronimoOperationInfo(String name, GeronimoParameterInfo[] parameterInfo, int impact, String description) {
  +        this(name, parameterInfo, impact, description, GeronimoMBeanInfo.DEFAULT_TARGET_NAME);
  +    }
  +
  +    public GeronimoOperationInfo(String name, GeronimoParameterInfo[] parameterInfo, int impact, String description, String targetName) {
           super("Ignore", null, null, "Ignore", MBeanOperationInfo.UNKNOWN);
           immutable = false;
           this.name = name;
           parameters = new ArrayList(Arrays.asList(parameterInfo));
           this.impact = impact;
           this.description = description;
  +        this.targetName = targetName;
           method = null;
           returnType = null;
           parameterTypes = null;