Module org.snmp4j.agent
Package org.snmp4j.agent.mo
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
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionMOTableRelation
(MOTable<BaseRow, ? extends MOColumn, ? extends MOTableModel<BaseRow>> baseTable, MOTable<DependentRow, ? extends MOColumn, ? extends MOTableModel<DependentRow>> dependentTable) Creates a table relation from a base table and the dependent table. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addDependentRows
(BaseRow baseTableRow) Adds all dependent rows for the specified base table row to the dependent table.void
Actually sets up the relationship between base and dependent table by adding this instance as row listener to the base table.protected MOTableRowListener
<BaseRow> MOTable
<BaseRow, ? extends MOColumn, ? extends MOTableModel<BaseRow>> org.snmp4j.smi.OID[]
getDependentIndexes
(BaseRow baseRow) Returns the dependent indexes for the specified base row.MOTable
<DependentRow, ? extends MOColumn, ? extends MOTableModel<DependentRow>> boolean
hasDependentRow
(BaseRow baseTableRow) Indicates whether the specified baseTableRow has any dependent rows.protected MOTableRow[]
removeDependentRows
(BaseRow baseTableRow) Removes all dependent rows for the specified base table row from the dependent table.void
Removes the relationship between base and dependent table by removing this instance as row listener from the base table.protected void
updateDependentRows
(BaseRow baseTableRow) Update theMOTableRow.getBaseRow()
reference all dependent rows for the specified base table row in the dependent table.
-
Constructor Details
-
MOTableRelation
public MOTableRelation(MOTable<BaseRow, ? extends MOColumn, ? extends MOTableModel<BaseRow>> baseTable, MOTable<DependentRow, ? extends MOColumn, ? extends MOTableModel<DependentRow>> dependentTable) Creates a table relation from a base table and the dependent table. To actually set up the relationship between those tablescreateRelationShip()
needs to be called.- Parameters:
baseTable
- the base table.dependentTable
- the dependent (augmenting) table.
-
-
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
-
hasDependentRow
Indicates whether the specified baseTableRow has any dependent rows. By default this method returnstrue
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
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
-
getDependentTable
public MOTable<DependentRow,? extends MOColumn, getDependentTable()? extends MOTableModel<DependentRow>> -
getRelationShipListener
-
addDependentRows
Adds all dependent rows for the specified base table row to the dependent table. This method is automatically called ifcreateRelationShip()
has been called.- Parameters:
baseTableRow
- a row of the base table.
-
updateDependentRows
Update theMOTableRow.getBaseRow()
reference all dependent rows for the specified base table row in the dependent table. This method is automatically called ifcreateRelationShip()
has been called.- Parameters:
baseTableRow
- a row of the base table.
-
removeDependentRows
Removes all dependent rows for the specified base table row from the dependent table. This method is automatically called ifcreateRelationShip()
has been called.- Parameters:
baseTableRow
- a row of the base table.- Returns:
- an array of the removed rows.
-