1 /* 2 * The contents of this file are subject to the terms 3 * of the Common Development and Distribution License 4 * (the License). You may not use this file except in 5 * compliance with the License. 6 * 7 * You can obtain a copy of the license at 8 * https://glassfish.dev.java.net/public/CDDLv1.0.html or 9 * glassfish/bootstrap/legal/CDDLv1.0.txt. 10 * See the License for the specific language governing 11 * permissions and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL 14 * Header Notice in each file and include the License file 15 * at glassfish/bootstrap/legal/CDDLv1.0.txt. 16 * If applicable, add the following below the CDDL Header, 17 * with the fields enclosed by brackets [] replaced by 18 * you own identifying information: 19 * "Portions Copyrighted [year] [name of copyright owner]" 20 * 21 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 22 */ 23 package com.sun.appserv.management.monitor; 24 25 import javax.management.openmbean.CompositeDataSupport; 26 import javax.management.j2ee.statistics.Stats; 27 import javax.management.j2ee.statistics.Statistic; 28 29 /** 30 Monitoring MBeans which expose one or more 31 {@link Statistic} implement this interface. 32 <p> 33 Each MonitoringStats MBean exposes Statistics as Attributes formed 34 using the following pattern: 35 <pre> <i>statistic-name</i>_<i>field-name</i> </pre> 36 For example, a CountStatistic names "Hosts" would generate the following 37 Attributes: 38 <ul> 39 <li>Hosts_Name</li> 40 <li>Hosts_Description</li> 41 <li>Hosts_Unit</li> 42 <li>Hosts_StartTime</li> 43 <li>Hosts_LastSampleTime</li> 44 <li>Hosts_Count</li> 45 </ul> 46 For most purposes, it is the "<i>name</i>_Count" value which should be of 47 primary interest. 48 <p> 49 The type of the Statistic will govern how many Attributes are generated, 50 based on its actual fields, but every Statistic interface will have 51 at least the Name, Description, Unit, StartTime and LastSampleTime fields present. 52 <p> 53 <b>Note:</b> These derived Attributes are not made available directly 54 in the interface for the MBean</b>; please refer to the documentation 55 for each MonitoringStats MBean to determine which Statistics are available, 56 and thus which derived Attributes available. 57 @see com.sun.appserv.management.base.AMX 58 @see com.sun.appserv.management.base.StdAttributesAccess 59 @see com.sun.appserv.management.base.Util#getExtra 60 @see com.sun.appserv.management.base.Extra 61 @see javax.management.j2ee.statistics.Statistic 62 */ 63 public interface MonitoringStats extends Monitoring 64 { 65 /** 66 Get a JSR 77 Stats object for all available statistics. Semantically, 67 the returned Stats object MUST be a "snapshot" to the current state 68 of the world. 69 */ 70 public Stats getStats(); 71 public String getStatsInterfaceName(); 72 73 /** 74 Get a specific JSR 77 Statistic. 75 76 @param name the Statistic name 77 */ 78 public Statistic getStatistic( String name ); 79 80 /** 81 Get specific JSR 77 Statistics. If a Statistic is not found, then null 82 is returned in its array slot. 83 84 @param names the Statistic names 85 @return corresponding values for the names 86 */ 87 public Statistic[] getStatistics( String[] names ); 88 89 /** 90 Get the names of all available Statistics. 91 */ 92 public String[] getStatisticNames( ); 93 94 95 /** 96 Get a JSR 77 Stats object encoded as a standard serializable JMX OpenType. 97 */ 98 public CompositeDataSupport getOpenStats(); 99 100 101 /** 102 Get a JSR 77 Statistic encoded as a standard serializable JMX OpenType. 103 104 @param name the Statistic name 105 */ 106 public CompositeDataSupport getOpenStatistic( String name ); 107 108 109 /** 110 Get JSR 77 Statistics encoded as a standard serializable JMX OpenTypes. 111 If a Statistic is not found, then null is returned in its array slot. 112 113 @param names the Statistic names 114 @return corresponding values for the names 115 */ 116 public CompositeDataSupport[] getOpenStatistics( String[] names ); 117 118 119 /** 120 Refresh any stale data. This may or may not be applicable, depending 121 on how the implementation performs its data collection. If the data 122 is always "live", then the implementation of this routine does nothing. 123 124 @return true if there may be new data present, false otherwise 125 */ 126 public boolean refresh(); 127 } 128 129 130 131 132