Package org.snmp4j.agent.mo.snmp
Class DateAndTime<T extends org.snmp4j.smi.OctetString>
java.lang.Object
org.snmp4j.agent.mo.MOColumn<V>
org.snmp4j.agent.mo.MOMutableColumn<T>
org.snmp4j.agent.mo.snmp.DateAndTime<T>
- All Implemented Interfaces:
Comparable
The
DateAndTime implements the DateAndTime textual convention
(TC) from the SNMPv2-TC MIB specification for columnar objects.
DateAndTime subclasses MOMutableColumn and can thus
directly be used with tables. To use this TC implementation as
MOScalar create the corresponding instance using
createMOScalar(org.snmp4j.smi.OID, org.snmp4j.agent.MOAccess, org.snmp4j.smi.OctetString, boolean) or even better use the DateAndTimeTC textual
convention in conjunction with a MOFactory.- Version:
- 1.0
- Author:
- Frank Fock
-
Constructor Summary
ConstructorsConstructorDescriptionDateAndTime(int columnID, MOAccess access, org.snmp4j.smi.OctetString defaultValue) DateAndTime(int columnID, MOAccess access, org.snmp4j.smi.OctetString defaultValue, boolean mutableInService) -
Method Summary
Modifier and TypeMethodDescriptionstatic MOScalar<org.snmp4j.smi.OctetString>createMOScalar(org.snmp4j.smi.OID oid, MOAccess access, org.snmp4j.smi.OctetString value, boolean localtime) Create aMOScalarDateAndTime instance.static GregorianCalendarmakeCalendar(org.snmp4j.smi.OctetString dateAndTimeValue) Creates aGregorianCalendarfrom a properly formatted DateAndTimeOctetString.static org.snmp4j.smi.OctetStringmakeDateAndTime(GregorianCalendar dateAndTime) Creates a DateAndTimeOctetStringvalue from aGregorianCalendar.static <T extends org.snmp4j.smi.OctetString>
TmakeDateAndTime(GregorianCalendar dateAndTime, T os) Creates a DateAndTimeOctetStringvalue from aGregorianCalendar.intvalidate(org.snmp4j.smi.Variable newValue, org.snmp4j.smi.Variable oldValue) static intvalidateDateAndTime(org.snmp4j.smi.Variable dateAndTime) Tests a variable for DateAndTime conformance.Methods inherited from class org.snmp4j.agent.mo.MOMutableColumn
addMOValueValidationListener, cleanup, commit, getDefaultValue, isMandatory, isMutableInService, prepare, removeMOValueValidationListener, setDefaultValue, setMandatory, setMutableInService, toString, undo, validateSetRequestMethods inherited from class org.snmp4j.agent.mo.MOColumn
compareTo, get, getAccess, getColumnID, getRestoreValue, getStoreValue, getSyntax, getTable, getValue, isVolatile, setAccess, setColumnID, setSyntax, setTable
-
Constructor Details
-
DateAndTime
public DateAndTime(int columnID, MOAccess access, org.snmp4j.smi.OctetString defaultValue, boolean mutableInService) -
DateAndTime
-
-
Method Details
-
validateDateAndTime
public static int validateDateAndTime(org.snmp4j.smi.Variable dateAndTime) Tests a variable for DateAndTime conformance.- Parameters:
dateAndTime- a Variable.- Returns:
SnmpConstants.SNMP_ERROR_SUCCESSifdateAndTimeis valid or an appropriate SNMP error code if not.
-
makeDateAndTime
Creates a DateAndTimeOctetStringvalue from aGregorianCalendar.- Parameters:
dateAndTime- aGregorianCalendarinstance.- Returns:
- the corresponding DateAndTime
OctetString.
-
makeDateAndTime
public static <T extends org.snmp4j.smi.OctetString> T makeDateAndTime(GregorianCalendar dateAndTime, T os) Creates a DateAndTimeOctetStringvalue from aGregorianCalendar.- Type Parameters:
T- theOctetStringtype to return and modify.- Parameters:
dateAndTime- aGregorianCalendarinstance.os- the OctetString instance where to store the value.- Returns:
- the os instance with the set calendar value.
- Since:
- 2.0.5
-
makeCalendar
Creates aGregorianCalendarfrom a properly formatted DateAndTimeOctetString.- Parameters:
dateAndTimeValue- an OctetString conforming to the DateAndTime TC.- Returns:
- the corresponding
GregorianCalendarinstance.
-
validate
public int validate(org.snmp4j.smi.Variable newValue, org.snmp4j.smi.Variable oldValue) - Overrides:
validatein classMOMutableColumn<T extends org.snmp4j.smi.OctetString>
-
createMOScalar
public static MOScalar<org.snmp4j.smi.OctetString> createMOScalar(org.snmp4j.smi.OID oid, MOAccess access, org.snmp4j.smi.OctetString value, boolean localtime) Create aMOScalarDateAndTime instance.- Parameters:
oid- the OID of the scalar (including the .0 suffix).access- theMOAccessinstance defining the maximum access rights.value- the initial value.localtime- iftruethe returned DateAndTime instance will always return the local time (does only makes sense for a read-only instance). Otherwise the value last set will be returned on GET like requests.- Returns:
- the
MOScalarinstance.
-