Implemented Scalars

 



 

Overview

 

In the previous section you saw how the stub files are generated.  This section deals with the files generated for the scalar group and how they are instrumented.

 

The file generated for the scalar group shoppingCartSummary is shoppingCartSummaryInstrument.java. The instrument file contains all the getter and setter methods for all the attributes in  the MBean . In this tutorial, the scalar attributes are totalItemCount and totalPrice .

 

Instrumentation

 

The extra code added for instrumentation inside the method getTotalItemCount() shoppingCartSummaryInstrument.java file is available in between the following tags:

 

 /* User code starts here */
 /* User code ends here */

 

public Integer  getTotalItemCount()
throws AgentException {
// Fill up the stub with required processing

 /* User code starts here */
com.adventnet.agent.application.shoppingcart.ShoppingCart shoppingCart = ReferenceProvider.getShoppingCart();
if(shoppingCart == null)
throw new AgentException("null reference got", CommonUtils.GENERR);

totalItemCount = new java.lang.Integer (shoppingCart.getTotalItemCount());

/* User code ends here */

return totalItemCount; }

 

The instrumentation code has to be filled between these tags in order to support code merging when regenerated.  Note that totalItemCount and totalPrice are "read-only" variables defined in the MIB and hence does not provide SET methods to modify the variable values.

 

When a get request is made from the manager for the scalar variable TotalItemcount,



Copyright © 1996-2004, AdventNet Inc. All Rights Reserved.