org.snmp4j.agent.mo.jmx
Class MBeanArrayIndexKeyProvider

java.lang.Object
  extended by org.snmp4j.agent.mo.jmx.MBeanMOInfo
      extended by org.snmp4j.agent.mo.jmx.MBeanAttributeMOInfo
          extended by org.snmp4j.agent.mo.jmx.MBeanAttributeKeyProvider
              extended by org.snmp4j.agent.mo.jmx.MBeanArrayIndexKeyProvider

public class MBeanArrayIndexKeyProvider
extends MBeanAttributeKeyProvider

To map the array indexes of an array provided by a MBean to SNMP table row indexes, the MBeanArrayIndexKeyProvider can be used.

Version:
1.0
Author:
Frank Fock

Field Summary
 
Fields inherited from class org.snmp4j.agent.mo.jmx.MBeanAttributeMOInfo
attribute
 
Constructor Summary
MBeanArrayIndexKeyProvider(javax.management.ObjectName name, TypedAttribute attribute)
          Creates an index mapping based on a MBean attribute that provides the keys of the table rows.
 
Method Summary
protected  java.util.Iterator createTailIterator(java.util.Iterator it, int pos)
           
 java.lang.Object getRowValues(javax.management.MBeanServerConnection server, java.lang.Object indexObject)
          Gets the row value(s) for the specified index object.
 java.util.Iterator keyIterator(javax.management.MBeanServerConnection server)
          Returns an iterator on the keys provided by this MBean attribute.
 
Methods inherited from class org.snmp4j.agent.mo.jmx.MBeanAttributeKeyProvider
asList, asList, combineKeys, getKey, getKeyCount, getKeys, getSubKeyProviderObjectName, keyTailIterator
 
Methods inherited from class org.snmp4j.agent.mo.jmx.MBeanAttributeMOInfo
getAttribute, getAttribute, getAttribute, getAttributeName, getAttributeType, setAttribute, setAttribute
 
Methods inherited from class org.snmp4j.agent.mo.jmx.MBeanMOInfo
getMBeanNames, getObjectName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MBeanArrayIndexKeyProvider

public MBeanArrayIndexKeyProvider(javax.management.ObjectName name,
                                  TypedAttribute attribute)
Creates an index mapping based on a MBean attribute that provides the keys of the table rows. The attribute may return an instance of one of the following supported classes:

Parameters:
name - the MBean's ObjectName.
attribute - the description of the attribute that provides the row keys.
Method Detail

keyIterator

public java.util.Iterator keyIterator(javax.management.MBeanServerConnection server)
                               throws java.io.IOException,
                                      javax.management.MBeanException,
                                      javax.management.AttributeNotFoundException,
                                      javax.management.InstanceNotFoundException,
                                      javax.management.ReflectionException
Description copied from class: MBeanAttributeKeyProvider
Returns an iterator on the keys provided by this MBean attribute.

Overrides:
keyIterator in class MBeanAttributeKeyProvider
Parameters:
server - the MBeanServerConnection to be used to access the MBean.
Returns:
Iterator an iterator providing the keys returned by the key provider attribute.
Throws:
java.io.IOException
javax.management.MBeanException
javax.management.AttributeNotFoundException
javax.management.InstanceNotFoundException
javax.management.ReflectionException

createTailIterator

protected java.util.Iterator createTailIterator(java.util.Iterator it,
                                                int pos)
Overrides:
createTailIterator in class MBeanAttributeKeyProvider

getRowValues

public java.lang.Object getRowValues(javax.management.MBeanServerConnection server,
                                     java.lang.Object indexObject)
                              throws java.io.IOException,
                                     javax.management.MBeanException,
                                     javax.management.AttributeNotFoundException,
                                     javax.management.InstanceNotFoundException,
                                     javax.management.ReflectionException
Gets the row value(s) for the specified index object. If the index object is not an instance of JMXArrayIndexKey the index object itself is returned. Otherwise, the n-th object of the objects provided by the MBean attribute supplied at creation time is returned where n corresponds to the index object's index value.

Overrides:
getRowValues in class MBeanAttributeKeyProvider
Parameters:
server - a MBeanServerConnection to use to access the MBean.
indexObject - a JMXArrayIndexKey denoting the row index/value(s) to return.
Returns:
indexObject if it is not an instance of JMXArrayIndexKey or otherwise the n-th key (or row value).
Throws:
java.io.IOException
javax.management.MBeanException
javax.management.AttributeNotFoundException
javax.management.InstanceNotFoundException
javax.management.ReflectionException

Copyright 2006-2007 Frank Fock (SNMP4J.org)