1 23 24 38 39 package com.sun.enterprise.admin.monitor.registry.spi; 40 import javax.management.j2ee.statistics.Statistic ; 41 import com.sun.enterprise.admin.monitor.stats.*; 42 import com.sun.enterprise.admin.common.constant.AdminConstants; 43 import java.util.logging.Logger ; 44 45 51 52 final class StatisticWorkaround { 53 private static final StatsDescriptionHelper helper = new StatsDescriptionHelper(); 54 private static Logger logger = Logger.getLogger(AdminConstants.kLoggerName); 55 static final Statistic [] populateDescriptions(final Statistic [] from) { 56 if (from == null) { 57 throw new IllegalArgumentException ("null arg"); 58 } 59 final int length = from.length; 60 final Statistic [] to = new Statistic [length]; 61 for (int i = 0 ; i < length ; i++) { 62 final Statistic as = from[i]; 63 final String name = as.getName(); 64 final String desc = helper.getDescription(name); 65 if (StatsDescriptionHelper.NO_DESCRIPTION_AVAILABLE.equals(desc)) { 66 to[i] = from[i]; 68 } 69 else { 70 attemptSettingDescription(as, desc); 71 to[i] = as; 72 } 73 } 74 return ( to ); 75 } 76 private static void attemptSettingDescription(final Statistic s, final String nd) { 77 if (s instanceof StatisticImpl) { 78 ((StatisticImpl)s).setDescription(nd); 79 logger.finest("New Description was set: " + nd); 80 } 81 else if (s instanceof AverageRangeStatisticImpl) { 82 ((AverageRangeStatisticImpl)s).setDescription(nd); 83 logger.finest("New Description was set: " + nd); 84 } 85 else if (s instanceof MutableBoundedRangeStatisticImpl) { 86 ((MutableBoundedRangeStatisticImpl)s).setDescription(nd); 87 logger.finest("New Description was set: " + nd); 88 } 89 else if (s instanceof MutableCountStatisticImpl) { 90 ((MutableCountStatisticImpl)s).setDescription(nd); 91 logger.finest("New Description was set: " + nd); 92 } 93 else if (s instanceof MutableTimeStatisticImpl) { 94 ((MutableTimeStatisticImpl)s).setDescription(nd); 95 logger.finest("New Description was set: " + nd); 96 } 97 } 98 } 99 | Popular Tags |