com.sun.mfwk.cms.model.measurement
Class PerformanceMfModel

java.lang.Object
  extended bycom.sun.mfwk.cms.model.measurement.PerformanceMfModel
All Implemented Interfaces:
ByClassesGenericModel, GenericModel, PerformanceGenericModel

public class PerformanceMfModel
extends java.lang.Object
implements PerformanceGenericModel

The PerformanceMfModel class is an implentation of the com.sun.management.oss.impl.model.measurement.PerformanceGenericModel.

This implementation allows to plug the Monitoring Framework CIB data model and JSR-77 data model into the com.sun.management.oss.impl.factory.measurement.JmxJVTPerformanceMonitorSession factory/jobs layer. Using this implementation, the com.sun.management.oss.impl.factory.measurement factory is able to create/manage measurement jobs that directly interact with the CIB/JSR-77 objects instanciated in the same JMX context of the factory.

Here is a description of how this implementation works and what it allows the factory to monitor:

Observable objects:
This implementation allows 4 types of CIB (Core information base) objects to be monitored (i.e: you can create measurement jobs on 4 types of CIB objects). The observable CIB objects are the ones that expose open statistics (i.e: have the getOpenStats method) that is:

This implementation also allows the JSR-77 (Java 2 Platform, Enterprise Edition Management Specification) MBeans (monitored objects) to be monitored. These objects are:

In terms of ObjectName, the following rules are derived from these requirements:

For an MBean to be monitorable, his ObjectName must:

For JSR-77 objects:

For CIB objects:

Observable classes:
The observable classes that are considered by this implementation are real Java classes, including the full package name of the class. Any object instance of a Java class having the getOpenStats() method and matching the naming rules described in the Observable objects section is a monitorable object.

For instance, if the ObjectName "msgCP_module:type=CIBProduct.CIBApplication,name=MSG_SRV_instance1084877186031,CIBProduct=MSG_SRV" corresponds to an instance of the "com.sun.mfwk.cib.CIBApplication" class, you can create a 'by classes' job on the "com.sun.mfwk.cib.CIBApplication" class and this object will be taken into account by the job.

To sum up: the observable classes set is the Java classes set of the objects instanciated with an ObjectName matching the naming rules.

Observable attributes:
Considering the MBeans (ObjectName) supported by this implentation (matching the previous naming rules), the set of the observable attributes supported by this implementation is made of (for either J2EE or CIB objects):

These attributes form a subset of every possible values you can get from the MBeans: only the attributes of a type defined in com.sun.management.oss.pm.measurement.com.sun.management.oss.pm.measurement are considered. The supported simple types are (as a reminder):

What we call simple attributes are the attributes of the MBean with a simple type, that is, the attributes you can retrieve with a simple getter. For instance if the MBean has a getter getFoo() which returns an object of a supported simple type. Then the "foo" attribute is monitorable.

This implementation will also handle only the attributes contained in the open statistics (retieved with getOpenStats) if they are of a supported simple type.

Observable attributes naming:
Let's take an exemple for a better understanding of the monitorable attribute naming rules. Considering the object of class "com.sun.mfwk.cib.CIBResource" with the ObjectName "storeCP_module:type=CIBProduct.CIBApplication.CIBResource,name=STORE,CIBProduct=STORE_SRV,CIBApplication=STORE_SRV_instance1084891119618", here is a list of every monitorable attributes of this object:

Open statistics:

Simple attributes:

A dotted attribute notation (e.g: "OperationTime.StartTime") represents the leaf of the open statistic whose name is "OperationTime". Only one level (one dot character) is supported in the implementation as far as the open statistics are conserned. If you want to create a job that retrieves the "OperationTime.StartTime" attribute of the MBean, use a PerformanceAttributeDescriptor that has "OperationTime.StartTime" as name and PerformanceAttributeDescriptor.LONG as type (java.lang.Long).

To specify every attributes of an open statistic, you can use the open statistic name. For instance, using a PerformanceAttributeDescriptor that has "OperationTime" as name and PerformanceAttributeDescriptor.COMPOSITE_DATA as type (special type for open statistics), you will get every simple attributes under the "OperationTime" open statistic that is:

If you use a non dotted notation and you use any type other than the special one PerformanceAttributeDescriptor.COMPOSITE_DATA, you specify a simple attribute. Exemple: using a PerformanceAttributeDescriptor that has "AvailabilityStatusDegradedTime" as name and PerformanceAttributeDescriptor.LONG as type (java.lang.Long), you will get the value of the simple "AvailabilityStatusDegradedTime" attribute in your reports.

