public abstract class

SnmpMib

extends SnmpMibAgent
implements Serializable
java.lang.Object
   ↳ com.sun.jmx.snmp.agent.SnmpMibAgent
     ↳ com.sun.jmx.snmp.agent.SnmpMib
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

Abstract class for representing an SNMP MIB.

When compiling a SNMP MIB, among all the classes generated by mibgen, there is one which extends SnmpMib for representing a whole MIB.
The class is used by the SNMP protocol adaptor as the entry point in the MIB.

This generated class can be subclassed in your code in order to plug in your own specific behaviour.

This API is a Sun Microsystems internal API and is subject to change without notice.

Summary

Fields
protected SnmpMibOid root The top element in the Mib tree.
[Expand]
Inherited Fields
From class com.sun.jmx.snmp.agent.SnmpMibAgent
Public Constructors
SnmpMib()
Default constructor.
Public Methods
void check(SnmpMibRequest req)
Checks if a set operation can be performed.
void get(SnmpMibRequest req)
Processes a get operation.
void getBulk(SnmpMibRequest req, int nonRepeat, int maxRepeat)
Processes a getBulk operation.
void getNext(SnmpMibRequest req)
Processes a getNext operation.
abstract SnmpMibTable getRegisteredTableMeta(String name)
Returns a registered SNMP Table metadata node.
long[] getRootOid()
Gets the root object identifier of the MIB.
abstract void registerTableMeta(String name, SnmpMibTable table)

Register an SNMP Table metadata node in the MIB.

void set(SnmpMibRequest req)
Processes a set operation.
Protected Methods
ObjectName getGroupObjectName(String name, String oid, String defaultName)

This callback should return the ObjectName associated to the group identified by the given groupName.

String getGroupOid(String groupName, String defaultOid)

This callback should return the OID associated to the group identified by the given groupName.

void registerGroupNode(String groupName, String groupOid, ObjectName groupObjName, SnmpMibNode node, Object group, MBeanServer server)

Register an SNMP group and its metadata node in the MIB.

[Expand]
Inherited Methods
From class com.sun.jmx.snmp.agent.SnmpMibAgent
From class java.lang.Object
From interface com.sun.jmx.snmp.agent.SnmpMibAgentMBean
From interface javax.management.MBeanRegistration

Fields

protected SnmpMibOid root

The top element in the Mib tree.

Public Constructors

public SnmpMib ()

Default constructor. Initializes the OID tree.

Public Methods

public void check (SnmpMibRequest req)

Checks if a set operation can be performed. If the operation cannot be performed, the method will raise a SnmpStatusException.

Parameters
req The SnmpMibRequest object holding the list of variable to be set. This list is composed of SnmpVarBind objects.

public void get (SnmpMibRequest req)

Processes a get operation.

Parameters
req The SnmpMibRequest object holding the list of variable to be retrieved. This list is composed of SnmpVarBind objects.

public void getBulk (SnmpMibRequest req, int nonRepeat, int maxRepeat)

Processes a getBulk operation. The method implements the getBulk operation by calling appropriately the getNext method.

Parameters
req The SnmpMibRequest object holding the list of variable to be retrieved. This list is composed of SnmpVarBind objects.
nonRepeat The number of variables, starting with the first variable in the variable-bindings, for which a single lexicographic successor is requested.
maxRepeat The number of lexicographic successors requested for each of the last R variables. R is the number of variables following the first nonRepeat variables for which multiple lexicographic successors are requested.

public void getNext (SnmpMibRequest req)

Processes a getNext operation.

Parameters
req The SnmpMibRequest object holding the list of OIDs from which the next variables should be retrieved. This list is composed of SnmpVarBind objects.

public abstract SnmpMibTable getRegisteredTableMeta (String name)

Returns a registered SNMP Table metadata node.

This method is used internally and you should never need to call it directly.

public long[] getRootOid ()

Gets the root object identifier of the MIB.

In order to be accurate, the method should be called once the MIB is fully initialized (that is, after a call to init or preRegister).

Returns
  • The root object identifier.

public abstract void registerTableMeta (String name, SnmpMibTable table)

Register an SNMP Table metadata node in the MIB.

This method is used internally and you should never need to call it directly.
It is used to establish the link between an SNMP table metadata node and its bean-like counterpart.
The group metadata nodes will create and register their underlying table metadata nodes in the MIB using this method.
The metadata nodes will be later retrieved from the MIB by the bean-like table objects using the getRegisterTableMeta() method.

Parameters
name The java-ized name of the SNMP table.
table The SNMP table metadata node - usually this corresponds to a mibgen generated object.

public void set (SnmpMibRequest req)

Processes a set operation.

Parameters
req The SnmpMibRequest object holding the list of variable to be set. This list is composed of SnmpVarBind objects.

Protected Methods

protected ObjectName getGroupObjectName (String name, String oid, String defaultName)

This callback should return the ObjectName associated to the group identified by the given groupName.

This method is provided as a hook to plug-in some custom specific behavior. You might want to override this method in order to provide a different object naming scheme than that proposed by default by mibgen.

This method is only meaningful if the MIB is registered in the MBeanServer, otherwise, it will not be called.

The default implementation of this method is to return an ObjectName built from the given defaultName.

Parameters
name The java-ized name of the SNMP group.
oid The OID returned by getGroupOid() - in dot notation.
defaultName The name by default generated by mibgen
Returns
  • The ObjectName of the group identified by name

protected String getGroupOid (String groupName, String defaultOid)

This callback should return the OID associated to the group identified by the given groupName.

This method is provided as a hook to plug-in some custom specific behavior. Although doing so is discouraged you might want to subclass this method in order to store & provide more metadata information (mapping OID <-> symbolic name) within the agent, or to "change" the root of the MIB OID by prefixing the defaultOid by an application dependant OID string, for instance.

The default implementation of this method is to return the given defaultOid

Parameters
groupName The java-ized name of the SNMP group.
defaultOid The OID defined in the MIB for that group (in dot notation).
Returns
  • The OID of the group identified by groupName, in dot-notation.

protected void registerGroupNode (String groupName, String groupOid, ObjectName groupObjName, SnmpMibNode node, Object group, MBeanServer server)

Register an SNMP group and its metadata node in the MIB.

This method is provided as a hook to plug-in some custom specific behavior. You might want to override this method if you want to set special links between the MBean, its metadata node, its OID or ObjectName etc..

If the MIB is not registered in the MBeanServer, the server and groupObjName parameters will be null.
If the given group MBean is not null, and if the server and groupObjName parameters are not null, then this method will also automatically register the group MBean with the given MBeanServer server.

Parameters
groupName The java-ized name of the SNMP group.
groupOid The OID as returned by getGroupOid() - in dot notation.
groupObjName The ObjectName as returned by getGroupObjectName(). This parameter may be null if the MIB is not registered in the MBeanServer.
node The metadata node, as returned by the metadata factory method for this group.
group The MBean for this group, as returned by the MBean factory method for this group.
server The MBeanServer in which the groups are to be registered. This parameter will be null if the MIB is not registered, otherwise it is a reference to the MBeanServer in which the MIB is registered.