com.outbackinc.services.protocol.snmp.mib
Class SimpleMIBService

java.lang.Object
  |
  +--com.outbackinc.services.protocol.snmp.mib.SimpleMIBService
All Implemented Interfaces:
SnmpMIBService

public class SimpleMIBService
extends java.lang.Object
implements SnmpMIBService

A basic file-based implementation of the SnmpMIBService interface.

Overview: SimpleMIBService maintains a collection of SimpleMIBDictionary objects, one for each mib loaded into the service.

Usage: The following code snippet provides an example of showing the loading and use of mibs with the service:

      // Create the service
      SnmpMIBService cSnmpMIBService = SnmpLocalInterfaces.getMIBService();
 
      // Load the IF-MIB MIB file into the service
      InputStream cInputStream = jMIBC.loadMib("IF-MIB.my");
      cSnmpMIBService.loadMIB("IF-MIB", cInputStream);

      // Or alternately, load the IF-MIB jMIB file into the service
      //cSnmpMIBService.loadMIB("IF-MIB", new FileInputStream("IF-MIB.jmib"));
 
      // Get a handle to the mib dictionary for the MIB
      SnmpMIBDictionary cSnmpMIBDictionary = cSnmpMIBService.getMIBDictionary("IF-MIB");

      // Resolve a name from the MIB to its OID
      System.out.println("OID for myname is: " + cSnmpMIBDictionary.resolveName("ifAdminStatus"));

      // List of all the MIBs in the service
      String[] szMibs = cSnmpMIBService.listAvailableMIBs();
      System.out.println("Available MIBs:\n");
      for (int i=0; i < szMibs.length; i++) 
      {
          System.out.println(szMibs[i]);
      }

      // List all MIBs in the service that contain the name "IF-MIB"
      SnmpMIBDictionary[] cSnmpMIBDictionaryList = cSnmpMIBService.findMIBs("IF-MIB");
      System.out.println("There are " + Integer.toString(cSnmpMIBDictionaryList.length) +
                         " MIBs containing the name 'IF-MIB':\n");
      for (int i=0; i < cSnmpMIBDictionaryList.length; i++) 
      {
          System.out.println(cSnmpMIBDictionaryList[i].getMIBDictionaryName());
      }
 

Note: The SimpleMIBService automatically loads an SnmpMIBDictionary object that contains all of the MIB-II objects (sysContact, ifNumber, atIfIndex, etc.). This SnmpMIBDictionary may be retrieved by the name "RFC1213-MIB".


Constructor Summary
SimpleMIBService()
          Constructor.
 
Method Summary
 SnmpMIBDictionary[] findMIBs(java.lang.String szVarName)
          Search all available MIBs for a given name/OID.
 SnmpMIBDictionary getMIBDictionary(java.lang.String szMibName)
          Finds the MIB Dictionary object for a specified MIB.
 java.lang.String[] listAvailableMIBs()
          Provides a list of the MIB definitions available to the service.
 void loadMIB(java.lang.String szName, java.io.InputStream cInputStream)
          Load a MIB definition into the service, making a new MIB dictionary available for it.
 void unloadMIB(java.lang.String szName)
          Unload a MIB definition from the service.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleMIBService

public SimpleMIBService()
Constructor.
Method Detail

loadMIB

public void loadMIB(java.lang.String szName,
                    java.io.InputStream cInputStream)
             throws java.lang.IllegalArgumentException
Description copied from interface: SnmpMIBService
Load a MIB definition into the service, making a new MIB dictionary available for it.
Specified by:
loadMIB in interface SnmpMIBService
Following copied from interface: com.outbackinc.services.protocol.snmp.mib.SnmpMIBService
Parameters:
name - name to assign to the mib
cInputStream - input stream used to read in the raw mib definition; format used is implementation dependent
Throws:
java.lang.Exception - thrown if there was a problem loading the MIB

unloadMIB

public void unloadMIB(java.lang.String szName)
               throws java.lang.IllegalArgumentException
Description copied from interface: SnmpMIBService
Unload a MIB definition from the service.
Specified by:
unloadMIB in interface SnmpMIBService
Following copied from interface: com.outbackinc.services.protocol.snmp.mib.SnmpMIBService
Parameters:
szName - name to assign to the mib
Throws:
java.lang.IllegalArgumentException - thrown if the MIB name wasn't found

getMIBDictionary

public SnmpMIBDictionary getMIBDictionary(java.lang.String szMibName)
Description copied from interface: SnmpMIBService
Finds the MIB Dictionary object for a specified MIB.
Specified by:
getMIBDictionary in interface SnmpMIBService
Following copied from interface: com.outbackinc.services.protocol.snmp.mib.SnmpMIBService
Parameters:
szMibName - common name used to specify the mib. (e.g. "rfc1213")
Returns:
MIB Dictionary object, corresponding to the named MIB

listAvailableMIBs

public java.lang.String[] listAvailableMIBs()
Description copied from interface: SnmpMIBService
Provides a list of the MIB definitions available to the service.
Specified by:
listAvailableMIBs in interface SnmpMIBService
Following copied from interface: com.outbackinc.services.protocol.snmp.mib.SnmpMIBService
Returns:
list of MIB definitions available to the service

findMIBs

public SnmpMIBDictionary[] findMIBs(java.lang.String szVarName)
Description copied from interface: SnmpMIBService
Search all available MIBs for a given name/OID.
Specified by:
findMIBs in interface SnmpMIBService
Following copied from interface: com.outbackinc.services.protocol.snmp.mib.SnmpMIBService
Parameters:
szVarName - MIB variable name/OID to lookup
Returns:
one or more MIB dictionary objects, each of which contains a mapping for szVarName, or null if no mappings were found


Home  Services  Products  Purchase  Contact Us  About Us  Legal  Ceramics
Copyright © 2003-2008 jSNMP Enterprises All rights reserved.