jdk/src/java.management/share/classes/javax/management/modelmbean/RequiredModelMBean.java
changeset 27957 24b4e6082f19
parent 25859 3317bb8137f4
child 32834 e1dca5fe4de3
equal deleted inserted replaced
27956:7e6ab24dd745 27957:24b4e6082f19
   714             }
   714             }
   715             info = modelMBeanInfo;
   715             info = modelMBeanInfo;
   716         }
   716         }
   717 
   717 
   718         retStr.append("\nMBeanInfo for ModelMBean is:");
   718         retStr.append("\nMBeanInfo for ModelMBean is:");
   719         retStr.append("\nCLASSNAME: \t"+ info.getClassName());
   719         retStr.append("\nCLASSNAME: \t").append(info.getClassName());
   720         retStr.append("\nDESCRIPTION: \t"+ info.getDescription());
   720         retStr.append("\nDESCRIPTION: \t").append(info.getDescription());
   721 
   721 
   722 
   722 
   723         try {
   723         try {
   724             retStr.append("\nMBEAN DESCRIPTOR: \t"+
   724             retStr.append("\nMBEAN DESCRIPTOR: \t").append(info.getMBeanDescriptor());
   725                           info.getMBeanDescriptor());
       
   726         } catch (Exception e) {
   725         } catch (Exception e) {
   727             retStr.append("\nMBEAN DESCRIPTOR: \t" + " is invalid");
   726             retStr.append("\nMBEAN DESCRIPTOR: \t  is invalid");
   728         }
   727         }
   729 
   728 
   730         retStr.append("\nATTRIBUTES");
   729         retStr.append("\nATTRIBUTES");
   731 
   730 
   732         final MBeanAttributeInfo[] attrInfo = info.getAttributes();
   731         final MBeanAttributeInfo[] attrInfo = info.getAttributes();
   733         if ((attrInfo != null) && (attrInfo.length>0)) {
   732         if ((attrInfo != null) && (attrInfo.length>0)) {
   734             for (int i=0; i<attrInfo.length; i++) {
   733             for (int i=0; i<attrInfo.length; i++) {
   735                 final ModelMBeanAttributeInfo attInfo =
   734                 final ModelMBeanAttributeInfo attInfo =
   736                     (ModelMBeanAttributeInfo)attrInfo[i];
   735                     (ModelMBeanAttributeInfo)attrInfo[i];
   737                 retStr.append(" ** NAME: \t"+ attInfo.getName());
   736                 retStr.append(" ** NAME: \t").append(attInfo.getName());
   738                 retStr.append("    DESCR: \t"+ attInfo.getDescription());
   737                 retStr.append("    DESCR: \t").append(attInfo.getDescription());
   739                 retStr.append("    TYPE: \t"+ attInfo.getType() +
   738                 retStr.append("    TYPE: \t").append(attInfo.getType())
   740                               "    READ: \t"+ attInfo.isReadable() +
   739                         .append("    READ: \t").append(attInfo.isReadable())
   741                               "    WRITE: \t"+ attInfo.isWritable());
   740                         .append("    WRITE: \t").append(attInfo.isWritable());
   742                 retStr.append("    DESCRIPTOR: " +
   741                 retStr.append("    DESCRIPTOR: ").append(attInfo.getDescriptor());
   743                               attInfo.getDescriptor().toString());
       
   744             }
   742             }
   745         } else {
   743         } else {
   746             retStr.append(" ** No attributes **");
   744             retStr.append(" ** No attributes **");
   747         }
   745         }
   748 
   746 
   750         final MBeanConstructorInfo[] constrInfo = info.getConstructors();
   748         final MBeanConstructorInfo[] constrInfo = info.getConstructors();
   751         if ((constrInfo != null) && (constrInfo.length > 0 )) {
   749         if ((constrInfo != null) && (constrInfo.length > 0 )) {
   752             for (int i=0; i<constrInfo.length; i++) {
   750             for (int i=0; i<constrInfo.length; i++) {
   753                 final ModelMBeanConstructorInfo ctorInfo =
   751                 final ModelMBeanConstructorInfo ctorInfo =
   754                     (ModelMBeanConstructorInfo)constrInfo[i];
   752                     (ModelMBeanConstructorInfo)constrInfo[i];
   755                 retStr.append(" ** NAME: \t"+ ctorInfo.getName());
   753                 retStr.append(" ** NAME: \t").append(ctorInfo.getName());
   756                 retStr.append("    DESCR: \t"+
   754                 retStr.append("    DESCR: \t").append(ctorInfo.getDescription());
   757                               ctorInfo.getDescription());
   755                 retStr.append("    PARAM: \t")
   758                 retStr.append("    PARAM: \t"+
   756                         .append(ctorInfo.getSignature().length)
   759                               ctorInfo.getSignature().length +
   757                         .append(" parameter(s)");
   760                               " parameter(s)");
   758                 retStr.append("    DESCRIPTOR: ").append(
   761                 retStr.append("    DESCRIPTOR: " +
   759                         ctorInfo.getDescriptor());
   762                               ctorInfo.getDescriptor().toString());
       
   763             }
   760             }
   764         } else {
   761         } else {
   765             retStr.append(" ** No Constructors **");
   762             retStr.append(" ** No Constructors **");
   766         }
   763         }
   767 
   764 
   769         final MBeanOperationInfo[] opsInfo = info.getOperations();
   766         final MBeanOperationInfo[] opsInfo = info.getOperations();
   770         if ((opsInfo != null) && (opsInfo.length>0)) {
   767         if ((opsInfo != null) && (opsInfo.length>0)) {
   771             for (int i=0; i<opsInfo.length; i++) {
   768             for (int i=0; i<opsInfo.length; i++) {
   772                 final ModelMBeanOperationInfo operInfo =
   769                 final ModelMBeanOperationInfo operInfo =
   773                     (ModelMBeanOperationInfo)opsInfo[i];
   770                     (ModelMBeanOperationInfo)opsInfo[i];
   774                 retStr.append(" ** NAME: \t"+ operInfo.getName());
   771                 retStr.append(" ** NAME: \t").append(operInfo.getName());
   775                 retStr.append("    DESCR: \t"+ operInfo.getDescription());
   772                 retStr.append("    DESCR: \t").append(operInfo.getDescription());
   776                 retStr.append("    PARAM: \t"+
   773                 retStr.append("    PARAM: \t")
   777                               operInfo.getSignature().length +
   774                         .append(operInfo.getSignature().length)
   778                               " parameter(s)");
   775                         .append(" parameter(s)");
   779                 retStr.append("    DESCRIPTOR: " +
   776                 retStr.append("    DESCRIPTOR: ").append(operInfo.getDescriptor());
   780                               operInfo.getDescriptor().toString());
       
   781             }
   777             }
   782         } else {
   778         } else {
   783             retStr.append(" ** No operations ** ");
   779             retStr.append(" ** No operations ** ");
   784         }
   780         }
   785 
   781 
   788         MBeanNotificationInfo[] notifInfo = info.getNotifications();
   784         MBeanNotificationInfo[] notifInfo = info.getNotifications();
   789         if ((notifInfo != null) && (notifInfo.length>0)) {
   785         if ((notifInfo != null) && (notifInfo.length>0)) {
   790             for (int i=0; i<notifInfo.length; i++) {
   786             for (int i=0; i<notifInfo.length; i++) {
   791                 final ModelMBeanNotificationInfo nInfo =
   787                 final ModelMBeanNotificationInfo nInfo =
   792                     (ModelMBeanNotificationInfo)notifInfo[i];
   788                     (ModelMBeanNotificationInfo)notifInfo[i];
   793                 retStr.append(" ** NAME: \t"+ nInfo.getName());
   789                 retStr.append(" ** NAME: \t").append(nInfo.getName());
   794                 retStr.append("    DESCR: \t"+ nInfo.getDescription());
   790                 retStr.append("    DESCR: \t").append(nInfo.getDescription());
   795                 retStr.append("    DESCRIPTOR: " +
   791                 retStr.append("    DESCRIPTOR: ").append(nInfo.getDescriptor());
   796                               nInfo.getDescriptor().toString());
       
   797             }
   792             }
   798         } else {
   793         } else {
   799             retStr.append(" ** No notifications **");
   794             retStr.append(" ** No notifications **");
   800         }
   795         }
   801 
   796