public abstract class

SnmpMibTable

extends SnmpMibNode
implements Serializable NotificationBroadcaster
java.lang.Object
   ↳ com.sun.jmx.snmp.agent.SnmpMibNode
     ↳ com.sun.jmx.snmp.agent.SnmpMibTable
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

This class is the base class for SNMP table metadata.

Its responsibility is to manage a sorted array of OID indexes according to the SNMP indexing scheme over the "real" table. Each object of this class can be bound to an SnmpTableEntryFactory to which it will forward remote entry creation requests, and invoke callbacks when an entry has been successfully added to / removed from the OID index array.

For each table defined in the MIB, mibgen will generate a specific class called TableTableName that will implement the SnmpTableEntryFactory interface, and a corresponding TableNameMeta class that will extend this class.
The TableTableName class corresponds to the MBean view of the table while the TableNameMeta class corresponds to the MIB metadata view of the same table.

Objects of this class are instantiated by the generated whole MIB class extending SnmpMib You should never need to instantiate this class directly.

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

Summary

Fields
protected boolean creationEnabled true if remote creation of entries via SET operations is enabled.
protected SnmpTableEntryFactory factory The entry factory
protected int nodeId The id of the contained entry object.
protected SnmpMib theMib The MIB to which the metadata is linked.
[Expand]
Inherited Fields
From class com.sun.jmx.snmp.agent.SnmpMibNode
Public Constructors
SnmpMibTable(SnmpMib mib)
Create a new SnmpMibTable metadata node.
Public Methods
void addEntry(SnmpOid rowOid, Object entry)
Add a new entry in this SnmpMibTable.
synchronized void addEntry(SnmpOid oid, ObjectName name, Object entry)
Add a new entry in this SnmpMibTable.
synchronized void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
Enable to add an SNMP entry listener to this SnmpMibTable.
void check(SnmpMibSubRequest req, int depth)
Generic handling of the check operation.
abstract void createNewEntry(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
This method is invoked when the creation of a new entry is requested by a remote SNMP manager.
void get(SnmpMibSubRequest req, int depth)
Generic handling of the get operation.
Object[] getBasicEntries()
Return the entries stored in this table SnmpMibTable.
synchronized Object getEntry(SnmpOid rowOid)
Get the entry corresponding to the specified rowOid.
synchronized ObjectName getEntryName(SnmpOid rowOid)
Get the ObjectName of the entry corresponding to the specified rowOid.
MBeanNotificationInfo[] getNotificationInfo()
Return a NotificationInfo object containing the notification class and the notification type sent by the SnmpMibTable.
int getSize()
Get the size of the table.
boolean hasRowStatus()
Return true if the conceptual row contains a columnar object used to control creation/deletion of rows in this table.
boolean isCreationEnabled()
Tell whether a new entry should be created when a SET operation is received for an entry that does not exist yet.
abstract boolean isRegistrationRequired()
Tell whether the specific version of this metadata generated by mibgen requires entries to be registered with the MBeanServer.
void registerEntryFactory(SnmpTableEntryFactory factory)
Register the factory through which table entries should be created when remote entry creation is enabled.
synchronized void removeEntry(SnmpOid rowOid, Object entry)
Remove the specified entry from the table.
void removeEntry(SnmpOid rowOid)
Remove the specified entry from the table.
synchronized void removeEntry(int pos, Object entry)
Remove the specified entry from the table.
synchronized void removeNotificationListener(NotificationListener listener)
Enable to remove an SNMP entry listener from this SnmpMibTable.
void set(SnmpMibSubRequest req, int depth)
Generic handling of the set operation.
void setCreationEnabled(boolean remoteCreationFlag)
This method lets you dynamically switch the creation policy.
Protected Methods
synchronized void beginRowAction(SnmpMibSubRequest req, SnmpOid rowOid, int depth, int rowAction)
This method takes care of initial RowStatus handling during the check() phase of a SET request.
abstract void check(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
This method is used internally and is implemented by the SnmpMibTable subclasses generated by mibgen.
void checkRemoveTableRow(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
Check whether the specified row can be removed from the table.
void checkRowStatusChange(SnmpMibSubRequest req, SnmpOid rowOid, int depth, int newStatus)
Check whether the control variable of the given row can be switched to the new specified newStatus.
boolean contains(SnmpOid oid, Object userData)
Return true if the entry identified by the given OID index is contained in this table.
void endRowAction(SnmpMibSubRequest req, SnmpOid rowOid, int depth, int rowAction)
This method takes care of final RowStatus handling during the set() phase of a SET request.
abstract void get(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
This method is used internally and is implemented by the SnmpMibTable subclasses generated by mibgen.
SnmpOid getNextOid(Object userData)
Return the first entry OID registered in the table.
SnmpOid getNextOid(SnmpOid oid, Object userData)
Get the SnmpOid index of the row that follows the given oid in the table.
abstract long getNextVarEntryId(SnmpOid rowOid, long var, Object userData)
This method is used internally and is implemented by the SnmpMibTable subclasses generated by mibgen.
long getNextVarEntryId(SnmpOid rowOid, long var, Object userData, int pduVersion)
Return the next OID arc corresponding to a readable columnar object in the underlying entry OBJECT-TYPE, possibly skipping over those objects that must not or cannot be returned.
int getRowAction(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
Return the RowStatus code value specified in this request.
abstract boolean isReadableEntryId(SnmpOid rowOid, long var, Object userData)
This method is used internally and is implemented by the SnmpMibTable subclasses generated by mibgen.
boolean isRowReady(SnmpOid rowOid, Object userData)
Tell whether the specified row is ready and can be put in the notInService state.
boolean isRowStatus(SnmpOid rowOid, long var, Object userData)
Return true if the columnar object identified by var is used to control the addition/deletion of rows in this table.
int mapRowStatus(SnmpOid rowOid, SnmpVarBind vbstatus, Object userData)
Map the value of the vbstatus varbind to the corresponding RowStatus code defined in EnumRowStatus.
void removeTableRow(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
Remove a table row upon a remote manager request.
abstract void set(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
This method is used internally and is implemented by the SnmpMibTable subclasses generated by mibgen.
SnmpValue setRowStatus(SnmpOid rowOid, int newStatus, Object userData)
Set the control variable to the specified newStatus value.
boolean skipEntryVariable(SnmpOid rowOid, long var, Object userData, int pduVersion)
Hook for subclasses.
abstract void validateVarEntryId(SnmpOid rowOid, long var, Object userData)
This method is used internally and is implemented by the SnmpMibTable subclasses generated by mibgen.
[Expand]
Inherited Methods
From class com.sun.jmx.snmp.agent.SnmpMibNode
From class java.lang.Object
From interface javax.management.NotificationBroadcaster

Fields

protected boolean creationEnabled

true if remote creation of entries via SET operations is enabled. [default value is false]

protected SnmpTableEntryFactory factory

The entry factory

protected int nodeId

The id of the contained entry object.

protected SnmpMib theMib

The MIB to which the metadata is linked.

Public Constructors

public SnmpMibTable (SnmpMib mib)

Create a new SnmpMibTable metadata node.

Parameters
mib The SNMP MIB to which the metadata will be linked.

Public Methods

public void addEntry (SnmpOid rowOid, Object entry)

Add a new entry in this SnmpMibTable. Also triggers the addEntryCB() callback of the SnmpTableEntryFactory interface if this node is bound to a factory. This method assumes that the given entry will not be registered. If the entry is going to be registered, or if ObjectName's are required, then addEntry(SnmpOid, ObjectName, Object) should be prefered.
This function is mainly provided for backward compatibility.

Parameters
rowOid The SnmpOid identifying the table row to be added.
entry The entry to add.
Throws
SnmpStatusException The entry couldn't be added at the position identified by the given rowOid, or this version of the metadata requires ObjectName's.

public synchronized void addEntry (SnmpOid oid, ObjectName name, Object entry)

Add a new entry in this SnmpMibTable. Also triggers the addEntryCB() callback of the SnmpTableEntryFactory interface if this node is bound to a factory.

Parameters
oid The SnmpOid identifying the table row to be added.
name The ObjectName with which this entry is registered. This parameter can be omitted if isRegistrationRequired() return false.
entry The entry to add.
Throws
SnmpStatusException The entry couldn't be added at the position identified by the given rowOid, or if this version of the metadata requires ObjectName's, and the given name is null.

public synchronized void addNotificationListener (NotificationListener listener, NotificationFilter filter, Object handback)

Enable to add an SNMP entry listener to this SnmpMibTable.

Parameters
listener The listener object which will handle the notifications emitted by the registered MBean.
filter The filter object. If filter is null, no filtering will be performed before handling notifications.
handback The context to be sent to the listener when a notification is emitted.
Throws
IllegalArgumentException Listener parameter is null.

public void check (SnmpMibSubRequest req, int depth)

Generic handling of the check operation.

The default implementation of this method is to

  • check whether a new entry must be created, and if remote creation of entries is enabled, create it.
  • call the generated check(req,oid,depth+1) method.

 public void check(SnmpMibSubRequest req, int depth)
    throws SnmpStatusException {
    final SnmpOid     oid    = req.getEntryOid();
    final int         action = getRowAction(req,oid,depth+1);

    beginRowAction(req,oid,depth+1,action);
    check(req,oid,depth+1);
 }
 

You should not need to override this method in any cases, because it will eventually call check(SnmpMibSubRequest req, int depth) on the generated derivative of SnmpMibEntry. If you need to implement specific policies for minimizing the accesses made to some remote underlying resources, or if you need to implement some consistency checks between the different values provided in the varbind list, you should then rather override check(SnmpMibSubRequest req, int depth) on the generated derivative of SnmpMibEntry.

Parameters
req The sub-request that must be handled by this node.
depth The depth reached in the OID tree.

public abstract void createNewEntry (SnmpMibSubRequest req, SnmpOid rowOid, int depth)

This method is invoked when the creation of a new entry is requested by a remote SNMP manager.
By default, remote entry creation is disabled - and this method will not be called. You can dynamically switch the entry creation policy by calling setCreationEnabled(true) and setCreationEnabled(false) on this object.

This method is called internally by the SNMP runtime and you should never need to call it directly. However you might want to extend it in order to implement your own specific application behaviour, should the default behaviour not be at your convenience.

Parameters
req The SNMP subrequest requesting this creation
rowOid The OID indexing the conceptual row (entry) for which the creation was requested.
depth The position of the columnar object arc in the OIDs from the varbind list.
Throws
SnmpStatusException if the entry cannot be created.

public void get (SnmpMibSubRequest req, int depth)

Generic handling of the get operation.

The default implementation of this method is to

  • check whether the entry exists, and if not register an exception for each varbind in the list.
  • call the generated get(req,oid,depth+1) method.

 public void get(SnmpMibSubRequest req, int depth)
    throws SnmpStatusException {
    boolean         isnew  = req.isNewEntry();

    // if the entry does not exists, then registers an error for
    // each varbind involved (nb: this should not happen, since
    // the error should already have been detected earlier)
    //
    if (isnew) {
        SnmpVarBind     var = null;
        for (Enumeration e= req.getElements(); e.hasMoreElements();) {
            var = (SnmpVarBind) e.nextElement();
            req.registerGetException(var,noSuchNameException);
        }
    }

    final SnmpOid oid = req.getEntryOid();
    get(req,oid,depth+1);
 }
 

You should not need to override this method in any cases, because it will eventually call get(SnmpMibSubRequest req, int depth) on the generated derivative of SnmpMibEntry. If you need to implement specific policies for minimizing the accesses made to some remote underlying resources, or if you need to implement some consistency checks between the different values provided in the varbind list, you should then rather override get(SnmpMibSubRequest req, int depth) on the generated derivative of SnmpMibEntry.

Parameters
req The sub-request that must be handled by this node.
depth The depth reached in the OID tree.

public Object[] getBasicEntries ()

Return the entries stored in this table SnmpMibTable.

If the subclass generated by mibgen uses the generic way to access the entries (i.e. if it goes through the MBeanServer) then some of the entries may be null. It all depends whether a non null entry was passed to addEntry().
Otherwise, if it uses the standard way (access the entry directly through their standard MBean interface) this array will contain all the entries.

Returns
  • The entries array.

public synchronized Object getEntry (SnmpOid rowOid)

Get the entry corresponding to the specified rowOid.

Parameters
rowOid The SnmpOid identifying the row to be retrieved.
Returns
  • The entry.
Throws
SnmpStatusException There is no entry with the specified rowOid in the table.

public synchronized ObjectName getEntryName (SnmpOid rowOid)

Get the ObjectName of the entry corresponding to the specified rowOid. The result of this method is only meaningful if isRegistrationRequired() yields true.

Parameters
rowOid The SnmpOid identifying the table row whose ObjectName we want to retrieve.
Returns
  • The object name of the entry.
Throws
SnmpStatusException There is no entry with the specified rowOid in the table.

public MBeanNotificationInfo[] getNotificationInfo ()

Return a NotificationInfo object containing the notification class and the notification type sent by the SnmpMibTable.

Returns
  • the array of possible notifications.

public int getSize ()

Get the size of the table.

Returns
  • The number of entries currently registered in this table.

public boolean hasRowStatus ()

Return true if the conceptual row contains a columnar object used to control creation/deletion of rows in this table.

This columnar object can be either a variable with RowStatus syntax as defined by RFC 2579, or a plain variable whose semantics is table specific.

By default, this function returns false, and it is assumed that the table has no such control variable.
When mibgen is used over SMIv2 MIBs, it will generate an hasRowStatus() method returning true for each table containing an object with RowStatus syntax.

When this method returns false the default mechanism for remote entry creation is used. Otherwise, creation/deletion is performed as specified by the control variable (see getRowAction() for more details).

This method is called internally when a SET request involving this table is processed.

If you need to implement a control variable which do not use the RowStatus convention as defined by RFC 2579, you should subclass the generated table metadata class in order to redefine this method and make it returns true.
You will then have to redefine the isRowStatus(), mapRowStatus(), isRowReady(), and setRowStatus() methods to suit your specific implementation.

Returns
  • true if this table contains a control variable (eg: a variable with RFC 2579 RowStatus syntax),
  • false if this table does not contain any control variable.

public boolean isCreationEnabled ()

Tell whether a new entry should be created when a SET operation is received for an entry that does not exist yet.

Returns
  • true if a new entry must be created, false otherwise.
    [default: returns false]

public abstract boolean isRegistrationRequired ()

Tell whether the specific version of this metadata generated by mibgen requires entries to be registered with the MBeanServer. In this case an ObjectName will have to be passed to addEntry() in order for the table to behave correctly (case of the generic metadata).

If that version of the metadata does not require entry to be registered, then passing an ObjectName becomes optional (null can be passed instead).

Returns
  • true if registration is required by this version of the metadata.

public void registerEntryFactory (SnmpTableEntryFactory factory)

Register the factory through which table entries should be created when remote entry creation is enabled.

Parameters
factory The SnmpTableEntryFactory through which entries will be created when a remote SNMP manager request the creation of a new entry via an SNMP SET request.

public synchronized void removeEntry (SnmpOid rowOid, Object entry)

Remove the specified entry from the table. Also triggers the removeEntryCB() callback of the SnmpTableEntryFactory interface if this node is bound to a factory.

Parameters
rowOid The SnmpOid identifying the table row to remove.
entry The entry to be removed. This parameter is not used internally, it is simply passed along to the removeEntryCB() callback.
Throws
SnmpStatusException if the specified entry couldn't be removed (if the given rowOid is not valid for instance).

public void removeEntry (SnmpOid rowOid)

Remove the specified entry from the table. Also triggers the removeEntryCB() callback of the SnmpTableEntryFactory interface if this node is bound to a factory.

Parameters
rowOid The SnmpOid identifying the table row to remove.
Throws
SnmpStatusException if the specified entry couldn't be removed (if the given rowOid is not valid for instance).

public synchronized void removeEntry (int pos, Object entry)

Remove the specified entry from the table. Also triggers the removeEntryCB() callback of the SnmpTableEntryFactory interface if this node is bound to a factory.

Parameters
pos The position of the entry in the table.
entry The entry to be removed. This parameter is not used internally, it is simply passed along to the removeEntryCB() callback.
Throws
SnmpStatusException if the specified entry couldn't be removed.

public synchronized void removeNotificationListener (NotificationListener listener)

Enable to remove an SNMP entry listener from this SnmpMibTable.

Parameters
listener The listener object which will handle the notifications emitted by the registered MBean. This method will remove all the information related to this listener.
Throws
ListenerNotFoundException The listener is not registered in the MBean.

public void set (SnmpMibSubRequest req, int depth)

Generic handling of the set operation.

The default implementation of this method is to call the generated set(req,oid,depth+1) method.

 public void set(SnmpMibSubRequest req, int depth)
    throws SnmpStatusException {
    final SnmpOid oid = req.getEntryOid();
    final int  action = getRowAction(req,oid,depth+1);

    set(req,oid,depth+1);
    endRowAction(req,oid,depth+1,action);
 }
 

You should not need to override this method in any cases, because it will eventually call set(SnmpMibSubRequest req, int depth) on the generated derivative of SnmpMibEntry. If you need to implement specific policies for minimizing the accesses made to some remote underlying resources, or if you need to implement some consistency checks between the different values provided in the varbind list, you should then rather override set(SnmpMibSubRequest req, int depth) on the generated derivative of SnmpMibEntry.

Parameters
req The sub-request that must be handled by this node.
depth The depth reached in the OID tree.

public void setCreationEnabled (boolean remoteCreationFlag)

This method lets you dynamically switch the creation policy.

Parameters
remoteCreationFlag Tells whether remote entry creation must be enabled or disabled.
  • setCreationEnabled(true) will enable remote entry creation via SET operations.
  • setCreationEnabled(false) will disable remote entry creation via SET operations.
  • By default remote entry creation via SET operation is disabled.

Protected Methods

protected synchronized void beginRowAction (SnmpMibSubRequest req, SnmpOid rowOid, int depth, int rowAction)

This method takes care of initial RowStatus handling during the check() phase of a SET request. In particular it will:

  • check that the given rowAction returned by getRowAction() is valid.
  • Then depending on the rowAction specified it will:
    • either call createNewEntry() ( rowAction = createAndGo or createAndWait ),
    • or call checkRemoveTableRow() ( rowAction = destroy),
    • or call checkRowStatusChange() ( rowAction = active or notInService),
    • or generate a SnmpStatusException if the passed rowAction is not correct.

In principle, you should not need to redefine this method.

beginRowAction() is called during the check phase of a SET request, before actual checking on the varbind list is performed.

Parameters
req The sub-request that must be handled by this node.
rowOid The SnmpOid identifying the table row involved in the operation.
depth The depth reached in the OID tree.
rowAction The requested action as returned by getRowAction(): one of the RowStatus codes defined in EnumRowStatus. These codes correspond to RowStatus codes as defined in RFC 2579, plus the unspecified value which is SNMP Runtime specific.
Throws
SnmpStatusException if the specified rowAction is not valid or cannot be executed. This should not happen since it would break the atomicity of the SET request. Specific checks should be implemented in beginRowAction() if needed.
See Also

protected abstract void check (SnmpMibSubRequest req, SnmpOid rowOid, int depth)

This method is used internally and is implemented by the SnmpMibTable subclasses generated by mibgen.

protected void checkRemoveTableRow (SnmpMibSubRequest req, SnmpOid rowOid, int depth)

Check whether the specified row can be removed from the table.

This method is called during the check phase of a SET request when the control variable specifies destroy

By default it is assumed that nothing prevents row deletion and this method does nothing. It is simply provided as a hook so that specific checks can be implemented.

Note that if the actual row deletion fails afterward, the atomicity of the request is no longer guaranteed.

Parameters
req The sub-request that must be handled by this node.
rowOid The SnmpOid identifying the table row involved in the operation.
depth The depth reached in the OID tree.
Throws
SnmpStatusException if the row deletion must be rejected.

protected void checkRowStatusChange (SnmpMibSubRequest req, SnmpOid rowOid, int depth, int newStatus)

Check whether the control variable of the given row can be switched to the new specified newStatus.

This method is called during the check phase of a SET request when the control variable specifies active or notInService.

By default it is assumed that nothing prevents putting the row in the requested state, and this method does nothing. It is simply provided as a hook so that specific checks can be implemented.

Note that if the actual row deletion fails afterward, the atomicity of the request is no longer guaranteed.

Parameters
req The sub-request that must be handled by this node.
rowOid The SnmpOid identifying the table row involved in the operation.
depth The depth reached in the OID tree.
newStatus The new status for the row: one of the RowStatus code defined in EnumRowStatus. These codes correspond to RowStatus codes as defined in RFC 2579, plus the unspecified value which is SNMP Runtime specific.
Throws
SnmpStatusException if switching to this new state would fail.

protected boolean contains (SnmpOid oid, Object userData)

Return true if the entry identified by the given OID index is contained in this table.

Do not call this method directly.

This method is provided has a hook for subclasses. It is called when a get/set request is received in order to determine whether the specified entry is contained in the table. You may want to override this method if you need to perform e.g. lazy evaluation of tables (you need to update the table when a request is received) or if your table is virtual.

Note that this method is called by the Runtime from within a synchronized block.

Parameters
oid The index part of the OID we're looking for.
userData A contextual object containing user-data. This object is allocated through the SnmpUserDataFactory for each incoming SNMP request.
Returns
  • true if the entry is found, false otherwise.

protected void endRowAction (SnmpMibSubRequest req, SnmpOid rowOid, int depth, int rowAction)

This method takes care of final RowStatus handling during the set() phase of a SET request. In particular it will:

  • either call setRowStatus(active) ( rowAction = createAndGo or active ),
  • or call setRowStatus(notInService or notReady) depending on the result of isRowReady() (rowAction = createAndWait ),
  • or call setRowStatus(notInService) ( rowAction = notInService),
  • or call removeTableRow() ( rowAction = destroy),
  • or generate a SnmpStatusException if the passed rowAction is not correct. This should be avoided since it would break SET request atomicity

In principle, you should not need to redefine this method.

endRowAction() is called during the set() phase of a SET request, after the actual set() on the varbind list has been performed. The varbind containing the control variable is updated with the value returned by setRowStatus() (if it is not null).

Parameters
req The sub-request that must be handled by this node.
rowOid The SnmpOid identifying the table row involved in the operation.
depth The depth reached in the OID tree.
rowAction The requested action as returned by getRowAction(): one of the RowStatus codes defined in EnumRowStatus. These codes correspond to RowStatus codes as defined in RFC 2579, plus the unspecified value which is SNMP Runtime specific.
Throws
SnmpStatusException if the specified rowAction is not valid.
See Also

protected abstract void get (SnmpMibSubRequest req, SnmpOid rowOid, int depth)

This method is used internally and is implemented by the SnmpMibTable subclasses generated by mibgen.

protected SnmpOid getNextOid (Object userData)

Return the first entry OID registered in the table.

Parameters
userData A contextual object containing user-data. This object is allocated through the SnmpUserDataFactory for each incoming SNMP request.
Returns
  • The SnmpOid of the first entry in the table.
Throws
SnmpStatusException If the table is empty.

protected SnmpOid getNextOid (SnmpOid oid, Object userData)

Get the SnmpOid index of the row that follows the given oid in the table. The given oid does not need to be a valid row OID index.

Parameters
oid The OID from which the search will begin.
userData A contextual object containing user-data. This object is allocated through the SnmpUserDataFactory for each incoming SNMP request.
Returns
  • The next SnmpOid index.
Throws
SnmpStatusException There is no index following the specified oid in the table.

protected abstract long getNextVarEntryId (SnmpOid rowOid, long var, Object userData)

This method is used internally and is implemented by the SnmpMibTable subclasses generated by mibgen.

Return the next OID arc corresponding to a readable columnar object in the underlying entry OBJECT-TYPE.

Parameters
rowOid The OID index of the row involved in the operation.
var Id of the variable we start from, looking for the next.
userData A contextual object containing user-data. This object is allocated through the SnmpUserDataFactory for each incoming SNMP request.
Returns
  • The next columnar object id.
Throws
SnmpStatusException If no id is found after the given id.

protected long getNextVarEntryId (SnmpOid rowOid, long var, Object userData, int pduVersion)

Return the next OID arc corresponding to a readable columnar object in the underlying entry OBJECT-TYPE, possibly skipping over those objects that must not or cannot be returned. Calls getNextVarEntryId(com.sun.jmx.snmp.SnmpOid, long, java.lang.Object), until skipEntryVariable(com.sun.jmx.snmp.SnmpOid, long, java.lang.Object, int) returns false.

Parameters
rowOid The OID index of the row involved in the operation.
var Id of the variable we start from, looking for the next.
userData A contextual object containing user-data. This object is allocated through the SnmpUserDataFactory for each incoming SNMP request.
pduVersion Protocol version of the original request PDU.
Returns
  • The next columnar object id which can be returned using the given PDU's protocol version.
Throws
SnmpStatusException If no id is found after the given id.

protected int getRowAction (SnmpMibSubRequest req, SnmpOid rowOid, int depth)

Return the RowStatus code value specified in this request.

The RowStatus code value should be one of the values defined by EnumRowStatus. These codes correspond to RowStatus codes as defined in RFC 2579, plus the unspecified value which is SNMP Runtime specific.

Parameters
req The sub-request that must be handled by this node.
rowOid The SnmpOid identifying the table row involved in the operation.
depth The depth reached in the OID tree.
Returns
  • The RowStatus code specified in this request, if any:
    • If the specified row does not exist and this table do not use any variable to control creation/deletion of rows, then default creation mechanism is assumed and createAndGo is returned
    • Otherwise, if the row exists and this table do not use any variable to control creation/deletion of rows, unspecified is returned.
    • Otherwise, if the request does not contain the control variable, unspecified is returned.
    • Otherwise, mapRowStatus() is called to extract the RowStatus code from the SnmpVarBind that contains the control variable.
Throws
SnmpStatusException if the value of the control variable could not be mapped to a RowStatus code.
See Also

protected abstract boolean isReadableEntryId (SnmpOid rowOid, long var, Object userData)

This method is used internally and is implemented by the SnmpMibTable subclasses generated by mibgen.

Parameters
rowOid The OID index of the row involved in the operation.
var The OID arc.
userData A contextual object containing user-data. This object is allocated through the SnmpUserDataFactory for each incoming SNMP request.
Throws
SnmpStatusException If this id is not valid.

protected boolean isRowReady (SnmpOid rowOid, Object userData)

Tell whether the specified row is ready and can be put in the notInService state.

This method is called only once, after all the varbind have been set on a new entry for which createAndWait was specified.

If the entry is not yet ready, this method should return false. It will then be the responsibility of the entry to switch its own state to notInService when it becomes ready. No further call to isRowReady() will be made.

By default, this method always return true.
mibgen will not generate any specific implementation for this method - meaning that by default, a row created using createAndWait will always be placed in notInService state at the end of the request.

If this table was defined using SMIv2, and if it contains a control variable with RowStatus syntax, mibgen will generate an implementation for this method that will delegate the work to the metadata class modelling the conceptual row, so that you can override the default behaviour by subclassing that metadata class.

You will have to redefine this method if this default mechanism does not suit your needs.

Parameters
rowOid The SnmpOid identifying the table row involved in the operation.
userData A contextual object containing user-data. This object is allocated through the SnmpUserDataFactory for each incoming SNMP request.
Returns
  • true if the row can be placed in notInService state.
Throws
SnmpStatusException An error occured while trying to retrieve the row status, and the operation should be aborted.
See Also

protected boolean isRowStatus (SnmpOid rowOid, long var, Object userData)

Return true if the columnar object identified by var is used to control the addition/deletion of rows in this table.

By default, this method assumes that there is no control variable and always return false

If this table was defined using SMIv2, and if it contains a control variable with RowStatus syntax, mibgen will generate a non default implementation for this method that will identify the RowStatus control variable.

You will have to redefine this method if you need to implement control variables that do not conform to RFC 2579 RowStatus TEXTUAL-CONVENTION.

Parameters
rowOid The SnmpOid identifying the table row involved in the operation.
var The OID arc identifying the involved columnar object.
userData A contextual object containing user-data. This object is allocated through the SnmpUserDataFactory for each incoming SNMP request.

protected int mapRowStatus (SnmpOid rowOid, SnmpVarBind vbstatus, Object userData)

Map the value of the vbstatus varbind to the corresponding RowStatus code defined in EnumRowStatus. These codes correspond to RowStatus codes as defined in RFC 2579, plus the unspecified value which is SNMP Runtime specific.

By default, this method assumes that the control variable is an Integer, and it simply returns its value without further analysis.

If this table was defined using SMIv2, and if it contains a control variable with RowStatus syntax, mibgen will generate a non default implementation for this method.

You will have to redefine this method if you need to implement control variables that do not conform to RFC 2579 RowStatus TEXTUAL-CONVENTION.

Parameters
rowOid The SnmpOid identifying the table row involved in the operation.
vbstatus The SnmpVarBind containing the value of the control variable, as identified by the isRowStatus() method.
userData A contextual object containing user-data. This object is allocated through the SnmpUserDataFactory for each incoming SNMP request.
Returns
  • The RowStatus code mapped from the value contained in vbstatus.
Throws
SnmpStatusException if the value of the control variable could not be mapped to a RowStatus code.
See Also

protected void removeTableRow (SnmpMibSubRequest req, SnmpOid rowOid, int depth)

Remove a table row upon a remote manager request. This method is called internally when getRowAction() yields destroy - i.e.: it is only called when a remote manager requests the removal of a table row.
You should never need to call this function directly.

By default, this method simply calls removeEntry(rowOid) .

You can redefine this method if you need to implement some specific behaviour when a remote row deletion is invoked.

Note that specific checks should not be implemented in this method, but rather in checkRemoveTableRow(). If checkRemoveTableRow() succeeds and this method fails afterward, the atomicity of the original SET request can no longer be guaranteed.

Parameters
req The sub-request that must be handled by this node.
rowOid The SnmpOid identifying the table row involved in the operation.
depth The depth reached in the OID tree.
Throws
SnmpStatusException if the actual row deletion fails. This should not happen since it would break the atomicity of the SET request. Specific checks should be implemented in checkRemoveTableRow() if needed. If the entry does not exists, no exception is generated and the method simply returns.

protected abstract void set (SnmpMibSubRequest req, SnmpOid rowOid, int depth)

This method is used internally and is implemented by the SnmpMibTable subclasses generated by mibgen.

protected SnmpValue setRowStatus (SnmpOid rowOid, int newStatus, Object userData)

Set the control variable to the specified newStatus value.

This method maps the given newStatus to the appropriate value for the control variable, then sets the control variable in the entry identified by rowOid. It returns the new value of the control variable.

By default, it is assumed that there is no control variable so this method does nothing and simply returns null.

If this table was defined using SMIv2, and if it contains a control variable with RowStatus syntax, mibgen will generate a non default implementation for this method.

You will have to redefine this method if you need to implement control variables that do not conform to RFC 2579 RowStatus TEXTUAL-CONVENTION.

Parameters
rowOid The SnmpOid identifying the table row involved in the operation.
newStatus The new status for the row: one of the RowStatus code defined in EnumRowStatus. These codes correspond to RowStatus codes as defined in RFC 2579, plus the unspecified value which is SNMP Runtime specific.
userData A contextual object containing user-data. This object is allocated through the SnmpUserDataFactory for each incoming SNMP request.
Returns
  • The new value of the control variable (usually new SnmpInt(newStatus)) or null if the table do not have any control variable.
Throws
SnmpStatusException If the given newStatus could not be set on the specified entry, or if the given newStatus is not valid.
See Also

protected boolean skipEntryVariable (SnmpOid rowOid, long var, Object userData, int pduVersion)

Hook for subclasses. The default implementation of this method is to always return false. Subclasses should redefine this method so that it returns true when:

  • the variable is a leaf that is not instantiated,
  • or the variable is a leaf whose type cannot be returned by that version of the protocol (e.g. an Counter64 with SNMPv1).

Parameters
rowOid The OID index of the row involved in the operation.
var Id of the variable we start from, looking for the next.
userData A contextual object containing user-data. This object is allocated through the SnmpUserDataFactory for each incoming SNMP request.
pduVersion Protocol version of the original request PDU.
Returns
  • true if the variable must be skipped by the get-next algorithm.

protected abstract void validateVarEntryId (SnmpOid rowOid, long var, Object userData)

This method is used internally and is implemented by the SnmpMibTable subclasses generated by mibgen.

Parameters
rowOid The OID index of the row involved in the operation.
var The var we want to validate.
userData A contextual object containing user-data. This object is allocated through the SnmpUserDataFactory for each incoming SNMP request.
Throws
SnmpStatusException If this id is not valid.