Show TOC Start of Content Area

Procedure documentation Building ObjectName(s) for the Resource MBean(s)  Locate the document in its SAP Library structure

Use

After getting a reference to the MBean server, you have to instantiate an MBean and register it using either the standard methods from the MBeanServer interface or a convenience method from the class com.sap.jmx.ObjectNameFactory (available in the JMX library).

...

Procedure

       1.      Declare it in the monitor-configuration.xml as one of type “APPLICATION”.

In this case you have to use the convenience method getNameForApplicationResourcePerNode(..) to build the ObjectName under which the MBean is registered.

       2.      In the XML file, give only a simple identifier for the resource MBean and the monitoring framework builds the MBean’s name in a standard way. This saves you from having to be familiar with the naming policy in the JMX infrastructure and allows more flexibility.

       3.      Modify the XML file:

<text-monitor name="Bank name" configuration-group="Name">

    <monitored-resource name="BankMBean" type="APPLICATION"/>

    <text-attribute-mapping>

        <text-attribute>

            <observed-resource-attribute name="BankName"/>

        </text-attribute>

    </text-attribute-mapping>

</text-monitor>

       4.      In the coding you have to build the ObjectName for the resource MBean in the following way:

ObjectName monitoringObjectName =

   ObjectNameFactory.getNameForApplicationResourcePerNode(

      "BankMBean",

      RuntimeProperties.get(RuntimeProperties.PROPERTY_APPLICATION),

      ObjectNameFactory.EMPTY_VALUE,

      ObjectNameFactory.EMPTY_VALUE);

The second parameter in the method getNameForApplicationResourcePerNode(..) is the name of the application that registers the MBean. If you do not want to hardcode the name, you can call RuntimeProperties.get(RuntimeProperties.PROPERTY_APPLICATION), as shown in the example, to get the name of the currently executed application.

Result

As a result, an ObjectName similar to the one listed below, is created and used for the resource MBean, but this is completely transparent to the resource developer:

com.sap.default:name=BankMBean,SAP_J2EEApplicationPerNode=sap.com/Bank,j2eeType=SAP_ApplicationResourcePerNode,SAP_J2EEClusterNode=5939850,SAP_J2EECluster=C11

 

Next, see Registering the MBean.

 

 

End of Content Area