|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.management.snmp.SnmpVarBind
public class SnmpVarBind
This class holds information for a MIB variable contained in an SnmpVarBindList
.
An SnmpVarBind
consists of three parts:
SnmpVarBind
which specifies whether the agent responded with an
exception condition for this variable such as noSuchInstance
, endOfMibView
,
or noSuchObject
.
On the manager side, these errors can be fixed with the
PduFixedOnError
option
and the request is retried by removing the variable from the request variable bindings list.
Field Summary | |
---|---|
static SnmpNull |
endOfMibView
Error code value as defined in RFC 1448 for: endOfMibView . |
static SnmpNull |
noSuchInstance
Error code value as defined in RFC 1448 for: noSuchInstance . |
static SnmpNull |
noSuchObject
Error code value as defined in RFC 1448 for: noSuchObject . |
int |
status
Indicates the status of the value in this SnmpVarBind . |
static String[] |
statusLegend
Keeps the legend for the value part of the SnmpVarBind . |
static int |
stValueEndOfMibView
Useful constant indicating that the status of the SnmpVarBind object is endOfMibView . |
static int |
stValueNoSuchInstance
Useful constant indicating that the status of the SnmpVarBind object is
noSuchInstance . |
static int |
stValueNoSuchObject
Useful constant indicating that the status of the SnmpVarBind object is noSuchObject . |
static int |
stValueOk
Useful constant indicating that the status of the SnmpVarBind object is valid. |
static int |
stValueUnspecified
Useful constant indicating that the status of the SnmpVarBind object is not initialized. |
Fields inherited from interface com.sun.management.snmp.SnmpDataTypeEnums |
---|
ApplFlag, BitStringTag, BooleanTag, Counter64Tag, CounterTag, CtxtFlag, errEndOfMibViewTag, errNoSuchInstanceTag, errNoSuchObjectTag, GaugeTag, IntegerTag, IpAddressTag, NsapTag, NullTag, ObjectIdentiferTag, ObjectIdentifierTag, OctetStringTag, OpaqueTag, SequenceTag, TableTag, TimeticksTag, UintegerTag, UnknownSyntaxTag |
Constructor Summary | |
---|---|
SnmpVarBind()
Default constructor. |
|
SnmpVarBind(SnmpOid oid)
Constructs a new SnmpVarBind object from the specified SnmpOid value. |
|
SnmpVarBind(SnmpOid oid,
SnmpValue val)
Constructs a new SnmpVarBind object from the specified SnmpOid and
SnmpValue . |
|
SnmpVarBind(String name)
Constructs a new SnmpVarBind object from the specified String value. |
Method Summary | |
---|---|
void |
addInstance(long inst)
Adds an instance part to the OID in the SnmpOid object. |
void |
addInstance(long[] inst)
Adds an instance part to the OID in the SnmpOid object. |
void |
addInstance(String inst)
Adds an instance part to the OID in the SnmpOid object. |
void |
appendInOid(SnmpOid oid)
Appends the specified SnmpOid to the end of the OID of this SnmpVarBind . |
void |
clearValue()
Clears the value associated with this SnmpVarBind and sets the status to
stValueUnspecified . |
Object |
clone()
Clones the SNMP variable (including value). |
Object |
cloneWithoutValue()
Clones the SNMP variable. |
void |
copyValue(SnmpVarBind var)
Clones and copies only the value part from another SnmpVarBind object. |
void |
copyValueAndOid(SnmpVarBind var)
Clones and copies the OID and value part from another SnmpVarBind object. |
SnmpOid |
getOid()
Returns the complete OID part associated with this SnmpVarBind . |
SnmpCounter64 |
getSnmpCounter64Value()
Returns the value part associated with this SnmpVarBind . |
SnmpCounter |
getSnmpCounterValue()
Returns the value part associated with this SnmpVarBind . |
SnmpGauge |
getSnmpGaugeValue()
Returns the value part associated with this SnmpVarBind . |
SnmpInt |
getSnmpIntValue()
Returns the value part associated with this SnmpVarBind . |
SnmpIpAddress |
getSnmpIpAddressValue()
Returns the value part associated with this SnmpVarBind . |
SnmpOid |
getSnmpOidValue()
Returns the value part associated with this SnmpVarBind . |
SnmpOpaque |
getSnmpOpaqueValue()
Returns the value part associated with this SnmpVarBind . |
SnmpStringFixed |
getSnmpStringFixedValue()
Returns the value part associated with this SnmpVarBind . |
SnmpString |
getSnmpStringValue()
Returns the value part associated with this SnmpVarBind . |
SnmpTimeticks |
getSnmpTimeticksValue()
Returns the value part associated with this SnmpVarBind . |
SnmpValue |
getSnmpValue()
Returns the value part associated with this SnmpVarBind . |
String |
getStringValue()
Returns the printable ASCII representation for the corresponding variable value. |
int |
getValueStatus()
Returns the status of the value associated with this SnmpVarBind as an integer. |
String |
getValueStatusLegend()
Returns the status of the value associated with this SnmpVarBind as a String . |
boolean |
hasVarBindException()
Determines whether the SnmpVarBind has an SNMP exception
(generated by agent in response to a request). |
void |
insertInOid(int oid)
Inserts a sub-id at the beginning of the OID of this SnmpVarBind . |
boolean |
isOidEqual(SnmpVarBind var)
Checks whether the OID for this variable completely matches the OID part of the specified SnmpVarBind object. |
boolean |
isUnspecifiedValue()
Checks whether the value associated with this SnmpVarBind is unspecified. |
boolean |
isValidValue()
Checks whether the object contains a valid accessible value. |
SnmpOidRecord |
resolveVarName(String name)
Consults the MIB table storage to resolve the name to its OID type structure. |
void |
setEndOfMibView()
Set the value to endOfMibView . |
void |
setNoSuchInstance()
Set the value to noSuchInstance . |
void |
setNoSuchObject()
Set the value to noSuchObject . |
void |
setOid(SnmpOid oid)
Sets the SnmpOid part associated with this SnmpVarBind with the specified OID. |
void |
setOid(SnmpOid oid,
boolean clearValue)
Sets the SnmpOid part associated with this SnmpVarBind with the specified OID. |
void |
setSnmpCounter64Value(long val)
Sets the SnmpCounter64 value part associated with this SnmpVarBind
with the specified counter 64 value. |
void |
setSnmpCounter64Value(UnsignedLong val)
Sets the SnmpCounter64 value part associated with this SnmpVarBind
with the specified counter 64 value. |
void |
setSnmpCounterValue(long val)
Sets the SnmpCounter value part associated with this SnmpVarBind
with the specified counter value. |
void |
setSnmpGaugeValue(long val)
Sets the SnmpGauge value part associated with this SnmpVarBind
with the specified gauge value. |
void |
setSnmpIntValue(long val)
Sets the SnmpInt value part associated with this SnmpVarBind
with the specified integer value. |
void |
setSnmpIpAddressValue(String val)
Sets the SnmpIpAddress value part associated with this SnmpVarBind
with the specified ipAddress value. |
void |
setSnmpOidValue(String val)
Sets the SnmpOid value part associated with this SnmpVarBind
with the specified OID value. |
void |
setSnmpOpaqueValue(byte[] val)
Sets the SnmpOpaque value part associated with this SnmpVarBind
with the specified bytes array values. |
void |
setSnmpStringFixedValue(String val)
Sets the SnmpStringFixed value part associated with this SnmpVarBind
with the specified string value. |
void |
setSnmpStringValue(String val)
Sets the SnmpString value part associated with this SnmpVarBind
with the specified string value. |
void |
setSnmpTimeticksValue(long val)
Sets the SnmpTimeticks value part associated with this SnmpVarBind
with the specified timeticks value. |
void |
setSnmpValue(SnmpValue val)
Sets the SnmpValue part associated with this SnmpVarBind with the specified value. |
String |
toString()
Returns the printable ASCII representation of this SnmpVarBind . |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String[] statusLegend
SnmpVarBind
.
public static final int stValueUnspecified
SnmpVarBind
object is not initialized.
public static final int stValueOk
SnmpVarBind
object is valid.
public static final int stValueNoSuchObject
SnmpVarBind
object is noSuchObject
.
Status of SnmpVarBind
as returned by the SNMPv2 agent.
public static final int stValueNoSuchInstance
SnmpVarBind
object is
noSuchInstance
.
Status of SnmpVarBind
as returned by the SNMPv2 agent.
In the SNMPv1 context, this is appropriate when noSuchName
is returned in response to the
SnmpGet
request.
public static final int stValueEndOfMibView
SnmpVarBind
object is endOfMibView
.
Status of SnmpVarBind
as returned by the SNMPv2 agent.
In the SNMPv1 context, this is appropriate when noSuchName
is returned in response to the
SnmpGetNext
request.
public static final SnmpNull noSuchObject
noSuchObject
.
public static final SnmpNull noSuchInstance
noSuchInstance
.
public static final SnmpNull endOfMibView
endOfMibView
.
public int status
SnmpVarBind
.
The default value is stValueUnspecified
.
This attribute is updated internally and should not be changed otherwise.
Constructor Detail |
---|
public SnmpVarBind()
public SnmpVarBind(SnmpOid oid)
SnmpVarBind
object from the specified SnmpOid
value.
oid
- The OID part of the SnmpVarBind
.public SnmpVarBind(SnmpOid oid, SnmpValue val)
SnmpVarBind
object from the specified SnmpOid
and
SnmpValue
.
oid
- The OID part of the SnmpVarBind
.val
- The value part of the SnmpVarBind
.public SnmpVarBind(String name) throws SnmpStatusException
SnmpVarBind
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
.
SnmpStatusException
- An error occurred while resolving the MIB variable name.Method Detail |
---|
public final SnmpOid getOid()
SnmpVarBind
.
SnmpOid
for this variable.public final void setOid(SnmpOid oid)
SnmpOid
part associated with this SnmpVarBind
with the specified OID.
The value part of this SnmpVarBind
will automatically be nulled.
oid
- The new OID.public final void setOid(SnmpOid oid, boolean clearValue)
SnmpOid
part associated with this SnmpVarBind
with the specified OID.
oid
- The new OID.clearValue
- If true the value part of this
SnmpVarBind
will be nulled.public final SnmpValue getSnmpValue()
SnmpVarBind
.
SnmpValue
for this variable.public final void setSnmpValue(SnmpValue val)
SnmpValue
part associated with this SnmpVarBind
with the specified value.
The status is updated to indicate that the value is valid.
val
- The new value.public final SnmpCounter64 getSnmpCounter64Value() throws ClassCastException
SnmpVarBind
.
SnmpCounter64
value for this variable.
ClassCastException
- An attempt has been made to cast an object to a subclass of which
it is not an instance.public final void setSnmpCounter64Value(long val) throws IllegalArgumentException
SnmpCounter64
value part associated with this SnmpVarBind
with the specified counter 64 value.
The status is updated to indicate that the value is valid.
val
- The new counter 64 value.
IllegalArgumentException
- The specified value is negative or larger than Long.MAX_VALUE
.SnmpCounter64
public final void setSnmpCounter64Value(UnsignedLong val) throws IllegalArgumentException
SnmpCounter64
value part associated with this SnmpVarBind
with the specified counter 64 value.
The status is updated to indicate that the value is valid.
val
- The new counter 64 value.
IllegalArgumentException
- The specified value is larger than Long.MAX_VALUE
.SnmpCounter64
public final SnmpInt getSnmpIntValue() throws ClassCastException
SnmpVarBind
.
SnmpInt
value for this variable.
ClassCastException
- An attempt has been made to cast an object to a subclass of which
it is not an instance.public final void setSnmpIntValue(long val) throws IllegalArgumentException
SnmpInt
value part associated with this SnmpVarBind
with the specified integer value.
The status is updated to indicate that the value is valid.
val
- The new integer value.
IllegalArgumentException
- The specified value is smaller than Integer.MIN_VALUE
or larger than Integer.MAX_VALUE
.SnmpInt
public final SnmpCounter getSnmpCounterValue() throws ClassCastException
SnmpVarBind
.
SnmpCounter
value for this variable.
ClassCastException
- An attempt has been made to cast an object to a subclass of which
it is not an instance.public final void setSnmpCounterValue(long val) throws IllegalArgumentException
SnmpCounter
value part associated with this SnmpVarBind
with the specified counter value.
The status is updated to indicate that the value is valid.
val
- The new counter value.
IllegalArgumentException
- The specified value is negative or larger than
SnmpUnsignedInt.MAX_VALUE
.SnmpCounter
public final SnmpGauge getSnmpGaugeValue() throws ClassCastException
SnmpVarBind
.
SnmpGauge
value for this variable.
ClassCastException
- An attempt has been made to cast an object to a subclass of which
it is not an instance.public final void setSnmpGaugeValue(long val) throws IllegalArgumentException
SnmpGauge
value part associated with this SnmpVarBind
with the specified gauge value.
The status is updated to indicate that the value is valid.
val
- The new gauge value.
IllegalArgumentException
- The specified value is negative or larger than
SnmpUnsignedInt.MAX_VALUE
.SnmpGauge
public final SnmpTimeticks getSnmpTimeticksValue() throws ClassCastException
SnmpVarBind
.
SnmpTimeticks
value for this variable.
ClassCastException
- An attempt has been made to cast an object to a subclass of which
it is not an instance.public final void setSnmpTimeticksValue(long val) throws IllegalArgumentException
SnmpTimeticks
value part associated with this SnmpVarBind
with the specified timeticks value.
The status is updated to indicate that the value is valid.
val
- The new timeticks value.
IllegalArgumentException
- The specified value is negative or larger than
SnmpUnsignedInt.MAX_VALUE
.SnmpTimeticks
public final SnmpOid getSnmpOidValue() throws ClassCastException
SnmpVarBind
.
SnmpOid
value for this variable.
ClassCastException
- An attempt has been made to cast an object to a subclass of which
it is not an instance.public final void setSnmpOidValue(String val) throws IllegalArgumentException
SnmpOid
value part associated with this SnmpVarBind
with the specified OID value.
The status is updated to indicate that the value is valid.
val
- The new OID value.
IllegalArgumentException
- The specified value is neither a numeric String
nor a String
of the MIB database.SnmpOid
public final SnmpIpAddress getSnmpIpAddressValue() throws ClassCastException
SnmpVarBind
.
SnmpIpAddress
value for this variable.
ClassCastException
- An attempt has been made to cast an object to a subclass of which
it is not an instance.public final void setSnmpIpAddressValue(String val) throws IllegalArgumentException
SnmpIpAddress
value part associated with this SnmpVarBind
with the specified ipAddress value.
The status is updated to indicate that the value is valid.
val
- The new IP address value.
IllegalArgumentException
- The specified value does not correspond to an IP address.SnmpIpAddress
public final SnmpString getSnmpStringValue() throws ClassCastException
SnmpVarBind
.
SnmpString
value for this variable.
ClassCastException
- An attempt has been made to cast an object to a subclass of which
it is not an instance.public final void setSnmpStringValue(String val)
SnmpString
value part associated with this SnmpVarBind
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 ClassCastException
SnmpVarBind
.
SnmpOpaque
value for this variable.
ClassCastException
- An attempt has been made to cast an object to a subclass of which
it is not an instance.public final void setSnmpOpaqueValue(byte[] val)
SnmpOpaque
value part associated with this SnmpVarBind
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 ClassCastException
SnmpVarBind
.
SnmpStringFixed
value for this variable.
ClassCastException
- An attempt has been made to cast an object to a subclass of which
it is not an instance.public final void setSnmpStringFixedValue(String val)
SnmpStringFixed
value part associated with this SnmpVarBind
with the specified string value.
The status is updated to indicate that the value is valid.
val
- The new string value.SnmpStringFixed
public SnmpOidRecord resolveVarName(String name) throws SnmpStatusException
name
- The MIB variable name or a dot-formatted OID String
.
SnmpOidRecord
object containing information on the MIB variable.
SnmpStatusException
- An error occurred while resolving the MIB variable name.public final int getValueStatus()
SnmpVarBind
as an integer.
This value is one of stValueUnspecified
, stValueOk
, stValueNoSuchObject
,
stValueNoSuchInstance
, stValueEndOfMibView
.
public final String getValueStatusLegend()
SnmpVarBind
as a String
.
This value is a displayable representation of the status integer value.
It is one of Value not initialized
, Valid Value
, No such object
,
No such Instance
, End of Mib View
.
public final boolean isValidValue()
true
if the associated value is valid, false
otherwise.public final boolean isUnspecifiedValue()
SnmpVarBind
is unspecified.
true
if the status is unspecified, false
otherwise.public final void clearValue()
SnmpVarBind
and sets the status to
stValueUnspecified
.
public final boolean isOidEqual(SnmpVarBind var)
SnmpVarBind
object.
var
- The object whose OID part is to be matched.
true
if the OID part matches exactly, false
otherwise.public final void addInstance(long inst)
SnmpOid
object.
Note that there is no getInstance
method.
This method will directly add the instance to the SnmpOid
object.
inst
- The sub-identifier to be appended to the OID.public final void addInstance(long[] inst) throws SnmpStatusException
SnmpOid
object.
Note that there is no getInstance
method.
This method will directly add the instance to the SnmpOid
object.
inst
- The sub-identifier array to be appended to the OID.
SnmpStatusException
- An error occurred while accessing a MIB node.public final void addInstance(String inst) throws SnmpStatusException
SnmpOid
object.
Note that there is no getInstance
method.
This method will directly add the instance to the SnmpOid
object.
inst
- Dot-formatted sub-identifier String
to be appended to the OID.
SnmpStatusException
- An error occurred while accessing a MIB node.public void insertInOid(int oid)
SnmpVarBind
.
oid
- The sub-id to insert.public void appendInOid(SnmpOid oid)
SnmpOid
to the end of the OID of this SnmpVarBind
.
oid
- The OID to append.public final boolean hasVarBindException()
SnmpVarBind
has an SNMP exception
(generated by agent in response to a request).
true
if the SnmpVarBind
has an SNMP response exception,
false
otherwise.public void copyValueAndOid(SnmpVarBind var)
SnmpVarBind
object.
var
- The SnmpVarBind
clone.public void copyValue(SnmpVarBind var)
SnmpVarBind
object.
var
- The SnmpVarBind
clone.public Object cloneWithoutValue()
public Object clone()
clone
in class Object
public final String getStringValue()
public final void setNoSuchObject()
noSuchObject
. This is equivalent to
setSnmpValue(SnmpVarBind.noSuchObject)
.
public final void setNoSuchInstance()
noSuchInstance
. This is equivalent to
setSnmpValue(SnmpVarBind.noSuchInstance)
.
public final void setEndOfMibView()
endOfMibView
. This is equivalent to
setSnmpValue(SnmpVarBind.endOfMibView)
.
public final String toString()
SnmpVarBind
.
toString
in class Object
|
Open Source build 02 opendmk-1.0-b02 2007.10.01_19:17:46_MEST |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |