public class DateAndTime<T extends org.snmp4j.smi.OctetString> extends MOMutableColumn<T>
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
.Constructor and Description |
---|
DateAndTime(int columnID,
MOAccess access,
org.snmp4j.smi.OctetString defaultValue) |
DateAndTime(int columnID,
MOAccess access,
org.snmp4j.smi.OctetString defaultValue,
boolean mutableInService) |
Modifier and Type | Method and Description |
---|---|
static MOScalar<org.snmp4j.smi.OctetString> |
createMOScalar(org.snmp4j.smi.OID oid,
MOAccess access,
org.snmp4j.smi.OctetString value,
boolean localtime)
Create a
MOScalar DateAndTime instance. |
static GregorianCalendar |
makeCalendar(org.snmp4j.smi.OctetString dateAndTimeValue)
Creates a
GregorianCalendar from a properly formatted
DateAndTime OctetString . |
static org.snmp4j.smi.OctetString |
makeDateAndTime(GregorianCalendar dateAndTime)
Creates a DateAndTime
OctetString value from a
GregorianCalendar . |
static <T extends org.snmp4j.smi.OctetString> |
makeDateAndTime(GregorianCalendar dateAndTime,
T os)
Creates a DateAndTime
OctetString value from a
GregorianCalendar . |
int |
validate(org.snmp4j.smi.Variable newValue,
org.snmp4j.smi.Variable oldValue) |
static int |
validateDateAndTime(org.snmp4j.smi.Variable dateAndTime)
Tests a variable for DateAndTime conformance.
|
addMOValueValidationListener, cleanup, commit, getDefaultValue, isMandatory, isMutableInService, prepare, removeMOValueValidationListener, setDefaultValue, setMandatory, setMutableInService, toString, undo, validateSetRequest
compareTo, get, getAccess, getColumnID, getRestoreValue, getStoreValue, getSyntax, getTable, getValue, isVolatile, setAccess, setColumnID, setSyntax, setTable
public DateAndTime(int columnID, MOAccess access, org.snmp4j.smi.OctetString defaultValue, boolean mutableInService)
public DateAndTime(int columnID, MOAccess access, org.snmp4j.smi.OctetString defaultValue)
public static int validateDateAndTime(org.snmp4j.smi.Variable dateAndTime)
dateAndTime
- a Variable.SnmpConstants.SNMP_ERROR_SUCCESS
if dateAndTime
is valid or an appropriate SNMP error code if not.public static org.snmp4j.smi.OctetString makeDateAndTime(GregorianCalendar dateAndTime)
OctetString
value from a
GregorianCalendar
.dateAndTime
- a GregorianCalendar
instance.OctetString
.public static <T extends org.snmp4j.smi.OctetString> T makeDateAndTime(GregorianCalendar dateAndTime, T os)
OctetString
value from a
GregorianCalendar
.T
- the OctetString
type to return and modify.dateAndTime
- a GregorianCalendar
instance.os
- the OctetString instance where to store the value.public static GregorianCalendar makeCalendar(org.snmp4j.smi.OctetString dateAndTimeValue)
GregorianCalendar
from a properly formatted
DateAndTime OctetString
.dateAndTimeValue
- an OctetString conforming to the DateAndTime TC.GregorianCalendar
instance.public int validate(org.snmp4j.smi.Variable newValue, org.snmp4j.smi.Variable oldValue)
validate
in class MOMutableColumn<T extends org.snmp4j.smi.OctetString>
public static MOScalar<org.snmp4j.smi.OctetString> createMOScalar(org.snmp4j.smi.OID oid, MOAccess access, org.snmp4j.smi.OctetString value, boolean localtime)
MOScalar
DateAndTime instance.oid
- the OID of the scalar (including the .0 suffix).access
- the MOAccess
instance defining the maximum access rights.value
- the initial value.localtime
- if true
the 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.MOScalar
instance.Copyright © 2019 SNMP4J.org. All rights reserved.