- java.lang.Object
-
- org.snmp4j.cfg.EngineBootsCounterFile
-
- All Implemented Interfaces:
EngineBootsProvider
,EngineIdProvider
,SnmpEngineIdProvider
public class EngineBootsCounterFile extends java.lang.Object implements SnmpEngineIdProvider
TheEngineBootsCounterFile
is aSnmpEngineIdProvider
that stores the boot counter amd the engine ID of an SNMP entity in a file.- Since:
- 3.5.0
- Version:
- 3.5.0
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.File
bootCounterFile
private int
boots
private OctetString
engineID
private static LogAdapter
logger
-
Constructor Summary
Constructors Constructor Description EngineBootsCounterFile(java.io.File bootCounterFile)
Creates the boot counter by using the specified file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.File
getBootCounterFile()
int
getEngineBoots()
Returns current engine boot counter value.OctetString
getEngineId(OctetString defaultEngineID)
Gets the engine ID for the SNMP entity associated with thisEngineIdProvider
.protected int
getLastEngineBoots()
Reads the engine boots counter from the corresponding input stream (file).void
resetEngineId(OctetString engineId)
Sets the persistently stored engine ID to a new value.protected void
setEngineBoots(int engineBoots)
int
updateEngineBoots()
Returns the current engine boot counter value incremented by one.
-
-
-
Field Detail
-
logger
private static final LogAdapter logger
-
bootCounterFile
private final java.io.File bootCounterFile
-
boots
private int boots
-
engineID
private OctetString engineID
-
-
Method Detail
-
updateEngineBoots
public int updateEngineBoots()
Returns the current engine boot counter value incremented by one.- Specified by:
updateEngineBoots
in interfaceEngineBootsProvider
- Returns:
- the last engine boots counter incremented by one.
-
getLastEngineBoots
protected int getLastEngineBoots()
Reads the engine boots counter from the corresponding input stream (file).- Returns:
- the boots counter value read or zero if it could not be read.
-
setEngineBoots
protected void setEngineBoots(int engineBoots)
-
getEngineBoots
public int getEngineBoots()
Description copied from interface:EngineBootsProvider
Returns current engine boot counter value.- Specified by:
getEngineBoots
in interfaceEngineBootsProvider
- Returns:
- the last engine boots counter.
-
getBootCounterFile
public java.io.File getBootCounterFile()
-
getEngineId
public OctetString getEngineId(OctetString defaultEngineID)
Description copied from interface:EngineIdProvider
Gets the engine ID for the SNMP entity associated with thisEngineIdProvider
.- Specified by:
getEngineId
in interfaceEngineIdProvider
- Parameters:
defaultEngineID
- the engine ID for this entity, if there is no persistently saved engine ID yet.- Returns:
- the persistently saved engine ID or the reference to the
defaultEngineID
which is then persistently stored.
-
resetEngineId
public void resetEngineId(OctetString engineId)
Description copied from interface:EngineIdProvider
Sets the persistently stored engine ID to a new value.- Specified by:
resetEngineId
in interfaceEngineIdProvider
- Parameters:
engineId
- the new engine ID for this SNMP entity.
-
-