Class SnmpScalarImplRO<T>

java.lang.Object
org.snmp4j.model.snmp.proxy.impl.SnmpProxyObjectImpl
org.snmp4j.model.snmp.proxy.impl.SnmpScalarImplRO<T>
Type Parameters:
T - specifies the model value type of the scalar proxy.
All Implemented Interfaces:
SnmpProxyObject, SnmpScalarRO<T>
Direct Known Subclasses:
SnmpScalarImpl

public class SnmpScalarImplRO<T> extends SnmpProxyObjectImpl implements SnmpScalarRO<T>
The SnmpScalarImpl class implements a SNMP scalar proxy with read-only access.
Author:
Frank Fock
  • Constructor Details

    • SnmpScalarImplRO

      public SnmpScalarImplRO(org.snmp4j.smi.OID oid, org.snmp4j.smi.OctetString context, T value, Class<T> valueClass, int snmpSyntax)
      Creates a SnmpProxyObject for a scalar SNMP OBJECT-TYPE.
      Parameters:
      oid - the OID of the scalar instance value (thus including the .0 suffix).
      context - the SNMP context associated with this proxy object.
      value - the mode value of the scalar.
      valueClass - the model value class.
      snmpSyntax - the SNMP syntax (BER syntax code) of the OBJECT-TYPE's base syntax.
  • Method Details

    • reload

      public TaskId reload(SnmpService snmpService, org.snmp4j.Target target, VariableBindingMapper variableBindingMapper, SnmpProxyReloadListener reloadListener)
      Description copied from interface: SnmpProxyObject
      Reload the model content of the proxy object from the target SNMP entity asynchronously in the background.
      Specified by:
      reload in interface SnmpProxyObject
      Parameters:
      snmpService - the SNMP service to use.
      target - the SNMP target (i.e., address, timeouts, etc.) to use.
      variableBindingMapper - the variable binding mapper that maps the retrieved SNMP values to model values (based on SNMP types or specific OID based mappings).
      reloadListener - a callback listener that is informed about the reloading status.
      Returns:
      the task ID for the background task.
    • waitForTask

      public boolean waitForTask(TaskId taskId, long timeout)
      Description copied from interface: SnmpProxyObject
      Wait until the specified background task terminates.
      Specified by:
      waitForTask in interface SnmpProxyObject
      Parameters:
      taskId - the task ID of the task to wait for.
      timeout - the maximum time to wait in millis.
      Returns:
      true if the task has terminated, false otherwise.
    • getName

      public String getName()
      Specified by:
      getName in interface SnmpScalarRO<T>
    • getValue

      public T getValue()
      Specified by:
      getValue in interface SnmpScalarRO<T>
    • setValue

      public void setValue(T value)
      Sets the model value of this scalar proxy without changing the SNMP value of the target SNMP entity.
      Specified by:
      setValue in interface SnmpScalarRO<T>
      Parameters:
      value - the new model value.
    • getValueClass

      public Class<T> getValueClass()
      Specified by:
      getValueClass in interface SnmpScalarRO<T>
    • getSnmpSyntax

      public int getSnmpSyntax()
      Specified by:
      getSnmpSyntax in interface SnmpScalarRO<T>
    • toString

      public String toString()
      Overrides:
      toString in class SnmpProxyObjectImpl