Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.management.snmp.agent
Class SnmpMibTable

    java.lang.Object
      com.sun.management.snmp.agent.SnmpMibNode
          com.sun.management.snmp.agent.SnmpMibTable

All Implemented Interfaces:
  NotificationBroadcaster, Serializable

Direct Known Subclasses:
  UsmUserTableMeta

public abstract class SnmpMibTable
extends SnmpMibNode
implements NotificationBroadcaster, Serializable

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.

Since:
  Java DMK 5.1
Version:
  4.62 11/22/05
Author:
  Sun Microsystems, Inc
See Also:
  `SnmpMib`, `SnmpMibEntry`, `SnmpTableEntryFactory`, `SnmpTableSupport`, Serialized Form

Field Summary
`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.

Fields inherited from class com.sun.management.snmp.agent.SnmpMibNode
`noSuchInstanceException, noSuchNameException, noSuchObjectException, varList`

Constructor Summary
`SnmpMibTable(SnmpMib mib)` Create a new `SnmpMibTable` metadata node.

Method Summary
`void` | `addEntry(SnmpOid rowOid, Object entry)` Add a new entry in this `SnmpMibTable`.
`void` | `addEntry(SnmpOid oid, ObjectName name, Object entry)` Add a new entry in this `SnmpMibTable`.
`void` | `addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)` Enable to add an SNMP entry listener to this `SnmpMibTable`.
`protected void` | `beginRowAction(SnmpMibSubRequest request, SnmpOid rowOid, int depth, int rowAction)` This method takes care of initial RowStatus handling during the check() phase of a SET request.
`void` | `check(SnmpMibSubRequest request, int depth)` Generic handling of the `check` operation.
`protected abstract void` | `check(SnmpMibSubRequest request, SnmpOid rowOid, int depth)` This method is used internally and is implemented by the `SnmpMibTable` subclasses generated by `mibgen`.
`protected void` | `checkRemoveTableRow(SnmpMibSubRequest request, SnmpOid rowOid, int depth)` Check whether the specified row can be removed from the table.
`protected void` | `checkRowStatusChange(SnmpMibSubRequest request, SnmpOid rowOid, int depth, int newStatus)` Check whether the control variable of the given row can be switched to the new specified `newStatus`.
`protected boolean` | `contains(SnmpOid oid, Object userData)` Return true if the entry identified by the given OID index is contained in this table.
`abstract void` | `createNewEntry(SnmpMibSubRequest request, SnmpOid rowOid, int depth)` This method is invoked when the creation of a new entry is requested by a remote SNMP manager.
`protected void` | `endRowAction(SnmpMibSubRequest request, SnmpOid rowOid, int depth, int rowAction)` This method takes care of final RowStatus handling during the set() phase of a SET request.
`void` | `get(SnmpMibSubRequest request, int depth)` Generic handling of the `get` operation.
`protected abstract void` | `get(SnmpMibSubRequest request, SnmpOid rowOid, int depth)` This method is used internally and is implemented by the `SnmpMibTable` subclasses generated by `mibgen`.
`Object[]` | `getBasicEntries()` Return the entries stored in this table `SnmpMibTable`.
`Object` | `getEntry(SnmpOid rowOid)` Get the entry corresponding to the specified rowOid.
`ObjectName` | `getEntryName(SnmpOid rowOid)` Get the ObjectName of the entry corresponding to the specified rowOid.
`protected SnmpOid` | `getNextOid(Object userData)` Return the first entry OID registered in the table.
`protected SnmpOid` | `getNextOid(SnmpOid oid, Object userData)` Get the `SnmpOid` index of the row that follows the given `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`.
`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.
`MBeanNotificationInfo[]` | `getNotificationInfo()` Return a `NotificationInfo` object containing the notification class and the notification type sent by the `SnmpMibTable`.
`protected int` | `getRowAction(SnmpMibSubRequest request, SnmpOid rowOid, int depth)` Return the RowStatus code value specified in this request.
`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.
`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`.
`abstract boolean` | `isRegistrationRequired()` Tell whether the specific version of this metadata generated by `mibgen` requires entries to be registered with the MBeanServer.
`protected boolean` | `isRowReady(SnmpOid rowOid, Object userData)` Tell whether the specified row is ready and can be put in the notInService state.
`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.
`protected int` | `mapRowStatus(SnmpOid rowOid, SnmpVarBind vbstatus, Object userData)` Map the value of the `vbstatus` varbind to the corresponding RowStatus code defined in `EnumRowStatus`.
`void` | `registerEntryFactory(SnmpTableEntryFactory factory)` Register the factory through which table entries should be created when remote entry creation is enabled.
`void` | `removeEntry(int pos, Object entry)` Remove the specified entry from the table.
`void` | `removeEntry(SnmpOid rowOid)` Remove the specified entry from the table.
`void` | `removeEntry(SnmpOid rowOid, Object entry)` Remove the specified entry from the table.
`void` | `removeNotificationListener(NotificationListener listener)` Enable to remove an SNMP entry listener from this `SnmpMibTable`.
`protected void` | `removeTableRow(SnmpMibSubRequest request, SnmpOid rowOid, int depth)` Remove a table row upon a remote manager request.
`void` | `set(SnmpMibSubRequest request, int depth)` Generic handling of the `set` operation.
`protected abstract void` | `set(SnmpMibSubRequest request, SnmpOid rowOid, int depth)` This method is used internally and is implemented by the `SnmpMibTable` subclasses generated by `mibgen`.
`void` | `setCreationEnabled(boolean remoteCreationFlag)` This method lets you dynamically switch the creation policy.
`protected SnmpValue` | `setRowStatus(SnmpOid rowOid, int newStatus, Object userData)` Set the control variable to the specified `newStatus` value.
`protected boolean` | `skipEntryVariable(SnmpOid rowOid, long var, Object userData, int pduVersion)` Hook for subclasses.
`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`.

