User: juhalindfors
  Date: 01/12/05 06:12:46

  Modified:    src/main/javax/management MBeanAttributeInfo.java
                        MBeanConstructorInfo.java MBeanOperationInfo.java
  Log:
  std mbean constructors
  
  Revision  Changes    Path
  1.2       +26 -6     jmx/src/main/javax/management/MBeanAttributeInfo.java
  
  Index: MBeanAttributeInfo.java
  ===================================================================
  RCS file: /cvsroot/jboss/jmx/src/main/javax/management/MBeanAttributeInfo.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MBeanAttributeInfo.java   2001/12/03 02:01:30     1.1
  +++ MBeanAttributeInfo.java   2001/12/05 14:12:46     1.2
  @@ -3,9 +3,8 @@
    */
   package javax.management;
   
  -public class MBeanAttributeInfo
  -         extends MBeanFeatureInfo
  -   implements java.io.Serializable, java.lang.Cloneable {
  +public class MBeanAttributeInfo extends MBeanFeatureInfo
  +   implements java.io.Serializable, Cloneable {
   
      protected String type = null;
      protected boolean isReadable = false;
  @@ -28,10 +27,31 @@
      public MBeanAttributeInfo(java.lang.String name,
                                java.lang.String description,
                                java.lang.reflect.Method getter,
  -                             java.lang.reflect.Method setter)
  -   throws IntrospectionException {
  +                             java.lang.reflect.Method setter) throws 
IntrospectionException {
         super(name, description);
  -      throw new Error("NYI");
  +      
  +      if (getter != null) {
  +         this.isReadable = true;
  +         if (getter.getName().startsWith("is"))
  +            this.isIs = true;
  +         this.type = getter.getReturnType().getName();
  +      }
  +      
  +      if (setter != null) {
  +         this.isWritable = true;
  +         
  +         if (type == null) {
  +            try {
  +               type = setter.getParameterTypes() [0].getName();
  +            }
  +            catch (ArrayIndexOutOfBoundsException e) {
  +               throw new IntrospectionException("Attribute setter is lacking type: 
" + name);
  +            }
  +         }
  +         
  +         if (!(type.equals(setter.getParameterTypes() [0].getName())))
  +            throw new IntrospectionException("Attribute type mismatch: " + name);
  +      }
      }
   
      public java.lang.Object clone() throws CloneNotSupportedException {
  
  
  
  1.2       +11 -2     jmx/src/main/javax/management/MBeanConstructorInfo.java
  
  Index: MBeanConstructorInfo.java
  ===================================================================
  RCS file: /cvsroot/jboss/jmx/src/main/javax/management/MBeanConstructorInfo.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MBeanConstructorInfo.java 2001/12/03 02:01:30     1.1
  +++ MBeanConstructorInfo.java 2001/12/05 14:12:46     1.2
  @@ -4,15 +4,24 @@
   package javax.management;
   
   public class MBeanConstructorInfo extends MBeanFeatureInfo
  -   implements java.io.Serializable, java.lang.Cloneable {
  +   implements java.io.Serializable, Cloneable {
   
      protected MBeanParameterInfo[] signature = null;
      
      public MBeanConstructorInfo(java.lang.String description,
                                  java.lang.reflect.Constructor constructor) {
         super(constructor.getName(), description);
  -      throw new Error("NYI");
  +
  +      Class[] sign = constructor.getParameterTypes();
  +      signature = new MBeanParameterInfo[sign.length];
  +      
  +      for (int i = 0; i < sign.length; ++i) {
  +         String name = sign[i].getName();
  +         signature[i] = new MBeanParameterInfo(name, name, "MBean Constructor 
Parameter.");
  +      }
  +
      }
  +   
      public MBeanConstructorInfo(java.lang.String name,
                                  java.lang.String description,
                                  MBeanParameterInfo[] signature) {
  
  
  
  1.2       +40 -20    jmx/src/main/javax/management/MBeanOperationInfo.java
  
  Index: MBeanOperationInfo.java
  ===================================================================
  RCS file: /cvsroot/jboss/jmx/src/main/javax/management/MBeanOperationInfo.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MBeanOperationInfo.java   2001/12/03 02:01:30     1.1
  +++ MBeanOperationInfo.java   2001/12/05 14:12:46     1.2
  @@ -3,42 +3,62 @@
    */
   package javax.management;
   
  -public class MBeanOperationInfo
  -         extends MBeanFeatureInfo
  -   implements java.io.Serializable, java.lang.Cloneable {
  +public class MBeanOperationInfo extends MBeanFeatureInfo
  +   implements java.io.Serializable, Cloneable {
   
   
  -   public static final int INFO = 0x1234;
  -
  -   public static final int ACTION = 0x332;
  -
  +   public static final int INFO        = 0x1234;
  +   public static final int ACTION      = 0x332;
      public static final int ACTION_INFO = 0xabcd;
  -
  -   public static final int UNKNOWN = 0xdead;
  +   public static final int UNKNOWN     = 0xdead;
   
   
  +   protected int impact = UNKNOWN;
  +   protected MBeanParameterInfo[] signature = null;
  +   protected String returnType = null;
  +   
      public MBeanOperationInfo(java.lang.String description,
  -                             java.lang.reflect.Method method) {super("", "");}
  -   public MBeanOperationInfo(java.lang.String name,
  -                             java.lang.String description,
  +                             java.lang.reflect.Method method) {
  +      super(method.getName(), description);
  +      this.returnType = method.getReturnType().getName();
  +      
  +      Class[] sign = method.getParameterTypes();
  +      signature = new MBeanParameterInfo[sign.length];
  +      
  +      for (int i = 0; i < sign.length; ++i) {
  +         String name = sign[i].getName();
  +         signature[i] = new MBeanParameterInfo(name, name, "MBean Operation 
Parameter.");
  +      }
  +   }
  +   
  +   public MBeanOperationInfo(String name, String description,
                                MBeanParameterInfo[] signature,
  -                             java.lang.String type,
  -                             int impact) {super("", "");}
  +                             String returnType, int impact) {
  +      super(name, description);
  +      this.signature = signature;
  +      this.returnType = returnType;
  +      this.impact = impact;
  +   }
   
  -   public java.lang.Object clone() {
  -      return null;
  +   public java.lang.Object clone() throws CloneNotSupportedException {
  +      MBeanOperationInfo clone = (MBeanOperationInfo)super.clone();
  +      clone.signature = getSignature();
  +      clone.returnType = getReturnType();
  +      clone.impact = getImpact();
  +      
  +      return clone;
      }
   
  -   public java.lang.String getReturnType() {
  -      return null;
  +   public String getReturnType() {
  +      return returnType;
      }
   
      public MBeanParameterInfo[] getSignature() {
  -      return null;
  +      return signature;
      }
   
      public int getImpact() {
  -      return 0;
  +      return impact;
      }
   
   }
  
  
  

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

Reply via email to