|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sun.jaw.snmp.common.SnmpVarBind | +--com.sun.jaw.snmp.manager.SnmpVar
This class holds SnmpVar
information for a
MIB variable. A SnmpVar
consists of two parts:
SnmpVar
that indicates if the
list is an exception as specified in SNMPv2 specification.
The value part if present determines the MIB syntax for the object.
It provides clone functions that can be used to clone the SnmpVar
with or without the value part.
A SnmpVar
can be constructed and a value can be assigned.
The SnmpVar
also has a status information which
specifies if the agent responded with an exception condition (SNMPv1 -> SNMPv2
translation) such as noSuchInstance
, endOfMibView
,
or noSuchObject
. Such errors are typically
fixed and the request is retried by removing these variables from the request.
Field Summary | |
static MibStoreIfSrv |
meta
Reference to a mib store service. |
static java.lang.String[] |
statusLegend
Keeps the legend for the value part of the SnmpVar . |
static int |
stValueEndOfMibView
Useful constant indicating that the status of the SnmpVar object is endOfMibView . |
static int |
stValueNoSuchInstance
Useful constant indicating that the status of the SnmpVar object is noSuchInstance . |
static int |
stValueNoSuchObject
Useful constant indicating that the status of the SnmpVar object is noSuchObject . |
static int |
stValueOk
Useful constant indicating that the status of the SnmpVar object is valid. |
static int |
stValueUnspecified
Useful constant indicating that the status of the SnmpVar object is not initialized. |
Fields inherited from class com.sun.jaw.snmp.common.SnmpVarBind |
endOfMibView,
noSuchInstance,
noSuchObject,
oid,
value |
Constructor Summary | |
SnmpVar(SnmpOid oid)
Constructs a new SnmpVar object from the specified SnmpOid value. |
|
SnmpVar(java.lang.String name)
Constructs a new SnmpVar object from the specified String value. |
Method Summary | |
void |
addInstance(long val)
Adds an instance part to the oid in the SnmpOid object. |
void |
addInstance(long[] val)
Adds an instance part to the oid in the SnmpOid object. |
void |
addInstance(java.lang.String s)
Adds an instance part to the oid in the SnmpOid object. |
void |
clearValue()
Clears the value associated with this SnmpVar and
sets the status to stValueUnspecified . |
java.lang.Object |
clone()
Clones the SNMP variable (including value). |
java.lang.Object |
cloneWithoutValue()
Clones the SNMP variable. |
void |
copyValue(SnmpVar srcVar)
Clones and copies only the value part from another object. |
void |
copyValueAndOid(SnmpVar srcVar)
Clones and copies the oid and value part from another object. |
SnmpCounter |
getCounter32()
Deprecated. As of JDMK 3.2, replaced by getSnmpCounterValue() |
SnmpGauge |
getGauge()
Deprecated. As of JDMK 3.2, replaced by getSnmpGaugeValue() |
SnmpInt |
getInteger32()
Deprecated. As of JDMK 3.2, replaced by getSnmpIntValue() |
SnmpIpAddress |
getIpAddress()
Deprecated. As of JDMK 3.2, replaced by getSnmpIpAddressValue() |
SnmpOid |
getOid()
Returns the complete oid part associated with this SnmpVar . |
SnmpCounter64 |
getSnmpCounter64Value()
Returns the value part associated with this SnmpVar . |
SnmpCounter |
getSnmpCounterValue()
Returns the value part associated with this SnmpVar . |
SnmpGauge |
getSnmpGaugeValue()
Returns the value part associated with this SnmpVar . |
SnmpInt |
getSnmpIntValue()
Returns the value part associated with this SnmpVar . |
SnmpIpAddress |
getSnmpIpAddressValue()
Returns the value part associated with this SnmpVar . |
SnmpOid |
getSnmpOid()
Deprecated. As of JDMK 3.2, replaced by getSnmpOidValue() |
SnmpOid |
getSnmpOidValue()
Returns the value part associated with this SnmpVar . |
SnmpOpaque |
getSnmpOpaqueValue()
Returns the value part associated with this SnmpVar . |
SnmpStringFixed |
getSnmpStringFixedValue()
Returns the value part associated with this SnmpVar . |
SnmpString |
getSnmpStringValue()
Returns the value part associated with this SnmpVar . |
SnmpTimeticks |
getSnmpTimeticksValue()
Returns the value part associated with this SnmpVar . |
SnmpValue |
getSnmpValue()
Returns the value part associated with this SnmpVar . |
java.lang.String |
getStringValue()
Returns the printable ASCII representation for the corresponding variable value. |
SnmpTimeticks |
getTimeTicks()
Deprecated. As of JDMK 3.2, replaced by getSnmpTimeticksValue() |
int |
getValueStatus()
Returns the status of the value associated with this SnmpVar . |
java.lang.String |
getValueStatusLegend()
Returns the status of the value associated with this SnmpVar . |
boolean |
hasVbException()
Determines if the SnmpVar has an SNMP exception
(generated by agent in response to a request). |
protected void |
illegalCall(java.lang.String s)
Throws a new SnmpStatusException with an error message. |
boolean |
isOidEqual(SnmpVar avar)
Checks whether the oid for this variable completely matches the oid part of the specified SnmpVar object. |
java.lang.String[] |
resolveVarName(java.lang.String name)
Consults the MIB storage to resolve the name to its oid type structure. |
void |
setCounter32Value(int val)
Deprecated. As of JDMK 3.2, replaced by setSnmpCounterValue(long) |
void |
setCounter64Value(java.lang.Object val)
Deprecated. As of JDMK 3.2, replaced by setSnmpCounter64Value(long) |
void |
setGauge32Value(int val)
Deprecated. As of JDMK 3.2, replaced by setSnmpGaugeValue(long) |
void |
setIntegerValue(int val)
Deprecated. As of JDMK 3.2, replaced by setSnmpIntValue(long) |
void |
setIpAddressValue(long val)
Deprecated. As of JDMK 3.2, replaced by setSnmpIpAddressValue(String) |
void |
setOid(SnmpOid newoid)
Sets the SnmpOid part associated with this SnmpVar
with the specified oid. |
void |
setOpaqueValue(java.lang.Object val)
Deprecated. As of JDMK 3.2, replaced by setSnmpOpaqueValue(byte[]) |
void |
setSnmpCounter64Value(long val)
Sets the SnmpCounter64 value part associated with this SnmpVar
with the specified counter 64 value. |
void |
setSnmpCounterValue(long val)
Sets the SnmpCounter value part associated with this SnmpVar
with the specified counter value. |
void |
setSnmpGaugeValue(long val)
Sets the SnmpGauge value part associated with this SnmpVar
with the specified gauge value. |
void |
setSnmpIntValue(long val)
Sets the SnmpInt value part associated with this SnmpVar
with the specified integer value. |
void |
setSnmpIpAddressValue(java.lang.String val)
Sets the SnmpIpAddress value part associated with this SnmpVar
with the specified ipAddress value. |
void |
setSnmpOidValue(java.lang.String val)
Sets the SnmpOid value part associated with this SnmpVar
with the specified oid value. |
void |
setSnmpOpaqueValue(byte[] val)
Sets the SnmpOpaque value part associated with this SnmpVar
with the specified bytes array values. |
void |
setSnmpStringFixedValue(java.lang.String val)
Sets the SnmpStringFixed value part associated with this SnmpVar
with the specified string value. |
void |
setSnmpStringValue(java.lang.String val)
Sets the SnmpString value part associated with this SnmpVar
with the specified string value. |
void |
setSnmpTimeticksValue(long val)
Sets the SnmpTimeticks value part associated with this SnmpVar
with the specified timeticks value. |
void |
setSnmpValue(SnmpValue val)
Sets the SnmpValue part associated with this SnmpVar
with the specified value. |
void |
setTimeticksValue(int val)
Deprecated. As of JDMK 3.2, replaced by setSnmpTimeticksValue(long) |
void |
setValueEndOfMibView()
Sets the status to indicate there is no such object
for this SnmpVar while doing an SnmpGetNext operation. |
void |
setValueNoSuchInstance()
Sets the status to indicate there is no such instance for this
SnmpVar . |
void |
setValueNoSuchObject()
Sets the status to indicate there is no such object for this
SnmpVar . |
protected void |
setValueValid()
Sets the status to indicate that the value for this
SnmpVar is valid. |
java.lang.String |
toString()
Returns the printable ASCII representation for this SnmpVar . |
boolean |
unspecifiedValue()
Checks if the value associated with this SnmpVar is unspecified. |
boolean |
validValue()
Checks if the object contains a valid accessible value. |
Methods inherited from class com.sun.jaw.snmp.common.SnmpVarBind |
appendInOid,
insertInOid |
Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static final java.lang.String[] statusLegend
SnmpVar
.public static final int stValueUnspecified
SnmpVar
object is not initialized.public static final int stValueOk
SnmpVar
object is valid.public static final int stValueNoSuchObject
SnmpVar
object is noSuchObject
.
Status of SnmpVar
as returned by SNMPv2 agent.public static final int stValueNoSuchInstance
SnmpVar
object is noSuchInstance
.
Status of SnmpVar
as returned by SNMPv2 agent.
In SNMPv1 context, this is appropriate when noSuchName
is returned in the response to SnmpGet
request.public static final int stValueEndOfMibView
SnmpVar
object is endOfMibView
.
Status of SnmpVar
as returned by SNMPv2 agent.
In SNMPv1 context, this is appropriate when noSuchName
is returned in the response to SnmpGetNext
request.public static MibStoreIfSrv meta
Constructor Detail |
public SnmpVar(SnmpOid oid)
SnmpVar
object from the specified SnmpOid
value.oid
- The oid part of the SnmpVar
.public SnmpVar(java.lang.String name) throws SnmpStatusException
SnmpVar
object from the specified String
value.
If the name is a MIB variable, it resolves the name with the MIB database.name
- The MIB variable name or a dot-formatted oid String
.Method Detail |
public java.lang.String[] resolveVarName(java.lang.String name) throws SnmpStatusException
name
- The MIB variable name or a dot-formatted oid String
.public final SnmpOid getOid()
SnmpVar
.SnmpOid
for this variable.public final void setOid(SnmpOid newoid)
SnmpOid
part associated with this SnmpVar
with the specified oid.
The value part of this SnmpVar
will automatically be nulled.newoid
- The new oid.SnmpOid
public final SnmpValue getSnmpValue()
SnmpVar
.SnmpValue
for this variable.public final void setSnmpValue(SnmpValue val)
SnmpValue
part associated with this SnmpVar
with the specified value.
The status is updated to indicate that the value is valid.val
- The new value.SnmpValue
public final SnmpCounter64 getSnmpCounter64Value() throws java.lang.ClassCastException
SnmpVar
.SnmpCounter64
value for this variable.public final void setSnmpCounter64Value(long val) throws java.lang.IllegalArgumentException
SnmpCounter64
value part associated with this SnmpVar
with the specified counter 64 value.
The status is updated to indicate that the value is valid.val
- The new counter 64 value.Long.MAX_VALUE
.SnmpCounter64
public final SnmpInt getSnmpIntValue() throws java.lang.ClassCastException
SnmpVar
.SnmpInt
value for this variable.public final void setSnmpIntValue(long val) throws java.lang.IllegalArgumentException
SnmpInt
value part associated with this SnmpVar
with the specified integer value.
The status is updated to indicate that the value is valid.val
- The new integer value.Integer.MIN_VALUE
or larger than Integer.MAX_VALUE
.SnmpInt
public final SnmpCounter getSnmpCounterValue() throws java.lang.ClassCastException
SnmpVar
.SnmpCounter
value for this variable.public final void setSnmpCounterValue(long val) throws java.lang.IllegalArgumentException
SnmpCounter
value part associated with this SnmpVar
with the specified counter value.
The status is updated to indicate that the value is valid.val
- The new counter value.SnmpUnsignedInt.MAX_VALUE
.SnmpCounter
public final SnmpGauge getSnmpGaugeValue() throws java.lang.ClassCastException
SnmpVar
.SnmpGauge
value for this variable.public final void setSnmpGaugeValue(long val) throws java.lang.IllegalArgumentException
SnmpGauge
value part associated with this SnmpVar
with the specified gauge value.
The status is updated to indicate that the value is valid.val
- The new gauge value.SnmpUnsignedInt.MAX_VALUE
.SnmpGauge
public final SnmpTimeticks getSnmpTimeticksValue() throws java.lang.ClassCastException
SnmpVar
.SnmpTimeticks
value for this variable.public final void setSnmpTimeticksValue(long val) throws java.lang.IllegalArgumentException
SnmpTimeticks
value part associated with this SnmpVar
with the specified timeticks value.
The status is updated to indicate that the value is valid.val
- The new timeticks value.SnmpUnsignedInt.MAX_VALUE
.SnmpTimeticks
public final SnmpOid getSnmpOidValue() throws java.lang.ClassCastException
SnmpVar
.SnmpOid
value for this variable.public final void setSnmpOidValue(java.lang.String val) throws java.lang.IllegalArgumentException
SnmpOid
value part associated with this SnmpVar
with the specified oid value.
The status is updated to indicate that the value is valid.val
- The new oid value.String
nor a String
of the MIB database.SnmpOid
public final SnmpIpAddress getSnmpIpAddressValue() throws java.lang.ClassCastException
SnmpVar
.SnmpIpAddress
value for this variable.public final void setSnmpIpAddressValue(java.lang.String val) throws java.lang.IllegalArgumentException
SnmpIpAddress
value part associated with this SnmpVar
with the specified ipAddress value.
The status is updated to indicate that the value is valid.val
- The new ipAddress value.SnmpIpAddress
public final SnmpString getSnmpStringValue() throws java.lang.ClassCastException
SnmpVar
.SnmpString
value for this variable.public final void setSnmpStringValue(java.lang.String val)
SnmpString
value part associated with this SnmpVar
with the specified string value.
The status is updated to indicate that the value is valid.val
- The new string value.SnmpString
public final SnmpOpaque getSnmpOpaqueValue() throws java.lang.ClassCastException
SnmpVar
.SnmpOpaque
value for this variable.public final void setSnmpOpaqueValue(byte[] val)
SnmpOpaque
value part associated with this SnmpVar
with the specified bytes array values.
The status is updated to indicate that the value is valid.val
- The new bytes array value.SnmpOpaque
public final SnmpStringFixed getSnmpStringFixedValue() throws java.lang.ClassCastException
SnmpVar
.SnmpStringFixed
value for this variable.public final void setSnmpStringFixedValue(java.lang.String val)
SnmpStringFixed
value part associated with this SnmpVar
with the specified string value.
The status is updated to indicate that the value is valid.val
- The new string value.SnmpStringFixed
public final int getValueStatus()
status
of the value associated with this SnmpVar
.public final java.lang.String getValueStatusLegend()
status
of the value associated with this SnmpVar
.String
.protected void setValueValid()
status
to indicate that the value for this
SnmpVar
is valid.
Accessible only to derived classes.public final void setValueNoSuchObject()
status
to indicate there is no such object for this
SnmpVar
.public final void setValueEndOfMibView()
status
to indicate there is no such object
for this SnmpVar
while doing an SnmpGetNext
operation.public final void setValueNoSuchInstance()
status
to indicate there is no such instance for this
SnmpVar
.public final boolean validValue()
public final void clearValue()
SnmpVar
and
sets the status to stValueUnspecified
.public final boolean hasVbException()
SnmpVar
has an SNMP exception
(generated by agent in response to a request).SnmpVar
has an SNMP response exception; false otherwise.public final boolean unspecifiedValue()
SnmpVar
is unspecified.public void copyValueAndOid(SnmpVar srcVar)
srcVar
- The SnmpVar clone.public void copyValue(SnmpVar srcVar)
srcVar
- The SnmpVar clone.public final boolean isOidEqual(SnmpVar avar)
SnmpVar
object.avar
- The object whose oid part is to be matched.public final java.lang.Object cloneWithoutValue()
public final java.lang.Object clone()
public final void addInstance(long val)
SnmpOid
object.
Note that there is no getInstance
method. This method
will directly add the instance to the SnmpOid
object.val
- The sub-identifier to be appended to the oid.public final void addInstance(long[] val) throws SnmpStatusException
SnmpOid
object.
Note that there is no getInstance
method. This method
will directly add the instance to the SnmpOid
object.val
- The sub-identifier array to be appended to the oid.public final void addInstance(java.lang.String s) throws SnmpStatusException
SnmpOid
object.
Note that there is no getInstance
method. This method
will directly add the instance to the SnmpOid
object.str
- Dot-formatted sub-identifier String
to
be appended to the oid.public final java.lang.String getStringValue()
public final java.lang.String toString()
SnmpVar
.protected void illegalCall(java.lang.String s) throws SnmpStatusException
SnmpStatusException
with an error message.s
- The error message.public final SnmpInt getInteger32() throws java.lang.ClassCastException
getSnmpIntValue()
public final void setIntegerValue(int val)
setSnmpIntValue(long)
public final SnmpCounter getCounter32() throws java.lang.ClassCastException
getSnmpCounterValue()
public final void setCounter32Value(int val)
setSnmpCounterValue(long)
public final SnmpGauge getGauge() throws java.lang.ClassCastException
getSnmpGaugeValue()
public final void setGauge32Value(int val)
setSnmpGaugeValue(long)
public final SnmpTimeticks getTimeTicks() throws java.lang.ClassCastException
getSnmpTimeticksValue()
public final void setTimeticksValue(int val)
setSnmpTimeticksValue(long)
public final SnmpIpAddress getIpAddress() throws java.lang.ClassCastException
getSnmpIpAddressValue()
public final void setIpAddressValue(long val)
setSnmpIpAddressValue(String)
public final SnmpOid getSnmpOid() throws java.lang.ClassCastException
getSnmpOidValue()
public final void setOpaqueValue(java.lang.Object val) throws SnmpStatusException
setSnmpOpaqueValue(byte[])
public final void setCounter64Value(java.lang.Object val) throws SnmpStatusException
setSnmpCounter64Value(long)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |