Module org.snmp4j.agent
Package org.snmp4j.agent.mo.util
Class MOTableSizeLimit<R extends MOTableRow>
- java.lang.Object
-
- org.snmp4j.agent.mo.util.MOTableSizeLimit<R>
-
- All Implemented Interfaces:
EventListener
,MOTableRowListener<R>
- Direct Known Subclasses:
LogMOTableSizeLimit
public class MOTableSizeLimit<R extends MOTableRow> extends Object implements MOTableRowListener<R>
This class implements a size limit on the number of rows in a table. If the limit is reached or exceeded, no more additional rows can be added by SNMP means.Use the
DefaultMOServer.registerTableRowListener(org.snmp4j.agent.MOServer, org.snmp4j.agent.mo.MOTableRowListener<R>)
method to register this table row listener for all tables in your agent, in order to be able to control the table sizes of all the tables in a server.- Since:
- 1.1.5
- Version:
- 1.4
- Author:
- Frank Fock
-
-
Field Summary
Fields Modifier and Type Field Description static String
PROPERTY_PREFIX
The property prefix each size limit definition has to start with.
-
Constructor Summary
Constructors Constructor Description MOTableSizeLimit(int maxNumRows)
MOTableSizeLimit(Properties limits)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SortedMap<org.snmp4j.smi.OID,Integer>
getLimits()
int
getMaxNumRows()
protected boolean
removeEldest(MOTableRowEvent<R> triggeringEvent, int numRows)
Remove try to remove a given number of eldest rows of the table referred to in the triggering event object.void
rowChanged(MOTableRowEvent<R> event)
A column or a complete row is changed/has been changed.void
setLimits(Properties limits)
void
setMaxNumRows(int maxNumRows)
-
-
-
Field Detail
-
PROPERTY_PREFIX
public static final String PROPERTY_PREFIX
The property prefix each size limit definition has to start with. The OID subtree for which the definition is effective is then appended as follows:snmp4j.MOTableSizeLimit.<OID>=<limit>
wherelimit
is a positive number or zero.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MOTableSizeLimit
public MOTableSizeLimit(int maxNumRows)
-
MOTableSizeLimit
public MOTableSizeLimit(Properties limits)
-
-
Method Detail
-
rowChanged
public void rowChanged(MOTableRowEvent<R> event)
A column or a complete row is changed/has been changed.- Specified by:
rowChanged
in interfaceMOTableRowListener<R extends MOTableRow>
- Parameters:
event
- aMOTableRowEvent
describing the event. To veto the event theMOTableRowEvent.setVetoStatus(int)
and optionally also theMOTableRowEvent.setVetoColumn(int)
can be called.
-
removeEldest
protected boolean removeEldest(MOTableRowEvent<R> triggeringEvent, int numRows)
Remove try to remove a given number of eldest rows of the table referred to in the triggering event object.- Parameters:
triggeringEvent
- the MOTableRowEvent object that describes the table with exceeding row limit.numRows
- the number of rows to remove (if possible).- Returns:
true
if one or more rows could be removed andfalse
if the causing event should be denied/rejected. The default implementation returnsfalse
always.
-
setMaxNumRows
public void setMaxNumRows(int maxNumRows)
-
getMaxNumRows
public int getMaxNumRows()
-
setLimits
public void setLimits(Properties limits)
-
-