com.adventnet.snmp.mibs
Class JdbcLeafSyntax

java.lang.Object
  |
  +--com.adventnet.snmp.mibs.LeafSyntax
        |
        +--com.adventnet.snmp.mibs.JdbcLeafSyntax

class JdbcLeafSyntax
extends LeafSyntax
implements java.io.Serializable, MIBConstants, java.lang.Cloneable

See Also:
Serialized Form

Field Summary
(package private)  byte[] alphaType
           
(package private)  java.util.Hashtable enumTable
           
(package private)  JdbcMibOperations jMibOps
           
(package private)  java.util.Vector labelVect
           
(package private)  java.lang.String moduleName
           
(package private)  java.lang.String name
           
(package private)  byte[] numericType
           
(package private)  java.lang.String oid
           
(package private)  java.lang.String queryString
           
(package private)  java.sql.ResultSet rs
           
(package private)  java.lang.String tableName
           
(package private)  byte type
           
 
Fields inherited from class com.adventnet.snmp.mibs.LeafSyntax
equivName, MAX, MIN, name, node_type, range, size, syntax, type
 
Fields inherited from interface com.adventnet.snmp.mibs.mibparser.MIBConstants
ACCESS_ACCESSIBLE_FOR_NOTIFY, ACCESS_NOT_ACCESSIBLE, ACCESS_NOT_IMPLEMENTED, ACCESS_READ_CREATE, ACCESS_READ_ONLY, ACCESS_READ_WRITE, ACCESS_WRITE_ONLY, accessStr, AGENT_CAPABILITIES, alphaStr, BITSTRING, COUNTER, COUNTER32, COUNTER64, GAUGE, GAUGE32, INTEGER, INTEGER32, IPADDRESS, macroStr, MODULE_COMPLIANCE, MODULE_IDENTITY, NETWORKADDRESS, NOTIFICATION_GROUP, NOTIFICATION_TYPE, NULL, numericStr, OBJECT_GROUP, OBJECT_IDENTIFIER, OBJECT_IDENTITY, OBJECT_TYPE, OCTETSTRING, OPAQUE, SEQUENCE, STATUS_CURRENT, STATUS_DEPRECATED, STATUS_MANDATORY, STATUS_OBSOLETE, STATUS_OPTIONAL, statusStr, TEXTUAL_CONVENTION, TIMETICKS, TRAP_TYPE, UNSIGNED32
 
Constructor Summary
(package private) JdbcLeafSyntax()
           
(package private) JdbcLeafSyntax(java.lang.String modulename, java.lang.String OID, JdbcMibOperations jdbcMibOps)
           
 
Method Summary
 boolean checkValue(int i)
          Checks whether the integer value argument is in the defined range for this syntax definition.
 boolean checkValue(java.lang.String s)
          Checks whether the String value argument is in the defined range for this syntax definition.
 java.lang.Object clone()
          Creates and returns a copy of this object.
(package private)  boolean getBITSRange(java.lang.String val)
           
 java.lang.String getDescription()
          Returns the description of the syntax.
 int[] getEnumint()
          Gives all the values present for an enumerated syntax.
 java.lang.String[] getEnumlabels()
          Gives all the labels present for an enumerated syntax.
(package private)  void getEnumTable()
           
 java.lang.String getEquivname()
          Gets the equivalent SNMP type name.
(package private)  java.lang.String getImportedModuleName(java.lang.String modulename, java.lang.String syntax)
           
 int getInt(java.lang.String s)
          Gets the int value of the label argument.
 java.lang.String getLabel(int val)
          Gets the label corresponding to the integer value argument.
 long getMax()
          Gives the maximum value allowed for the syntaxes.
 long getMin()
          Gives the minimum value allowed for all the syntaxes.
 java.lang.String getName()
          Returns the name of this LeafSyntax instance.
 java.lang.String[] getRangeItems()
          Gets the range constraints available for this syntax.
 LeafSyntax getSyntax()
          Gives the syntax for this leafSyntax Object.
(package private)  java.lang.String getTCDefinedMIB(java.lang.String modulename, java.lang.String syntax)
           
