|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.adventnet.snmp.mibs.MibOperations
The MibOperations Class provides MIB support for the SNMP libraries. It enables the user to support SNMP operations by using the information in the MIB Modules.
The MibOperations class is used for the following functionalities:
The MibOperations class needs to be instantiated to parse and use MIBs. Instantiate this class to add dynamic MIB support to your SNMP applications.
For instance, to use in an application
MibOperations mibOps = new MibOperations();
try
{
mibOps.loadMibModules("RFC1213-MIB");
}
catch (Exception ex)
{
System.err.println("Error loading MIBs: " + ex);
}
We can get the objects of MibModule, MibNode, LeafSyntax, MibTrap from the methods present in the MibOperations class.
The method encodeInstanceString(Vector, Vector) can be used to encode the given index value based on the syntax of the indexMibNodes.
We can also create varbind using the method createVariableBinding(String,String[],String) with the supplied parameters.
LeafSyntax instance can be obtained using the methods getLeafSyntax(SnmpOID) and getSyntaxByName(String).
The methods toByteString() and toString() can be used to print the datas.
Some methods like getMibNode() are present both in MibModule and in the MibOperations class. If the method getMibNode() in MibOperations is used, then the node will be searched in all the mibs loaded so far whereas if you use the method getMibNode() in MibModule then the search is restricted to that particular Module.
To get a MibModule instance you can use the method getMibModule(String). This will return the MibModule. The argument for getMibModule is the module name. The argument should be case sensitive,that is to say, the case of the argument should match with the case of the module name. To get the enumeration of all the modules loaded, use MibOperations.getMibModules().
In case the module is getting loaded from a http url location, there might be issues related to content-type handling. Specifically, unless the web-server is configured to handle MIB extensions cds and cmi, you can receive errors in loading the MIB. While plain MIB files are in ascii, configuration issues on web-server do not come into the picture. But , the compiled MIB being binary type is affected if the content-type is indicated by the server as text/plain or text/html etc.
| Field Summary | |
static int |
ALL_MESSAGES
For printing all the debug messages |
(package private) static int |
allowedLevel
For setting the MsSql database |
(package private) java.applet.Applet |
applet
|
(package private) boolean |
calledFromMibModule
|
(package private) boolean |
canSerialize
|
(package private) java.lang.String |
cdsFile
|
(package private) java.lang.String |
cdsFileName
|
(package private) byte[] |
checks
|
(package private) java.io.File |
cmiFile
|
(package private) java.util.Vector |
collectedModules
|
static byte |
CRITICAL
For setting the critical parsing level |
static int |
CRITICAL_MESSAGES
For printing all the critical messages |
(package private) boolean |
database
|
(package private) byte |
dbType
|
(package private) boolean |
displayHintFlag
|
(package private) boolean |
endsWithCMI
|
(package private) java.util.Hashtable |
entryTable
|
(package private) static java.util.Hashtable |
equivName
|
(package private) java.util.Hashtable |
errAugNotEntryTable
|
(package private) java.util.Hashtable |
errDiffSizeTable
|
(package private) java.util.Hashtable |
errDispHintTable
|
(package private) java.util.Hashtable |
errImpliedTable
|
(package private) java.util.Hashtable |
errInAppDefvalTable
|
(package private) java.util.Hashtable |
errIndexTable
|
(package private) static boolean |
errMsg
|
(package private) java.util.Hashtable |
errNamesTable
|
(package private) java.util.Hashtable |
errOctetStrSizeTable
|
(package private) java.util.Hashtable |
errRecrAugEntryTable
|
(package private) java.util.Hashtable |
errTrapNumTable
|
(package private) java.lang.String[] |
extensionName
|
(package private) java.lang.String |
extensionNames
|
(package private) boolean |
extFlag
|
(package private) java.util.Hashtable |
genericTcList
|
(package private) java.util.Hashtable |
globalImports
|
(package private) java.util.Vector |
impModVect
|
(package private) byte |
importsParsingLevel
|
(package private) MibNode |
indxNode
|
(package private) boolean |
isDescRead
|
(package private) boolean |
isLoadedFromApplURL
|
(package private) boolean |
jdbc
|
(package private) JdbcMibOperations |
jMibOps
|
(package private) boolean |
justParse
|
static byte |
LENIENT
For setting flexible parsing level. |
(package private) boolean |
loadDirect
|
(package private) boolean |
loadedFromJar
|
(package private) java.util.Vector |
loadedModules
|
(package private) boolean |
loadFromSerializedMibs
|
(package private) static boolean |
loggingFlag
|
(package private) java.lang.String |
mibFileDir
|
(package private) java.lang.String |
mibFileName
|
(package private) MibParserConstants |
mibParserConstants
|
(package private) java.util.Hashtable |
modNameDefnTable
|
(package private) java.lang.String |
moduleDefinition
|
(package private) boolean |
moduleFileNameMatch
|
(package private) java.util.Vector |
moduleNameVector
|
(package private) boolean |
moduleParsed
|
(package private) java.util.Hashtable |
modules
|
(package private) java.lang.String |
multipleRevision
|
(package private) java.util.Vector |
multipleRevisionModuleNames
|
static byte |
MYSQL
For setting the MySql database |
static byte |
NORMAL
For setting normal parsing level. |
(package private) int[] |
oidNums
|
static byte |
ORACLE
For setting the Oracle database |
(package private) boolean |
overWrite
|
(package private) boolean |
overWriteCMI
|
(package private) boolean |
overWriteDataBase
|
(package private) boolean |
overWriteSer
|
(package private) byte |
parsingLevel
|
(package private) static byte[] |
readerVer
This mib reader class version. |
(package private) byte[] |
removedChecks
|
(package private) ImportResolver |
resolver
|
(package private) java.util.Vector |
revisionFileNames
|
(package private) java.lang.String |
revisionString
|
(package private) java.lang.String |
searchPath
|
(package private) java.util.Vector |
searchPathDir
|
(package private) java.lang.String |
serializedFileName
|
(package private) boolean |
serializeMibs
|
static byte |
SERIOUS
For setting the serious parsing level |
static int |
SERIOUS_MESSAGES
For printing all the serious messages |
(package private) java.lang.String |
sfName
|
(package private) boolean |
showImportedIndex
|
(package private) java.util.Vector |
standardNodes
|
(package private) MibNode[] |
starters
|
(package private) java.sql.Statement |
stmt
|
(package private) LeafSyntax |
syntax
|
(package private) boolean |
throwFileNotFound
|
(package private) boolean |
toBytes
|
(package private) java.util.Vector |
userLabel
|
static int |
WARNING_MESSAGES
For printing all the warning messages |
| Fields inherited from interface com.adventnet.snmp.mibs.mibparser.MIBConstants |
ACCESS_ACCESSIBLE_FOR_NOTIFY,
ACCESS_NOT_ACCESSIBLE,
ACCESS_NOT_IMPLEMENTED,
ACCESS_READ_CREATE,
ACCESS_READ_ONLY,
ACCESS_READ_WRITE,
ACCESS_WRITE_ONLY,
accessStr,
AGENT_CAPABILITIES,
alphaStr,
BITSTRING,
COUNTER,
COUNTER32,
COUNTER64,
GAUGE,
GAUGE32,
INTEGER,
INTEGER32,
IPADDRESS,
macroStr,
MODULE_COMPLIANCE,
MODULE_IDENTITY,
NETWORKADDRESS,
NOTIFICATION_GROUP,
NOTIFICATION_TYPE,
NULL,
numericStr,
OBJECT_GROUP,
OBJECT_IDENTIFIER,
OBJECT_IDENTITY,
OBJECT_TYPE,
OCTETSTRING,
OPAQUE,
SEQUENCE,
STATUS_CURRENT,
STATUS_DEPRECATED,
STATUS_MANDATORY,
STATUS_OBSOLETE,
STATUS_OPTIONAL,
statusStr,
TEXTUAL_CONVENTION,
TIMETICKS,
TRAP_TYPE,
UNSIGNED32 |
| Constructor Summary | |
MibOperations()
This instantiates a new MibOperations instance for MIB operations. |
|
| Method Summary | |
void |
addChecks(byte[] checks,
byte parsingLevel)
Used to add checks to the existing parsing level. |
void |
addLabel(java.lang.String addLabel)
Used to add label which should not be treated as a reserved word by the MIB parser. |
(package private) void |
changeModuleName()
|
(package private) java.lang.String |
checkFileName(java.lang.String fileName)
Used to delete all the tables related to the specified module in the database. |
(package private) boolean |
checkMultipleRevision(java.lang.String moduleName)
|
(package private) void |
checkSequenceConstruct(java.lang.String moduleNow)
|
void |
createCompiledMibs(java.lang.String mibs)
Used to create compiled mibs namely the cmi and cds files. |
SnmpVarBind |
createVariableBinding(java.lang.String varName,
java.lang.String[] indexes,
java.lang.String value)
Creates an SnmpVarBind instance with the supplied parameters. |
(package private) static void |
debugLogging(java.lang.String methodName,
java.lang.String className,
java.lang.String debugStr)
|
(package private) static void |
debugPrint(java.lang.String debugOutput)
The default debug function, which prints to stdout |
(package private) static void |
debugPrint(java.lang.String msg,
int msgClass)
Will print the debug messages. |
(package private) void |
deregisterImport(java.lang.String moduleName,
MibModule reader)
Conveys a resolution and lack of interest in moduleName for reader |
void |
enableDisplayHint(boolean flag)
Used to set the displayHint flag. |
java.lang.String |
encodeInstanceString(java.util.Vector indexValue,
java.util.Vector indexMibNodes)
Encodes an instance string based on the Snmp Type of the indexMibNode. |
(package private) java.lang.Object[] |
findFile(java.lang.Object[] obj)
|
(package private) java.lang.String |
findFileName(java.lang.String fileName)
|
(package private) java.lang.String |
findFileNameFromSearchPath(java.lang.String fileName)
|
(package private) void |
getAugInfo()
|
(package private) void |
getAugInfo(MibModule mod)
|
byte[] |
getChecks(byte parsingLevel)
Used to get the checks available for a particular parsingLevel. |
byte |
getDatabaseName()
Gets the name of the Database. |
java.util.Vector |
getErrorMessages(java.lang.String module)
Returns Vector of MibErrorMessages object for the module specified. |
java.util.Vector |
getErrorModuleNames()
Returns the names of modules which are having parsing errors. |
java.lang.String |
getErrorString(SnmpPDU pdu)
Gives a detailed error information on the PDU using information from the loaded MIBs. |
(package private) java.lang.String |
getexistingfilename(java.lang.String fileName)
|
(package private) java.lang.String |
getExistingFileName(java.lang.String fileName)
|
(package private) java.lang.String |
getFileName(java.lang.String fileName)
|
boolean |
getIgnoreSpecificControlCodes()
Used to get the value determining whether the new-line characters, tabs and carriage returns are printed or their hex values |
byte |
getImportsParsingLevel()
Returns the parsingLevel for the dependency MIB files. |
java.lang.String |
getInstanceString(SnmpOID oid)
Gets the Instance portion of OID as a String. |
java.lang.String |
getInstanceString(SnmpOID oid,
MibNode node)
Gets the Instance portion of OID as a String. |
LeafSyntax |
getLeafSyntax(SnmpOID oid)
Gets the syntax for the node corresponding to this oid. |
MibModule |
getMibModule(MibNode node)
Gets the MIB Module that contains the specified MibNode. |
MibModule |
getMibModule(java.lang.String name)
Gets the MIB Module from list of already loaded MIBs. |
java.util.Enumeration |
getMibModuleNames()
Gets the names of the Mib modules loaded. |
java.util.Enumeration |
getMibModules()
Gets all the MIB modules loaded in this MibOperations instance. |
MibNode |
getMibNode(SnmpOID oid)
Gets the MibNode for this SnmpOID instance by searching all the MIB modules. |
MibNode |
getMibNode(java.lang.String oidString)
Gets the node corresponding to this label. |
MibNode |
getMibNode(java.lang.String nodeLabel,
java.lang.String mib)
Gets the node correspoding to the label in this mib. |
MibNode |
getMibNode(java.util.Vector oid)
Gives the MibNode per the Vector of Strings OID argument. |
java.lang.String |
getMibPath()
Gets the search Path in which the MIB files are searched. |
MibTrap |
getMibTrap(SnmpOID enterprise,
int genericType,
int specificType)
Gets the trap definition matching the given enterprise, generic type and specific type values. |
(package private) MibModule |
getModuleFromGlobalImports(java.lang.String mName)
Gets the MibModule from globalImports Hashtable by using the mName as parameter. |
(package private) java.lang.Object[] |
getmodulenamedefinition(java.lang.Object[] obj)
|
java.lang.String |
getModuleNameDefinition(java.lang.String file)
Lets you know the module name contained in this MIB file. |
(package private) java.lang.String |
getModuleNameDefinition(java.lang.String file,
boolean singleFlag)
|
java.lang.String[] |
getModuleNameDefinitions(java.lang.String fileName)
Gives all the module names contained in this mib file. |
int |
getModuleSize()
Returns the number of modules loaded in this MibOperations instance. |
java.lang.String |
getMultipleRevision()
Gets the multiple revisions availabe for the MIB. |
(package private) java.util.Vector |
getMultipleRevisionModuleNames()
|
MibNode |
getNearestNode(SnmpOID oid)
Gets the node corresponding to the oid which is nearest to this SnmpOID instance. |
java.util.Vector |
getNodesFromNames(java.util.Vector nodes)
Gets the MibNodes corresponding to the names in the Vector. |
java.util.Vector |
getNodesFromString(java.lang.String nodeList)
Gets the MibNodes corresponding to the node names in the nodelist. |
NotificationType |
getNotificationType(SnmpOID trapoid)
Gets the NotificationType object of the given trap oid |
(package private) SnmpOID |
getNumericOID(java.lang.String s)
|
boolean |
getOverwriteCMI()
Deprecated. since 4.0, replaced by isOverwriteCMI() |
byte |
getParsingLevel()
Returns the parsingLevel. |
(package private) MibModule |
getRevisionModule(MibModule mod)
|
(package private) java.lang.String |
getRevisionModuleName(java.lang.String moduleName)
|
java.lang.String |
getSerializedMibFileName()
Retrieves the Serialized MIB file name. |
SnmpOID |
getSnmpOID(java.lang.String s)
Creates an SnmpOID instance based on the loaded MIBs. |
(package private) SnmpOID |
getSnmpOid(java.lang.String oid,
MibModule module)
|
(package private) MibNode |
getStarterNode(int subid)
|
(package private) MibNode |
getStarterNode(java.lang.String nodeLabel)
|
LeafSyntax |
getSyntaxByName(java.lang.String name)
Gets the syntax for the node represented by the String argument. |
boolean |
getThrowFileNotFound()
Deprecated. |
(package private) void |
initialiseEquivname()
|
(package private) void |
initialiseSyntaxes()
Just sets up the general LeafSyntax elements The elems here belong to the numericStr and alphaStr group in MIBConstants. |
void |
initJdbcParams(java.lang.String driverName,
java.lang.String URL,
java.lang.String userName,
java.lang.String passWord)
If you need to use database support, you have to invoke this method to initialize the Jdbc Parameters. |
boolean |
isDBConnected()
Used to know whether the Database connection is alive or not. |
(package private) static boolean |
isDebugLog(int level)
|
boolean |
isDisplayHintEnabled()
Used to know whether the displayHint flag is enabled or not. |
(package private) boolean |
isEndsWithCMI(java.lang.String fileName)
|
boolean |
isLoadFromCompiledMibs()
Used to know whether the MIB is loaded from the compiled mibs. |
boolean |
isLoadFromDatabase()
Used to know whether the MIB is loaded from the DataBase. |
boolean |
isLoadFromSerializedMibs()
Used to know whether the MIB is loaded from serialized mibs. |
boolean |
isMultipleRevision()
Used to know whether the multiple revision is set or not. |
boolean |
isOverwriteCMI()
Used to know whether the compiled mib files are overwritten. |
boolean |
isOverwriteDatabase()
Gets the overwriteDataBase boolean. |
boolean |
isOverwriteSerializedMibs()
Used to know whether the serialized mib files are overwritten. |
(package private) static boolean |
isPerformanceLog(int level)
|
boolean |
isReadDesc()
Used to know whether reading the descriptions from compiled modules is enabled. |
boolean |
isSerializeMibs()
Gets the serializeMibs boolean |
boolean |
isShowImportedIndex()
Used to know whether the external indices are shown in the Mib tree. |
(package private) boolean |
isStarterNode(MibNode node)
Performs a name check to see if node is a starterNode |
(package private) boolean |
isVersionOk(java.io.DataInputStream inp,
java.io.DataInputStream descInp)
Modify this method to return false if you don't want the reader to parse through a compiled mib with a higher version. |
(package private) java.lang.Object[] |
loadFromClasspath(java.lang.Object[] obj)
|
(package private) java.lang.Object[] |
loadFromFile(java.lang.Object[] obj)
|
(package private) java.lang.Object[] |
loadFromJar(java.lang.Object[] obj)
|
(package private) MibModule |
loadFromSerializedMibs(java.lang.Object[] obj)
|
(package private) java.lang.Object[] |
loadFromURL(java.lang.Object[] obj)
|
(package private) void |
loadImports(java.lang.String fileName)
|
(package private) void |
loadMibModule(java.applet.Applet applet,
java.lang.String urlName)
|
MibModule |
loadMibModule(java.applet.Applet applet,
java.net.URL url)
Load a MIB Module from an applet using the URL. |
(package private) MibModule |
loadmibmodule(java.lang.Object[] obj)
|
MibModule |
loadMibModule(java.lang.String fileName)
Load a MIB Module from this file. |
void |
loadMibModules(java.applet.Applet applet,
java.lang.String mibs)
Load a set of MIB Modules from an applet using the string URLs. |
void |
loadMibModules(java.lang.String mibs)
Load a set of MIB Modules from files. |
(package private) MibModule |
loadMibsDirectly(java.lang.Object[] obj,
java.lang.String moduleName)
|
(package private) MibModule |
loadMibsFromCMI(java.lang.Object[] obj)
|
(package private) MibModule |
loadModule(java.io.InputStream istr,
java.io.InputStream dstr,
java.lang.String strName)
Loads the module using the specified Input and description file input streams. |
(package private) static void |
performanceLogging(java.lang.String methodName,
java.lang.String className,
long timeDiff)
|
(package private) static void |
printLogMessage(java.lang.String errorMessage,
int type)
|
(package private) java.lang.String |
readInitialisers(java.io.DataInputStream istr)
This just reads in the initial data |
(package private) java.lang.String |
readMibModuleName(java.io.DataInputStream inp)
Reads in the mib module name from the input stream |
(package private) void |
registerImport(java.lang.String moduleName,
MibModule reader)
to register the import module requirement. |
(package private) void |
registerModule(MibModule module)
Register the module for use with mibOps. |
void |
registerParsingLevel(byte parsingLevel,
byte[] checks)
Used to create an used defined parsing level. |
void |
removeChecks(byte[] checks,
byte parsingLevel)
Used to remove checks from the existing parsing level. |
(package private) void |
removeModules()
|
(package private) void |
resolveDefOID(MibModule module)
|
(package private) void |
resolveImports(java.lang.String moduleName,
java.lang.String strName)
|
(package private) void |
revertBack()
|
void |
setDatabaseName(byte type)
Used to set the database. |
void |
setDebug(boolean debug)
Defines whether debugging output should be generated to stdout. |
static void |
setDebugMessageLevel(int level)
Sets the debug message level. |
(package private) void |
setFileName(java.lang.String fileName)
|
void |
setIgnoreSpecificControlCodes(boolean specConCode)
Used to set the value determining whether the new-line characters, tabs and carriage returns are printed as they are or their hex values. |
void |
setImportsParsingLevel(byte parsingLevel)
Used to set the level of parsing for the dependency MIB files. |
void |
setLoadFromCompiledMibs(boolean flag)
Defines whether to load mib from compiled MIBs. |
void |
setLoadFromDatabase(boolean flag)
Defines whether to load the MIB from DataBase. |
void |
setLoadFromSerializedMibs(boolean flag)
Defines whether to load mib from serialized MIB file. |
void |
setMibFileExtension(java.lang.String extension)
Registers the extensions with which the MIB file is to be searched. |
void |
setMibPath(java.lang.String path)
Sets the search Path in which the Mib Parser will search for the MIB modules. |
void |
setMultipleRevision(java.lang.String revisionFileName)
Sets the Multiple revision for the MIB. |
void |
setOverwriteCMI(boolean overWrite)
Defines whether to overwrite the existing compiled files. |
void |
setOverwriteDatabase(boolean overWrite)
Defines whether to overwrite the existing database files. |
void |
setOverwriteSerializedMibs(boolean flag)
Defines whether to overwrite the existing serialized MIB files. |
void |
setParsingLevel(byte parsingLevel)
Used to set the level of parsing. |
void |
setReadDesc(boolean readFlag)
Sets the flag for reading the descriptions from compiled mib modules. |
void |
setSerializedMibFileName(java.lang.String fileName)
Defines the name with which the serialized MIB file is to be stored. |
void |
setSerializeMibs(boolean flag)
Defines whether to serialize the MibModule. |
void |
setShowImportedIndex(boolean flag)
Sets the showImportedIndex boolean value. |
void |
setThrowFileNotFound(boolean value)
Deprecated. |
java.lang.String |
toByteString(SnmpPDU pdu)
Returns the byte representation of the SnmpPDU using the MIB information. |
java.lang.String |
toByteString(SnmpVarBind varBind)
Returns the byte representation of SnmpVarbind using the MIB information. |
java.lang.String |
toByteString(SnmpVar var,
SnmpOID oid)
Gives a translated value for the SnmpVar instance using the MIB information. |