HOME

com.ireasoning.util
Class MibTreeNode

java.lang.Object
  extended bycom.ireasoning.util.CTreeNode
      extended bycom.ireasoning.util.MibTreeNode
All Implemented Interfaces:
Comparable, Serializable

public class MibTreeNode
extends CTreeNode

This class represents node in a MIB tree

See Also:
Serialized Form

Field Summary
static byte SYN_BITS
          Bits data type
static byte SYN_COUNTER
          Counter32 data type
static byte SYN_COUNTER64
          Counter64 data type
static byte SYN_GAUGE
          Gauge data type
static byte SYN_INTEGER
          Integer data type
static byte SYN_IPADDRESS
          IpAddress data type
static byte SYN_OID
          OID data type
static byte SYN_OPAQUE
          Opaque data type
static byte SYN_STRING
          Octet String data type
static byte SYN_TIMETICKS
          Timeticks data type
static byte SYN_UNSIGNED
          Unsigned integer data type
 
Constructor Summary
MibTreeNode(Comparable name)
          Constructor
MibTreeNode(Comparable name, CTreeNode root)
          Constructor
 
Method Summary
 MibTreeNode findChildNode(SnmpOID childOid)
          Finds immediate child node whose oid match passed childOid.
 MibTreeNode findChildNode(String childOid)
          Finds immediate child node whose oid match passed childOid.
 String getAccess()
          ACCESS or MAX-ACCESS clause.
 String getAugments()
          Returns the AUGMENTS clause
 String getAugmentsTable()
          Returns the agumenting table from a table node
 String getDefVal()
          Returns the value of "DEFVAL" clause
 String getDescription()
          Returns the MIB node's Description clause
 String getFullName()
          Gets the oid as fully qualified name, such as ".iso.org.dod.internet.mgmt.mib-2.ip.ipAddrTable"
 String[] getIndice()
          Return indices from table entry node
 String getModuleIdentity()
          Returns the MIB's MODULE-IDENTITY value
 String getModuleName()
          Returns MIB module name
 byte getNodeType()
           
 String[] getObjects()
          Returns OBJECTS clause as string array
 String[] getObjectsOIDs()
          Returns the OIDs corresponding to each object in OBJECTS clause
 SnmpOID getOID()
          Returns OID of this node
 byte getRealSyntaxType()
          Returns the node's basic syntax type.
 SnmpOID getRowStatusOID()
          The OID of the table entry which is RowStatus or EntryStatus type.
 String getStatus()
          Returns the STATUS clause value
 Syntax getSyntax()
          Returns the syntax clause as a Syntax object.
 String getSyntaxType()
          Returns the Syntax clause' data type.
 String[] getTableIndice()
          Returns indice from table node
 Vector getTrapNodes()
          Returns the SMIv1/v2 trap nodes
 String getUnits()
          Returns the value of "UNITS" clause
 boolean isDynamicTable()
          Tests if it's a dynamic table.
 boolean isEntryStatus()
          Tests if it's SNMPv1 dynamic table It's a property of table node.
 boolean isGroupNode()
          Returns true if this node is a group node, such as "system" group
 boolean isImplied()
          Tests if it's a IMPLIED index node.
 boolean isIndexNode()
          Test if it's a index node, e.g.
 boolean isScalarNode()
          Tests if it's a scalar node, e.g.
 boolean isSnmpV2TrapNode()
          Tests if it's a SMIv2 trap node
 boolean isTableColumnNode()
          Checks if it's a column node in a table, such as IfIndex in IfTable.
 boolean isTableEntryNode()
          Returns true if this node is table entry node, such as "ifEntry" node
 boolean isTableLeafNode()
          Tests if it's a leaf node of a table.
 boolean isTableNode()
          Returns true if this node is a table node, such as "IfTable" node
