dain        2004/02/24 23:49:10

  Modified:    modules/kernel/src/java/org/apache/geronimo/gbean
                        GBeanInfoFactory.java
  Log:
  Changed operations to be keyed by a method signature instead of just
  method name
  
  Revision  Changes    Path
  1.14      +48 -22    
incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanInfoFactory.java
  
  Index: GBeanInfoFactory.java
  ===================================================================
  RCS file: 
/home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanInfoFactory.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- GBeanInfoFactory.java     24 Feb 2004 22:36:01 -0000      1.13
  +++ GBeanInfoFactory.java     25 Feb 2004 07:49:10 -0000      1.14
  @@ -65,6 +65,8 @@
   import java.util.Map;
   import java.util.Set;
   
  +import org.apache.geronimo.kernel.jmx.MBeanOperationSignature;
  +
   /**
    * @version $Revision$ $Date$
    */
  @@ -91,7 +93,7 @@
       }
   
       public GBeanInfoFactory(Class clazz) {
  -        this(((Class) checkNotNull(clazz)).getName(), clazz.getName(), null);
  +        this(checkNotNull(clazz).getName(), clazz.getName(), null);
       }
   
       public GBeanInfoFactory(String name, String className) {
  @@ -103,7 +105,7 @@
       }
   
       public GBeanInfoFactory(Class clazz, GBeanInfo source) {
  -        this(((Class) checkNotNull(clazz)).getName(), clazz.getName(), 
source);
  +        this(checkNotNull(clazz).getName(), clazz.getName(), source);
       }
   
       public GBeanInfoFactory(String name, String className, GBeanInfo source) 
{
  @@ -113,19 +115,21 @@
           this.name = name;
           this.className = className;
           if (source != null) {
  -            Set sourceAttrs = source.getAttributes();
  -            if (sourceAttrs != null && !sourceAttrs.isEmpty()) {
  -                for (Iterator it = sourceAttrs.iterator(); it.hasNext();) {
  -                    GAttributeInfo gattrInfo = (GAttributeInfo) it.next();
  -                    attributes.put(gattrInfo.getName(), gattrInfo);
  +            Set sourceAttributes = source.getAttributes();
  +            if (sourceAttributes != null && !sourceAttributes.isEmpty()) {
  +                for (Iterator it = sourceAttributes.iterator(); 
it.hasNext();) {
  +                    GAttributeInfo attributeInfo = (GAttributeInfo) 
it.next();
  +                    attributes.put(attributeInfo.getName(), attributeInfo);
                   }
               }
   
  -            Set sourceOps = source.getOperations();
  -            if (sourceOps != null && !sourceOps.isEmpty()) {
  -                for (Iterator it = sourceOps.iterator(); it.hasNext();) {
  -                    GOperationInfo gopInfo = (GOperationInfo) it.next();
  -                    operations.put(gopInfo.getName(), gopInfo);
  +            Set sourceOperations = source.getOperations();
  +            if (sourceOperations != null && !sourceOperations.isEmpty()) {
  +                for (Iterator it = sourceOperations.iterator(); 
it.hasNext();) {
  +                    GOperationInfo operationInfo = (GOperationInfo) 
it.next();
  +                    operations.put(
  +                            new 
MBeanOperationSignature(operationInfo.getName(), 
operationInfo.getParameterList()),
  +                            operationInfo);
                   }
               }
               references.addAll(source.getReferences());
  @@ -138,15 +142,29 @@
       /**
        * Checks whether or not the input argument is null; otherwise it throws
        * [EMAIL PROTECTED] IllegalArgumentException}.
  -     * 
  -     * @param obj
  -     *            the input argument to validate
  +     *
  +     * @param clazz the input argument to validate
  +     * @throws IllegalArgumentException if input is null
  +     */
  +    private static Class checkNotNull(final Class clazz) {
  +        if (clazz == null) {
  +            throw new IllegalArgumentException("null argument supplied");
  +        }
  +        return clazz;
  +    }
  +
  +    /**
  +     * Checks whether or not the input argument is null; otherwise it throws
  +     * [EMAIL PROTECTED] IllegalArgumentException}.
  +     *
  +     * @param string the input argument to validate
  +     * @throws IllegalArgumentException if input is null
        */
  -    private static final Object checkNotNull(final Object obj) {
  -        if (obj == null) {
  +    private static String checkNotNull(final String string) {
  +        if (string == null) {
               throw new IllegalArgumentException("null argument supplied");
           }
  -        return obj;
  +        return string;
       }
   
       public void addInterface(Class intf) {
  @@ -207,8 +225,10 @@
           constructor = new GConstructorInfo(names, types);
       }
   
  -    public void addOperation(GOperationInfo info) {
  -        operations.put(info.getName(), info);
  +    public void addOperation(GOperationInfo operationInfo) {
  +        operations.put(
  +                new MBeanOperationSignature(operationInfo.getName(), 
operationInfo.getParameterList()),
  +                operationInfo);
       }
   
       public void addOperation(String name) {
  @@ -232,7 +252,13 @@
       }
   
       public GBeanInfo getBeanInfo() {
  -        return new GBeanInfo(name, className, attributes.values(), 
constructor, operations.values(), references,
  +        return new GBeanInfo(
  +                name,
  +                className,
  +                attributes.values(),
  +                constructor,
  +                operations.values(),
  +                references,
                   notifications);
       }
   }
  
  
  

Reply via email to