MySnmpCrawler API

snmp.mibdb
Class MibDatabaseImpl

java.lang.Object
  |
  +--snmp.mibdb.MibDatabase
        |
        +--snmp.mibdb.MibDatabaseImpl
All Implemented Interfaces:
java.io.Serializable

class MibDatabaseImpl
extends MibDatabase
implements java.io.Serializable

This class reads the MIB file and loads the mib tree into a link list. Each node in the link list represents a object variable in the MIB file. Each object variable contains a reference to its parent variable and a list of child variables. In order to access the object variable efficiently, it also contains a hash map that can access the variable object group directly.

Version:
$Revision: 0.1 $ $Date: 2004/03/09 06:03:55 $
Author:
Scott Cheng

Field Summary
private  java.util.HashMap indexList
           
private static MibDatabaseImpl instance
           
private  OidEntity root
           
 
Constructor Summary
private MibDatabaseImpl(java.lang.String mibFile)
          Constructs the MIB database using the passed mib file name.
 
Method Summary
(package private)  void addIndex(OidEntity node)
          Adds the OidEntity node into the index list.
static MibDatabase create(java.lang.String mibFile)
          Creates the singleton MibDatabase instance from the passed MIB file.
private  void createDB(net.percederberg.mib.Mib mib)
           
private  void createDB(net.percederberg.mib.symbol.Symbol symbol)
           
static MibDatabase getInstance()
          Gets the singleton MibDatabase instance.
 OidEntity getOidGroup(java.lang.String oid)
          Retrieves the OidEntity object that matches to the passed OID string in the MIB database.
 OidRecord getOidRecord(java.lang.String oid)
          Retrieves the OidRecord that matches to the passed OID string in the MIB database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

private static MibDatabaseImpl instance

indexList

private java.util.HashMap indexList

root

private OidEntity root
Constructor Detail

MibDatabaseImpl

private MibDatabaseImpl(java.lang.String mibFile)
                 throws SnmpException
Constructs the MIB database using the passed mib file name.

Parameters:
mibFile - The MIB file name.
Method Detail

getOidRecord

public OidRecord getOidRecord(java.lang.String oid)
                       throws SnmpException
Retrieves the OidRecord that matches to the passed OID string in the MIB database.

Specified by:
getOidRecord in class MibDatabase
Parameters:
oid - OID string
Returns:
The matched OidRecord
Throws:
SnmpException - Thrown if there is no such OID record.

getOidGroup

public OidEntity getOidGroup(java.lang.String oid)
                      throws SnmpException
Retrieves the OidEntity object that matches to the passed OID string in the MIB database.

Parameters:
oid - OID string
Returns:
The matched group OidRecord
Throws:
SnmpException - Thrown if there is no such OID group.

createDB

private void createDB(net.percederberg.mib.Mib mib)
               throws SnmpException
SnmpException

createDB

private void createDB(net.percederberg.mib.symbol.Symbol symbol)
               throws SnmpException
SnmpException

addIndex

void addIndex(OidEntity node)
Adds the OidEntity node into the index list.

Parameters:
node - The OidEntity node.

create

public static MibDatabase create(java.lang.String mibFile)
                          throws SnmpException
Creates the singleton MibDatabase instance from the passed MIB file.

Parameters:
mibFile - The MIB file name.
Returns:
The MibDatabase instance.
Throws:
SnmpException - Thrown when any error occurs during the MIB database creation.

getInstance

public static MibDatabase getInstance()
                               throws SnmpException
Gets the singleton MibDatabase instance.

Returns:
The MibDatabase instance.
Throws:
SnmpException - Thrown when there is no instance of the MibDatabase existed.

MySnmpCrawler API