OpenNMS API 1.2.3

org.opennms.netmgt.capsd.snmp
Class SystemGroup

java.lang.Object
  extended byjava.util.AbstractMap
      extended byjava.util.TreeMap
          extended byorg.opennms.netmgt.capsd.snmp.SystemGroup
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable, SnmpHandler, java.util.SortedMap

public final class SystemGroup
extends java.util.TreeMap
implements SnmpHandler

SystemGroup holds the system group properties It implements the SnmpHandler to receive notifications when a reply is received/error occurs in the SnmpSession used to send requests /recieve replies.

Author:
Sowmya , Weave , OpenNMS
See Also:
RFC1213 , Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.util.TreeMap
 
Nested classes inherited from class java.util.AbstractMap
 
Field Summary
 boolean m_error
           Flag indicating the success or failure of the informational query.
private  Signaler m_signal
           Used to synchronize the class to ensure that the session has finished collecting data before the value of success or failure is set, and control is returned to the caller.
private static NamedSnmpVar[] ms_elemList
           The keys that will be supported by default from the TreeMap base class.
static SnmpObjectId ROOT
           The SnmpObjectId that represents the root of the system tree.
static java.lang.String SYS_CONTACT
           
static java.lang.String SYS_DESCR
           
static java.lang.String SYS_LOCATION
           
static java.lang.String SYS_NAME
           
static java.lang.String SYS_OBJECTID
           
static java.lang.String SYS_UPTIME
           
static java.lang.String SYSTEM_OID
           The SYSTEM_OID is the object identifier that represents the root of the system information in the MIB forest.
 
Fields inherited from class java.util.TreeMap
 
Fields inherited from class java.util.AbstractMap
 
Constructor Summary
private SystemGroup()
           The default constructor is marked private and will always throw an exception.
  SystemGroup(SnmpSession session, Signaler signaler)
           The class constructor is used to initialize the collector and send out the initial SNMP packet requesting data.
 
Method Summary
 boolean failed()
           Returns the success or failure code for collection of the data.
static SnmpPduRequest getPdu()
           This method is used to build the initial SNMP PDU that is sent to the remote host.
static java.lang.String getPrintableString(SnmpOctetString octetString)
          This method takes an SnmpOctetString and replaces any unprintable characters with ASCII period ('.') and returns the resulting character string.
 void snmpInternalError(SnmpSession session, int error, SnmpSyntax pdu)
           This method is part of the SnmpHandler interface and called when an internal error happens in a session.
 void snmpReceivedPdu(SnmpSession session, int command, SnmpPduPacket pdu)
           This method is used to process received SNMP PDU packets from the remote agent.
 void snmpTimeoutError(SnmpSession session, SnmpSyntax pdu)
           This method is part of the SnmpHandler interface and is invoked when the SnmpSession does not receive a reply after exhausting the retransmission attempts.
 void update(SnmpVarBind[] vars)
           This method is used to update the map with the current information from the agent.
 
Methods inherited from class java.util.TreeMap
clear, clone, comparator, containsKey, containsValue, entrySet, firstKey, get, headMap, keySet, lastKey, put, putAll, remove, size, subMap, tailMap, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, isEmpty, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode, isEmpty
 

Field Detail

SYS_OBJECTID

public static final java.lang.String SYS_OBJECTID
See Also:
Constant Field Values

SYS_UPTIME

public static final java.lang.String SYS_UPTIME
See Also:
Constant Field Values

SYS_NAME

public static final java.lang.String SYS_NAME
See Also:
Constant Field Values

SYS_DESCR

public static final java.lang.String SYS_DESCR
See Also:
Constant Field Values

SYS_LOCATION

public static final java.lang.String SYS_LOCATION
See Also:
Constant Field Values

SYS_CONTACT

public static final java.lang.String SYS_CONTACT
See Also:
Constant Field Values

ms_elemList

private static NamedSnmpVar[] ms_elemList

The keys that will be supported by default from the TreeMap base class. Each of the elements in the list are an instance of the SNMP Interface table. Objects in this list should be used by multiple instances of this class.


m_error

public boolean m_error

Flag indicating the success or failure of the informational query. If the flag is set to false then either part of all of the information was unable to be retreived. If it is set to true then all of the data was received from the remote host.


SYSTEM_OID

public static final java.lang.String SYSTEM_OID