(package private)  byte getTCType(java.lang.String modulename, java.lang.String type)
           
 byte getType()
          Retrieves the SNMP ASN.1 tag value for this syntax.
 boolean isConstrained()
          Checks whether the syntax has some range/size limitations explicitly defined in the MIB.
(package private)  boolean IsConstrained()
           
 boolean isEnumerated()
          Checks whether the syntax is enumerated.
(package private)  boolean isImportedTC(java.lang.String tcName)
           
 boolean isRanged()
          Checks to see if this syntax has size or value limitations.
(package private)  boolean isTC(java.lang.String oid)
           
 java.lang.String toString()
          Returns the syntax name for display purposes.
 java.lang.String toTagString()
          Gives the detailed description of this syntax.
 
Methods inherited from class com.adventnet.snmp.mibs.LeafSyntax
createVariable, createvariable, createVariable, decodeInstanceString, encodeInstanceString, getBaseSyntaxName, getRange, getSize, getSnmpType, getTypeStr, initializeMINandMAXvalues, isFixedLen, isFixedLength, readType, readType, setEquivname, setMax, setMin, setName, setRange, setSize, setSyntax, setType, stringToArray
 
Methods inherited from class java.lang.Object
, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

alphaType

byte[] alphaType

numericType

byte[] numericType

enumTable

java.util.Hashtable enumTable

rs

java.sql.ResultSet rs

queryString

java.lang.String queryString

moduleName

java.lang.String moduleName

oid

java.lang.String oid

name

java.lang.String name

tableName

java.lang.String tableName

labelVect

java.util.Vector labelVect

type

byte type

jMibOps

JdbcMibOperations jMibOps
Constructor Detail

JdbcLeafSyntax

JdbcLeafSyntax()

JdbcLeafSyntax

JdbcLeafSyntax(java.lang.String modulename,
               java.lang.String OID,
               JdbcMibOperations jdbcMibOps)
Method Detail

getName

public java.lang.String getName()
Description copied from class: LeafSyntax
Returns the name of this LeafSyntax instance.
Overrides:
getName in class LeafSyntax
Tags copied from class: LeafSyntax
Returns:
the syntax name

getDescription

public java.lang.String getDescription()
Description copied from class: LeafSyntax
Returns the description of the syntax. for example, "OCTET STRING (SIZE (0..255))"
Overrides:
getDescription in class LeafSyntax
Tags copied from class: LeafSyntax
Returns:
the syntax description

getType

public byte getType()
Description copied from class: LeafSyntax
Retrieves the SNMP ASN.1 tag value for this syntax.

The following table lists the syntax, corresponding tag values and the equivalent SnmpAPI types.

Syntax TagValue equivalent SnmpAPI types
INTEGER/Integer32 0x02 SnmpAPI.INTEGER
OCTET STRING/BITS 0x04 SnmpAPI.STRING
NULL 0x05 SnmpAPI.NULL
OBJECT IDENTIFIER  0x06 SnmpAPI.OBJID
IpAddress 0x40 SnmpAPI.IPADDRESS
NetworkAddress 0x40 SnmpAPI.NETWORKADDRESS
Counter/Counter32 0x41 SnmpAPI.COUNTER
Unsigned32 0x42 SnmpAPI.UNSIGNED32
Gauge/Gauge32 0x42 SnmpAPI.GAUGE
TimeTicks 0x43 SnmpAPI.TIMETICKS
Opaque 0x44 SnmpAPI.OPAQUE
Counter64 0x46 SnmpAPI.COUNTER64

Overrides:
getType in class LeafSyntax
Tags copied from class: LeafSyntax
Returns:
the type value of this syntax in bytes

getTCType

byte getTCType(java.lang.String modulename,
               java.lang.String type)

getEnumlabels

public java.lang.String[] getEnumlabels()
Description copied from class: LeafSyntax
Gives all the labels present for an enumerated syntax.

For example, if the syntax is INTEGER { up(1), down(2), testing(3) }
then the String array contain the following values
"up", "down" and "testing"

If you want to get a particular enumerated label, then you can use the method getLabel(int).
The method getEnumint() can be used to get the enumerated values available for an enumerated syntax.

