Class MOTableRelation<BaseRow extends MOTableRow,DependentRow extends MOTableRow>

java.lang.Object
org.snmp4j.agent.mo.MOTableRelation<BaseRow,DependentRow>
Type Parameters:
BaseRow - The row type of the base table.
DependentRow - The row type of the dependent table.

public class MOTableRelation<BaseRow extends MOTableRow,DependentRow extends MOTableRow> extends Object
The MOTableRelation class models table relations like sparse table relationship and augmentation. This class implements the augmentation relationship. In order to implement a sparse table relationship, sub-classing MOTableRelation is needed and the methods hasDependentRow(BaseRow) and getDependentIndexes(BaseRow) must be overwritten then.
Version:
3.0.0
Author:
Frank Fock
  • Constructor Details

  • Method Details

    • createRelationShip

      public void createRelationShip()
      Actually sets up the relationship between base and dependent table by adding this instance as row listener to the base table.
    • removeRelationShip

      public void removeRelationShip()
      Removes the relationship between base and dependent table by removing this instance as row listener from the base table.
      Since:
      3.0.0
    • createRelationShipListener

      protected MOTableRowListener<BaseRow> createRelationShipListener()
    • hasDependentRow

      public boolean hasDependentRow(BaseRow baseTableRow)
      Indicates whether the specified baseTableRow has any dependent rows. By default this method returns true because the default implementation represents an augmentation relationship. Overwrite this method in a sub-class to implement a sparse table relationship.
      Parameters:
      baseTableRow - a row of the base table.
      Returns:
      true if the row has dependent rows.
    • getDependentIndexes

      public org.snmp4j.smi.OID[] getDependentIndexes(BaseRow baseRow)
      Returns the dependent indexes for the specified base row. By default, this method returns the base rows index in a one element array, because the default implementation represents an augmentation relationship. Overwrite this method in a sub-class to implement a sparse table relationship.
      Parameters:
      baseRow - a row of the base table.
      Returns:
      an array of row index values of the dependent rows.
    • getBaseTable

      public MOTable<BaseRow,? extends MOColumn,? extends MOTableModel<BaseRow>> getBaseTable()
    • getDependentTable

      public MOTable<DependentRow,? extends MOColumn,? extends MOTableModel<DependentRow>> getDependentTable()
    • getRelationShipListener

      public MOTableRowListener<BaseRow> getRelationShipListener()
    • addDependentRows

      protected void addDependentRows(BaseRow baseTableRow)
      Adds all dependent rows for the specified base table row to the dependent table. This method is automatically called if createRelationShip() has been called.
      Parameters:
      baseTableRow - a row of the base table.
    • updateDependentRows

      protected void updateDependentRows(BaseRow baseTableRow)
      Update the MOTableRow.getBaseRow() reference all dependent rows for the specified base table row in the dependent table. This method is automatically called if createRelationShip() has been called.
      Parameters:
      baseTableRow - a row of the base table.
    • removeDependentRows

      protected MOTableRow[] removeDependentRows(BaseRow baseTableRow)
      Removes all dependent rows for the specified base table row from the dependent table. This method is automatically called if createRelationShip() has been called.
      Parameters:
      baseTableRow - a row of the base table.
      Returns:
      an array of the removed rows.