Class BufferedMOMutableTableModel<R extends org.snmp4j.agent.mo.MOTableRow>

java.lang.Object
org.snmp4j.agent.mox.BufferedMOTableModel<R>
org.snmp4j.agent.mox.BufferedMOMutableTableModel<R>
All Implemented Interfaces:
EventListener, org.snmp4j.agent.mo.MOMutableTableModel<R>, org.snmp4j.agent.mo.MOTableModel<R>, org.snmp4j.agent.mo.MOTableRowFactory<R>, org.snmp4j.agent.mo.MOTableRowListener<R>

public abstract class BufferedMOMutableTableModel<R extends org.snmp4j.agent.mo.MOTableRow> extends BufferedMOTableModel<R> implements org.snmp4j.agent.mo.MOMutableTableModel<R>, org.snmp4j.agent.mo.MOTableRowListener<R>
The BufferedMOMutableTableModel is a read/write/create table model that dynamically loads data from an backend as needed. The internal buffer holds up to BufferedMOTableModel.getMaxBufferSize() rows fetched from the backend. Rows are removed from the buffer either when they are older than BufferedMOTableModel.getBufferTimeoutNanoSeconds() or if the maximum number of buffered rows is reached.

Updates, row creations and removals are directly processed by the backend. Thus, updates are not buffered by this table model although the internal buffer reflects the changes.

IMPORTANT: The table model needs to be informed about row changes by calling the rowChanged(MOTableRowEvent) method of the implemented MOTableRowListener interface. This is typically done by adding this model as row listener with DefaultMOTable.addMOTableRowListener(MOTableRowListener) but it can also be called manually.

If you need to be sure that every row change is automatically processed by the backend through this BufferedMOMutableTableModel then you will have to implement and use your own MOTableRow implementation created by your own MOTableRowFactory. That row implementation has then to call the rowChanged(MOTableRowEvent) of this table model after each change.

Since:
2.2
Author:
Frank Fock
  • Constructor Details

    • BufferedMOMutableTableModel

      protected BufferedMOMutableTableModel(org.snmp4j.agent.mo.MOTableRowFactory<R> rowFactory)
      Creates a BufferedMOMutableTableModel with the specified MOTableRowFactory.
      Parameters:
      rowFactory - the row factory to be used to create rows from backend data.
  • Method Details

    • addRow

      public R addRow(R row)
      Specified by:
      addRow in interface org.snmp4j.agent.mo.MOMutableTableModel<R extends org.snmp4j.agent.mo.MOTableRow>
    • clear

      public void clear()
      Specified by:
      clear in interface org.snmp4j.agent.mo.MOMutableTableModel<R extends org.snmp4j.agent.mo.MOTableRow>
    • clear

      public List<R> clear(org.snmp4j.agent.mo.MOTableRowFilter<R> filter)
      Specified by:
      clear in interface org.snmp4j.agent.mo.MOMutableTableModel<R extends org.snmp4j.agent.mo.MOTableRow>
    • deleteAllRows

      protected abstract void deleteAllRows()
      Removes all rows in the table.
    • bulkDeleteRows

      protected abstract void bulkDeleteRows(List<org.snmp4j.smi.OID> indexList)
      Removes the rows with a row index that matches an entry in the supplied index list.
      Parameters:
      indexList - the row indexes of the rows to remove.
    • insertRow

      protected abstract void insertRow(org.snmp4j.smi.OID index, org.snmp4j.smi.Variable[] values)
      Inserts a non-existing row.
      Parameters:
      index - the row index of the new row.
      values - the values for the columns of the row.
    • writeRow

      protected abstract void writeRow(org.snmp4j.smi.OID index, org.snmp4j.smi.Variable[] values)
      Updates/writes the content of a row.
      Parameters:
      index - the row index of the existing row.
      values - the new values for the columns in that row.
    • deleteRow

      protected abstract void deleteRow(org.snmp4j.smi.OID index)
      Deletes a single row.
      Parameters:
      index - the row index of the deleting row.
    • rowChanged

      public void rowChanged(org.snmp4j.agent.mo.MOTableRowEvent<R> event)
      Specified by:
      rowChanged in interface org.snmp4j.agent.mo.MOTableRowListener<R extends org.snmp4j.agent.mo.MOTableRow>
    • removeRow

      public R removeRow(org.snmp4j.smi.OID index)
      Description copied from class: BufferedMOTableModel
      Removes a row from the table. By default this method throws a UnsupportedOperationException.
      Specified by:
      removeRow in interface org.snmp4j.agent.mo.MOMutableTableModel<R extends org.snmp4j.agent.mo.MOTableRow>
      Overrides:
      removeRow in class BufferedMOTableModel<R extends org.snmp4j.agent.mo.MOTableRow>
      Parameters:
      index - the index of the target row.
      Returns:
      the removed row and null if such a row does not exist.