13.0 External Storage of Data for Tables

 


13.1 JMXTableModelListener : An Overview

13.2 Methods Present in JMXTableModelListener Interface


 

The AdventNet Multi-Protocol agent supports storage of tabular data in text files, XML files, databases, and RAM. In some cases, tabular data may be held in some other form or stored externally in a different place. The JmxTableModelListener Interface is implemented to handle this type of user storage models.

 

13.1 JMXTableModelListener : An Overview

 

To use the JmxTableModelListener, the XXXTable.java has to implement the com.adventnet.utils.jmx.JmxTableModelListener interface. This interface is used for handling tables in JMX when user needs the choice of handling the table entries rather than the Multi-Protocol agent holding them in memory.

 

To implement this interface, follow the steps given below :

For example, if Storage option is specified as User Defined for the adiskTable of the AGENT-SAMPLE-MIB, the following code is generated in the AdiskTable.java file.

 

public class AdiskTable implements JmxTableModelListener

 

With this, the Agent gets initialized with User Storage Model and thus any request from the manager for that particular table is forwarded to the Interface implemented for this purpose. Data is retrieved from the table only when the request reaches the Agent. The interface, when initialized, calls the respective methods present in the interface. These methods will be exposed to the MBeanServer through the xxxTable.xml file. Users have to instrument these methods according to their requirement, so that it returns the required information. The xml files are generated in ./jmxprojects/<projectname>/agent/bin/conf/xml/mbeans directory.

 

13.2 Methods Present in JMXTableModelListener Interface

 

The interface has the following methods defined in it.

      public int totalRows();

      public java.util.List getEntries(int startIndex,int endIndex)

For example, if the first five rows need to be retrieved from the table, the adaptors will invoke this method by passing 1, 5 as the parameters to this method. For getting the first row alone, the parameters passed would be 1, 1. Because this returns an ArrayList of CompositeData instances, the getEntry() method will be invoked after this to get the actual entries.

 



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