User: ejort   
  Date: 02/01/26 13:09:41

  Modified:    src/main/org/jboss/mx/server MBeanInvoker.java
                        StandardMBeanInvoker.java
  Log:
  Use the attributes class name not the args class name for setAttribute - needs 
optimizing
  
  Revision  Changes    Path
  1.5       +24 -3     jmx/src/main/org/jboss/mx/server/MBeanInvoker.java
  
  Index: MBeanInvoker.java
  ===================================================================
  RCS file: /cvsroot/jboss/jmx/src/main/org/jboss/mx/server/MBeanInvoker.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- MBeanInvoker.java 2002/01/24 22:14:22     1.4
  +++ MBeanInvoker.java 2002/01/26 21:09:41     1.5
  @@ -16,6 +16,7 @@
   import javax.management.DynamicMBean;
   import javax.management.Attribute;
   import javax.management.AttributeList;
  +import javax.management.MBeanAttributeInfo;
   import javax.management.MBeanInfo;
   import javax.management.MBeanOperationInfo;
   import javax.management.MBeanParameterInfo;
  @@ -43,7 +44,7 @@
    *
    *
    * @author  <a href="mailto:[EMAIL PROTECTED]";>Juha Lindfors</a>.
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
    *   
    */
   public abstract class MBeanInvoker
  @@ -53,6 +54,7 @@
      protected Interceptor stack        = null;
      protected Object resource          = null;
      protected Descriptor[] descriptors = null;
  +   protected MBeanInfo info = null;
   
      // Public --------------------------------------------------------
      public Object getResource()
  @@ -128,14 +130,33 @@
   
      public void setAttribute(Attribute attribute) throws AttributeNotFoundException, 
InvalidAttributeValueException, MBeanException, ReflectionException
      {
  +      // REVIEW: This NEEDS to be optimized
  +      // Get the real signature of the attribute
  +      String attributeClassName = null;
  +      String attributeName = attribute.getName();
  +      MBeanAttributeInfo[] attInfos = info.getAttributes();
  +      for (int i = 0; i < attInfos.length; i++)
  +      {
  +         if (attInfos[i].getName().equals(attributeName))
  +         {
  +            attributeClassName = attInfos[i].getType();
  +            break;
  +         }
  +      }
  +      if (attributeClassName == null)
  +      {
  +         throw new AttributeNotFoundException(attributeName);
  +      }
  +
  +      // Set the value
         try
         {
            Invocation invocation = new Invocation(
  -                                    attribute.getName(),
  +                                    attributeName,
                                       Invocation.ATTRIBUTE,
                                       Invocation.WRITE,
                                       new Object[] { attribute.getValue() },
  -                                    new String[] { 
attribute.getValue().getClass().getName() },
  +                                    new String[] { attributeClassName },
                                       descriptors
                                    );
            stack.invoke(invocation);
  
  
  
  1.3       +1 -2      jmx/src/main/org/jboss/mx/server/StandardMBeanInvoker.java
  
  Index: StandardMBeanInvoker.java
  ===================================================================
  RCS file: /cvsroot/jboss/jmx/src/main/org/jboss/mx/server/StandardMBeanInvoker.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StandardMBeanInvoker.java 2002/01/12 20:10:53     1.2
  +++ StandardMBeanInvoker.java 2002/01/26 21:09:41     1.3
  @@ -43,7 +43,7 @@
    * @see org.jboss.mx.interceptor.StandardMBeanInterceptor
    *
    * @author  <a href="mailto:[EMAIL PROTECTED]";>Juha Lindfors</a>.
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    *   
    */
   public class StandardMBeanInvoker
  @@ -51,7 +51,6 @@
   {
   
      // Attributes ----------------------------------------------------
  -   private MBeanInfo info  = null;
   
      // Constructors --------------------------------------------------
      public StandardMBeanInvoker(Object resource) throws NotCompliantMBeanException, 
ReflectionException
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to