All Packages Class Hierarchy This Package Previous Next Index
Class com.sun.jaw.snmp.manager.SnmpVar
java.lang.Object
|
+----com.sun.jaw.snmp.common.SnmpVarBind
|
+----com.sun.jaw.snmp.manager.SnmpVar
- public class SnmpVar
- extends SnmpVarBind
- implements SnmpDataTypeEnums, Cloneable
This class holds SnmpVar information for a
MIB variable. A SnmpVar consists of two parts:
- - The corresponding OID object for the MIB variable.
- - A value associated with that OID instance.
- - The status of the
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.
-
meta
- Reference to a mib store service.
-
statusLegend
- Keeps the legend for the value part of the
SnmpVar.
-
stValueEndOfMibView
- Status of
SnmpVar as returned by SNMPv2 agent.
-
stValueNoSuchInstance
- Status of
SnmpVar as returned by SNMPv2 agent.
-
stValueNoSuchObject
- Status of
SnmpVar as returned by SNMPv2 agent.
-
stValueOk
- Indicates that a valid value exists for this
SnmpVar.
-
stValueUnspecified
- Enumeration values which indicate the status of the value part of the
SnmpVar object is not initialized.
-
SnmpVar(SnmpOid)
- Constructor to create
SnmpVar object.
-
SnmpVar(String)
- Creates a
SnmpVar object.
-
addInstance(long)
- Adds an instance part to the OID in
SnmpOid object.
-
addInstance(long[])
- Adds an instance part to the OID in
SnmpOid object.
-
addInstance(String)
- Adds an instance part to the OID in
SnmpOid object.
-
clearValue()
- Sets the status to indicate there is no such object for
this
SnmpVar.
-
clone()
- This clones the SNMP variable.
-
cloneWithoutValue()
- Clones the SNMP variable.
-
copyValue(SnmpVar)
- Clones and copies only the value part from another object.
-
copyValueAndOid(SnmpVar)
- Clones and copies the OID and value part from another object.
-
getCounter32()
-
-
getGauge()
-
-
getInteger32()
-
-
getIpAddress()
-
-
getOid()
- Returns the
SnmpOid associated with this variable.
-
getSnmpOid()
-
-
getSnmpValue()
-
-
getStringValue()
- Gets the printable ASCII representation for the corresponding
variable value.
-
getTimeTicks()
-
-
getValueStatus()
- Returns the status of the value associated with this
SnmpVar.
-
getValueStatusLegend()
- Returns the status of the value associated with this
SnmpVar.
-
hasVbException()
- Convenience method which can be used to determine if the
SnmpVar
has an SNMP exceptions (generated by agent in response to a request).
-
isOidEqual(SnmpVar)
- Checks whether the OID for this variable completely matches the
OID part of the specified
SnmpVar object.
-
resolveVarName(String)
- This method consults the MIB storage to resolve the name to
its OID, type structure.
-
setCounter32Value(int)
-
-
setCounter64Value(Object)
-
-
setGauge32Value(int)
-
-
setIntegerValue(int)
- These are methods which are used to set the value part of variable.
-
setIpAddressValue(long)
-
-
setOpaqueValue(Object)
-
-
setSnmpValue(SnmpValue)
-
-
setTimeticksValue(int)
-
-
setValueEndOfMibView()
- Sets the status to indicate there is no such object while doing
SnmpGetNext for this SnmpVar.
-
setValueNoSuchInstance()
- Sets the
SnmpVar status to indicate there is no such instance.
-
setValueNoSuchObject()
- Sets the status to indicate there is no such object for this
SnmpVar.
-
toString()
- Returns a string representation of the object.
-
unspecifiedValue()
- Convenience function to check if a value is unspecified.
-
validValue()
- Used to check if the object contains a valid accessible value.
statusLegend
public static final String statusLegend[]
- Keeps the legend for the value part of the
SnmpVar.
stValueUnspecified
public static final int stValueUnspecified
- Enumeration values which indicate the status of the value part of the
SnmpVar object is not initialized.
stValueOk
public static final int stValueOk
- Indicates that a valid value exists for this
SnmpVar.
stValueNoSuchObject
public static final int stValueNoSuchObject
- Status of
SnmpVar as returned by SNMPv2 agent.
stValueNoSuchInstance
public static final int stValueNoSuchInstance
- Status of
SnmpVar as returned by SNMPv2 agent.
In SNMPv1 context, this is appropriate when noSuchName
is returned in the response to SnmpGetRequest.
stValueEndOfMibView
public static final int stValueEndOfMibView
- Status of
SnmpVar as returned by SNMPv2 agent.
In SNMPv1 context, this is appropriate when noSuchName
is returned in the response to SnmpGetNext request.
meta
public static MibStoreIfSrv meta
- Reference to a mib store service. If no mib store service is available,
the class will not be able to resolved named contained in Object identifier.
SnmpVar
public SnmpVar(SnmpOid oid)
- Constructor to create
SnmpVar object.
- Parameters:
- oid - The OID part of the
SnmpVar.
SnmpVar
public SnmpVar(String name) throws SnmpStatusException
- Creates a
SnmpVar object. If the name is a MIB
variable, it resolves the name with the MIB database.
- Parameters:
- name - The MIB variable name or a dot-formatted OID string.
- Throws: SnmpStatusException
- An error occurred while accessing a MIB node.
getOid
public final SnmpOid getOid()
- Returns the
SnmpOid associated with this variable.
- Returns:
- SnmpOid complete OID for this variable.
- See Also:
- SnmpOid
resolveVarName
public String[] resolveVarName(String name) throws SnmpStatusException
- This method consults the MIB storage to resolve the name to
its OID, type structure.
- Throws: SnmpStatusException
- An error occurred while accessing a MIB node.
getValueStatus
public final int getValueStatus()
- Returns the status of the value associated with this
SnmpVar.
- Returns:
- status of associated value.
getValueStatusLegend
public final String getValueStatusLegend()
- Returns the status of the value associated with this
SnmpVar.
- Returns:
- status of associated value.
validValue
public final boolean validValue()
- Used to check if the object contains a valid accessible value.
- Returns:
- true if there is a legal valid associated value.
clearValue
public final void clearValue()
- Sets the status to indicate there is no such object for
this
SnmpVar.
hasVbException
public final synchronized boolean hasVbException()
- Convenience method which can be used to determine if the
SnmpVar
has an SNMP exceptions (generated by agent in response to a request).
- Returns:
- true if the
SnmpVar has an SNMP response exception.
unspecifiedValue
public final synchronized boolean unspecifiedValue()
- Convenience function to check if a value is unspecified.
- Returns:
- true if status is unspecified.
setValueNoSuchObject
public final void setValueNoSuchObject()
- Sets the status to indicate there is no such object for this
SnmpVar.
setValueEndOfMibView
public final void setValueEndOfMibView()
- Sets the status to indicate there is no such object while doing
SnmpGetNext for this SnmpVar.
setValueNoSuchInstance
public final void setValueNoSuchInstance()
- Sets the
SnmpVar status to indicate there is no such instance.
copyValueAndOid
public void copyValueAndOid(SnmpVar srcVar)
- Clones and copies the OID and value part from another object.
copyValue
public void copyValue(SnmpVar srcVar)
- Clones and copies only the value part from another object.
isOidEqual
public final boolean isOidEqual(SnmpVar avar)
- Checks whether the OID for this variable completely matches the
OID part of the specified
SnmpVar object.
- Parameters:
- avar - Object whose OID part is to be matched.
- Returns:
- true if the OID part matches exactly.
cloneWithoutValue
public final Object cloneWithoutValue()
- Clones the SNMP variable. It does not clone the value portion.
This is recommended if you do not want to clone value portion.
- Returns:
- a new object with value part set to null.
clone
public final Object clone()
- This clones the SNMP variable. It clones everything including value.
- Overrides:
- clone in class Object
addInstance
public final void addInstance(long val)
- Adds an instance part to the OID in
SnmpOid object.
Note that there is no getInstance method. This method
will directly add the instance to SnmpOid object.
- Parameters:
- val - The sub-identifier to be appended to the OID.
addInstance
public final void addInstance(long val[]) throws SnmpStatusException
- Adds an instance part to the OID in
SnmpOid object.
Note that there is no getInstance method. This method
will directly add the instance to SnmpOid object.
- Parameters:
- val - The sub-identifier array to be appended to the OID.
- Throws: SnmpStatusException
- An error occurred while accessing a MIB node.
addInstance
public final void addInstance(String s) throws SnmpStatusException
- Adds an instance part to the OID in
SnmpOid object.
Note that there is no getInstance method. This method
will directly add the instance to SnmpOid object.
- Parameters:
- str - Dot-formatted sub-identifier string to
be appended to the OID.
- Throws: SnmpStatusException
- An error occurred while accessing a MIB node.
setIntegerValue
public final void setIntegerValue(int val)
- These are methods which are used to set the value part of variable.
The derived class would override this if appropriate.
- Parameters:
- val - The integer value.
getInteger32
public final SnmpInt getInteger32() throws ClassCastException
- Throws: ClassCastException
- An attempt has been made to cast an object to a subclass of which it is not an instance.
setCounter32Value
public final void setCounter32Value(int val)
getCounter32
public final SnmpCounter getCounter32() throws ClassCastException
- Throws: ClassCastException
- An attempt has been made to cast an object to a subclass of which it is not an instance.
setGauge32Value
public final void setGauge32Value(int val)
getGauge
public final SnmpGauge getGauge() throws ClassCastException
- Throws: ClassCastException
- An attempt has been made to cast an object to a subclass of which it is not an instance.
setTimeticksValue
public final void setTimeticksValue(int val)
getTimeTicks
public final SnmpTimeticks getTimeTicks() throws ClassCastException
- Throws: ClassCastException
- An attempt has been made to cast an object to a subclass of which it is not an instance.
setOpaqueValue
public final void setOpaqueValue(Object val) throws SnmpStatusException
- Throws: SnmpStatusException
- An error occurred while accessing a MIB node.
setCounter64Value
public final void setCounter64Value(Object val) throws SnmpStatusException
- Throws: SnmpStatusException
- An error occurred while accessing a MIB node.
setIpAddressValue
public final void setIpAddressValue(long val)
getIpAddress
public final SnmpIpAddress getIpAddress() throws ClassCastException
- Throws: ClassCastException
- An attempt has been made to cast an object to a subclass of which it is not an instance.
getSnmpOid
public final SnmpOid getSnmpOid() throws ClassCastException
- Throws: ClassCastException
- An attempt has been made to cast an object to a subclass of which it is not an instance.
getSnmpValue
public final synchronized SnmpValue getSnmpValue()
setSnmpValue
public final void setSnmpValue(SnmpValue val)
getStringValue
public final String getStringValue()
- Gets the printable ASCII representation for the corresponding
variable value. This is mandatory and will be implemented by every class
and deliver a string representation.
- Returns:
- the printable ASCII representation.
toString
public final String toString()
- Returns a string representation of the object.
- Overrides:
- toString in class SnmpVarBind
All Packages Class Hierarchy This Package Previous Next Index