- java.lang.Object
-
- org.snmp4j.agent.cfg.EngineBootsCounterFile
-
- All Implemented Interfaces:
EngineBootsProvider,EngineIdProvider
public class EngineBootsCounterFile extends Object implements EngineBootsProvider, EngineIdProvider
TheEngineBootsCounterFileis aEngineBootsProviderthat stores the boot counter amd the engine ID of an agent in a file.- Version:
- 3.3.0
- Author:
- Frank Fock
-
-
Constructor Summary
Constructors Constructor Description EngineBootsCounterFile(File bootCounterFile)Creates the boot counter by using the specified file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FilegetBootCounterFile()intgetEngineBoots()Returns current engine boot counter value.org.snmp4j.smi.OctetStringgetEngineId(org.snmp4j.smi.OctetString defaultEngineID)Gets the engine ID for the SNMP entity associated with thisEngineIdProvider.protected intgetLastEngineBoots()Reads the engine boots counter from the corresponding input stream (file).voidresetEngineId(org.snmp4j.smi.OctetString engineId)Sets the persistently stored engine ID to a new value.protected voidsetEngineBoots(int engineBoots)intupdateEngineBoots()Returns the current engine boot counter value incremented by one.
-
-
-
Constructor Detail
-
EngineBootsCounterFile
public EngineBootsCounterFile(File bootCounterFile)
Creates the boot counter by using the specified file.- Parameters:
bootCounterFile- a file (does not have to exists yet but must be writable).
-
-
Method Detail
-
updateEngineBoots
public int updateEngineBoots()
Returns the current engine boot counter value incremented by one.- Specified by:
updateEngineBootsin 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:EngineBootsProviderReturns current engine boot counter value.- Specified by:
getEngineBootsin interfaceEngineBootsProvider- Returns:
- the last engine boots counter.
-
getBootCounterFile
public File getBootCounterFile()
-
getEngineId
public org.snmp4j.smi.OctetString getEngineId(org.snmp4j.smi.OctetString defaultEngineID)
Description copied from interface:EngineIdProviderGets the engine ID for the SNMP entity associated with thisEngineIdProvider.- Specified by:
getEngineIdin 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
defaultEngineIDwhich is then persistently stored.
-
resetEngineId
public void resetEngineId(org.snmp4j.smi.OctetString engineId)
Description copied from interface:EngineIdProviderSets the persistently stored engine ID to a new value.- Specified by:
resetEngineIdin interfaceEngineIdProvider- Parameters:
engineId- the new engine ID for this SNMP entity.
-
-