org.snmp4j.agent.mo.snmp
Class DateAndTimeScalar<T extends org.snmp4j.smi.OctetString>

java.lang.Object
  extended by org.snmp4j.agent.mo.MOScalar<T>
      extended by org.snmp4j.agent.mo.snmp.DateAndTimeScalar<T>
All Implemented Interfaces:
ManagedObject, ManagedObjectValueAccess, MOScope, RegisteredManagedObject, SerializableManagedObject
Direct Known Subclasses:
Snmp4jHeartbeatMib.Snmp4jAgentHBRefTime

public class DateAndTimeScalar<T extends org.snmp4j.smi.OctetString>
extends MOScalar<T>

The DateAndTimeScalar implements the DateAndTime textual convention (TC) from the SNMPv2-TC MIB specificion for scalar objects.

DateAndTimeScalar subclasses MOScalar and can thus directly be used.

It is recommended to use this TC implementation not directly, instead use the DateAndTimeTC textual convention in conjunction with a MOFactory.

Version:
2.0.5
Author:
Frank Fock

Constructor Summary
DateAndTimeScalar(org.snmp4j.smi.OID oid, MOAccess access, T value)
           
DateAndTimeScalar(org.snmp4j.smi.OID oid, MOAccess access, T value, boolean localtime)
           
 
Method Summary
 java.util.GregorianCalendar getCalendar()
          Gets a gregorian calendar instance with the date and time of this scalar.
 T getValue()
          Returns the actual value of this scalar managed object.
 int isValueOK(SubRequest sreq)
          Checks whether the new value contained in the supplied sub-request is a valid value for this object.
 void setCalendar(java.util.GregorianCalendar calendar)
          Sets the date and time value (incl.
 
Methods inherited from class org.snmp4j.agent.mo.MOScalar
addMOChangeListener, addMOValueValidationListener, changeValue, checkRequestScope, cleanup, commit, covers, find, fireAfterMOChange, fireAfterPrepareMOChange, fireBeforeMOChange, fireBeforePrepareMOChange, fireValidate, get, getAccess, getID, getLowerBound, getOid, getScope, getSingleInstanceScope, getUpperBound, getValue, isCovered, isLowerIncluded, isOverlapping, isUpperIncluded, isVolatile, load, next, prepare, removeMOChangeListener, removeMOValueValidationListener, save, setValue, setValue, setVolatile, toString, toStringDetails, undo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DateAndTimeScalar

public DateAndTimeScalar(org.snmp4j.smi.OID oid,
                         MOAccess access,
                         T value)

DateAndTimeScalar

public DateAndTimeScalar(org.snmp4j.smi.OID oid,
                         MOAccess access,
                         T value,
                         boolean localtime)
Method Detail

isValueOK

public int isValueOK(SubRequest sreq)
Description copied from class: MOScalar
Checks whether the new value contained in the supplied sub-request is a valid value for this object. The checks are performed by firing a MOValueValidationEvent the registered listeners.

Overrides:
isValueOK in class MOScalar<T extends org.snmp4j.smi.OctetString>
Parameters:
sreq - the SubRequest with the new value.
Returns:
SnmpConstants.SNMP_ERROR_SUCCESS if the new value is OK, any other appropriate SNMPv2/v3 error status if not.

getValue

public T getValue()
Description copied from class: MOScalar
Returns the actual value of this scalar managed object. For a basic instrumentation, overwrite this method to provide always the actual value and/or to update the internal value member and then call super.MOScalar.getValue() in the derived class.

Overrides:
getValue in class MOScalar<T extends org.snmp4j.smi.OctetString>
Returns:
a non null Variable with the same syntax defined for this scalar object.

setCalendar

public void setCalendar(java.util.GregorianCalendar calendar)
Sets the date and time value (incl. time zone) from a gregorian calendar value.

Parameters:
calendar - a GregorianCalendar instance.

getCalendar

public java.util.GregorianCalendar getCalendar()
Gets a gregorian calendar instance with the date and time of this scalar.

Returns:
a GregorianCalendar instance.

Copyright 2005-2012 Frank Fock (SNMP4J.org)

Copyright © 2012 SNMP4J.org. All Rights Reserved.