Overrides:
getEnumlabels in class LeafSyntax
Tags copied from class: LeafSyntax
Returns:
string array of the enumerated labels.
null, if the syntax is not enumerated.
See Also:
LeafSyntax.getLabel(int), LeafSyntax.getEnumint()

getEnumint

public int[] getEnumint()
Description copied from class: LeafSyntax
Gives all the values present for an enumerated syntax.

For example, if the syntax is INTEGER { up(1), down(2), testing(3) }
then the integer array contain the following values
'1', '2' and '3'

If you want to get a particular enumerated value, then you can use the method getInt(String).
The method getEnumlabels() can be used to get the enumerated labels available for an enumerated syntax.

Overrides:
getEnumint in class LeafSyntax
Tags copied from class: LeafSyntax
Returns:
integer array of enumerated integers.
null, if the syntax is not enumerated.
See Also:
LeafSyntax.getInt(java.lang.String), #getEnumlables

getMin

public long getMin()
Description copied from class: LeafSyntax
Gives the minimum value allowed for all the syntaxes.

For the enumerated syntaxes, returns the minimum of the enumerated values.
For example, if the syntax is INTEGER { up(1), down(2), testing(3) } this method will return 1.

Overrides:
getMin in class LeafSyntax
Tags copied from class: LeafSyntax
Returns:
the minimum value in bytes.
See Also:
LeafSyntax.getMax()

getMax

public long getMax()
Description copied from class: LeafSyntax
Gives the maximum value allowed for the syntaxes.

For the enumerated syntaxes, returns the maximum of the enumerated values.
For example, if the syntax is INTEGER { up(1), down(2), testing(3) } this method will return 3.

Overrides:
getMax in class LeafSyntax
Tags copied from class: LeafSyntax
Returns:
the maximum value in bytes.
See Also:
LeafSyntax.getMin()

toString

public java.lang.String toString()
Description copied from class: LeafSyntax
Returns the syntax name for display purposes. Same as the getName() method
Overrides:
toString in class LeafSyntax
Tags copied from class: LeafSyntax
See Also:
LeafSyntax.getName()

toTagString

public java.lang.String toTagString()
Description copied from class: LeafSyntax
Gives the detailed description of this syntax.
Overrides:
toTagString in class LeafSyntax
Tags copied from class: LeafSyntax
Returns:
the string representation of the description of syntax. e.g. DisplayString (SIZE (0..255))

getLabel

public java.lang.String getLabel(int val)
Description copied from class: LeafSyntax
Gets the label corresponding to the integer value argument.

If you want to get all the enumerated labels, the method getEnumlables() can be used.

Overrides:
getLabel in class LeafSyntax
Tags copied from class: LeafSyntax
Parameters:
val - the integer value which ought to be one of the enumerations.
Returns:
the string representing this value
null if not an enumerated integer or if the value is not found.
See Also:
LeafSyntax.getEnumlabels()

getInt

public int getInt(java.lang.String s)
Description copied from class: LeafSyntax
Gets the int value of the label argument.

If you want to get all the enumerated values, the method getEnumint() can be used.

Overrides:
getInt in class LeafSyntax
Tags copied from class: LeafSyntax
Parameters:
s - the string value which should be one of the enumerations.
Returns:
the integer corresponding to the label.
returns -1 if not found or if not an enumerated integer.
See Also:
LeafSyntax.getEnumint()

checkValue

public boolean checkValue(int i)
Description copied from class: LeafSyntax
Checks whether the integer value argument is in the defined range for this syntax definition.

In case of enumerated syntax, if the input argument is any one of the enumerated value, then this method will return true.

For other syntaxes, if the value is between the maximum and minimum values or if it is one of the maximum and minimum values, then this will return true.

Overrides:
checkValue in class LeafSyntax
Tags copied from class: LeafSyntax
Parameters:
i - the integer value.
Returns:
true if it is in the enumeration list or if within max size limits(includes boundary values)
false otherwise.

checkValue

public boolean checkValue(java.lang.String s)
Description copied from class: LeafSyntax
Checks whether the String value argument is in the defined range for this syntax definition.