static void normalizeTreeNodeNames(MibTreeNode start)
          Changes all the node names starting from start node to be compatible with java naming convention (such as no '-' or '.' is allowed), and ensure there is no duplicate names.
 MibTreeNode searchByOID(SnmpOID oid)
          Search for the node whose OID is the passed oid, whithin this node's subtree
 MibTreeNode searchIgnoreCase(String name)
          Case insensitive search for the node with passed name within this node's subtree, starting from itself.
 MibTreeNode searchIgnoreCase(String name, String parentNodeName)
          Case insensitive search for the node with passed name within this node's subtree, starting from itself.
 void setAccess(String access)
          Sets the MIB node's ACCESS or MAX-ACCESS clause value
 void setAugments(String augments)
          Sets the AUGMENTS clause
 void setAugmentsTable(String augments)
           
 void setDefVal(String defval)
          Sets the value of "DEFVAL" clause
 void setDescription(String s)
          Sets the value of Description clause
 void setEntryStatus(boolean isEntryStatus)
           
 void setFullName(String s)
          Sets full name of this node
 void setImplied(boolean isImplied)
           
 void setIndice(String[] s)
          Sets indice of this node ( Table's entry node)
 void setModuleName(String name)
           
 void setObjects(String[] s)
          Sets the value of OBJECTS clause
 void setObjectsOIDs(String[] s)
          Sets OIDs for each object in OBJECTS clause
 void setOID(SnmpOID oid)
          Sets numeric OID value
 void setOID(String oid)
          Sets numeric OID value
 void setRealSyntaxType(byte type)
          Sets the basic syntax type of this node
 void setRowStatusOID(SnmpOID rowStatusOID)
          The OID of the table entry which is RowStatus or EntryStatus type.
 void setStatus(String status)
          Sets the STATUS clause value
 void setSyntax(Syntax s)
          Sets Syntax object
 void setTableIndice(String[] s)
           
 void setTableNode(boolean b)
          Sets whether this node is a table node
 void setUnits(String units)
          Sets the value of "UNITS" clause
static void shallowCopy(MibTreeNode src, MibTreeNode dest)
          Makes a copy of this node, its child nodes are not copied
static SnmpDataType toSnmpObject(byte dataType, String value)
          Returns java object corresponding to the passed data type
 String toString()
          Returns a string representation
Methods used in this method:
getName, getOID, getFullName, getSyntax, getAccess, getStatus, isIndexNode, isSnmpV2TrapNode, getIndice, getAugments, getDescription, etc.
 
Methods inherited from class com.ireasoning.util.CTreeNode
addChild, addChild, appendChild, appendChild, appendChild, compareTo, compareTo, compareTo, copy, equals, getChildNode, getChildNodeCount, getChildNodeIndex, getChildNodes, getFirstChild, getLastChild, getLeftMost, getName, getNextSibling, getParent, getPrevSibling, getRawName, getRightMost, getRoot, hashCode, insertBefore, isChildNode, isInSameTree, isLeaf, isRoot, removeChild, removeChild, removeChild, removeNode, replaceChild, search, setName, setParent, setRoot, toJTreeNode, traverse
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SYN_OID

public static final byte SYN_OID
OID data type

See Also:
Constant Field Values

SYN_STRING

public static final byte SYN_STRING
Octet String data type

See Also:
Constant Field Values

SYN_INTEGER

public static final byte SYN_INTEGER
Integer data type

See Also:
Constant Field Values

SYN_UNSIGNED

public static final byte SYN_UNSIGNED
Unsigned integer data type

See Also:
Constant Field Values

SYN_GAUGE

public static final byte SYN_GAUGE
Gauge data type

See Also:
Constant Field Values

SYN_COUNTER

public static final byte SYN_COUNTER
Counter32 data type

See Also:
Constant Field Values

SYN_COUNTER64

public static final byte SYN_COUNTER64
Counter64 data type

See Also:
Constant Field Values

SYN_TIMETICKS

public static final byte SYN_TIMETICKS
Timeticks data type

See Also:
Constant Field Values

SYN_IPADDRESS

public static final byte SYN_IPADDRESS
IpAddress data type

See Also:
Constant Field Values

SYN_BITS

public static final byte SYN_BITS
Bits data type

See Also:
Constant Field Values

SYN_OPAQUE

public static final byte SYN_OPAQUE
Opaque data type

See Also:
Constant Field Values
Constructor Detail

MibTreeNode

public MibTreeNode(Comparable name)
Constructor

Parameters:
name - mib node name

MibTreeNode

public MibTreeNode(Comparable name,
                   CTreeNode root)
Constructor

Parameters:
root - root of this tree
name - mib node name
Method Detail

getNodeType

public byte getNodeType()

getOID

public SnmpOID getOID()
Returns OID of this node


setOID

public void setOID(String oid)
Sets numeric OID value


setOID

public void setOID(SnmpOID oid)
Sets numeric OID value


getFullName

public String getFullName()
Gets the oid as fully qualified name, such as ".iso.org.dod.internet.mgmt.mib-2.ip.ipAddrTable"

See Also:
CTreeNode.getName()

setFullName

public void setFullName(String s)
Sets full name of this node


getDescription

public String getDescription()
Returns the MIB node's Description clause


setDescription

public void setDescription(String s)
Sets the value of Description clause


getAccess

public String getAccess()
ACCESS or MAX-ACCESS clause. Possible values are {not-accessible, read-only, read-write, write-only} (SMIv1); {not-accessible, accessible-for-notify, read-only, read-write, read-create} (SMIv2)


setAccess

public void setAccess(String access)
Sets the MIB node's ACCESS or MAX-ACCESS clause value


getDefVal

public String getDefVal()
Returns the value of "DEFVAL" clause


setDefVal

public void setDefVal(String defval)
Sets the value of "DEFVAL" clause


getUnits

public String getUnits()
Returns the value of "UNITS" clause


setUnits

public void setUnits(String units)
Sets the value of "UNITS" clause


getStatus

public String getStatus()
Returns the STATUS clause value


setStatus

public void setStatus(String status)
Sets the STATUS clause value


isTableNode

public boolean isTableNode()
Returns true if this node is a table node, such as "IfTable" node


setTableNode

public void setTableNode(boolean b)
Sets whether this node is a table node


isTableEntryNode

public boolean isTableEntryNode()
Returns true if this node is table entry node, such as "ifEntry" node


isGroupNode

public boolean isGroupNode()
Returns true if this node is a group node, such as "system" group


isTableColumnNode

public boolean isTableColumnNode()
Checks if it's a column node in a table, such as IfIndex in IfTable.


isTableLeafNode

public boolean isTableLeafNode()
Tests if it's a leaf node of a table. In mib file, it's the node such as IfIndex (so it's the same as isTableColumnNode()). But in mib instances, it's the instance node such as IfIndex.1


isIndexNode

public boolean isIndexNode()
Test if it's a index node, e.g. ifIndex in IfTable


isScalarNode

public boolean isScalarNode()
Tests if it's a scalar node, e.g. sysUpTime node in RFC1213


getSyntax

public Syntax getSyntax()
Returns the syntax clause as a Syntax object.


setSyntax

public void setSyntax(Syntax s)
Sets Syntax object


getSyntaxType

public String getSyntaxType()
Returns the Syntax clause' data type. For example, it's "INTEGER" in "SYNTAX INTEGER { up(1), down(2), testing(3)}"

See Also:
getSyntax()

getRealSyntaxType

public byte getRealSyntaxType()
Returns the node's basic syntax type.

Note:
You need to call MibUtil.setRealSyntaxType(true) before calling MibUtil.parserMib(...) method.

Returns:
one of {SYN_OID, SYN_STRING, SYN_INTEGER, SYN_UNSIGNED, SYN_GAUGE, SYN_COUNTER, SYN_COUNTER64, SYN_TIMETICKS, SYN_IPADDRESS, SYN_OPAQUE}
See Also:
MibUtil.setResolveSyntax(boolean b)

setRealSyntaxType

public void setRealSyntaxType(byte type)
Sets the basic syntax type of this node


getIndice

public String[] getIndice()
Return indices from table entry node


setIndice

public void setIndice(String[] s)
Sets indice of this node ( Table's entry node)


getTableIndice

public String[] getTableIndice()
Returns indice from table node


setTableIndice

public void setTableIndice(String[] s)

getObjects

public String[] getObjects()
Returns OBJECTS clause as string array


setObjects

public void setObjects(String[] s)
Sets the value of OBJECTS clause


getObjectsOIDs

public String[] getObjectsOIDs()
Returns the OIDs corresponding to each object in OBJECTS clause

See Also:
getObjects()

setObjectsOIDs

public void setObjectsOIDs(String[] s)
Sets OIDs for each object in OBJECTS clause


shallowCopy

public static void shallowCopy(MibTreeNode src,
                               MibTreeNode dest)
Makes a copy of this node, its child nodes are not copied


normalizeTreeNodeNames

public static void normalizeTreeNodeNames(MibTreeNode start)
Changes all the node names starting from start node to be compatible with java naming convention (such as no '-' or '.' is allowed), and ensure there is no duplicate names. And append ".0" to the scalar node's oid


findChildNode

public MibTreeNode findChildNode(String childOid)
Finds immediate child node whose oid match passed childOid.

Parameters:
childOid - the oid of child node, which might be appended with indice, so it might be longer
Returns:
child node, or null if not found
See Also:
searchIgnoreCase(java.lang.String)

findChildNode

public MibTreeNode findChildNode(SnmpOID childOid)
Finds immediate child node whose oid match passed childOid.

Parameters:
childOid - the oid of child node, which might be appended with indice, so it might be longer
Returns:
child node, or null if not found
See Also:
searchIgnoreCase(java.lang.String)

toSnmpObject

public static SnmpDataType toSnmpObject(byte dataType,
                                        String value)
Returns java object corresponding to the passed data type

Parameters:
dataType - one of {SYN_OID, SYN_STRING, SYN_INTEGER, SYN_UNSIGNED, SYN_GAUGE, SYN_COUNTER, SYN_COUNTER64, SYN_TIMETICKS, SYN_IPADDRESS, SYN_BITS, SYN_OPAQUE}
value - a String value
Returns:
an object which implements SnmpDataType interface, such as SnmpInt, SnmpOctetString, SnmpCounter32, etc.

getRowStatusOID

public SnmpOID getRowStatusOID()
The OID of the table entry which is RowStatus or EntryStatus type. It's a property of table node.


setRowStatusOID

public void setRowStatusOID(SnmpOID rowStatusOID)
The OID of the table entry which is RowStatus or EntryStatus type. It's a property of table node.


isDynamicTable

public boolean isDynamicTable()
Tests if it's a dynamic table. It's a property of table node.


isEntryStatus

public boolean isEntryStatus()
Tests if it's SNMPv1 dynamic table It's a property of table node.


setEntryStatus

public void setEntryStatus(boolean isEntryStatus)

getAugments

public String getAugments()
Returns the AUGMENTS clause


setAugments

public void setAugments(String augments)
Sets the AUGMENTS clause


getAugmentsTable

public String getAugmentsTable()
Returns the agumenting table from a table node


setAugmentsTable

public void setAugmentsTable(String augments)

isImplied

public boolean isImplied()
Tests if it's a IMPLIED index node. It's a property of table node and table entry node


setImplied

public void setImplied(boolean isImplied)

getTrapNodes

public Vector getTrapNodes()
Returns the SMIv1/v2 trap nodes

Returns:
a Vector object whose element is TrapNode
See Also:
TrapNode

isSnmpV2TrapNode

public boolean isSnmpV2TrapNode()
Tests if it's a SMIv2 trap node


searchByOID

public MibTreeNode searchByOID(SnmpOID oid)
Search for the node whose OID is the passed oid, whithin this node's subtree

Parameters:
oid - the OID of the node to be found
Returns:
node found, or null if no node found
See Also:
searchIgnoreCase(java.lang.String)

searchIgnoreCase

public MibTreeNode searchIgnoreCase(String name)
Case insensitive search for the node with passed name within this node's subtree, starting from itself.

Parameters:
name - mib node name (NOT oid)
Returns:
null if nothing found.
See Also:
CTreeNode.search(java.lang.Comparable), searchByOID(com.ireasoning.protocol.snmp.SnmpOID)

searchIgnoreCase

public MibTreeNode searchIgnoreCase(String name,
                                    String parentNodeName)
Case insensitive search for the node with passed name within this node's subtree, starting from itself.

This method is especially useful if MIBs contain duplicate node names. The searchIgnoreCase(String name) cannot uniquely identify nodes with duplicate names. In this case this method can help you find the nodes.

Parameters:
name - mib node name (NOT oid)
parentNodeName - parent node name
Returns:
null if nothing found.
See Also:
CTreeNode.search(java.lang.Comparable), searchByOID(com.ireasoning.protocol.snmp.SnmpOID), searchIgnoreCase(String name)

getModuleName

public String getModuleName()
Returns MIB module name


setModuleName

public void setModuleName(String name)

getModuleIdentity

public String getModuleIdentity()
Returns the MIB's MODULE-IDENTITY value


toString

public String toString()
Returns a string representation
Methods used in this method:
getName, getOID, getFullName, getSyntax, getAccess, getStatus, isIndexNode, isSnmpV2TrapNode, getIndice, getAugments, getDescription, etc.

Overrides:
toString in class CTreeNode
See Also:
CTreeNode.getName(), getOID(), getFullName(), getSyntax(), getAccess(), getStatus(), isIndexNode(), isSnmpV2TrapNode(), getIndice(), getAugments(), getDescription()

HOME

Copyright © 2002 iReasoning Inc. All Rights Reserved.