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
TheMOTableRelation
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-classingMOTableRelation
is needed and the methodshasDependentRow(BaseRow)
andgetDependentIndexes(BaseRow)
must be overwritten then.- Version:
- 3.0.0
- Author:
- Frank Fock
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
MOTableRelation.RelationShipListener
-
Constructor Summary
Constructors Constructor Description 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addDependentRows(BaseRow baseTableRow)
Adds all dependent rows for the specified base table row to the dependent table.void
createRelationShip()
Actually sets up the relationship between base and dependent table by adding this instance as row listener to the base table.protected MOTableRowListener<BaseRow>
createRelationShipListener()
MOTable<BaseRow,? extends MOColumn,? extends MOTableModel<BaseRow>>
getBaseTable()
org.snmp4j.smi.OID[]
getDependentIndexes(BaseRow baseRow)
Returns the dependent indexes for the specified base row.MOTable<DependentRow,? extends MOColumn,? extends MOTableModel<DependentRow>>
getDependentTable()
MOTableRowListener<BaseRow>
getRelationShipListener()
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
removeRelationShip()
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 Detail
-
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 Detail
-
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 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
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 ifcreateRelationShip()
has been called.- Parameters:
baseTableRow
- a row of the base table.
-
updateDependentRows
protected void updateDependentRows(BaseRow baseTableRow)
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
protected MOTableRow[] removeDependentRows(BaseRow baseTableRow)
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.
-
-