Class RowStatus<R extends MOTableRow>

java.lang.Object
org.snmp4j.agent.mo.MOColumn<org.snmp4j.smi.Integer32>
org.snmp4j.agent.mo.MOMutableColumn<org.snmp4j.smi.Integer32>
org.snmp4j.agent.mo.snmp.RowStatus<R>
Type Parameters:
R - The row type of the rows managed by this RowStatus.
All Implemented Interfaces:
Comparable<MOColumn<org.snmp4j.smi.Integer32>>, EventListener, MOChangeListener, MOTableRowListener<R>

public class RowStatus<R extends MOTableRow> extends MOMutableColumn<org.snmp4j.smi.Integer32> implements MOChangeListener, MOTableRowListener<R>
The RowStatus class implements the columnar object TC RowStatus. The RowStatus textual convention is used to manage the creation and deletion of conceptual rows, and is used as the value of the SYNTAX clause for the status column of a conceptual row. See RFC 2579.

The RowStatus column controls row creation and deletion in SNMP tables with READ-CREATE maximum access. Since the state of a dynamic row is/may be important to dependent rows / other objects of an agent, row status change events can be propagated to other objects through registering RowStatusListeners.

Version:
1.0
Author:
Frank Fock
  • Field Details

  • Constructor Details

    • RowStatus

      public RowStatus(int columnID)
      Creates a RowStatus column with the specified column sub-identifier and maximum access of 'read-create'.
      Parameters:
      columnID - a column sub-identifier.
    • RowStatus

      public RowStatus(int columnID, MOAccess access)
      Creates a RowStatus column with the specified column sub-identifier.
      Parameters:
      columnID - a column sub-identifier.
      access - the maximum access for the RowStatus column (should be READ-CREATE).
  • Method Details

    • setTable

      public <R extends MOTableRow> void setTable(MOTable<R,? extends MOColumn,? extends MOTableModel<R>> table)
      Sets the table instance this columnar object is contained in. This method should be called by MOTable instance to register the table with the RowStatus column. When called, this RowStatus registers itself as MOChangeListener and MOTableRowListener.
      Overrides:
      setTable in class MOColumn<org.snmp4j.smi.Integer32>
      Type Parameters:
      R - the MOTableRow type supported by the table.
      Parameters:
      table - the MOTable instance where this column is contained in.
    • unsetTable

      public void unsetTable(MOTable<R,? extends MOColumn,? extends MOTableModel<R>> table)
      Unsets the table instance and thus unregisters itself as MOChangeListener and MOTableRowListener.
      Parameters:
      table - the MOTable instance where this column was part of.
    • isReady

      protected boolean isReady(MOTableRow row, int rowStatusColumn)
    • isReady

      protected boolean isReady(MOTableRow row, int rowStatusColumn, MOTableRow changeSet)
    • prepare

      public void prepare(SubRequest<?> subRequest, MOTableRow row, MOTableRow changeSet, int column)
      Overrides:
      prepare in class MOMutableColumn<org.snmp4j.smi.Integer32>
    • commit

      public void commit(SubRequest<?> subRequest, MOTableRow row, MOTableRow changeSet, int column)
      Overrides:
      commit in class MOMutableColumn<org.snmp4j.smi.Integer32>
    • assignNewValue

      protected void assignNewValue(SubRequest<?> subRequest, MOTableRow row, int column, int newValue)
    • undo

      public void undo(SubRequest<?> subRequest, MOTableRow row, int column)
      Overrides:
      undo in class MOMutableColumn<org.snmp4j.smi.Integer32>
    • beforePrepareMOChange

      public void beforePrepareMOChange(MOChangeEvent changeEvent)
      Description copied from interface: MOChangeListener
      A ManagedObject change is being prepared. To cancel preparation set the deny reason to a SNMPv2/v3 error status.
      Specified by:
      beforePrepareMOChange in interface MOChangeListener
      Parameters:
      changeEvent - the change event object.
    • beforeMOChange

      public void beforeMOChange(MOChangeEvent changeEvent)
      Description copied from interface: MOChangeListener
      A ManagedObject change is being committed. To cancel the commit phase set the deny reason to a SNMPv2/v3 error status.

      NOTE: Canceling the commit phase must be avoided. Setting a deny reason has only an effect if DeniableEventObject.isDeniable() returns true. Otherwise, you will need to throw an exception.

      Specified by:
      beforeMOChange in interface MOChangeListener
      Parameters:
      changeEvent - the change event object.
    • afterMOChange

      public void afterMOChange(MOChangeEvent changeEvent)
      Description copied from interface: MOChangeListener
      A change has been committed. Setting the deny reason of the supplied event object will be ignored.
      Specified by:
      afterMOChange in interface MOChangeListener
      Parameters:
      changeEvent - the change event object.
    • afterPrepareMOChange

      public void afterPrepareMOChange(MOChangeEvent changeEvent)
      Description copied from interface: MOChangeListener
      A change has been prepared. Setting the deny reason of the supplied event object will be ignored.
      Specified by:
      afterPrepareMOChange in interface MOChangeListener
      Parameters:
      changeEvent - the change event object.
    • addRowStatusListener

      public void addRowStatusListener(RowStatusListener l)
    • removeRowStatusListener

      public void removeRowStatusListener(RowStatusListener l)
    • fireRowStatusChanged

      protected void fireRowStatusChanged(RowStatusEvent event)
    • isRowActive

      public static boolean isRowActive(MOTableRow row, int rowStatusColumnIndex)
      Tests if the specified row is active.
      Parameters:
      row - a row with a RowStatus column.
      rowStatusColumnIndex - the column index of the RowStatus column in row.
      Returns:
      true if row is active.
    • getRowStatus

      public static org.snmp4j.smi.Integer32 getRowStatus(MOTableRow row, MOTable<?,?,?> table)
      Gets the value of the RowStatus column (if it exists) in the specified row and table. It starts searching for the RowStatus column from the last column and then proceeds down to the first until it finds it. If no RowStatus column can be found, null is returned.
      Parameters:
      row - a row with a RowStatus column (otherwise null is returned).
      table - the table of the given row.
      Returns:
      the Integer32 value of the RowStatus column in the given row or null if the table has no RowStatus column.
      Since:
      3.3.0
    • rowChanged

      public void rowChanged(MOTableRowEvent<R> event)
      Description copied from interface: MOTableRowListener
      A column or a complete row is changed/has been changed.
      Specified by:
      rowChanged in interface MOTableRowListener<R extends MOTableRow>
      Parameters:
      event - a MOTableRowEvent describing the event. To veto the event the MOTableRowEvent.setVetoStatus(int) and optionally also the MOTableRowEvent.setVetoColumn(int) can be called. If MOTableRowEvent.getNumberOfConsecutiveEventsOfSameOrigin() is greater than zero you need to set MOTableRowEvent.setSendNextEventsOfSameOrigin(boolean) to true in order to receive those consecutive events too. Otherwise they will be ignored and not been propagated to this listener.
    • isVolatile

      public boolean isVolatile(MOTableRow row, int column)
      Description copied from class: MOColumn
      Tests if the supplied row is volatile or persistent. If volatile then the row will not be saved when the table is saved to persistent storage.
      Overrides:
      isVolatile in class MOColumn<org.snmp4j.smi.Integer32>
      Parameters:
      row - a row of the table where this column is part of.
      column - the column index of this column in row.
      Returns:
      true if row will not be persistently stored.
    • get

      public void get(SubRequest<?> subRequest, MOTableRow row, int column)
      Description copied from class: MOColumn
      Process a get sub-request for the specified table row and column.
      Overrides:
      get in class MOColumn<org.snmp4j.smi.Integer32>
      Parameters:
      subRequest - the GET sub-request to execute.
      row - the row that contains the value to return in the GET response PDU.
      column - the column index of the value to return in subRequest