OpenNMS API 1.2.9

## org.opennms.netmgt.capsd
Class IfSnmpCollector

    java.lang.Object
      org.opennms.netmgt.capsd.IfSnmpCollector

All Implemented Interfaces:
  java.lang.Runnable

final class IfSnmpCollector
extends java.lang.Object
implements java.lang.Runnable

This class is designed to collect the necessary SNMP information from the target address and store the collected information. When the class is initially constructed no information is collected. The SNMP Session creating and colletion occurs in the main run method of the instance. This allows the collection to occur in a thread if necessary.

Author:
  Weave , OpenNMS

Field Summary
`private java.net.InetAddress` `m_address` The IP address to used to collect the SNMP information
`private IfTable` `m_ifTable` The interface table information
`private IfXTable` `m_ifXTable` The interface extensions table information
`private IpAddrTable` `m_ipAddrTable` The IP address table
`private SnmpPeer` `m_peer` The SnmpPeer object used to communicate via SNMP with the remote host.
`private SystemGroup` `m_sysGroup` The system group information

Constructor Summary
`private` `IfSnmpCollector()` The default constructor.
`(package private)` `IfSnmpCollector(SnmpPeer peer)` Constructs a new snmp collector for a node using the passed interface as the collection point.

Method Summary
`(package private) boolean` `failed()` Returns true if any part of the collection failed.
`(package private) int` `getAdminStatus(int ifIndex)`
`(package private) java.net.InetAddress[]` `getIfAddressAndMask(int ifIndex)` Returns the Internet address at the corresponding index.
`(package private) SnmpOctetString` `getIfAlias(int ifIndex)`
`(package private) int` `getIfIndex(java.net.InetAddress address)`
`(package private) SnmpOctetString` `getIfName(int ifIndex)`
`(package private) IfTable` `getIfTable()` Returns the collected interface table.
`(package private) int` `getIfType(int ifIndex)`
`(package private) IfXTable` `getIfXTable()` Returns the collected interface extensions table.
`(package private) IpAddrTable` `getIpAddrTable()` Returns the collected IP Interface Address table.
`(package private) java.net.InetAddress` `getMask(int ifIndex)` Returns the netmask address at the corresponding index.
`(package private) SystemGroup` `getSystemGroup()` Returns the collected system group.
`(package private) java.net.InetAddress` `getTarget()` Returns the target address that the collection occured for.
`(package private) boolean` `hasIfTable()` Returns true if the interface table was collected.
`(package private) boolean` `hasIfXTable()` Returns true if the interface extensions table was collected.
`(package private) boolean` `hasIpAddrTable()` Returns true if the IP Interface Address table was collected.
`(package private) boolean` `hasSystemGroup()` Returns true if the system group was collected successfully
`void` `run()` Preforms the collection for the targeted internet address.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### m_peer

    private SnmpPeer m_peer

  The SnmpPeer object used to communicate via SNMP with the remote host.

### m_address

    private final java.net.InetAddress m_address

  The IP address to used to collect the SNMP information

### m_sysGroup

    private SystemGroup m_sysGroup

  The system group information

### m_ifTable

    private IfTable m_ifTable

  The interface table information

### m_ipAddrTable

    private IpAddrTable m_ipAddrTable

  The IP address table

### m_ifXTable

    private IfXTable m_ifXTable

  The interface extensions table information

Constructor Detail

### IfSnmpCollector

    private IfSnmpCollector()

  The default constructor. Since this class requires an IP address to collect SNMP information the default constructor is declared private and will also throw an exception

Throws:
  `java.lang.UnsupportedOperationException` - Always thrown.

### IfSnmpCollector

    IfSnmpCollector(SnmpPeer peer)

  Constructs a new snmp collector for a node using the passed interface as the collection point. The collection does not occur until the `run` method is invoked.

Parameters:
  `peer` - The SnmpPeer object to collect from.

Method Detail

### failed

    boolean failed()

  Returns true if any part of the collection failed.

### hasSystemGroup

    boolean hasSystemGroup()

  Returns true if the system group was collected successfully

### getSystemGroup

    SystemGroup getSystemGroup()

  Returns the collected system group.

### hasIfTable

    boolean hasIfTable()

  Returns true if the interface table was collected.

### getIfTable

    IfTable getIfTable()

  Returns the collected interface table.

### hasIpAddrTable

    boolean hasIpAddrTable()

  Returns true if the IP Interface Address table was collected.

### getIpAddrTable

    IpAddrTable getIpAddrTable()

  Returns the collected IP Interface Address table.

### hasIfXTable

    boolean hasIfXTable()

  Returns true if the interface extensions table was collected.

### getIfXTable

    IfXTable getIfXTable()

  Returns the collected interface extensions table.

### getTarget

    java.net.InetAddress getTarget()

  Returns the target address that the collection occured for.

### getMask

    java.net.InetAddress getMask(int ifIndex)

  Returns the netmask address at the corresponding index. If the address cannot be resolved then a null reference is returned. NOTE: If an interface has more than one IP address associated with it only the FIRST match is returned.

  Parameters:
    `ifIndex` - The index to search for.
  Throws:
    `java.lang.IndexOutOfBoundsException` - Thrown if the index cannot be resolved due to an incomplete table.

### getIfAddressAndMask

    java.net.InetAddress[] getIfAddressAndMask(int ifIndex)

  Returns the Internet address at the corresponding index. If the address cannot be resolved then a null reference is returned.

  Parameters:
    `ifIndex` - The index to search for.
  Throws:
    `java.lang.IndexOutOfBoundsException` - Thrown if the index cannot be resolved due to an incomplete table.

### getAdminStatus

    int getAdminStatus(int ifIndex)

### getIfType

    int getIfType(int ifIndex)

### getIfIndex

    int getIfIndex(java.net.InetAddress address)

### getIfName

    SnmpOctetString getIfName(int ifIndex)

### getIfAlias

    SnmpOctetString getIfAlias(int ifIndex)

### run

    public void run()

  Preforms the collection for the targeted internet address. The success or failure of the collection should be tested via the `failed` method.

  No synchronization is preformed, so if this is used in a separate thread context synchornization must be added.

  Specified by:
    `run` in interface `java.lang.Runnable`

OpenNMS API 1.2.9

Generated by ranger on May 19 2007 2335.