Fields Summary |
---|
public static final String[] | statusLegendKeeps the legend for the value part of the SnmpVarBind . |
public static final int | stValueUnspecifiedUseful constant indicating that the status of the SnmpVarBind object is not initialized. |
public static final int | stValueOkUseful constant indicating that the status of the SnmpVarBind object is valid. |
public static final int | stValueNoSuchObjectUseful constant indicating that the status of the SnmpVarBind object is noSuchObject .
Status of SnmpVarBind as returned by the SNMPv2 agent. |
public static final int | stValueNoSuchInstanceUseful constant indicating that the status of the 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 | stValueEndOfMibViewUseful constant indicating that the status of the 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 | noSuchObjectError code value as defined in RFC 1448 for: noSuchObject . |
public static final SnmpNull | noSuchInstanceError code value as defined in RFC 1448 for: noSuchInstance . |
public static final SnmpNull | endOfMibViewError code value as defined in RFC 1448 for: endOfMibView . |
public SnmpOid | oidThe OID of the SnmpVarBind .
The default value is null.
Reserved for internal use:
As of Java Dynamic Management Kit 5.0, use instead getOid and setOid |
public SnmpValue | valueThe value of the SnmpVarBind .
The default value is null.
Reserved for internal use:
As of Java Dynamic Management Kit 5.0, use instead getSnmpValue and setSnmpValue |
public int | statusIndicates the status of the value in this SnmpVarBind .
The default value is stValueUnspecified .
This attribute is updated internally and should not be changed otherwise. |
Methods Summary |
---|
public final void | addInstance(long inst)Adds an instance part to the OID in the SnmpOid object.
Note that there is no getInstance method.
This method will directly add the instance to the SnmpOid object.
oid.append(inst) ;
return ;
|
public final void | addInstance(long[] inst)Adds an instance part to the OID in the SnmpOid object.
Note that there is no getInstance method.
This method will directly add the instance to the SnmpOid object.
oid.addToOid(inst) ;
return ;
|
public final void | addInstance(java.lang.String inst)Adds an instance part to the OID in the SnmpOid object.
Note that there is no getInstance method.
This method will directly add the instance to the SnmpOid object.
if (inst != null) {
oid.addToOid(inst) ;
}
return ;
|
public void | appendInOid(SnmpOid oid)Appends the specified SnmpOid to the end of the OID of this SnmpVarBind .
this.oid.append(oid) ;
|
public final void | clearValue()Clears the value associated with this SnmpVarBind and sets the status to
stValueUnspecified .
this.value = null ;
status = stValueUnspecified ;
|
public java.lang.Object | clone()Clones the SNMP variable (including value).
// SnmpVarBind v = null ;
// try {
// v = (SnmpVarBind) super.clone() ;
// v.copyValueAndOid(this) ;
// } catch (CloneNotSupportedException e) {
// throw new InternalError() ;
// }
// return v ;
SnmpVarBind v = new SnmpVarBind() ;
v.copyValueAndOid(this) ;
return v ;
|
public java.lang.Object | cloneWithoutValue()Clones the SNMP variable. It does not clone the value portion.
SnmpOid noid = (SnmpOid)this.oid.clone() ;
return new SnmpVarBind(noid) ;
|
public void | copyValue(com.sun.jmx.snmp.SnmpVarBind var)Clones and copies only the value part from another SnmpVarBind object.
if (var.isValidValue()) {
this.value = var.getSnmpValue().duplicate() ;
setValueValid() ;
} else {
status = var.getValueStatus() ;
if (status == stValueEndOfMibView) value=endOfMibView;
else if (status == stValueNoSuchObject) value=noSuchObject;
else if (status == stValueNoSuchInstance) value=noSuchInstance;
}
|
public void | copyValueAndOid(com.sun.jmx.snmp.SnmpVarBind var)Clones and copies the OID and value part from another SnmpVarBind object.
setOid((SnmpOid) (var.oid.clone())) ;
copyValue(var) ;
|
public final SnmpOid | getOid()Returns the complete OID part associated with this SnmpVarBind .
return this.oid ;
|
public final SnmpCounter64 | getSnmpCounter64Value()Returns the value part associated with this SnmpVarBind .
return (SnmpCounter64)this.value ;
|
public final SnmpCounter | getSnmpCounterValue()Returns the value part associated with this SnmpVarBind .
return (SnmpCounter)this.value ;
|
public final SnmpGauge | getSnmpGaugeValue()Returns the value part associated with this SnmpVarBind .
return (SnmpGauge)this.value ;
|
public final SnmpInt | getSnmpIntValue()Returns the value part associated with this SnmpVarBind .
return (SnmpInt)this.value ;
|
public final SnmpIpAddress | getSnmpIpAddressValue()Returns the value part associated with this SnmpVarBind .
return (SnmpIpAddress)this.value ;
|
public final SnmpOid | getSnmpOidValue()Returns the value part associated with this SnmpVarBind .
return (SnmpOid)this.value ;
|
public final SnmpOpaque | getSnmpOpaqueValue()Returns the value part associated with this SnmpVarBind .
return (SnmpOpaque)this.value ;
|
public final SnmpStringFixed | getSnmpStringFixedValue()Returns the value part associated with this SnmpVarBind .
return (SnmpStringFixed)this.value ;
|
public final SnmpString | getSnmpStringValue()Returns the value part associated with this SnmpVarBind .
return (SnmpString)this.value ;
|
public final SnmpTimeticks | getSnmpTimeticksValue()Returns the value part associated with this SnmpVarBind .
return (SnmpTimeticks)this.value ;
|
public final synchronized SnmpValue | getSnmpValue()Returns the value part associated with this SnmpVarBind .
return this.value ;
|
public final java.lang.String | getStringValue()Returns the printable ASCII representation for the corresponding variable value.
return this.value.toString() ;
|
public final int | getValueStatus()Returns the status of the value associated with this SnmpVarBind as an integer.
This value is one of {@link #stValueUnspecified}, {@link #stValueOk}, {@link #stValueNoSuchObject},
{@link #stValueNoSuchInstance}, {@link #stValueEndOfMibView}.
return status ;
|
public final java.lang.String | getValueStatusLegend()Returns the status of the value associated with this 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 .
return statusLegend[status] ;
|
private void | handleLong(java.lang.String oid, int index)
String str;
if (index >0) {
str= oid.substring(0, index);
} else {
str= oid ;
}
// just parse the element.
//
Long.parseLong(str);
|
public final synchronized boolean | hasVarBindException()Determines whether the SnmpVarBind has an SNMP exception
(generated by agent in response to a request).
switch (status) {
case stValueUnspecified :
case stValueNoSuchObject :
case stValueNoSuchInstance :
case stValueEndOfMibView :
return true ;
}
return false ;
|
public void | insertInOid(int oid)Inserts a sub-id at the beginning of the OID of this SnmpVarBind .
this.oid.insert(oid) ;
|
public final boolean | isOidEqual(com.sun.jmx.snmp.SnmpVarBind var)Checks whether the OID for this variable completely matches the OID part of the specified
SnmpVarBind object.
return this.oid.equals(var.oid) ;
|
public final boolean | isUnspecifiedValue()Checks whether the value associated with this SnmpVarBind is unspecified.
return (status == stValueUnspecified) ;
|
public final boolean | isValidValue()Checks whether the object contains a valid accessible value.
return (status == stValueOk) ;
|
public SnmpOidRecord | resolveVarName(java.lang.String name)Consults the MIB table storage to resolve the name to its OID type structure.
SnmpOidTable mibTable = oid.getSnmpOidTable();
if (mibTable == null)
throw new SnmpStatusException(SnmpStatusException.noSuchName);
int index = name.indexOf('.");
if (index < 0) {
return mibTable.resolveVarName(name);
} else {
return mibTable.resolveVarOid(name);
}
|
public final void | setEndOfMibView()Set the value to {@link #endOfMibView}. This is equivalent to
setSnmpValue(SnmpVarBind.endOfMibView) .
value=endOfMibView;
status=stValueEndOfMibView;
|
public final void | setNoSuchInstance()Set the value to {@link #noSuchInstance}. This is equivalent to
setSnmpValue(SnmpVarBind.noSuchInstance) .
value=noSuchInstance;
status=stValueNoSuchInstance;
|
public final void | setNoSuchObject()Set the value to {@link #noSuchObject}. This is equivalent to
setSnmpValue(SnmpVarBind.noSuchObject) .
value=noSuchObject;
status=stValueNoSuchObject;
|
public final void | setOid(SnmpOid oid)Sets the SnmpOid part associated with this SnmpVarBind with the specified OID.
The value part of this SnmpVarBind will automatically be nulled.
this.oid = oid ;
clearValue() ;
|
public final void | setSnmpCounter64Value(long val)Sets the SnmpCounter64 value part associated with this SnmpVarBind
with the specified counter 64 value.
The status is updated to indicate that the value is valid.
clearValue() ;
this.value = new SnmpCounter64(val) ;
setValueValid() ;
|
public final void | setSnmpCounterValue(long val)Sets the SnmpCounter value part associated with this SnmpVarBind
with the specified counter value.
The status is updated to indicate that the value is valid.
clearValue() ;
this.value = new SnmpCounter(val) ;
setValueValid() ;
|
public final void | setSnmpGaugeValue(long val)Sets the SnmpGauge value part associated with this SnmpVarBind
with the specified gauge value.
The status is updated to indicate that the value is valid.
clearValue() ;
this.value = new SnmpGauge(val) ;
setValueValid() ;
|
public final void | setSnmpIntValue(long val)Sets the SnmpInt value part associated with this SnmpVarBind
with the specified integer value.
The status is updated to indicate that the value is valid.
clearValue() ;
this.value = new SnmpInt(val) ;
setValueValid() ;
|
public final void | setSnmpIpAddressValue(java.lang.String val)Sets the SnmpIpAddress value part associated with this SnmpVarBind
with the specified ipAddress value.
The status is updated to indicate that the value is valid.
clearValue() ;
this.value = new SnmpIpAddress(val) ;
setValueValid() ;
|
public final void | setSnmpOidValue(java.lang.String val)Sets the SnmpOid value part associated with this SnmpVarBind
with the specified OID value.
The status is updated to indicate that the value is valid.
clearValue() ;
this.value = new SnmpOid(val) ;
setValueValid() ;
|
public final void | setSnmpOpaqueValue(byte[] val)Sets the SnmpOpaque value part associated with this SnmpVarBind
with the specified bytes array values.
The status is updated to indicate that the value is valid.
clearValue() ;
this.value = new SnmpOpaque(val) ;
setValueValid() ;
|
public final void | setSnmpStringFixedValue(java.lang.String val)Sets the SnmpStringFixed value part associated with this SnmpVarBind
with the specified string value.
The status is updated to indicate that the value is valid.
clearValue() ;
this.value = new SnmpStringFixed(val) ;
setValueValid() ;
|
public final void | setSnmpStringValue(java.lang.String val)Sets the SnmpString value part associated with this SnmpVarBind
with the specified string value.
The status is updated to indicate that the value is valid.
clearValue() ;
this.value = new SnmpString(val) ;
setValueValid() ;
|
public final void | setSnmpTimeticksValue(long val)Sets the SnmpTimeticks value part associated with this SnmpVarBind
with the specified timeticks value.
The status is updated to indicate that the value is valid.
clearValue() ;
this.value = new SnmpTimeticks(val) ;
setValueValid() ;
|
public final void | setSnmpValue(SnmpValue val)Sets the SnmpValue part associated with this SnmpVarBind with the specified value.
The status is updated to indicate that the value is valid.
this.value= val ;
setValueValid();
|
private void | setValueValid()Sets the status to indicate that the value for this SnmpVarBind is valid.
if (value == endOfMibView) status=stValueEndOfMibView;
else if (value == noSuchObject) status=stValueNoSuchObject;
else if (value == noSuchInstance) status=stValueNoSuchInstance;
else status = stValueOk ;
|
public final java.lang.String | toString()Returns the printable ASCII representation of this SnmpVarBind .
StringBuffer s = new StringBuffer(400) ;
s.append("Object ID : " + this.oid.toString()) ;
if (isValidValue()) {
s.append(" (Syntax : " + this.value.getTypeName() + ")\n") ;
s.append("Value : " + this.value.toString()) ;
} else {
s.append("\n" + "Value Exception : " + getValueStatusLegend()) ;
}
return s.toString() ;
|