Methods inherited from class com.sun.management.snmp.agent.SnmpMibNode
`getNextIdentifier, getNextVarId, getNextVarId, getRootOid, skipVariable, sort`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### nodeId

    protected int nodeId

  The id of the contained entry object.

### theMib

    protected SnmpMib theMib

  The MIB to which the metadata is linked.

### creationEnabled

    protected boolean creationEnabled

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

### factory

    protected SnmpTableEntryFactory factory

  The entry factory

Constructor Detail

### SnmpMibTable

    public SnmpMibTable(SnmpMib mib)

  Create a new `SnmpMibTable` metadata node.

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

Method Detail

### createNewEntry

    public abstract void createNewEntry(SnmpMibSubRequest request,
                                        SnmpOid rowOid,
                                        int depth)
                                 throws SnmpStatusException

  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 behavior, should the default behavior not be at your convenience.

  Parameters:
    `request` - 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.

### isRegistrationRequired

    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.

### isCreationEnabled

    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`]

### setCreationEnabled

    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.

### hasRowStatus

    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 (e.g. a variable with RFC 2579 RowStatus syntax),
    - `false` if this table does not contain any control variable.

### get

    public void get(SnmpMibSubRequest request,
                    int depth)
             throws SnmpStatusException

  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(request,oid,depth+1)` method.

       public void get(SnmpMibSubRequest request, int depth)
      	  throws SnmpStatusException {
          boolean         isnew  = request.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= request.getElements(); e.hasMoreElements();) {
                  var = (SnmpVarBind) e.nextElement();
                  request.registerGetException(var,noSuchNameException);
              }
          }

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

  You should not need to override this method in any cases, because it will eventually call `get(SnmpMibSubRequest request, 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 request, int depth)` on the generated derivative of `SnmpMibEntry`.

  Specified by:
    `get` in class `SnmpMibNode`
  Parameters:
    `request` - The sub-request that must be handled by this node.
    `depth` - The depth reached in the OID tree.
  Throws:
    `SnmpStatusException` - An error occurred while accessing the MIB node.

