|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.adventnet.snmp.mibs.MibModule
This class represents a MIB module, and enables operations on MIB modules loaded from MIB files.
Typically one MIB module is specified in an MIB file. Th MibModule instance can be obtained by loading the MIB through the MibOperations object.
MibOperations mibOps = new MibOperations(); MibModule module = null; try { mibOps.loadMibModule("RFC1213-MIB"); module = mibOps.getMibModule("RFC1213-MIB"); } catch(Excepion ex) { }
The functions in MibOperations which apply across all loaded MIBs. Use this class to restrict your operation to a specific MIB module. This is not advisable always. Infact, some of the methods will use mibOps to get the appropriate values.
We can obtain the all Macro types present in the MIB module.
The following table lists the macrotypes and the methods for getting the
corresponding macrotype objects defined in the module.
Macro Types | Methods for retreiving the macro types |
AGENT-CAPABILITIES | getDefinedAgentCapabilities() |
MODULE-IDENTITY | getMibModuleIdentity() |
MODULE-COMPLIANCE | getDefinedModuleCompliances() |
NOTIFICATION-TYPE | getDefinedNotificationTypes() |
OBJECT-TYPE/OBJECT IDENTIFIERS | getDefinedNodes() |
OBJECT-GROUP | getDefinedObjectGroups() |
TEXTUAL-CONVENTION | getDefinedTCs() |
TRAP-TYPE | getDefinedTraps() |
Each MIB Module is associated with a MibModule instance, which is built from parsing a MIB file. The root in a module is the highest node defined in the given module file, e.g. mgmt in rfc1213, or rmon in rfc1271-RMON. However, the parent nodes including "iso" are nodes in the module nodeList.
Once parsed, the MIB module is attached to the MibOperations instance so subsequent operations will make use of the MIB definitions.
The compiled approach has taken a slightly different route. In the ideal case a particular node will not be replicated across two MIBs. The relationships and the dependencies of the nodes upon elements in other MIBs are instead kept track of.
Field Summary |
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 |
Method Summary | |
MibNode |
getAgentCapabilities()
Deprecated. since 4.0. Instead you can use the method getDefinedAgentCapabilities |
AgentCapabilities |
getAgentCapabilities(java.lang.String acName)
Returns the AgentCapabilities object present in this module. |
java.util.Enumeration |
getDefinedAgentCapabilities()
Returns the Enumeration of AgentCapabilities present in this module. |
java.util.Enumeration |
getDefinedModuleCompliances()
Returns the ModuleCompliances present in this module. |
java.util.Enumeration |
getDefinedNodes()
Gets all the nodes defined in this module using this method. |
java.util.Enumeration |
getDefinedNotificationGroups()
Gets all the NotificationGroup objects defined in this module. |
java.util.Enumeration |
getDefinedNotifications()
Gets all the NOTIFICATION-TYPE objects defined in this module. |
java.util.Enumeration |
getDefinedNotificationTypes()
Gets all the NotificationType objects defined in this module. |
java.util.Enumeration |
getDefinedObjectGroups()
Gets all the ObjectGroup objects defined in this module. |
java.util.Enumeration |
getDefinedTCs()
Gets all the TEXTUAL-CONVENTIONS defined in this module. |
java.util.Enumeration |
getDefinedTraps()
Gets all the TRAP-TYPE objects defined in this MIB module. |
java.lang.String |
getFilename()
Deprecated. since 2.1 . Instead you can use the method getFileName() |
java.lang.String |
getFileName()
Gets the filename of this module. |
java.lang.String |
getImportedModules()
Gets the names of the modules imported by this module. |
java.util.Hashtable |
getImports()
Gets the imported elements in the MIB. |
LeafSyntax |
getLeafSyntax(SnmpOID oid)
Gets the syntax of the node corresponding to this oid. |
ModuleIdentity |
getMibModuleIdentity()
Gets the ModuleIdentity object for the given name. |
MibNode |
getMibNode(int[] oid)
Gets the MibNode corresponding to the int array of OID. |
MibNode |
getMibNode(SnmpOID oid)
Gets the MibNode corresponding to the SnmpOID argument |
MibNode |
getMibNode(java.lang.String oid)
Gets the MibNode corresponding to the String OID argument. |
MibNode |
getMibNode(java.util.Vector oid)
Gets the MibNode per the Vector of Strings OID argument. |
MibNode |
getMibNodeByName(java.lang.String nodeLabel)
Gives the MibNode corresponding to the specified nodeLabel |
MibNode |
getMibNotification(java.lang.String name)
Gets the NOTIFICATION-TYPE object corresponding to the given name. |
MibTC |
getMibTC(java.lang.String name)
Gets the TEXTUAL-CONVENTION corresponding to the given name. |
MibTrap |
getMibTrap(java.lang.String name)
Used to get the MibTrap object by giving the trap name. Using the MibTrap object, the trap informations such as the enterprise, trap number etc. |
boolean |
getMibVersion()
Used to know whether the loaded MIB module is an SMIv1 MIB (Structure of Management Information) or SMIv2 MIB. |
ModuleCompliance |
getModuleCompliance(java.lang.String mcName)
Returns the ModuleComplience object corresponding to the given name. |
MibNode |
getModuleIdentity()
Gives the MODULE-IDENTITY node defined in the MIB. |
java.lang.String |
getName()
Gets the name of this MIB module. |
MibNode |
getNearestNode(int[] oid)
Gets the Nearest MibNode corresponding to the int array of OID. |
NotificationGroup |
getNotificationGroup(java.lang.String name)
Gets the NotificationGroup object for the given name. |
NotificationType |
getNotificationType(java.lang.String name)
Gets the NotificationType object for the given name. |
ObjectGroup |
getObjectGroup(java.lang.String name)
Gets the ObjectGroup object for the given name. |
MibNode |
getRootNode()
Gets a reference to the root node in this MIB module. |
java.util.Vector |
getRootNodes()
Returns a collection of root nodes. |
SnmpOID |
getSnmpOID(java.lang.String s)
Creates an SnmpOID instance from the specified string and information from this Module. |
java.lang.String |
toString()
Returns the name of this MibModule. |
java.lang.String |
translateToNames(java.lang.String oid)
Used for translating numbered OID String to named OID String. |
java.lang.String |
translateToNumbers(java.lang.String oid)
Used for translating named OID String to numbered OID String. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
public boolean getMibVersion()
If the MibModule contains any one of the following Macro constructs, this module will be treated as an SMIv2 MIB.
public java.lang.String getName()
The module name begins with an upper-case letter and continues with zero or more letters, digits, or hyphens, except that a hyphen can not be the last character, nor can there be two consecutive hyphens. For example, RFC1213-MIB
toString()
public java.lang.String toString()
toString
in class java.lang.Object
getName()
public MibNode getRootNode()
This method will create a root node by getting the common ancestor node
of all the nodes present in this module.
If a module has more than one root node this method will return null.
In that case the method getRootNodes() can be used which retuns all
the root nodes.
getRootNodes()
public java.util.Vector getRootNodes()
In case of a module containing a single root node, both
the methods getRootNode() and getRootNodes() will return
the root node.
In case of module containing more than one root nodes like
iso and ccitt, the getRootNode() will return null and the
getRootNodes() will return a collection of root nodes.
getRootNode()
public java.util.Enumeration getDefinedTraps()
getMibTrap(java.lang.String)
public MibTrap getMibTrap(java.lang.String name)
name
- the name of the trap
MibOperations.getMibTrap(com.adventnet.snmp.snmp2.SnmpOID, int, int)
public java.util.Enumeration getDefinedNotifications()
getMibNotification(java.lang.String)
public MibNode getMibNotification(java.lang.String name)
name
- label of the node whose macro-type is NOTIFICATION-TYPE
public java.util.Enumeration getDefinedNodes()
public java.lang.String getFileName()
public java.lang.String getFilename()
getFileName()
public MibNode getModuleIdentity()
public MibNode getAgentCapabilities()
public java.util.Enumeration getDefinedAgentCapabilities()
public AgentCapabilities getAgentCapabilities(java.lang.String acName)
public java.util.Enumeration getDefinedModuleCompliances()
public ModuleCompliance getModuleCompliance(java.lang.String mcName)
public java.lang.String getImportedModules()
getImports()
public java.lang.String translateToNames(java.lang.String oid)
for example, if the input argument is 1.3.0, then this method
will return ".iso.org.dod.internet.mgmt.mib-2.system.sysUpTime.0"
oid
- numbered OID string(e.g. .1.3.6.1.2.1.1.3.0)
public java.lang.String translateToNumbers(java.lang.String oid)
oid
- OID String( e.g. .iso.org.dod)
public MibNode getMibNodeByName(java.lang.String nodeLabel)
nodeLabel
- the name of the node
public MibNode getMibNode(java.lang.String oid)
oid
- String OID
public LeafSyntax getLeafSyntax(SnmpOID oid)
oid
- the SnmpOID instance of the node
public MibNode getMibNode(SnmpOID oid)
oid
- an instance of SnmpOID
public MibNode getMibNode(java.util.Vector oid)
oid
- Vector of Strings OID
public MibNode getMibNode(int[] oid)
oid
- Integer array of the OID
public MibNode getNearestNode(int[] oid)
oid
- Integer array of the OID
public SnmpOID getSnmpOID(java.lang.String s)
s
- String OID(e.g. .1.3.6 or .iso.org.dod)
public java.util.Enumeration getDefinedTCs()
getMibTC(java.lang.String)
public MibTC getMibTC(java.lang.String name)
name
- the label of the TEXTUAL-CONVENTION
public java.util.Hashtable getImports()
public java.util.Enumeration getDefinedNotificationTypes()
getNotificationType(java.lang.String)
,
getDefinedNotifications()
public NotificationType getNotificationType(java.lang.String name)
name
- label of the node whose macro-type is NOTIFICATION-TYPE
getMibNotification(java.lang.String)
public java.util.Enumeration getDefinedNotificationGroups()
getNotificationGroup(java.lang.String)
public NotificationGroup getNotificationGroup(java.lang.String name)
name
- label of the node whose macro-type is NOTIFICATION-GROUP
public java.util.Enumeration getDefinedObjectGroups()
getObjectGroup(java.lang.String)
public ObjectGroup getObjectGroup(java.lang.String name)
name
- label of the node whose macro-type is OBJECT-GROUP
public ModuleIdentity getMibModuleIdentity()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |