FileDocCategorySizeDatePackage
GenericMonitorMBean.javaAPI DocGlassfish v2 API10407Fri May 04 22:33:44 BST 2007com.sun.enterprise.admin.monitor

GenericMonitorMBean

public class GenericMonitorMBean extends BaseMonitorMBean
A simple monitoring MBean. This monitoring MBean does not expose any monitorable attributes but is used only to group other monitoring MBeans that expose monitorable properties.

Fields Summary
private static GenericMonitorMBean
root
Root monitoring MBean.
private static MBeanInfo
genericMBeanInfo
MBeanInfo for all generic MBeans, exposes no attributes.
private static com.sun.enterprise.util.i18n.StringManager
localStrings
Constructors Summary
public GenericMonitorMBean()
Creates a new instance of GenericMonitorMBean


               
      
    
Methods Summary
public java.lang.ObjectgetAttribute(java.lang.String str)
Get value of specified attribute. As there are no attributes exposed by this object, the method always throws AttributeNotFoundException.

throws
AttributeNotFoundException always

		String msg = localStrings.getString( "admin.monitor.unknown_attribute", str );
        throw new AttributeNotFoundException( msg );
    
public com.sun.enterprise.admin.monitor.types.MonitoredAttributeTypegetAttributeType(java.lang.String str)
Get type of specified monitored attribute. As there are no attributes exposed by this object, the method always throws UnsupportedOperationException.

throws
UnsupportedOperationException always.

		String msg = localStrings.getString( "admin.monitor.unsupported_getattributetype" );
        throw new UnsupportedOperationException( msg );
    
public javax.management.AttributeListgetAttributes(java.lang.String[] str)
Get the values of several attributes of the monitoring MBean. As there are no attributes exposed by this MBean, the method always returns a empty AttributeList.

param
attributes A list of the attributes to be retrieved.
returns
The list of attributes retrieved.

        return new AttributeList();
    
public javax.management.MBeanInfogetMBeanInfo()
Provides the exposed attributes and actions of the monitoring MBean using an MBeanInfo object.

returns
An instance of MBeanInfo with all attributes and actions exposed by this monitoring MBean.

        if (genericMBeanInfo == null) {
            genericMBeanInfo = createMBeanInfo(new HashMap());
        }
        return genericMBeanInfo;
    
private java.util.HashMapgetMonitoredObjectTypeMap(MonitoredObjectType[] typeList)
Get a map of type and MonitoredObjectType instances from the array of MonitoredObjectType instances.

        HashMap map = new HashMap();
        int size = (typeList != null) ? typeList.length : 0;
        for (int i = 0; i < size; i++) {
            map.put(typeList[i].getTypeName(), typeList[i]);
        }
        return map;
    
public java.util.MapgetMonitoringMetaData()
Get a map of monitored attribute names and their types. The keys in the map are names of the attribute and the values are their types. The type value are instances of class com.iplanet.ias.monitor.type.MonitoredAttributeType (or its sub-classes). As no attributes are exposed by this MBean, it always returns a empty map.

return
map of names and types of all monitored attributes

        return new HashMap();
    
public static com.sun.enterprise.admin.monitor.GenericMonitorMBeangetRoot()
Get root monitoring MBean. The root MBean is initialized when the server starts up and is available thereafter.

        if (root == null) {
            root = new GenericMonitorMBean();
            root.setNodeName(ObjectNames.kMonitoringRootClass);
            root.setNodeType(ObjectNames.kMonitoringRootClass);
            String instName = AdminService.getAdminService().getInstanceName();
            ObjectName objName = ObjectNames.getRootMonitorMBeanName(instName);
            objectNameMap.put(objName, root);
            root.setObjectName(objName);
        }
        return root;
    
private voidstartMonitoring(java.util.HashMap typeMap)
Start monitoring on all child mbeans whose type is included in the specified typeMap.

param
typeName a map of type string and MonitoredObjectType instance

        Iterator iter = childList.iterator();
        while (iter.hasNext()) {
            BaseMonitorMBean mBean = (BaseMonitorMBean)iter.next();
            if (typeMap.containsKey(mBean.getNodeType())) {
                if (mBean.getClass() == GenericMonitorMBean.class) {
                    ((GenericMonitorMBean)mBean).startMonitoring(typeMap);
                } else {
                    mBean.startMonitoring();
                }
            }
        }
    
public voidstartMonitoring()
Start monitoring on the resource represented by this MBean. This method starts monitoring on all child monitoring MBeans of this MBean by calling startMonitoring on them one after another.

        Iterator iter = childList.iterator();
        while (iter.hasNext()) {
            BaseMonitorMBean mBean = (BaseMonitorMBean)iter.next();
            mBean.startMonitoring();
        }
    
public voidstartMonitoring(MonitoredObjectType[] typeList)
Start monitoring on the resource represented by this MBean, if the type of this MBean is included in the type list. The method will also result in call to startMonitoring() of all child MBeans of the type included in the type list.

param
typeList list of monitored object types on which monitoring is to be enabled.

        HashMap typeMap = getMonitoredObjectTypeMap(typeList);
        startMonitoring(typeMap);
    
public voidstopMonitoring(MonitoredObjectType[] typeList)
Stop monitoring on the resource represented by this MBean, if the type of this MBean is included in the type list. The method will also result in call to startMonitoring() of all child MBeans of the type included in the type list.

param
typeList list of monitored object types on which monitoring is to be enabled.

        HashMap typeMap = getMonitoredObjectTypeMap(typeList);
        stopMonitoring(typeMap);
    
private voidstopMonitoring(java.util.HashMap typeMap)
Stop monitoring on all child mbeans whose type is included in the specified typeMap.

param
typeName a map of type string and MonitoredObjectType instance

        Iterator iter = childList.iterator();
        while (iter.hasNext()) {
            BaseMonitorMBean mBean = (BaseMonitorMBean)iter.next();
            if (typeMap.containsKey(mBean.getNodeType())) {
                if (mBean.getClass() == GenericMonitorMBean.class) {
                    ((GenericMonitorMBean)mBean).stopMonitoring(typeMap);
                } else {
                    mBean.stopMonitoring();
                }
            }
        }
    
public voidstopMonitoring()
Stop monitoring on the resource represented by this MBean. This method stops monitoring on all child monitoring MBeans of this MBean by calling stopMonitoring on them one after another.

        Iterator iter = childList.iterator();
        while (iter.hasNext()) {
            BaseMonitorMBean mBean = (BaseMonitorMBean)iter.next();
            mBean.stopMonitoring();
        }