Class DefaultMOTable<R extends MOTableRow,C extends MOColumn,M extends MOTableModel<R>>
- All Implemented Interfaces:
ManagedObject<SubRequest<?>>,ManagedObjectValueAccess<SubRequest<?>>,ChangeableManagedObject<SubRequest<?>>,GenericManagedObject,MOTable<R,,C, M> MOScope,RandomAccessManagedObject<SubRequest<?>>,RegisteredManagedObject<SubRequest<?>>,SerializableManagedObject<SubRequest<?>>
- Direct Known Subclasses:
SNMPv2MIB.SysOREntry
DefaultMOTable class is the default implementation of the MOTable class. For most use cases, it
is not necessary to customize this class through deriving your own sub-class. Instead, using a different MOTableModel as table data provider is sufficient.
The default table model can be used to hold the data of a SNMP conceptual table as real tabular data. If you want to
implement a virtual table, you will have to directly implement the interfaces MOTableModel or MOMutableTableModel to access the data based on the actual view.
- Version:
- 3.0
- Author:
- Frank Fock
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<MOChangeListener>protected Mprotected List<MOTableRowListener<R>>protected WeakHashMap<Request<?,?, ?>, Map<org.snmp4j.smi.OID, R>> protected WeakHashMap<Request<?,?, ?>, Map<org.snmp4j.smi.OID, DefaultMOTable.ChangeSet>> protected List<RowModificationControlColumn> -
Constructor Summary
ConstructorsConstructorDescriptionDefaultMOTable(org.snmp4j.smi.OID oid, MOTableIndex indexDef, C[] columns) Creates a new SNMP table with the specified "Entry" OID, INDEX, columns, and aDefaultMOMutableTableModelas table model.DefaultMOTable(org.snmp4j.smi.OID oid, MOTableIndex indexDef, C[] columns, M model) Creates a new SNMP table with the specified "Entry" OID, INDEX, columns, andMOTableModel. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds aMOChangeListenerthat needs to be informed about state changes of thisManagedObject.voidAdds aMOTableRowListenerlistener that needs to be informed about row changes (creation, addition, removal).addNewRow(org.snmp4j.smi.OID index, org.snmp4j.smi.Variable[] initialValues) Creates a new row for this table with the supplied index and initial values and then immediately callsMOTable.addRow(MOTableRow).protected DefaultMOTable.ChangeSetaddPendingChanges(SubRequest<?> subRequest, MOTableRow row, boolean newRow) booleanAdds the supplied row to the underlying table model and fires the appropriateMOTableRowEvent.protected booleanaddRowInternal(R row, MOTableRowEvent.OriginType originType) Adds the supplied row to the underlying table model and fires the appropriateMOTableRowEvent.voidcleanup(SubRequest<?> request) Cleansup a (sub)request and frees all resources locked during the preparation phase.voidcommit(SubRequest<?> request) Commits a previously prepared SET (sub)request.booleancovers(org.snmp4j.smi.OID oid) Checks if this scope covers the supplied OID.createRow(org.snmp4j.smi.OID index) Creates a new row for this table with the supplied index and default values.createRow(org.snmp4j.smi.OID index, org.snmp4j.smi.Variable[] initialValues) Creates a new row for this table with the supplied index and initial values.createRowInternal(org.snmp4j.smi.OID index, org.snmp4j.smi.Variable[] initialValues, MOTableRowEvent.OriginType originType) Creates a new row for this table with the supplied index and initial values.List<org.snmp4j.smi.VariableBinding>exportInstance(org.snmp4j.smi.OID instanceID) Exports the byte representation of an instance of theManagedObject.org.snmp4j.smi.OIDFinds the object identifier of the first object instance in the specified range.protected MOTableCellInfofindCell(MOScope range, SubRequest<?> request) protected voidfireAfterMOChange(MOChangeEvent changeEvent) protected voidfireAfterPrepareMOChange(MOChangeEvent changeEvent) protected voidfireBeforeMOChange(MOChangeEvent changeEvent) protected voidfireBeforePrepareMOChange(MOChangeEvent changeEvent) protected voidfireRowChanged(MOTableRowEvent<R> event) protected voidFires aMOTableRowEvent.EXISTSfor all rows in this table if the provided listener actively subscribes to all such events this time by settingMOTableRowEvent.setSendNextEventsOfSameOrigin(boolean)totrueon the first rows and following events.voidget(SubRequest<?> request) Processes a GET request and return the result in the supplied sub-request.getCellInfo(org.snmp4j.smi.OID oid) Returns aMOTableCellInfoinstance for the supplied cell OID.org.snmp4j.smi.OIDgetCellOID(org.snmp4j.smi.OID index, int col) protected intgetChangesFromRequest(org.snmp4j.smi.OID index, MOTableRow row, SubRequest<?> request, org.snmp4j.smi.Variable[] values, boolean setDefaultValues, boolean newRow) getColumn(int index) Gets the column definition for the specified column.intReturns the number of columns in this table.intgetColumnIndex(int id) Returns the zero based column index for the specified column sub-identifier.C[]Gets the column definitions for this table.org.snmp4j.smi.Variable[]Returns an array of variables where each variable corresponds to the column with the same index.getDependentTableRow(org.snmp4j.smi.OID dependentTableID, org.snmp4j.smi.OID index) Gets the row with the given index from the dependent table (thus a table which extends this table using aMOTableRelation) with the provided table entry object identifier.org.snmp4j.smi.OIDgetID()Gets the unique object ID of the managed object.Gets the index definition of this table.final org.snmp4j.smi.OIDgetIndexPart(org.snmp4j.smi.OID anyOID) Returns the index part of a column instance identifier of this table.org.snmp4j.smi.OIDgetInstanceSubID(org.snmp4j.smi.OID instanceOID) Returns the instance sub-identifier suffix for the given instance OID.org.snmp4j.smi.OIDGets the lower bound OID of the scope.getModel()Gets the table model of this table.getNewRows(Request<?, ?, ?> key) org.snmp4j.smi.OIDgetOID()Returns the OID of the table entry.protected DefaultMOTable.ChangeSetgetPendingChangeSet(SubRequest<?> subRequest, org.snmp4j.smi.OID index) protected org.snmp4j.smi.Variable[]Gets the values of a row that need to be made persistent on behalf of asave(MOOutput output)call.protected List<RowModificationControlColumn>getRowPreview(Request<?, ?, ?> request, org.snmp4j.smi.OID index) Gets aDefaultMOTable.ChangeSetthat contains the row values as if they had been already committed (not taking into account value modifications performed by the columns commit operations).getScope()Returns the scope of object identifiers this managed object is managing.org.snmp4j.smi.OIDGets the upper bound OID of the scope.protected org.snmp4j.smi.VariablegetValue(MOTableRow row, int col, SubRequest<?> req) org.snmp4j.smi.VariablegetValue(org.snmp4j.smi.OID cellOID) Gets the value of the cell instance with the specified instance OID.org.snmp4j.smi.VariablegetValue(org.snmp4j.smi.OID index, int col) Gets the value of the cell instance in the specified column and row.org.snmp4j.smi.VariablegetValue(org.snmp4j.smi.OID index, int col, SubRequest<?> req) protected booleanhasNewRows(Request<?, ?, ?> key) booleanimportInstance(org.snmp4j.smi.OID instanceID, List<org.snmp4j.smi.VariableBinding> data, ImportMode importMode) Imports the data that internally represents the instance specified by the OID suffixinstanceIDfrom the byte data provided which can be encoded in any representation theManagedObjectis able to understand.intReturns the number of instances managed by thisManagedObject.Iterator<org.snmp4j.smi.OID>protected booleanisChangeSetComplete(SubRequest<?> subRequest, org.snmp4j.smi.OID index, int column) booleanChecks whether the supplied scope is covered by this scope.booleanIndicates whether the lower bound OID is included in the scope or not.booleanisOverlapping(MOScope other) Checks whether the supplied scope overlap with this one, thus sharing at least one OID with the supplied one.booleanIndicates whether the upper bound OID is included in the scope or not.booleanTests if this instance of a SerializableManagedObject should be serialized or deserialized through persistent storage load or save operation.booleanisVolatile(org.snmp4j.smi.OID instanceSubID) Tests if the specified instance should be serialized or deserialized through persistent storage load or save operation.voidLoads the content of the managed object from the specified input (stream).protected voidloadRow(org.snmp4j.smi.OID rowIndex, org.snmp4j.smi.Variable[] rawRowValues, int importMode) booleannext(SubRequest<?> request) Finds the successor instance for the object instance ID (OID) given by the supplied sub-request and returns it within the supplied sub-request object.voidprepare(SubRequest<?> request) Prepares a SET (sub)request.intRemoves all rows from this table.intremoveAnyStorageType(Set<StorageType.StorageTypeEnum> storageTypeSet) Remove all rows that have aStorageTypecolumn with a value that matches one of the provided values.protected intremoveAnyStorageType(Set<StorageType.StorageTypeEnum> storageTypeSet, int storageTypeColumn) voidRemoves aMOChangeListenerfrom thisManagedObject.voidRemovesMOTableRowListenerinstance.removeRow(org.snmp4j.smi.OID index) Removes the row with the specified index and returns it if the operation was successful.protected org.snmp4j.smi.Variable[]restoreRawDataForHiddenColumns(org.snmp4j.smi.Variable[] rawValues, int startIndexHidden) Restore hidden raw values.voidSaves the (non-volatile) content of this managed object to the specified output (stream).voidbooleansetValue(org.snmp4j.smi.VariableBinding newValueAndInstancceOID) Sets the value of a particular MIB object instance managed by thisManagedObject.voidsetVolatile(boolean isVolatile) toString()voidundo(SubRequest<?> request) Compensates (undo) a (sub)request when a commit of another subrequest failed with an error.voidUpdate the content of this table that is covered by the supplied scope.protected voidupdate(MOScope range, SubRequest<?> request) Update this table for the supplied search range and sub-request if it has not yet been updated for that request.
-
Field Details
-
model
-
newRows
-
pendingChanges
protected WeakHashMap<Request<?,?, pendingChanges?>, Map<org.snmp4j.smi.OID, DefaultMOTable.ChangeSet>> -
moChangeListeners
-
moTableRowListeners
-
rowModificationControlColumns
-
-
Constructor Details
-
DefaultMOTable
Creates a new SNMP table with the specified "Entry" OID, INDEX, columns, and aDefaultMOMutableTableModelas table model.- Parameters:
oid- the OID of the SNMP table's Entry object. If the table is ifTable (1.3.6.1.2.1.2.2) then the OID to provide is 1.3.6.1.2.1.2.2.1 which is the ifEntry OID. By SMI rule, you can simply append ".1" to the table OID.indexDef- the index definition of the table based on the INDEX clause of the table MIB definition.columns- the column definitions which may also include non-accessible columns.
-
DefaultMOTable
Creates a new SNMP table with the specified "Entry" OID, INDEX, columns, andMOTableModel.- Parameters:
oid- the OID of the SNMP table's Entry object. If the table is ifTable (1.3.6.1.2.1.2.2) then the OID to provide is 1.3.6.1.2.1.2.2.1 which is the ifEntry OID. By SMI rule, you can simply append ".1" to the table OID.indexDef- the index definition of the table based on the INDEX clause of the table MIB definition.columns- the column definitions which may also include non-accessible columns.model- the table model holding the table data.
-
-
Method Details
-
getCellInfo
Description copied from interface:MOTableReturns aMOTableCellInfoinstance for the supplied cell OID. The returned object contains the index, column index, and column ID of the specified cell, if available.- Specified by:
getCellInfoin interfaceMOTable<R extends MOTableRow,C extends MOColumn, M extends MOTableModel<R>> - Parameters:
oid- cell instance OID.- Returns:
- a
MOTableCellInfoinstance with the index, column index and column ID of the specified cell if available.
-
getColumnIndex
public int getColumnIndex(int id) Description copied from interface:MOTableReturns the zero based column index for the specified column sub-identifier.- Specified by:
getColumnIndexin interfaceMOTable<R extends MOTableRow,C extends MOColumn, M extends MOTableModel<R>> - Parameters:
id- a column sub-identifier (normally one based) as defined in the MIB specification.- Returns:
- a value greater or equal to zero denoting the column index
of the column associated with
id. The column index points into the column array returned byMOTable.getColumns(). A value less than zero indicates that such a column does not exists currently but could be inserted at the(-n)-1position ifnis the returned value.
-
getColumn
Description copied from interface:MOTableGets the column definition for the specified column.- Specified by:
getColumnin interfaceMOTable<R extends MOTableRow,C extends MOColumn, M extends MOTableModel<R>> - Parameters:
index- the (zero-based) column index.- Returns:
- a
MOColumninstance describing the attributes of requested column.
-
getColumnCount
public int getColumnCount()Description copied from interface:MOTableReturns the number of columns in this table.- Specified by:
getColumnCountin interfaceMOTable<R extends MOTableRow,C extends MOColumn, M extends MOTableModel<R>> - Returns:
- the column count.
-
createRow
Creates a new row for this table with the supplied index and initial values. If the underlying table model is not aMOMutableTableModelinstance or if one of theMOTableRowListenerdeny the row creation attempt thennullwill be returned.- Specified by:
createRowin interfaceMOTable<R extends MOTableRow,C extends MOColumn, M extends MOTableModel<R>> - Parameters:
index- the index OID of the new row.initialValues- the initial values that should be assigned to the new row. If the array contains less values than this table has columns, default values will be created for the missing columns.- Returns:
- the created
MOTableRowinstance ornullif the row cannot be created.
-
createRowInternal
public R createRowInternal(org.snmp4j.smi.OID index, org.snmp4j.smi.Variable[] initialValues, MOTableRowEvent.OriginType originType) Creates a new row for this table with the supplied index and initial values. If the underlying table model is not aMOMutableTableModelinstance or if one of theMOTableRowListenerdeny the row creation attempt thennullwill be returned. TheMOTableRowEvent.OriginTypespecifies whether this method is called on behalf of an external SNMP (AgentX) protocol operation or behalf of an internal load operation.- Parameters:
index- the index OID of the new row.initialValues- the initial values that should be assigned to the new row. If the array contains less values than this table has columns, default values will be created for the missing columns.originType- the origin type (MOTableRowEvent.OriginType.externalorMOTableRowEvent.OriginType.internal) of this event.- Returns:
- the created
MOTableRowinstance ornullif the row cannot be created. - Since:
- 3.3.0
-
addNewRow
Description copied from interface:MOTableCreates a new row for this table with the supplied index and initial values and then immediately callsMOTable.addRow(MOTableRow). If one of theMOTableRowListenerdeny the row creation attempt thennullwill be returned andMOTable.addRow(MOTableRow)will not be called.This method is the same as calling:
R newRow = createRow(index, initialValues); if (newRow != null) { addRow(newRow); } return newRow;- Specified by:
addNewRowin interfaceMOTable<R extends MOTableRow,C extends MOColumn, M extends MOTableModel<R>> - Parameters:
index- the index OID of the new row.initialValues- the initial values that should be assigned to the new row.- Returns:
- the created
MOTableRowinstance ornullif the row cannot be created.
-
createRow
Description copied from interface:MOTableCreates a new row for this table with the supplied index and default values. If one of theMOTableRowListenerdeny the row creation attempt thennullwill be returned.- Specified by:
createRowin interfaceMOTable<R extends MOTableRow,C extends MOColumn, M extends MOTableModel<R>> - Parameters:
index- the index OID of the new row.- Returns:
- the created
MOTableRowinstance ornullif the row cannot be created.
-
addRow
Adds the supplied row to the underlying table model and fires the appropriateMOTableRowEvent. Since this method is typically called during the commit phase of a SET request that creates a table, it should be avoided to return an error here. Instead, error checking should be placed in theprepare(org.snmp4j.agent.request.SubRequest<?>)method. TheMOTableRowEvent.OriginTypeof the firedMOTableRowEventis set toMOTableRowEvent.OriginType.external.- Specified by:
addRowin interfaceMOTable<R extends MOTableRow,C extends MOColumn, M extends MOTableModel<R>> - Parameters:
row- theMOTableRowto add.- Returns:
trueif the row has been added orfalseif it could not be added.
-
addRowInternal
Adds the supplied row to the underlying table model and fires the appropriateMOTableRowEvent. TheMOTableRowEvent.OriginTypespecifies whether this method is called on behalf of an external SNMP (AgentX) protocol operation or behalf of an internal load operation.- Parameters:
row- theMOTableRowto add.originType- the origin type (MOTableRowEvent.OriginType.externalorMOTableRowEvent.OriginType.internal) of this event.- Returns:
trueif the row has been added orfalseif it could not be added.
-
removeRow
Description copied from interface:MOTableRemoves the row with the specified index and returns it if the operation was successful.- Specified by:
removeRowin interfaceMOTable<R extends MOTableRow,C extends MOColumn, M extends MOTableModel<R>> - Parameters:
index- the index OID of the row to remove.- Returns:
- the removed row or
nullif the row cannot be found or cannot be removed.
-
removeAll
public int removeAll()Removes all rows from this table. Before a row is removed the corresponding DELETE event is fired and listeners may veto these events for all rows. Only if there is no veto, a row will be deleted. The number of deleted rows is then returned.- Returns:
- the number of removed rows or -1 if the table model does not support row removal.
-
removeAnyStorageType
Remove all rows that have aStorageTypecolumn with a value that matches one of the provided values.- Parameters:
storageTypeSet- a set ofStorageType.StorageTypeEnumvalues.- Returns:
- the number of deleted rows or -1 if the table does not contain a
StorageTypecolumn. - Since:
- 3.0
-
removeAnyStorageType
protected int removeAnyStorageType(Set<StorageType.StorageTypeEnum> storageTypeSet, int storageTypeColumn) -
commit
Description copied from interface:ManagedObjectCommits a previously prepared SET (sub)request. This is the second phase of a two phase commit. The change is committed but the resources locked during prepare not freed yet.- Specified by:
commitin interfaceManagedObject<R extends MOTableRow>- Parameters:
request- theSubRequestto process.
-
getIndexPart
public final org.snmp4j.smi.OID getIndexPart(org.snmp4j.smi.OID anyOID) Description copied from interface:MOTableReturns the index part of a column instance identifier of this table.- Specified by:
getIndexPartin interfaceMOTable<R extends MOTableRow,C extends MOColumn, M extends MOTableModel<R>> - Parameters:
anyOID- the OID of a column instance. The returned result is undefined, when this OID is not a column instance OID.- Returns:
- an OID representing the index OID of the row identified by the
instanceIdentifiercolumn instance OID.
-
getCellOID
public org.snmp4j.smi.OID getCellOID(org.snmp4j.smi.OID index, int col) -
find
Description copied from interface:MOTableFinds the object identifier of the first object instance in the specified range.- Specified by:
findin interfaceManagedObject<R extends MOTableRow>- Specified by:
findin interfaceMOTable<R extends MOTableRow,C extends MOColumn, M extends MOTableModel<R>> - Parameters:
range- aMOScopespecifying the search range.- Returns:
- the OID of the lexicographic first instance in the search range or
nullif no such instance exists.
-
findCell
-
getScope
Description copied from interface:ManagedObjectReturns the scope of object identifiers this managed object is managing.- Specified by:
getScopein interfaceManagedObject<R extends MOTableRow>- Returns:
- the
MOScopethat defines a range (possibly also a single or none instance OID) of object IDs managed by this managed object.
-
getValue
public org.snmp4j.smi.Variable getValue(org.snmp4j.smi.OID cellOID) Description copied from interface:MOTableGets the value of the cell instance with the specified instance OID.- Specified by:
getValuein interfaceManagedObjectValueAccess<R extends MOTableRow>- Specified by:
getValuein interfaceMOTable<R extends MOTableRow,C extends MOColumn, M extends MOTableModel<R>> - Parameters:
cellOID- the instance OID of the requested cell.- Returns:
- the value of the cell or
nullif such a cell does not exist.
-
getValue
-
getValue
public org.snmp4j.smi.Variable getValue(org.snmp4j.smi.OID index, int col) Description copied from interface:MOTableGets the value of the cell instance in the specified column and row.- Specified by:
getValuein interfaceMOTable<R extends MOTableRow,C extends MOColumn, M extends MOTableModel<R>> - Parameters:
index- the row index of the cell.col- the column index of the cell.- Returns:
- the value of the cell or
nullif such a cell does not exist.
-
getValue
-
update
Update the content of this table that is covered by the supplied scope.This method is part of the
UpdatableManagedObjectinterface. Although theDefaultMOTabledoes not implement that interface, subclasses of this class may do so easily by overriding this hook-up method.- Parameters:
updateScope- the scope to update. Ifnullthe whole managed object is updated.- Since:
- 1.2
- See Also:
-
update
Update this table for the supplied search range and sub-request if it has not yet been updated for that request.By default, the
update(MOScope updateScope)is being called on behalf of this method call (which itself does not nothing by default). You may choose either to implement theUpdatableManagedObjectinterface and implement its interface in a subclass. Then it is recommended to overwrite this method by an empty method. Otherwise, do not implement theUpdatableManagedObjectinterface.- Parameters:
range- the search range.request- the sub-request triggered the update ornullif that request cannot be determined.
-
get
Description copied from interface:ManagedObjectProcesses a GET request and return the result in the supplied sub-request.- Specified by:
getin interfaceManagedObject<R extends MOTableRow>- Parameters:
request- theSubRequestto process.
-
next
Description copied from interface:ManagedObjectFinds the successor instance for the object instance ID (OID) given by the supplied sub-request and returns it within the supplied sub-request object.- Specified by:
nextin interfaceManagedObject<R extends MOTableRow>- Parameters:
request- theSubRequestto process.- Returns:
trueif the search request found an appropriate instance,falseotherwise.
-
prepare
Description copied from interface:ManagedObjectPrepares a SET (sub)request. This method represents the first phase of a two phase commit. During preparation all necessary resources should be locked in order to be able to execute the commit without claiming additional resources.- Specified by:
preparein interfaceManagedObject<R extends MOTableRow>- Parameters:
request- theSubRequestto process.
-
getRowModificationControlColumns
-
getChangesFromRequest
protected int getChangesFromRequest(org.snmp4j.smi.OID index, MOTableRow row, SubRequest<?> request, org.snmp4j.smi.Variable[] values, boolean setDefaultValues, boolean newRow) -
hasNewRows
-
getNewRows
-
isChangeSetComplete
protected boolean isChangeSetComplete(SubRequest<?> subRequest, org.snmp4j.smi.OID index, int column) -
addPendingChanges
protected DefaultMOTable.ChangeSet addPendingChanges(SubRequest<?> subRequest, MOTableRow row, boolean newRow) -
getPendingChangeSet
protected DefaultMOTable.ChangeSet getPendingChangeSet(SubRequest<?> subRequest, org.snmp4j.smi.OID index) -
getRowPreview
Gets aDefaultMOTable.ChangeSetthat contains the row values as if they had been already committed (not taking into account value modifications performed by the columns commit operations). This method can be called when processing commits of otherManagedObjects on behalf of the same SNMP request to determine what a certain row will contain if the this SET will be successful.- Parameters:
request- the request to preview. Ifnullor no pending changes exist for this request, the current row values are returned.index- the row index of the row to return.- Returns:
- the values as if the provided
requesthas already been committed of the row identified byindex. - Since:
- 3.0
-
cleanup
Description copied from interface:ManagedObjectCleansup a (sub)request and frees all resources locked during the preparation phase.- Specified by:
cleanupin interfaceManagedObject<R extends MOTableRow>- Parameters:
request- theSubRequestto process.
-
undo
Description copied from interface:ManagedObjectCompensates (undo) a (sub)request when a commit of another subrequest failed with an error. This also frees any resources locked during the preparation phase.- Specified by:
undoin interfaceManagedObject<R extends MOTableRow>- Parameters:
request- theSubRequestto process.
-
getOID
public org.snmp4j.smi.OID getOID()Description copied from interface:MOTableReturns the OID of the table entry.- Specified by:
getOIDin interfaceMOTable<R extends MOTableRow,C extends MOColumn, M extends MOTableModel<R>> - Returns:
- a table entry OID (including the .1 suffix).
-
setModel
-
setVolatile
public void setVolatile(boolean isVolatile) -
getModel
Description copied from interface:MOTableGets the table model of this table.- Specified by:
getModelin interfaceMOTable<R extends MOTableRow,C extends MOColumn, M extends MOTableModel<R>> - Returns:
- a MOTableModel instance.
-
getColumns
Description copied from interface:MOTableGets the column definitions for this table.- Specified by:
getColumnsin interfaceMOTable<R extends MOTableRow,C extends MOColumn, M extends MOTableModel<R>> - Returns:
- an array with the column definitions of this table.
-
getIndexDef
Description copied from interface:MOTableGets the index definition of this table.- Specified by:
getIndexDefin interfaceMOTable<R extends MOTableRow,C extends MOColumn, M extends MOTableModel<R>> - Returns:
- a MOTableIndex instance containing the sub-index definitions for this table.
-
isVolatile
public boolean isVolatile()Description copied from interface:SerializableManagedObjectTests if this instance of a SerializableManagedObject should be serialized or deserialized through persistent storage load or save operation.- Specified by:
isVolatilein interfaceRandomAccessManagedObject<R extends MOTableRow>- Specified by:
isVolatilein interfaceSerializableManagedObject<R extends MOTableRow>- Returns:
trueifSerializableManagedObject.load(org.snmp4j.agent.io.MOInput)andSerializableManagedObject.save(org.snmp4j.agent.io.MOOutput)should not be called through a persistent storage operation andfalseif these method should be called.
-
getLowerBound
public org.snmp4j.smi.OID getLowerBound()Description copied from interface:MOScopeGets the lower bound OID of the scope. Whether the lower bound is included or excluded from the scope's region is determined byMOScope.isLowerIncluded().- Specified by:
getLowerBoundin interfaceMOScope- Returns:
- an OID.
-
getUpperBound
public org.snmp4j.smi.OID getUpperBound()Description copied from interface:MOScopeGets the upper bound OID of the scope. Whether the upper bound is included or excluded from the scope's region is determined byMOScope.isUpperIncluded().- Specified by:
getUpperBoundin interfaceMOScope- Returns:
- OID
-
isLowerIncluded
public boolean isLowerIncluded()Description copied from interface:MOScopeIndicates whether the lower bound OID is included in the scope or not.- Specified by:
isLowerIncludedin interfaceMOScope- Returns:
trueif the lower bound is included.
-
isUpperIncluded
public boolean isUpperIncluded()Description copied from interface:MOScopeIndicates whether the upper bound OID is included in the scope or not.- Specified by:
isUpperIncludedin interfaceMOScope- Returns:
trueif the upper bound is included.
-
isCovered
Description copied from interface:MOScopeChecks whether the supplied scope is covered by this scope. -
isOverlapping
Description copied from interface:MOScopeChecks whether the supplied scope overlap with this one, thus sharing at least one OID with the supplied one.- Specified by:
isOverlappingin interfaceMOScope- Parameters:
other- aMOScope.- Returns:
trueif there exists at least one OID that is included in both scopes.
-
addMOChangeListener
Description copied from interface:ChangeableManagedObjectAdds aMOChangeListenerthat needs to be informed about state changes of thisManagedObject.- Specified by:
addMOChangeListenerin interfaceChangeableManagedObject<R extends MOTableRow>- Parameters:
l- aMOChangeListenerinstance.
-
removeMOChangeListener
Description copied from interface:ChangeableManagedObjectRemoves aMOChangeListenerfrom thisManagedObject.- Specified by:
removeMOChangeListenerin interfaceChangeableManagedObject<R extends MOTableRow>- Parameters:
l- aMOChangeListenerinstance.
-
fireBeforePrepareMOChange
-
fireAfterPrepareMOChange
-
fireBeforeMOChange
-
fireAfterMOChange
-
addMOTableRowListener
Description copied from interface:MOTableAdds aMOTableRowListenerlistener that needs to be informed about row changes (creation, addition, removal).- Specified by:
addMOTableRowListenerin interfaceMOTable<R extends MOTableRow,C extends MOColumn, M extends MOTableModel<R>> - Parameters:
l- aMOTableRowListenerinstance.
-
getDependentTableRow
public MOTableRow getDependentTableRow(org.snmp4j.smi.OID dependentTableID, org.snmp4j.smi.OID index) Gets the row with the given index from the dependent table (thus a table which extends this table using aMOTableRelation) with the provided table entry object identifier.- Parameters:
dependentTableID- the OID of theMOTablethat is linked with aMOTableRelationas dependent table.index- the row index of the dependent's table row that should be returned.- Returns:
- a
MOTableRowif such a row exists ornullotherwise. - Since:
- 3.0
-
fireRowExistsEvent
Fires aMOTableRowEvent.EXISTSfor all rows in this table if the provided listener actively subscribes to all such events this time by settingMOTableRowEvent.setSendNextEventsOfSameOrigin(boolean)totrueon the first rows and following events.- Parameters:
l- the table row listener.
-
removeMOTableRowListener
Description copied from interface:MOTableRemovesMOTableRowListenerinstance.- Specified by:
removeMOTableRowListenerin interfaceMOTable<R extends MOTableRow,C extends MOColumn, M extends MOTableModel<R>> - Parameters:
l- aMOTableRowListenerinstance.
-
fireRowChanged
-
importInstance
public boolean importInstance(org.snmp4j.smi.OID instanceID, List<org.snmp4j.smi.VariableBinding> data, ImportMode importMode) Description copied from interface:RandomAccessManagedObjectImports the data that internally represents the instance specified by the OID suffixinstanceIDfrom the byte data provided which can be encoded in any representation theManagedObjectis able to understand.- Specified by:
importInstancein interfaceRandomAccessManagedObject<R extends MOTableRow>- Parameters:
instanceID- the OID suffix identifying the instance to export, for scalars this is "0" and for tabular objects this is the row index.data- the SNMP data of the instance where the OID identifies the sub-instance (i.e. the column sub-ID for row instances and "0" for scalar objects).importMode- defines the import strategy - must not benull!- Returns:
trueif the import was successful,falseotherwise.
-
restoreRawDataForHiddenColumns
protected org.snmp4j.smi.Variable[] restoreRawDataForHiddenColumns(org.snmp4j.smi.Variable[] rawValues, int startIndexHidden) Restore hidden raw values. Overwrite this method in subclasses to convert the raw value of a hidden column to the runtime value, for example for secretOctetStringconvertOctetStringtoSecretOctetString.- Parameters:
rawValues- the complete raw values (including regular columns).startIndexHidden- the array index ofrawValueswhere the hidden columns start.- Returns:
- the restored raw values, including any hidden columns. By default
rawValuesis returned. - Since:
- 3.6.1
-
isVolatile
public boolean isVolatile(org.snmp4j.smi.OID instanceSubID) Tests if the specified instance should be serialized or deserialized through persistent storage load or save operation.- Specified by:
isVolatilein interfaceRandomAccessManagedObject<R extends MOTableRow>- Parameters:
instanceSubID- the OID suffix identifying the instance to check, for scalars this is "0" and for tabular objects this is the row index.- Returns:
trueif the specified sub-instance exists and isStorageType.volatile_.- Since:
- 3.2.0
-
exportInstance
Description copied from interface:RandomAccessManagedObjectExports the byte representation of an instance of theManagedObject.- Specified by:
exportInstancein interfaceRandomAccessManagedObject<R extends MOTableRow>- Parameters:
instanceID- the OID suffix identifying the instance to export, for scalars this is "0" and for tabular objects this is the row index.- Returns:
- the SNMP data of the instance where the OID identifies the sub-instance (i.e. the column sub-ID for row instances and "0" for scalar objects).
-
instanceIterator
- Specified by:
instanceIteratorin interfaceRandomAccessManagedObject<R extends MOTableRow>
-
getInstanceSubID
public org.snmp4j.smi.OID getInstanceSubID(org.snmp4j.smi.OID instanceOID) Returns the instance sub-identifier suffix for the given instance OID. Any implementations of this method must use the same instance notion of instance identifier asimportInstance(OID, List, ImportMode),exportInstance(OID), andinstanceIterator().- Specified by:
getInstanceSubIDin interfaceRandomAccessManagedObject<R extends MOTableRow>- Parameters:
instanceOID- the fully qualifiedOIDof a SNMPVariable.- Returns:
- the instance ID that uniquely identifies the object instance the specified
Variablebelongs to within thisRandomAccessManagedObject.
-
instanceCount
public int instanceCount()Returns the number of instances managed by thisManagedObject.- Specified by:
instanceCountin interfaceRandomAccessManagedObject<R extends MOTableRow>- Returns:
- the number of instances managed by this object.
-
getID
public org.snmp4j.smi.OID getID()Description copied from interface:RegisteredManagedObjectGets the unique object ID of the managed object.- Specified by:
getIDin interfaceRegisteredManagedObject<R extends MOTableRow>- Returns:
- an OID.
-
load
Description copied from interface:SerializableManagedObjectLoads the content of the managed object from the specified input (stream).- Specified by:
loadin interfaceSerializableManagedObject<R extends MOTableRow>- Parameters:
input- aMOInputinstance.- Throws:
IOException- if an MOInput operation fails.
-
loadRow
protected void loadRow(org.snmp4j.smi.OID rowIndex, org.snmp4j.smi.Variable[] rawRowValues, int importMode) -
save
Description copied from interface:SerializableManagedObjectSaves the (non-volatile) content of this managed object to the specified output (stream).- Specified by:
savein interfaceSerializableManagedObject<R extends MOTableRow>- Parameters:
output- aMOOutputinstance.- Throws:
IOException- if an MOOutput operation fails.
-
getPersistentValues
Gets the values of a row that need to be made persistent on behalf of asave(MOOutput output)call.- Parameters:
row- a MOTableRow that is being saved into a MOOutput stream.- Returns:
- an array of
Variableinstances that need to be saved. Typically, these are all columns of the row - including hidden extension columns/values. - Since:
- 1.2
-
getDefaultValues
public org.snmp4j.smi.Variable[] getDefaultValues()Description copied from interface:MOTableReturns an array of variables where each variable corresponds to the column with the same index. If a column has a default value, the returned variable is notnulland contains that default value.- Specified by:
getDefaultValuesin interfaceMOTable<R extends MOTableRow,C extends MOColumn, M extends MOTableModel<R>> - Returns:
- the default variables for a newly created row as an array of
Variableinstances.
-
toString
-
covers
public boolean covers(org.snmp4j.smi.OID oid) Description copied from interface:MOScopeChecks if this scope covers the supplied OID. -
setValue
public boolean setValue(org.snmp4j.smi.VariableBinding newValueAndInstancceOID) Description copied from interface:ManagedObjectValueAccessSets the value of a particular MIB object instance managed by thisManagedObject. This is a low level operation, thus no change events will be fired.- Specified by:
setValuein interfaceManagedObjectValueAccess<R extends MOTableRow>- Parameters:
newValueAndInstancceOID- aVariableBindingidentifying the object instance to modify by its OID and the new value by its variable part.- Returns:
trueif the object instance exists and has been modified successfully,falseotherwise.
-