NOTE : This method is supposed to be used for the enumerated syntax where the input is the any one of the enumerated label. When used for any other syntaxes, this method checks whether the length of the input String argument exceeds the maximum size of the syntax.

Overrides:
checkValue in class LeafSyntax
Tags copied from class: LeafSyntax
Parameters:
s - the string value.
Returns:
true if in the enumeration list(if exists) or if the value is within max size limit for the syntax string
false otherwise.

IsConstrained

boolean IsConstrained()

isConstrained

public boolean isConstrained()
Description copied from class: LeafSyntax
Checks whether the syntax has some range/size limitations explicitly defined in the MIB.

For example, if a node is defined with a syntax INTEGER, eventhough it has a standard/default range (-2147483648 .. 2147483647), this method will return false as there is no range constraints explicitly imposed on the syntax in the MIB.

Overrides:
isConstrained in class LeafSyntax
Tags copied from class: LeafSyntax
Returns:
true if the range restrictions is defined explicitly.
false otherwise.

isEnumerated

public boolean isEnumerated()
Description copied from class: LeafSyntax
Checks whether the syntax is enumerated.
Overrides:
isEnumerated in class LeafSyntax
Tags copied from class: LeafSyntax
Returns:
true if the syntax contains the enum labels.
false otherwise.

isRanged

public boolean isRanged()
Description copied from class: LeafSyntax
Checks to see if this syntax has size or value limitations.

By default all the basic integer types have constraints on their values in terms of numeric ranges and hence this method will return true for all the basic integer datatypes.

Overrides:
isRanged in class LeafSyntax
Tags copied from class: LeafSyntax
Returns:
true if the syntax has range restrictions.
false if enumerated or if the syntax does not have the range restriction.
See Also:
LeafSyntax.isEnumerated()

getSyntax

public LeafSyntax getSyntax()
Description copied from class: LeafSyntax
Gives the syntax for this leafSyntax Object.

The idea is that each LeafSyntax could be a Textual-Convention. In such a cases the textual convention's syntax will be applicable. However if the textual convention's syntax is another textual convention then we have a case where it should be possible to derive the syntax tree without going into a cyclic loop.

Overrides:
getSyntax in class LeafSyntax
Tags copied from class: LeafSyntax
Returns:
LeafSyntax object for this syntax.

getRangeItems

public java.lang.String[] getRangeItems()
Description copied from class: LeafSyntax
Gets the range constraints available for this syntax. For example if a syntax has a range like (0 .. 255 | 400 .. 500) then this method will return an array containing two components namely "0 .. 255" and "400 .. 500".
Overrides:
getRangeItems in class LeafSyntax
Tags copied from class: LeafSyntax
Returns:
the string array of range constraints.
null, if there are no range restrictions.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Description copied from class: LeafSyntax
Creates and returns a copy of this object.
Overrides:
clone in class LeafSyntax
Tags copied from class: LeafSyntax
Returns:
the copy of this LeafSyntax object.
Throws:
java.lang.CloneNotSupportedException - is thrown if the object's class does not support the Cloneable interface.

getEnumTable

void getEnumTable()

getTCDefinedMIB

java.lang.String getTCDefinedMIB(java.lang.String modulename,
                                 java.lang.String syntax)

getImportedModuleName

java.lang.String getImportedModuleName(java.lang.String modulename,
                                       java.lang.String syntax)

isTC

boolean isTC(java.lang.String oid)

getBITSRange

boolean getBITSRange(java.lang.String val)
Overrides:
getBITSRange in class LeafSyntax

isImportedTC

boolean isImportedTC(java.lang.String tcName)

getEquivname

public java.lang.String getEquivname()
Description copied from class: LeafSyntax
Gets the equivalent SNMP type name. Using this method we can get the base datatype of a TC.

In case of MultiLevel-TC, returns the syntax of base TC.
For example, if the syntax of TC "LevelB" is "LevelA" whose syntax is OCTET STRING,
then this method will return OCTET STRING.

Overrides:
getEquivname in class LeafSyntax
Tags copied from class: LeafSyntax
Returns:
the base syntax as a String