com.adventnet.snmp.snmp2.agent
Class AgentNode

java.lang.Object
  extended by com.adventnet.utils.btree.TreeCell
      extended by com.adventnet.snmp.snmp2.agent.AgentNode

public class AgentNode
extends com.adventnet.utils.btree.TreeCell

This AgentNode is used to store the VarBindRequestListener information while a oid is registering with PduRequestHandler. AgentTree is constructed with AgentNode. This class extends TreeCell.

See Also:
AgentTree, PduRequestHandler

Field Summary
(package private)  VarBindRequestListenerHolder holder
           
 
Constructor Summary
AgentNode(AgentTree tr, java.lang.Object key, int subId)
          Constructor for AgentNode.
 
Method Summary
 void addCell(com.adventnet.utils.btree.TreeCell cell)
          Add a child to this cell
 int compareTo(java.lang.Object toComp)
          Compares the key (toComp) with the key associated with this TreeCell.
 AgentNode getChildCell(int subid)
          Gets the child with the specified subid if exists.
(package private)  AgentNode getFirstChild()
           
 AgentNode getNearestCell(java.lang.Object key)
          Gets the Nearest Cell.
 AgentNode getNearestLeafCell(java.lang.Object oid)
          Gets the Nearest Leaf node Cell in the subTree.
 VarBindRequestListenerHolder getVarBindRequestListenerHolder()
          Getter for the VarBindRequestListener holder associated with this node.
 boolean isInRange(java.lang.Object key)
          This Method is to Check out whether the key is in appropriate range.
 int length()
          Getter for length of the key.
(package private)  void setVarBindRequestListenerHolder(VarBindRequestListenerHolder holder)
          Setter for VarBindRequestListener associated with this node.
 java.lang.String toString()
          Gets the dotted representation of the node (OID representation of the node) e.g., .1.3.6.1.2.1.1.1
 
Methods inherited from class com.adventnet.utils.btree.TreeCell
compareTo, getChildList, getKey, getLevel, getNextCell, getNextLeafCell, getParent, getSubId, getTreeFramework, isLeaf, isProxy, setParent, setProxy, setSubId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

holder

VarBindRequestListenerHolder holder
Constructor Detail

AgentNode

public AgentNode(AgentTree tr,
                 java.lang.Object key,
                 int subId)
Constructor for AgentNode.

Parameters:
tr - The framework to which this node needs to be added.
key - int[] registered key.
subId - The subIdentifier for the node.
Method Detail

getVarBindRequestListenerHolder

public VarBindRequestListenerHolder getVarBindRequestListenerHolder()
Getter for the VarBindRequestListener holder associated with this node. For each VarBindRequestListener there will be a VarBindRequestListenerHolder associated with it. This is package access class, so this method may not useful for API users.

Returns:
the VarBindRequestListenerHolder

setVarBindRequestListenerHolder

void setVarBindRequestListenerHolder(VarBindRequestListenerHolder holder)
Setter for VarBindRequestListener associated with this node. API users may not require this method

Parameters:
VarBindRequestListenerHolder -

addCell

public void addCell(com.adventnet.utils.btree.TreeCell cell)
Add a child to this cell

Overrides:
addCell in class com.adventnet.utils.btree.TreeCell
Parameters:
cell - the instance of the TreeCell

length

public int length()
Getter for length of the key.

Returns:
the key length

compareTo

public int compareTo(java.lang.Object toComp)
Compares the key (toComp) with the key associated with this TreeCell.

Specified by:
compareTo in class com.adventnet.utils.btree.TreeCell
Parameters:
toComp - the Object key to be compared (int []).
Returns:
-1 If toComp is Lesser Than the other Key, 0 If the Keys are Equal, 1 If the tocomp key is larger than the other key.
See Also:
com.adventnet.utils.btree.TreeCell.compareTo()

toString

public java.lang.String toString()
Gets the dotted representation of the node (OID representation of the node) e.g., .1.3.6.1.2.1.1.1

Overrides:
toString in class com.adventnet.utils.btree.TreeCell
Returns:
string representation of the OID

isInRange

public boolean isInRange(java.lang.Object key)
This Method is to Check out whether the key is in appropriate range.

Parameters:
key - The Key that has to be checked.
Returns:
True if it is in range otherwise False.

getNearestCell

public AgentNode getNearestCell(java.lang.Object key)
Gets the Nearest Cell. This neednot be a leaf cell.

Parameters:
key - The object for which the Nearest Cell is to required.
Returns:
If the oid is not in range returns a null otherwise AgentNode.
See Also:
isInRange()

getChildCell

public AgentNode getChildCell(int subid)
Gets the child with the specified subid if exists.

Parameters:
subid - subidentifier of the Node
Returns:
null if no child exists with such a subId

getFirstChild

AgentNode getFirstChild()

getNearestLeafCell

public AgentNode getNearestLeafCell(java.lang.Object oid)
                             throws AgentSnmpException
Gets the Nearest Leaf node Cell in the subTree.

Parameters:
oid - Object Oid For which the nearest Leaf Node is needed.
Returns:
This Node if the node is a leaf node.
Throws:
AgentSnmpException - If the node is not in Range.
See Also:
isInRange(), getNearestCell()