|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.outbackinc.services.protocol.snmp.mib.SimpleMIBService
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 |
public SimpleMIBService()
Method Detail |
public void loadMIB(java.lang.String szName, java.io.InputStream cInputStream) throws java.lang.IllegalArgumentException
SnmpMIBService
loadMIB
in interface SnmpMIBService
com.outbackinc.services.protocol.snmp.mib.SnmpMIBService
name
- name to assign to the mibcInputStream
- input stream used to read in the raw
mib definition; format used is implementation dependentjava.lang.Exception
- thrown if there was a problem loading
the MIBpublic void unloadMIB(java.lang.String szName) throws java.lang.IllegalArgumentException
SnmpMIBService
unloadMIB
in interface SnmpMIBService
com.outbackinc.services.protocol.snmp.mib.SnmpMIBService
szName
- name to assign to the mibjava.lang.IllegalArgumentException
- thrown if the MIB name wasn't foundpublic SnmpMIBDictionary getMIBDictionary(java.lang.String szMibName)
SnmpMIBService
getMIBDictionary
in interface SnmpMIBService
com.outbackinc.services.protocol.snmp.mib.SnmpMIBService
szMibName
- common name used to specify the mib. (e.g. "rfc1213")public java.lang.String[] listAvailableMIBs()
SnmpMIBService
listAvailableMIBs
in interface SnmpMIBService
com.outbackinc.services.protocol.snmp.mib.SnmpMIBService
public SnmpMIBDictionary[] findMIBs(java.lang.String szVarName)
SnmpMIBService
findMIBs
in interface SnmpMIBService
com.outbackinc.services.protocol.snmp.mib.SnmpMIBService
szVarName
- MIB variable name/OID to lookup
|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Home Services Products Purchase Contact Us About Us Legal Ceramics
Copyright © 2003-2008 jSNMP Enterprises All rights reserved.