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.


Variable Index

 o meta
Reference to a mib store service.
 o statusLegend
Keeps the legend for the value part of the SnmpVar.
 o stValueEndOfMibView
Status of SnmpVar as returned by SNMPv2 agent.
 o stValueNoSuchInstance
Status of SnmpVar as returned by SNMPv2 agent.
 o stValueNoSuchObject
Status of SnmpVar as returned by SNMPv2 agent.
 o stValueOk
Indicates that a valid value exists for this SnmpVar.
 o stValueUnspecified
Enumeration values which indicate the status of the value part of the SnmpVar object is not initialized.

Constructor Index

 o SnmpVar(SnmpOid)
Constructor to create SnmpVar object.
 o SnmpVar(String)
Creates a SnmpVar object.

Method Index

 o addInstance(long)
Adds an instance part to the OID in SnmpOid object.
 o addInstance(long[])
Adds an instance part to the OID in SnmpOid object.
 o addInstance(String)
Adds an instance part to the OID in SnmpOid object.
 o clearValue()
Sets the status to indicate there is no such object for this SnmpVar.
 o clone()
This clones the SNMP variable.
 o cloneWithoutValue()
Clones the SNMP variable.
 o copyValue(SnmpVar)
Clones and copies only the value part from another object.
 o copyValueAndOid(SnmpVar)
Clones and copies the OID and value part from another object.
 o getCounter32()
 o getGauge()
 o getInteger32()
 o getIpAddress()
 o getOid()
Returns the SnmpOid associated with this variable.
 o getSnmpOid()
 o getSnmpValue()
 o getStringValue()
Gets the printable ASCII representation for the corresponding variable value.
 o getTimeTicks()
 o getValueStatus()
Returns the status of the value associated with this SnmpVar.
 o getValueStatusLegend()
Returns the status of the value associated with this SnmpVar.
 o hasVbException()
Convenience method which can be used to determine if the SnmpVar has an SNMP exceptions (generated by agent in response to a request).
 o isOidEqual(SnmpVar)
Checks whether the OID for this variable completely matches the OID part of the specified SnmpVar object.
 o resolveVarName(String)
This method consults the MIB storage to resolve the name to its OID, type structure.
 o setCounter32Value(int)
 o setCounter64Value(Object)
 o setGauge32Value(int)
 o setIntegerValue(int)
These are methods which are used to set the value part of variable.
 o setIpAddressValue(long)
 o setOpaqueValue(Object)
 o setSnmpValue(SnmpValue)
 o setTimeticksValue(int)
 o setValueEndOfMibView()
Sets the status to indicate there is no such object while doing SnmpGetNext for this SnmpVar.
 o setValueNoSuchInstance()
Sets the SnmpVar status to indicate there is no such instance.
 o setValueNoSuchObject()
Sets the status to indicate there is no such object for this SnmpVar.
 o toString()
Returns a string representation of the object.
 o unspecifiedValue()
Convenience function to check if a value is unspecified.
 o validValue()
Used to check if the object contains a valid accessible value.

Variables

 o statusLegend
 public static final String statusLegend[]
Keeps the legend for the value part of the SnmpVar.

 o stValueUnspecified
 public static final int stValueUnspecified
Enumeration values which indicate the status of the value part of the SnmpVar object is not initialized.

 o stValueOk
 public static final int stValueOk
Indicates that a valid value exists for this SnmpVar.

 o stValueNoSuchObject
 public static final int stValueNoSuchObject
Status of SnmpVar as returned by SNMPv2 agent.

 o 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.

 o 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.

 o 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.

Constructors

 o SnmpVar
 public SnmpVar(SnmpOid oid)
Constructor to create SnmpVar object.

Parameters:
oid - The OID part of the SnmpVar.
 o 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.

Methods

 o getOid
 public final SnmpOid getOid()
Returns the SnmpOid associated with this variable.

Returns:
SnmpOid complete OID for this variable.
See Also:
SnmpOid
 o 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.
 o getValueStatus
 public final int getValueStatus()
Returns the status of the value associated with this SnmpVar.

Returns:
status of associated value.
 o getValueStatusLegend
 public final String getValueStatusLegend()
Returns the status of the value associated with this SnmpVar.

Returns:
status of associated value.
 o 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.
 o clearValue
 public final void clearValue()
Sets the status to indicate there is no such object for this SnmpVar.

 o 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.
 o unspecifiedValue
 public final synchronized boolean unspecifiedValue()
Convenience function to check if a value is unspecified.

Returns:
true if status is unspecified.
 o setValueNoSuchObject
 public final void setValueNoSuchObject()
Sets the status to indicate there is no such object for this SnmpVar.

 o setValueEndOfMibView
 public final void setValueEndOfMibView()
Sets the status to indicate there is no such object while doing SnmpGetNext for this SnmpVar.

 o setValueNoSuchInstance
 public final void setValueNoSuchInstance()
Sets the SnmpVar status to indicate there is no such instance.

 o copyValueAndOid
 public void copyValueAndOid(SnmpVar srcVar)
Clones and copies the OID and value part from another object.

 o copyValue
 public void copyValue(SnmpVar srcVar)
Clones and copies only the value part from another object.

 o 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.
 o 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.
 o clone
 public final Object clone()
This clones the SNMP variable. It clones everything including value.

Overrides:
clone in class Object
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o setCounter32Value
 public final void setCounter32Value(int val)
 o 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.
 o setGauge32Value
 public final void setGauge32Value(int val)
 o 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.
 o setTimeticksValue
 public final void setTimeticksValue(int val)
 o 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.
 o setOpaqueValue
 public final void setOpaqueValue(Object val) throws SnmpStatusException
Throws: SnmpStatusException
An error occurred while accessing a MIB node.
 o setCounter64Value
 public final void setCounter64Value(Object val) throws SnmpStatusException
Throws: SnmpStatusException
An error occurred while accessing a MIB node.
 o setIpAddressValue
 public final void setIpAddressValue(long val)
 o 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.
 o 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.
 o getSnmpValue
 public final synchronized SnmpValue getSnmpValue()
 o setSnmpValue
 public final void setSnmpValue(SnmpValue val)
 o 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.
 o 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