### check

    public void check(SnmpMibSubRequest request,
                      int depth)
               throws SnmpStatusException

  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(request,oid,depth+1)` method.

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

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

  You should not need to override this method in any cases, because it will eventually call `check(SnmpMibSubRequest request, 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 request, int depth)` on the generated derivative of `SnmpMibEntry`.

  Specified by:
    `check` in class `SnmpMibNode`
  Parameters:
    `request` - The sub-request that must be handled by this node.
    `depth` - The depth reached in the OID tree.
  Throws:
    `SnmpStatusException` - An error occurred while accessing the MIB node.

### set

    public void set(SnmpMibSubRequest request,
                    int depth)
             throws SnmpStatusException

  Generic handling of the `set` operation.

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

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

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

  You should not need to override this method in any cases, because it will eventually call `set(SnmpMibSubRequest request, 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 request, int depth)` on the generated derivative of `SnmpMibEntry`.

  Specified by:
    `set` in class `SnmpMibNode`
  Parameters:
    `request` - The sub-request that must be handled by this node.
    `depth` - The depth reached in the OID tree.
  Throws:
    `SnmpStatusException` - An error occurred while accessing the MIB node.

### addEntry

    public void addEntry(SnmpOid rowOid,
                         Object entry)
                  throws SnmpStatusException

  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 preferred.
  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.

### addEntry

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

  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.

### removeEntry

    public void removeEntry(SnmpOid rowOid,
                            Object entry)
                     throws SnmpStatusException

  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).

### removeEntry

    public void removeEntry(SnmpOid rowOid)
                     throws SnmpStatusException

  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).

### removeEntry

    public void removeEntry(int pos,
                            Object entry)
                     throws SnmpStatusException

  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.

### getEntry

    public Object getEntry(SnmpOid rowOid)
                    throws SnmpStatusException

  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.

### getEntryName

    public ObjectName getEntryName(SnmpOid rowOid)
                            throws SnmpStatusException

  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.

### getBasicEntries

    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.

### getSize

    public int getSize()

  Get the size of the table.

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

### addNotificationListener

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

  Enable to add an SNMP entry listener to this `SnmpMibTable`.

  Specified by:
    `addNotificationListener` in interface `NotificationBroadcaster`
  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.

### removeNotificationListener

    public void removeNotificationListener(NotificationListener listener)
                                    throws ListenerNotFoundException

  Enable to remove an SNMP entry listener from this `SnmpMibTable`.

  Specified by:
    `removeNotificationListener` in interface `NotificationBroadcaster`
  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.

### getNotificationInfo

    public MBeanNotificationInfo[] getNotificationInfo()

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

  Specified by:
    `getNotificationInfo` in interface `NotificationBroadcaster`

### registerEntryFactory

    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.

### isRowStatus

    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.

### getRowAction

    protected int getRowAction(SnmpMibSubRequest request,
                               SnmpOid rowOid,
                               int depth)
                        throws SnmpStatusException

  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 Java DMK specific.

  Parameters:
    `request` - 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:
    `EnumRowStatus`

### mapRowStatus

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

  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 Java DMK 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:
    `EnumRowStatus`

### setRowStatus

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

  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 Java DMK 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:
    `EnumRowStatus`

### isRowReady

    protected boolean isRowReady(SnmpOid rowOid,
                                 Object userData)
                          throws SnmpStatusException

  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 modeling the conceptual row, so that you can override the default behavior 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 occurred while trying to retrieve the row status, and the operation should be aborted.
  See Also:
    `EnumRowStatus`

### checkRowStatusChange

    protected void checkRowStatusChange(SnmpMibSubRequest request,
                                        SnmpOid rowOid,
                                        int depth,
                                        int newStatus)
                                 throws SnmpStatusException

  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:
    `request` - 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 Java DMK specific.
  Throws:
    `SnmpStatusException` - if switching to this new state would fail.

### checkRemoveTableRow

    protected void checkRemoveTableRow(SnmpMibSubRequest request,
                                       SnmpOid rowOid,
                                       int depth)
                                throws SnmpStatusException

  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:
    `request` - 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.

### removeTableRow

    protected void removeTableRow(SnmpMibSubRequest request,
                                  SnmpOid rowOid,
                                  int depth)
                           throws SnmpStatusException

  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 behavior 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:
    `request` - 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.

### beginRowAction

    protected void beginRowAction(SnmpMibSubRequest request,
                                  SnmpOid rowOid,
                                  int depth,
                                  int rowAction)
                           throws SnmpStatusException

  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:
    `request` - 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 Java DMK 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:
    `EnumRowStatus`

### endRowAction

    protected void endRowAction(SnmpMibSubRequest request,
                                SnmpOid rowOid,
                                int depth,
                                int rowAction)
                         throws SnmpStatusException

  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:
    `request` - 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 Java DMK specific.
  Throws:
    `SnmpStatusException` - if the specified `rowAction` is not valid.
  See Also:
    `EnumRowStatus`

### getNextVarEntryId

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

  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.management.snmp.SnmpOid,long, java.lang.Object)`, until `skipEntryVariable(com.sun.management.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.

### skipEntryVariable

    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.

### getNextOid

    protected SnmpOid getNextOid(SnmpOid oid,
                                 Object userData)
                          throws SnmpStatusException

  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.

### getNextOid

    protected SnmpOid getNextOid(Object userData)
                          throws SnmpStatusException

  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.

### getNextVarEntryId

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

  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.

### validateVarEntryId

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

  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.

### isReadableEntryId

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

  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.

### get

    protected abstract void get(SnmpMibSubRequest request,
                                SnmpOid rowOid,
                                int depth)
                         throws SnmpStatusException

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

  Throws:
    `SnmpStatusException`

### check

    protected abstract void check(SnmpMibSubRequest request,
                                  SnmpOid rowOid,
                                  int depth)
                           throws SnmpStatusException

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

  Throws:
    `SnmpStatusException`

### set

    protected abstract void set(SnmpMibSubRequest request,
                                SnmpOid rowOid,
                                int depth)
                         throws SnmpStatusException

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

  Throws:
    `SnmpStatusException`

### contains

    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.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| FCS Release jdmk-5_1-b34.3 2007.01.18_18:11:52_MET
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.