699 "getMBeanInfo()",printModelMBeanInfo(modelMBeanInfo));
700 }
701
702 return((MBeanInfo) modelMBeanInfo.clone());
703 }
704
705 private String printModelMBeanInfo(ModelMBeanInfo info) {
706 final StringBuilder retStr = new StringBuilder();
707 if (info == null) {
708 if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
709 MODELMBEAN_LOGGER.logp(Level.FINER,
710 RequiredModelMBean.class.getName(),
711 "printModelMBeanInfo(ModelMBeanInfo)",
712 "ModelMBeanInfo to print is null, " +
713 "printing local ModelMBeanInfo");
714 }
715 info = modelMBeanInfo;
716 }
717
718 retStr.append("\nMBeanInfo for ModelMBean is:");
719 retStr.append("\nCLASSNAME: \t"+ info.getClassName());
720 retStr.append("\nDESCRIPTION: \t"+ info.getDescription());
721
722
723 try {
724 retStr.append("\nMBEAN DESCRIPTOR: \t"+
725 info.getMBeanDescriptor());
726 } catch (Exception e) {
727 retStr.append("\nMBEAN DESCRIPTOR: \t" + " is invalid");
728 }
729
730 retStr.append("\nATTRIBUTES");
731
732 final MBeanAttributeInfo[] attrInfo = info.getAttributes();
733 if ((attrInfo != null) && (attrInfo.length>0)) {
734 for (int i=0; i<attrInfo.length; i++) {
735 final ModelMBeanAttributeInfo attInfo =
736 (ModelMBeanAttributeInfo)attrInfo[i];
737 retStr.append(" ** NAME: \t"+ attInfo.getName());
738 retStr.append(" DESCR: \t"+ attInfo.getDescription());
739 retStr.append(" TYPE: \t"+ attInfo.getType() +
740 " READ: \t"+ attInfo.isReadable() +
741 " WRITE: \t"+ attInfo.isWritable());
742 retStr.append(" DESCRIPTOR: " +
743 attInfo.getDescriptor().toString());
744 }
745 } else {
746 retStr.append(" ** No attributes **");
747 }
748
749 retStr.append("\nCONSTRUCTORS");
750 final MBeanConstructorInfo[] constrInfo = info.getConstructors();
751 if ((constrInfo != null) && (constrInfo.length > 0 )) {
752 for (int i=0; i<constrInfo.length; i++) {
753 final ModelMBeanConstructorInfo ctorInfo =
754 (ModelMBeanConstructorInfo)constrInfo[i];
755 retStr.append(" ** NAME: \t"+ ctorInfo.getName());
756 retStr.append(" DESCR: \t"+
757 ctorInfo.getDescription());
758 retStr.append(" PARAM: \t"+
759 ctorInfo.getSignature().length +
760 " parameter(s)");
761 retStr.append(" DESCRIPTOR: " +
762 ctorInfo.getDescriptor().toString());
763 }
764 } else {
765 retStr.append(" ** No Constructors **");
766 }
767
768 retStr.append("\nOPERATIONS");
769 final MBeanOperationInfo[] opsInfo = info.getOperations();
770 if ((opsInfo != null) && (opsInfo.length>0)) {
771 for (int i=0; i<opsInfo.length; i++) {
772 final ModelMBeanOperationInfo operInfo =
773 (ModelMBeanOperationInfo)opsInfo[i];
774 retStr.append(" ** NAME: \t"+ operInfo.getName());
775 retStr.append(" DESCR: \t"+ operInfo.getDescription());
776 retStr.append(" PARAM: \t"+
777 operInfo.getSignature().length +
778 " parameter(s)");
779 retStr.append(" DESCRIPTOR: " +
780 operInfo.getDescriptor().toString());
781 }
782 } else {
783 retStr.append(" ** No operations ** ");
784 }
785
786 retStr.append("\nNOTIFICATIONS");
787
788 MBeanNotificationInfo[] notifInfo = info.getNotifications();
789 if ((notifInfo != null) && (notifInfo.length>0)) {
790 for (int i=0; i<notifInfo.length; i++) {
791 final ModelMBeanNotificationInfo nInfo =
792 (ModelMBeanNotificationInfo)notifInfo[i];
793 retStr.append(" ** NAME: \t"+ nInfo.getName());
794 retStr.append(" DESCR: \t"+ nInfo.getDescription());
795 retStr.append(" DESCRIPTOR: " +
796 nInfo.getDescriptor().toString());
797 }
798 } else {
799 retStr.append(" ** No notifications **");
800 }
801
802 retStr.append(" ** ModelMBean: End of MBeanInfo ** ");
803
804 return retStr.toString();
805 }
806
807 /**
808 * Invokes a method on or through a RequiredModelMBean and returns
809 * the result of the method execution.
810 * <P>
811 * If the given method to be invoked, together with the provided
812 * signature, matches one of RequiredModelMbean
813 * accessible methods, this one will be call. Otherwise the call to
814 * the given method will be tried on the managed resource.
815 * <P>
816 * The last value returned by an operation may be cached in
|
699 "getMBeanInfo()",printModelMBeanInfo(modelMBeanInfo));
700 }
701
702 return((MBeanInfo) modelMBeanInfo.clone());
703 }
704
705 private String printModelMBeanInfo(ModelMBeanInfo info) {
706 final StringBuilder retStr = new StringBuilder();
707 if (info == null) {
708 if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
709 MODELMBEAN_LOGGER.logp(Level.FINER,
710 RequiredModelMBean.class.getName(),
711 "printModelMBeanInfo(ModelMBeanInfo)",
712 "ModelMBeanInfo to print is null, " +
713 "printing local ModelMBeanInfo");
714 }
715 info = modelMBeanInfo;
716 }
717
718 retStr.append("\nMBeanInfo for ModelMBean is:");
719 retStr.append("\nCLASSNAME: \t").append(info.getClassName());
720 retStr.append("\nDESCRIPTION: \t").append(info.getDescription());
721
722
723 try {
724 retStr.append("\nMBEAN DESCRIPTOR: \t").append(info.getMBeanDescriptor());
725 } catch (Exception e) {
726 retStr.append("\nMBEAN DESCRIPTOR: \t is invalid");
727 }
728
729 retStr.append("\nATTRIBUTES");
730
731 final MBeanAttributeInfo[] attrInfo = info.getAttributes();
732 if ((attrInfo != null) && (attrInfo.length>0)) {
733 for (int i=0; i<attrInfo.length; i++) {
734 final ModelMBeanAttributeInfo attInfo =
735 (ModelMBeanAttributeInfo)attrInfo[i];
736 retStr.append(" ** NAME: \t").append(attInfo.getName());
737 retStr.append(" DESCR: \t").append(attInfo.getDescription());
738 retStr.append(" TYPE: \t").append(attInfo.getType())
739 .append(" READ: \t").append(attInfo.isReadable())
740 .append(" WRITE: \t").append(attInfo.isWritable());
741 retStr.append(" DESCRIPTOR: ").append(attInfo.getDescriptor());
742 }
743 } else {
744 retStr.append(" ** No attributes **");
745 }
746
747 retStr.append("\nCONSTRUCTORS");
748 final MBeanConstructorInfo[] constrInfo = info.getConstructors();
749 if ((constrInfo != null) && (constrInfo.length > 0 )) {
750 for (int i=0; i<constrInfo.length; i++) {
751 final ModelMBeanConstructorInfo ctorInfo =
752 (ModelMBeanConstructorInfo)constrInfo[i];
753 retStr.append(" ** NAME: \t").append(ctorInfo.getName());
754 retStr.append(" DESCR: \t").append(ctorInfo.getDescription());
755 retStr.append(" PARAM: \t")
756 .append(ctorInfo.getSignature().length)
757 .append(" parameter(s)");
758 retStr.append(" DESCRIPTOR: ").append(
759 ctorInfo.getDescriptor());
760 }
761 } else {
762 retStr.append(" ** No Constructors **");
763 }
764
765 retStr.append("\nOPERATIONS");
766 final MBeanOperationInfo[] opsInfo = info.getOperations();
767 if ((opsInfo != null) && (opsInfo.length>0)) {
768 for (int i=0; i<opsInfo.length; i++) {
769 final ModelMBeanOperationInfo operInfo =
770 (ModelMBeanOperationInfo)opsInfo[i];
771 retStr.append(" ** NAME: \t").append(operInfo.getName());
772 retStr.append(" DESCR: \t").append(operInfo.getDescription());
773 retStr.append(" PARAM: \t")
774 .append(operInfo.getSignature().length)
775 .append(" parameter(s)");
776 retStr.append(" DESCRIPTOR: ").append(operInfo.getDescriptor());
777 }
778 } else {
779 retStr.append(" ** No operations ** ");
780 }
781
782 retStr.append("\nNOTIFICATIONS");
783
784 MBeanNotificationInfo[] notifInfo = info.getNotifications();
785 if ((notifInfo != null) && (notifInfo.length>0)) {
786 for (int i=0; i<notifInfo.length; i++) {
787 final ModelMBeanNotificationInfo nInfo =
788 (ModelMBeanNotificationInfo)notifInfo[i];
789 retStr.append(" ** NAME: \t").append(nInfo.getName());
790 retStr.append(" DESCR: \t").append(nInfo.getDescription());
791 retStr.append(" DESCRIPTOR: ").append(nInfo.getDescriptor());
792 }
793 } else {
794 retStr.append(" ** No notifications **");
795 }
796
797 retStr.append(" ** ModelMBean: End of MBeanInfo ** ");
798
799 return retStr.toString();
800 }
801
802 /**
803 * Invokes a method on or through a RequiredModelMBean and returns
804 * the result of the method execution.
805 * <P>
806 * If the given method to be invoked, together with the provided
807 * signature, matches one of RequiredModelMbean
808 * accessible methods, this one will be call. Otherwise the call to
809 * the given method will be tried on the managed resource.
810 * <P>
811 * The last value returned by an operation may be cached in
|