Granularities:
The CIB and JSR-77 data models do not have particular limits regarding the supported granularities. The getSupportedGranularities method is however implemented, returning a large number of possible second values. This method is useless as the JmxJVTOperationalStatusMonitorSession currently allows the usage of any strictly positive value as far as the granularity is concerned.

Important dynamicity aspects:
Considering the following methods:

Any information returned by these methods are totally dynamic. It means that if you (the measurement jobs factory) call these methods to know what are the observable classes/objects/attributes, they will return best effort answers, i.e: they will give available information according to what are the current object instances in the MBeanServer if any available. For instance, getSupportedObservableClasses will return no classes while no supported CIB/JSR-77 objects are instanciated in the MBeanServer.

This is mainly due to the fact that we want every classes (that could be created by a component product team inheriting from one of the classes we support) to be monitorable with the current implementation: no classes/object names/attribute names have been hardcoded in this implementation.

However, if you know by advance a correct class/ObjectName/attribute name, you can create a job on it and the job will be able to work properly once the observed entity is instanciated in the MBeanServer.

Copyright (c) 2004 Sun Microsystems

Version:
1.0
Author:
Mathieu Rossignol
See Also:
com.sun.management.oss.impl.model.measurement.PerformanceGenericModel

Constructor Summary
PerformanceMfModel()
          This constructor creates a PerformanceMfModel.
 
Method Summary
 GenericObject[] getData(javax.management.ObjectName[] dnList, PerformanceAttributeDescriptor[] attributesToMeasure)
          getData Collects wanted attribute values for each specified object.
 PerformanceAttributeDescriptor[] getObservableAttributes(java.lang.String observableObjectClassName)
          getObservableAttributes will return all observable attributes for a particular class.
 ObservableObjectClassIterator getObservableObjectClasses()
          getObservableObjectClasses will return all observable object classes in the model.
 ObservableObjectIterator getObservableObjects(java.lang.String observableObjectClassName, javax.management.ObjectName base)
          getObservableObjects will return all observable objects of a certain class under a level determined by the base.
 int[] getSupportedGranularities(java.lang.String observableObjectClass)
          getSupportedGranularities will return an array of granularities that is supported by the supplied observable object class.
 javax.management.ObjectName[] getSupportedObservableObjects(javax.management.ObjectName[] dnList)
          getSupportedObservableObjects will filter out which of the potentially observable objects are actually observable.
 boolean hasPerformanceAttributes(javax.management.ObjectName dn, PerformanceAttributeDescriptor[] attributesToMeasure)
          Returns true if the given object has every attributes specified in attributesToMeasure.
 boolean isMatchingNamingRules(javax.management.ObjectName on)
          Checks if an obect is matching the naming rules of the data model.
 java.lang.String isOfClass(javax.management.ObjectName on, java.lang.String[] classNames)
          isOfClass Checks if an object is of one of the given classes.
 boolean isValidClass(java.lang.String className)
          Returns true if the given className is valid in this data model context.
 void setMBS(javax.management.MBeanServer server)
          setMBS is the first method called by the factory, after having instanciated its own GenericModel object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PerformanceMfModel

public PerformanceMfModel()
This constructor creates a PerformanceMfModel.

Method Detail

setMBS

public void setMBS(javax.management.MBeanServer server)
            throws java.lang.IllegalArgumentException
setMBS is the first method called by the factory, after having instanciated its own GenericModel object. It must be coded so that the MBeanServer is kept into object and used for performing necessary JMX queries.

Specified by:
setMBS in interface GenericModel
Parameters:
server - the MBeanServer to be used for queries.
Throws:
java.lang.IllegalArgumentException - Is raised if the input parameter is null.

getData

public GenericObject[] getData(javax.management.ObjectName[] dnList,
                               PerformanceAttributeDescriptor[] attributesToMeasure)
getData Collects wanted attribute values for each specified object.

See com.sun.management.oss.impl.model.measurement.PerformanceGenericModel.getData(ObjectName[] dnList, PerformanceAttributeDescriptor[] attributesToMeasure).

See the top description of this page for knowing how data (attributes) are retrieved.

Specified by:
getData in interface PerformanceGenericModel
Parameters:
dnList - The distinguished names of the objects that should be in browsed.
attributesToMeasure - The attributes that are going to be collected.
Returns:
Data collected

