org.snmp4j.agent.mo
Class MOTableRelation

java.lang.Object
  extended by org.snmp4j.agent.mo.MOTableRelation

public class MOTableRelation
extends java.lang.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(org.snmp4j.agent.mo.MOTableRow) and getDependentIndexes(org.snmp4j.agent.mo.MOTableRow) must be overwritten then.

Version:
1.0
Author:
Frank Fock

Nested Class Summary
protected  class MOTableRelation.RelationShipListener
           
 
Constructor Summary
MOTableRelation(MOTable baseTable, MOTable dependentTable)
          Creates a table relation from a base table and the dependent table.
 
Method Summary
protected  void addDependentRows(MOTableRow 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 createRelationShipListener()
           
 org.snmp4j.smi.OID[] getDependentIndexes(MOTableRow baseRow)
          Returns the dependent indexes for the specified base row.
 boolean hasDependentRow(MOTableRow baseTableRow)
          Indicates whether the specified baseTableRow has any dependent rows.
protected  MOTableRow[] removeDependentRows(MOTableRow baseTableRow)
          Removes all dependent rows for the specified base table row from the dependent table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MOTableRelation

public MOTableRelation(MOTable baseTable,
                       MOTable dependentTable)
Creates a table relation from a base table and the dependent table. To actually set up the relationship between those tables createRelationShip() 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.


createRelationShipListener

protected MOTableRowListener createRelationShipListener()

hasDependentRow

public boolean hasDependentRow(MOTableRow 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(MOTableRow 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.

addDependentRows

protected void addDependentRows(MOTableRow 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.

removeDependentRows

protected MOTableRow[] removeDependentRows(MOTableRow 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.

Copyright 2005-2010 Frank Fock (SNMP4J.org)

Copyright © 2011 SNMP4J.org. All Rights Reserved.