org.snmp4j.agent.mo.jmx
Class MBeanAttributeKeyProvider

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
Direct Known Subclasses:
MBeanArrayIndexKeyProvider, MBeanInvokationKeyProvider

public class MBeanAttributeKeyProvider
extends MBeanAttributeMOInfo

The MBeanAttributeKeyProvider provides the row keys of a conceptual table from a MBean attribute. The keys are returned in the same order as provided by the MBean attribute by default. If the keysNeedSorting is set, keys are returned always in their natural order.

Version:
1.0
Author:
Frank Fock

Field Summary
 
Fields inherited from class org.snmp4j.agent.mo.jmx.MBeanAttributeMOInfo
attribute
 
Constructor Summary
MBeanAttributeKeyProvider(javax.management.ObjectName name, TypedAttribute attribute)
          Creates a key provider with a MBean name and a attribute description.
MBeanAttributeKeyProvider(javax.management.ObjectName name, TypedAttribute attribute, boolean keysNeedSorting)
          Creates a key provider with a MBean name and a attribute description.
 
Method Summary
static java.util.List<java.lang.Integer> asList(int[] a)
           
static java.util.List<java.lang.Long> asList(long[] a)
           
protected  java.util.Iterator createTailIterator(java.util.Iterator it, int indexPos)
           
 int getKeyCount(javax.management.MBeanServerConnection server)
          Returns the number of row keys available.
 java.lang.Object getRowValues(javax.management.MBeanServerConnection server, java.lang.Object indexObject)
           
 java.util.Iterator keyIterator(javax.management.MBeanServerConnection server)
          Returns an iterator on the keys provided by this MBean attribute.
 java.util.Iterator keyTailIterator(javax.management.MBeanServerConnection server, java.lang.Object firstRowId)
          Returns an iterator on the keys provided by this MBean attribute starting from the supplied row key.
 
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

MBeanAttributeKeyProvider

public MBeanAttributeKeyProvider(javax.management.ObjectName name,
                                 TypedAttribute attribute)
Creates a key provider with a MBean name and a attribute description.

Parameters:
name - a MBean's ObjectName.
attribute - the description of an attribute of the MBean identified by name.

MBeanAttributeKeyProvider

public MBeanAttributeKeyProvider(javax.management.ObjectName name,
                                 TypedAttribute attribute,
                                 boolean keysNeedSorting)
Creates a key provider with a MBean name and a attribute description.

Parameters:
name - a MBean's ObjectName.
attribute - the description of an attribute of the MBean identified by name.
keysNeedSorting - if true keys will be sorted by their natural order.
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
Returns an iterator on the keys provided by this MBean attribute.

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

asList

public static java.util.List<java.lang.Integer> asList(int[] a)

asList

public static java.util.List<java.lang.Long> asList(long[] a)

keyTailIterator

public java.util.Iterator keyTailIterator(javax.management.MBeanServerConnection server,
                                          java.lang.Object firstRowId)
                                   throws java.io.IOException,
                                          javax.management.MBeanException,
                                          javax.management.AttributeNotFoundException,
                                          javax.management.InstanceNotFoundException,
                                          javax.management.ReflectionException
Returns an iterator on the keys provided by this MBean attribute starting from the supplied row key.

Parameters:
server - the MBeanServerConnection to be used to access the MBean.
firstRowId - the lower bound (including) row key for the iterator.
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 indexPos)

getKeyCount

public int getKeyCount(javax.management.MBeanServerConnection server)
                throws java.io.IOException,
                       javax.management.MBeanException,
                       javax.management.AttributeNotFoundException,
                       javax.management.InstanceNotFoundException,
                       javax.management.ReflectionException
Returns the number of row keys available.

Parameters:
server - the MBeanServerConnection to be used to access the MBean.
Returns:
the number of keys.
Throws:
java.io.IOException
javax.management.MBeanException
javax.management.AttributeNotFoundException
javax.management.InstanceNotFoundException
javax.management.ReflectionException

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
Throws:
java.io.IOException
javax.management.MBeanException
javax.management.AttributeNotFoundException
javax.management.InstanceNotFoundException
javax.management.ReflectionException

Copyright 2006-2007 Frank Fock (SNMP4J.org)