Class MIBTree

java.lang.Object
org.snmp4j.agent.io.prop.MIBTree

public class MIBTree extends Object
An in-memory representation of the managed objects configured by a MOInput source (for example a PropertyMOInput properties file), organised as an OID prefix tree (trie) per SNMP context.

Each configured managed object becomes a terminal MIBTree.Node located at its OID. A node is either a scalar (carrying a single Variable value) or a table (carrying a MIBTree.Table with one MIBTree.Row per configured row). Intermediate nodes model the OID hierarchy and carry no value.

Values that could not be resolved during parsing are preserved as UnresolvedReference instances so that their configured reference remains visible.

Since:
3.9.2
Version:
3.9.2
Author:
SNMP4J.org
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    A node in the OID tree.
    static final class 
    A single configured table row: an index OID and the per-column values.
    static final class 
    The configured rows of a conceptual table (SMI table row entry).
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addScalar(org.snmp4j.smi.OctetString context, org.snmp4j.smi.OID oid, org.snmp4j.smi.Variable value)
    Adds a scalar managed object at the given OID within the given context.
    void
    addTable(org.snmp4j.smi.OctetString context, org.snmp4j.smi.OID oid, int columnCount, List<MIBTree.Row> rows)
    Adds a conceptual table (row entry) managed object at the given OID within the given context.
    Set<org.snmp4j.smi.OctetString>
    Returns the contexts present in this tree, in insertion order.
    getRoot(org.snmp4j.smi.OctetString context)
    Returns the root node for the given context, or null if that context is not present.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MIBTree

      public MIBTree()
  • Method Details

    • getContexts

      public Set<org.snmp4j.smi.OctetString> getContexts()
      Returns the contexts present in this tree, in insertion order. The set may contain a null element denoting the context-independent (default) data.
      Returns:
      the set of context names (possibly including null).
    • getRoot

      public MIBTree.Node getRoot(org.snmp4j.smi.OctetString context)
      Returns the root node for the given context, or null if that context is not present.
      Parameters:
      context - the context name, or null for the context-independent data.
      Returns:
      the context root MIBTree.Node, or null.
    • addScalar

      public void addScalar(org.snmp4j.smi.OctetString context, org.snmp4j.smi.OID oid, org.snmp4j.smi.Variable value)
      Adds a scalar managed object at the given OID within the given context.
      Parameters:
      context - the context name, or null for the context-independent data.
      oid - the object instance OID.
      value - the configured value (null if the configuration left the value empty).
    • addTable

      public void addTable(org.snmp4j.smi.OctetString context, org.snmp4j.smi.OID oid, int columnCount, List<MIBTree.Row> rows)
      Adds a conceptual table (row entry) managed object at the given OID within the given context.
      Parameters:
      context - the context name, or null for the context-independent data.
      oid - the table entry OID.
      columnCount - the number of columns configured per row.
      rows - the configured rows.