getSupportedObservableObjects

public javax.management.ObjectName[] getSupportedObservableObjects(javax.management.ObjectName[] dnList)
getSupportedObservableObjects will filter out which of the potentially observable objects are actually observable.

See the top description of this page for knowing what are the objects supported by this implementation.

Specified by:
getSupportedObservableObjects in interface GenericModel
Parameters:
dnList - The distinguished names of the objects that should be browsed.
Returns:
List of the supported objects.

getSupportedGranularities

public int[] getSupportedGranularities(java.lang.String observableObjectClass)
                                throws java.lang.IllegalArgumentException
getSupportedGranularities will return an array of granularities that is supported by the supplied observable object class.

See the top description of this page for futher information.

Specified by:
getSupportedGranularities in interface GenericModel
Parameters:
observableObjectClass - Class you want to know the supported granularities for.
Returns:
An array of granularities that is supported by the supplied observable object class.
Throws:
java.lang.IllegalArgumentException - Is raised if an arguement has a wrong format/value.

isValidClass

public boolean isValidClass(java.lang.String className)
Returns true if the given className is valid in this data model context.

See the top description of this page for the description of what is a valid class.

Specified by:
isValidClass in interface ByClassesGenericModel
Parameters:
className - The class to check for validity.
Returns:
Validity of the class.

isMatchingNamingRules

public boolean isMatchingNamingRules(javax.management.ObjectName on)
Checks if an obect is matching the naming rules of the data model.

See the top description of this page for the naming rules.

Specified by:
isMatchingNamingRules in interface GenericModel
Parameters:
on - The object name to check for validity
Returns:
True if the object name is valid.

getObservableObjectClasses

public ObservableObjectClassIterator getObservableObjectClasses()
getObservableObjectClasses will return all observable object classes in the model.

See the top description of this page for the description of what is an observable class.

Specified by:
getObservableObjectClasses in interface GenericModel
Returns:
Observable classes.

getObservableObjects

public ObservableObjectIterator getObservableObjects(java.lang.String observableObjectClassName,
                                                     javax.management.ObjectName base)
                                              throws java.lang.IllegalArgumentException
getObservableObjects will return all observable objects of a certain class under a level determined by the base. If base is not specified then all instances of that class are returned.

See the top description of this page for the description of what is an observable object.

Specified by:
getObservableObjects in interface GenericModel
Parameters:
observableObjectClassName - The class name of the observable object instances to be found.
base - The JMX pattern to use for searching for observable objects.
Returns:
Iterator that contains all supported observable objects.
Throws:
java.lang.IllegalArgumentException - Is raised if the input paramters are not valid.

getObservableAttributes

public PerformanceAttributeDescriptor[] getObservableAttributes(java.lang.String observableObjectClassName)
                                                         throws java.lang.IllegalArgumentException
getObservableAttributes will return all observable attributes for a particular class.

See the top description of this page for the description of what is an observable attribute.

Specified by:
getObservableAttributes in interface GenericModel
Parameters:
observableObjectClassName - The class name of the observable object instances to be found.
Returns:
An array of attribute descriptors.
Throws:
java.lang.IllegalArgumentException - Is raised if the input parameters are not valid.

isOfClass

public java.lang.String isOfClass(javax.management.ObjectName on,
                                  java.lang.String[] classNames)
                           throws java.lang.IllegalArgumentException
isOfClass Checks if an object is of one of the given classes. Returns the Class the object is of or null if object is not of one of the provided classes.

See the top description of this page for the description of what is a valid class.

Specified by:
isOfClass in interface ByClassesGenericModel
Parameters:
on - The object we want to know the class.
classNames - The proposed classes.
Returns:
The Class the object is of or null if object is not of one of the provided classes.
Throws:
java.lang.IllegalArgumentException - Is raised if the input paramters are not valid.

hasPerformanceAttributes

public boolean hasPerformanceAttributes(javax.management.ObjectName dn,
                                        PerformanceAttributeDescriptor[] attributesToMeasure)
                                 throws ObjectNotFoundException
Returns true if the given object has every attributes specified in attributesToMeasure.

See the top description of this page for the description of what is an observable attribute.

Specified by:
hasPerformanceAttributes in interface PerformanceGenericModel
Parameters:
dn - Object name you want to check for attributes.
attributesToMeasure - Attributes to check.
Returns:
True if the provided object has every attributes to check.
Throws:
ObjectNotFoundException - Is raised if the object is not found.