com.adventnet.snmp.mibs
Class MibTC

java.lang.Object
  |
  +--com.adventnet.snmp.mibs.LeafSyntax
        |
        +--com.adventnet.snmp.mibs.MibTC
Direct Known Subclasses:
JdbcMibTC

public class MibTC
extends LeafSyntax
implements java.io.Serializable, java.lang.Cloneable

This class represents a TEXTUAL-CONVENTION macro in a MIB module. As it is a subclass of LeafSyntax, we can create new SNMP variables with the given syntax. We can also check syntax rules on variables, and get more information on the syntax.

The TEXTUAL-CONVENTION macro is present only in an SMIv2 MIB.

The MibTC object can be obtained in any one of the following methods after loading the MIB file containg the TC

 MibOperations mibOps = new MibOperations();
 mibOps.loadMibModules("mibFile");
 

Method 1 MibModule module = mibops.getMibModule("TC1-MIB"); MibTC tc = module.getMibTC("tcName");

Method 2 MibModule module = mibOps.getMibModule("moduleName"); Enumeration en = module.getDefinedTCs(); while(en.hasMoreElements()) { MibTC tc = (MibTC)en.nextElement(); }

Method 3 If the syntax of the node is a TC, MibNode node = mibOps.getMibNode("nodeLabel"); MibTC tc = (MibTC)node.getSyntax();

Method 4 MibOperations mibOps = new MibOperations(); mibOps.loadMibModule("mibFile"); MibTC tc = (MibTC)mibOps.getSyntaxByName("tcName");

The following table list the fields present in a TEXTUAL-CONVENTION macro and the methods for retreiving the corresponding field values.

FieldsMethods for retreving the values
DISPLAY-HINTgetDisplayHint()
STATUSgetStatus()
DESCRIPTIONgetDescription()
REFERENCEgetReference()

Example for a TEXTUAL-CONVENTION defined in an SMIv2 MIB.

		
		PhysAddress ::= TEXTUAL-CONVENTION
			DISPLAY-HINT "1x:"
			STATUS       current
			DESCRIPTION	"Represents media- or physical-level addresses."
			SYNTAX       OCTET STRING
 

In SMIv2 the equivalent for TEXTUAL-CONVENTION is Type Assignment
Example for a Type Assignment defined in an SMIv1 MIB.

		PhysAddress ::= OCTET STRING
 

In case of an SMIv1 TC, the DISPLAY-HINT, STATUS, DESCRIPTION and the REFERENCE clause values are empty string.

See Also:
Serialized Form

Field Summary
(package private)  CommentClass commentObj
           
(package private)  java.lang.String description
           
(package private)  java.lang.String displayHint
           
(package private)  java.lang.String reference
           
(package private)  java.lang.String status
           
(package private)  LeafSyntax syntax
           
 
Fields inherited from class com.adventnet.snmp.mibs.LeafSyntax
equivName, MAX, MIN, name, node_type, range, size, syntax, type
 
Constructor Summary
(package private) MibTC()
           
 
Method Summary
 java.lang.Object clone()
          Creates and returns a copy of this object.
 java.lang.String getDisplayHint()
          Gets the DISPLAY-HINT field in this TC.
 java.lang.String getName()
          Returns the name of this TEXTUAL-CONVENTION.
 java.lang.String getReference()
          Gets the REFERENCE string for this TC.
 java.lang.String getStatus()
          Gets the STATUS field value for this TC.
 LeafSyntax getSyntax()
          Gets the syntax associated with this TC.
 java.lang.String getTCDescription()
          Gets the DESCRIPTION string for this TC.
(package private)  void readElements(java.io.DataInputStream inp, java.io.DataInputStream descInp, MibModule module)
           
(package private)  void readElements(SyntaxTextualConvention tc, MibModule module)
           
 java.lang.String toString()
          Returns the name of this TEXTUAL-CONVENTION.
(package private)  void updateSyntax(LeafSyntax actualSyntaxToUse)
           
 
Methods inherited from class com.adventnet.snmp.mibs.LeafSyntax
checkValue, checkValue, createVariable, createvariable, createVariable, decodeInstanceString, encodeInstanceString, getBaseSyntaxName, getBITSRange, getDescription, getEnumint, getEnumlabels, getEquivname, getInt, getLabel, getMax, getMin, getRange, getRangeItems, getSize, getSnmpType, getType, getTypeStr, initializeMINandMAXvalues, isConstrained, isEnumerated, isFixedLen, isFixedLength, isRanged, readType, readType, setEquivname, setMax, setMin, setName, setRange, setSize, setSyntax, setType, stringToArray, toTagString
 
Methods inherited from class java.lang.Object
, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

syntax

LeafSyntax syntax

displayHint

java.lang.String displayHint

status

java.lang.String status

description

java.lang.String description

reference

java.lang.String reference

commentObj

CommentClass commentObj
Constructor Detail

MibTC

MibTC()
Method Detail

getSyntax

public LeafSyntax getSyntax()
Gets the syntax associated with this TC.

For example, if the syntax of the TC "LevelA" is OCTET STRING, then this method will return OCTET STRING as a LeafSyntax object.

Overrides:
getSyntax in class LeafSyntax
Returns:
LeafSyntax object.

getDisplayHint

public java.lang.String getDisplayHint()
Gets the DISPLAY-HINT field in this TC. The DISPLAY-HINT is the optional field of the TEXTUAL-CONVENTION. This DISPLAY-HINT gives a hint as to how the value of an instance of an object with the syntax defined using this textual convention might be displayed.
Returns:
the value in the DISPLAY-HINT field, if present.
else return empty string.
See Also:
MibOperations.enableDisplayHint(boolean)

toString

public java.lang.String toString()
Returns the name of this TEXTUAL-CONVENTION. Same as the method getName().
Overrides:
toString in class LeafSyntax
Returns:
String - the name of this TEXTUAL-CONVENTION
See Also:
getName()

getName

public java.lang.String getName()
Returns the name of this TEXTUAL-CONVENTION. Same as the mehod toString().
Overrides:
getName in class LeafSyntax
Returns:
String - the name of this TEXTUAL-CONVENTION
See Also:
toString()

getStatus

public java.lang.String getStatus()
Gets the STATUS field value for this TC.
Returns:
the value of the STATUS field
empty string if the STATUS filed is not present or if this is an SMIv1 Type Assignment.

getTCDescription

public java.lang.String getTCDescription()
Gets the DESCRIPTION string for this TC.
Returns:
the DESCRIPTION value.
empty string, in case of SMIv1 Type Assignment construct.

getReference

public java.lang.String getReference()
Gets the REFERENCE string for this TC.
Returns:
the REFERENCE value, if present.
empty string, if not found or if this is a SMIv1 Type Assignment.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Creates and returns a copy of this object.
Overrides:
clone in class LeafSyntax
Throws:
java.lang.CloneNotSupportedException - is thrown if the object's class does not support the interface which could be cloned.

updateSyntax

void updateSyntax(LeafSyntax actualSyntaxToUse)

readElements

void readElements(java.io.DataInputStream inp,
                  java.io.DataInputStream descInp,
                  MibModule module)
            throws java.io.IOException

readElements

void readElements(SyntaxTextualConvention tc,
                  MibModule module)