The SYSTEM_OID is the object identifier that represents the root of the system information in the MIB forest. Each of the system elements can be retreived by adding their specific index to the string, and an additional Zero(0) to signify the single instance item.

See Also:
Constant Field Values

ROOT

public static final SnmpObjectId ROOT

The SnmpObjectId that represents the root of the system tree. It is created at initilization time and is the converted value of SYSTEM_OID.

See Also:
SYSTEM_OID

m_signal

private Signaler m_signal

Used to synchronize the class to ensure that the session has finished collecting data before the value of success or failure is set, and control is returned to the caller.

Constructor Detail

SystemGroup

private SystemGroup()
             throws java.lang.UnsupportedOperationException

The default constructor is marked private and will always throw an exception. This is done to disallow the default constructor. The reason is that this object requires an SNMP session and a synchronization object to perform it's duties.

Throws:
java.lang.UnsupportedOperationException - Always thrown from this method since it is not supported.
See Also:
SystemGroup(SnmpSession, Signaler)

SystemGroup

public SystemGroup(SnmpSession session,
                   Signaler signaler)

The class constructor is used to initialize the collector and send out the initial SNMP packet requesting data. The data is then received and store by the object. When all the data has been collected the passed signaler object is notified using the notifyAll() method.

Parameters:
session - The SNMP session with the remote agent.
signaler - The object signaled when data collection is done.
Method Detail

update

public void update(SnmpVarBind[] vars)

This method is used to update the map with the current information from the agent.

This does not clear out any column in the actual row that does not have a definition.

Parameters:
vars - The variables in the interface row.

getPdu

public static SnmpPduRequest getPdu()

This method is used to build the initial SNMP PDU that is sent to the remote host. The PDU contains as many variable bindings as needed by the object. The varbinds are SnmpNull objects that have been initialized each with one instance of a required variable. The PDU type is marked as GET so that only a single Request/Response is required to get all the data.

Returns:
An SnmpPduRequest with the command GET and a predefined varbind list.
See Also:
SnmpNull, SnmpPduRequest

snmpReceivedPdu

public void snmpReceivedPdu(SnmpSession session,
                            int command,
                            SnmpPduPacket pdu)

This method is used to process received SNMP PDU packets from the remote agent. The method is part of the SnmpHandler interface and will be invoked when a PDU is successfully decoded. The method is passed the receiving session, the PDU command, and the actual PDU packet.

When all the data has been received from the session the signaler object, initialized in the constructor, is signaled. In addition, the receiving instance will call notifyAll() on itself at the same time.

Specified by:
snmpReceivedPdu in interface SnmpHandler
Parameters:
session - The SNMP Session that received the PDU
command - The command contained in the received pdu
pdu - The actual received PDU.

snmpInternalError

public void snmpInternalError(SnmpSession session,
                              int error,
                              SnmpSyntax pdu)

This method is part of the SnmpHandler interface and called when an internal error happens in a session. This is usually the result of an I/O error. This method will not be called if the session times out sending a packet, see snmpTimeoutError for timeout handling.

Specified by:
snmpInternalError in interface SnmpHandler
Parameters:
session - The session that had an unexpected error
error - The error condition
pdu - The PDU being sent when the error occured
See Also:
snmpTimeoutError(org.opennms.protocols.snmp.SnmpSession, org.opennms.protocols.snmp.SnmpSyntax), SnmpHandler

snmpTimeoutError

public void snmpTimeoutError(SnmpSession session,
                             SnmpSyntax pdu)

This method is part of the SnmpHandler interface and is invoked when the SnmpSession does not receive a reply after exhausting the retransmission attempts.

Specified by:
snmpTimeoutError in interface SnmpHandler
Parameters:
session - The session invoking the error handler
pdu - The PDU that the remote failed to respond to.
See Also:
SnmpHandler

failed

public boolean failed()

Returns the success or failure code for collection of the data.


getPrintableString

public static java.lang.String getPrintableString(SnmpOctetString octetString)
This method takes an SnmpOctetString and replaces any unprintable characters with ASCII period ('.') and returns the resulting character string. Special case in which the supplied SnmpOctetString consists of a single ASCII Null byte is also handled. In this special case an empty string is returned. NOTE: A character is considered unprintable if its decimal value falls outside of the range: 32 - 126.

Parameters:
octetString - SnmpOctetString from which to generate the String
Returns:
a Java String object created from the octet string's byte array.

OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.