Class DefaultMOTable<R extends MOTableRow,C extends MOColumn,M extends MOTableModel<R>>

java.lang.Object
org.snmp4j.agent.mo.DefaultMOTable<R,C,M>
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

public class DefaultMOTable<R extends MOTableRow,C extends MOColumn,M extends MOTableModel<R>> extends Object implements MOTable<R,C,M>, MOScope, SerializableManagedObject<SubRequest<?>>, RandomAccessManagedObject<SubRequest<?>>
The 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.7.0
Author:
Frank Fock
  • Field Details

  • Constructor Details

    • DefaultMOTable

      public DefaultMOTable(org.snmp4j.smi.OID oid, MOTableIndex indexDef, C[] columns)
      Creates a new SNMP table with the specified "Entry" OID, INDEX, columns, and a DefaultMOMutableTableModel as 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

      public DefaultMOTable(org.snmp4j.smi.OID oid, MOTableIndex indexDef, C[] columns, M model)
      Creates a new SNMP table with the specified "Entry" OID, INDEX, columns, and MOTableModel.
      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

      public MOTableCellInfo getCellInfo(org.snmp4j.smi.OID oid)
      Description copied from interface: MOTable
      Returns a MOTableCellInfo instance for the supplied cell OID. The returned object contains the index, column index, and column ID of the specified cell, if available.
      Specified by:
      getCellInfo in interface MOTable<R extends MOTableRow,C extends MOColumn,M extends MOTableModel<R>>
      Parameters:
      oid - cell instance OID.
      Returns:
      a MOTableCellInfo instance with the index, column index and column ID of the specified cell if available.
    • getColumnIndex

      public int getColumnIndex(int id)
      Description copied from interface: MOTable
      Returns the zero based column index for the specified column sub-identifier.
      Specified by:
      getColumnIndex in interface MOTable<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 by MOTable.getColumns(). A value less than zero indicates that such a column does not exists currently but could be inserted at the (-n)-1 position if n is the returned value.
    • getColumn

      public C getColumn(int index)
      Description copied from interface: MOTable
      Gets the column definition for the specified column.
      Specified by:
      getColumn in interface MOTable<R extends MOTableRow,C extends MOColumn,M extends MOTableModel<R>>
      Parameters:
      index - the (zero-based) column index.
      Returns:
      a MOColumn instance describing the attributes of requested column.
    • getColumnCount

      public int getColumnCount()
      Description copied from interface: MOTable
      Returns the number of columns in this table.
      Specified by:
      getColumnCount in interface MOTable<R extends MOTableRow,C extends MOColumn,M extends MOTableModel<R>>
      Returns:
      the column count.
    • createRow

      public R 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. If the underlying table model is not a MOMutableTableModel instance or if one of the MOTableRowListener deny the row creation attempt then null will be returned.
      Specified by:
      createRow in interface MOTable<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 MOTableRow instance or null if 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 a MOMutableTableModel instance or if one of the MOTableRowListener deny the row creation attempt then null will be returned. The MOTableRowEvent.OriginType specifies 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.external or MOTableRowEvent.OriginType.internal) of this event.
      Returns:
      the created MOTableRow instance or null if the row cannot be created.
      Since:
      3.3.0
    • addNewRow

      public R addNewRow(org.snmp4j.smi.OID index, org.snmp4j.smi.Variable[] initialValues)
      Description copied from interface: MOTable
      Creates a new row for this table with the supplied index and initial values and then immediately calls MOTable.addRow(MOTableRow). If one of the MOTableRowListener deny the row creation attempt then null will be returned and MOTable.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:
      addNewRow in interface MOTable<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 MOTableRow instance or null if the row cannot be created.
    • createRow

      public R createRow(org.snmp4j.smi.OID index)
      Description copied from interface: MOTable
      Creates a new row for this table with the supplied index and default values. If one of the MOTableRowListener deny the row creation attempt then null will be returned.
      Specified by:
      createRow in interface MOTable<R extends MOTableRow,C extends MOColumn,M extends MOTableModel<R>>
      Parameters:
      index - the index OID of the new row.
      Returns:
      the created MOTableRow instance or null if the row cannot be created.
    • addRow

      public boolean addRow(R row)
      Adds the supplied row to the underlying table model and fires the appropriate MOTableRowEvent. 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 the prepare(org.snmp4j.agent.request.SubRequest<?>) method. The MOTableRowEvent.OriginType of the fired MOTableRowEvent is set to MOTableRowEvent.OriginType.external.
      Specified by:
      addRow in interface MOTable<R extends MOTableRow,C extends MOColumn,M extends MOTableModel<R>>
      Parameters:
      row - the MOTableRow to add.
      Returns:
      true if the row has been added or false if it could not be added.
    • addRowInternal

      protected boolean addRowInternal(R row, MOTableRowEvent.OriginType originType)
      Adds the supplied row to the underlying table model and fires the appropriate MOTableRowEvent. The MOTableRowEvent.OriginType specifies whether this method is called on behalf of an external SNMP (AgentX) protocol operation or behalf of an internal load operation.
      Parameters:
      row - the MOTableRow to add.
      originType - the origin type (MOTableRowEvent.OriginType.external or MOTableRowEvent.OriginType.internal) of this event.
      Returns:
      true if the row has been added or false if it could not be added.
    • removeRow

      public R removeRow(org.snmp4j.smi.OID index)
      Description copied from interface: MOTable
      Removes the row with the specified index and returns it if the operation was successful.
      Specified by:
      removeRow in interface MOTable<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 null if 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

      public int removeAnyStorageType(Set<StorageType.StorageTypeEnum> storageTypeSet)
      Remove all rows that have a StorageType column with a value that matches one of the provided values.
      Parameters:
      storageTypeSet - a set of StorageType.StorageTypeEnum values.
      Returns:
      the number of deleted rows or -1 if the table does not contain a StorageType column.
      Since:
      3.0
    • removeAnyStorageType

      protected int removeAnyStorageType(Set<StorageType.StorageTypeEnum> storageTypeSet, int storageTypeColumn)
    • commit

      public void commit(SubRequest<?> request)
      Description copied from interface: ManagedObject
      Commit 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:
      commit in interface ManagedObject<R extends MOTableRow>
      Parameters:
      request - the SubRequest to process.
    • getIndexPart

      public final org.snmp4j.smi.OID getIndexPart(org.snmp4j.smi.OID anyOID)
      Description copied from interface: MOTable
      Returns the index part of a column instance identifier of this table.
      Specified by:
      getIndexPart in interface MOTable<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 instanceIdentifier column instance OID.
    • getCellOID

      public org.snmp4j.smi.OID getCellOID(org.snmp4j.smi.OID index, int col)
    • find

      public org.snmp4j.smi.OID find(MOScope range)
      Description copied from interface: MOTable
      Finds the object identifier of the first object instance in the specified range.
      Specified by:
      find in interface ManagedObject<R extends MOTableRow>
      Specified by:
      find in interface MOTable<R extends MOTableRow,C extends MOColumn,M extends MOTableModel<R>>
      Parameters:
      range - a MOScope specifying the search range.
      Returns:
      the OID of the lexicographic first instance in the search range or null if no such instance exists.
    • findCell

      protected MOTableCellInfo findCell(MOScope range, SubRequest<?> request)
    • getScope

      public MOScope getScope()
      Description copied from interface: ManagedObject
      Return the scope of object identifiers this managed object is managing.
      Specified by:
      getScope in interface ManagedObject<R extends MOTableRow>
      Returns:
      the MOScope that 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: MOTable
      Gets the value of the cell instance with the specified instance OID.
      Specified by:
      getValue in interface ManagedObjectValueAccess<R extends MOTableRow>
      Specified by:
      getValue in interface MOTable<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 null if such a cell does not exist.
    • getValue

      public org.snmp4j.smi.Variable getValue(org.snmp4j.smi.OID index, int col, SubRequest<?> req)
    • getValue

      public org.snmp4j.smi.Variable getValue(org.snmp4j.smi.OID index, int col)
      Description copied from interface: MOTable
      Gets the value of the cell instance in the specified column and row.
      Specified by:
      getValue in interface MOTable<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 null if such a cell does not exist.
    • getValue

      protected org.snmp4j.smi.Variable getValue(MOTableRow row, int col, SubRequest<?> req)
    • update

      public void update(MOScope updateScope)
      Update the content of this table that is covered by the supplied scope.

      This method is part of the UpdatableManagedObject interface. Although the DefaultMOTable does not implement that interface, subclasses of this class may do so easily by overriding this hook-up method.

      Parameters:
      updateScope - the scope to update. If null the whole managed object is updated.
      Since:
      1.2
      See Also:
    • update

      protected void update(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.

      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 the UpdatableManagedObject interface and implement its interface in a subclass. Then it is recommended to overwrite this method by an empty method. Otherwise, do not implement the UpdatableManagedObject interface.

      Parameters:
      range - the search range.
      request - the sub-request triggered the update or null if that request cannot be determined.
    • get

      public void get(SubRequest<?> request)
      Description copied from interface: ManagedObject
      Process a GET request and return the result in the supplied sub-request.
      Specified by:
      get in interface ManagedObject<R extends MOTableRow>
      Parameters:
      request - the SubRequest to process.
    • next

      public boolean next(SubRequest<?> request)
      Description copied from interface: ManagedObject
      Find 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:
      next in interface ManagedObject<R extends MOTableRow>
      Parameters:
      request - the SubRequest to process.
      Returns:
      true if the search request found an appropriate instance, false otherwise.
    • prepare

      public void prepare(SubRequest<?> request)
      Description copied from interface: ManagedObject
      Prepare 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:
      prepare in interface ManagedObject<R extends MOTableRow>
      Parameters:
      request - the SubRequest to process.
    • getRowModificationControlColumns

      protected List<RowModificationControlColumn> getRowModificationControlColumns()
    • getChangesFromRequest

      protected int getChangesFromRequest(org.snmp4j.smi.OID index, MOTableRow row, SubRequest<?> request, org.snmp4j.smi.Variable[] values, boolean setDefaultValues, boolean newRow)
    • hasNewRows

      protected boolean hasNewRows(Request<?,?,?> key)
    • getNewRows

      protected Map<org.snmp4j.smi.OID,R> getNewRows(Request<?,?,?> key)
    • 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

      public DefaultMOTable.ChangeSet getRowPreview(Request<?,?,?> request, org.snmp4j.smi.OID index)
      Gets a DefaultMOTable.ChangeSet that 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 other ManagedObjects 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. If null or 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 request has already been committed of the row identified by index.
      Since:
      3.0
    • cleanup

      public void cleanup(SubRequest<?> request)
      Description copied from interface: ManagedObject
      Cleanup a (sub)request and free all resources locked during the preparation phase.
      Specified by:
      cleanup in interface ManagedObject<R extends MOTableRow>
      Parameters:
      request - the SubRequest to process.
    • undo

      public void undo(SubRequest<?> request)
      Description copied from interface: ManagedObject
      Compensate (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:
      undo in interface ManagedObject<R extends MOTableRow>
      Parameters:
      request - the SubRequest to process.
    • getOID

      public org.snmp4j.smi.OID getOID()
      Description copied from interface: MOTable
      Returns the OID of the table entry.
      Specified by:
      getOID in interface MOTable<R extends MOTableRow,C extends MOColumn,M extends MOTableModel<R>>
      Returns:
      a table entry OID (including the .1 suffix).
    • setModel

      public void setModel(M model)
    • setVolatile

      public void setVolatile(boolean isVolatile)
    • getModel

      public M getModel()
      Description copied from interface: MOTable
      Gets the table model of this table.
      Specified by:
      getModel in interface MOTable<R extends MOTableRow,C extends MOColumn,M extends MOTableModel<R>>
      Returns:
      a MOTableModel instance.
    • getColumns

      public C[] getColumns()
      Description copied from interface: MOTable
      Gets the column definitions for this table.
      Specified by:
      getColumns in interface MOTable<R extends MOTableRow,C extends MOColumn,M extends MOTableModel<R>>
      Returns:
      an array with the column definitions of this table.
    • getIndexDef

      public MOTableIndex getIndexDef()
      Description copied from interface: MOTable
      Gets the index definition of this table.
      Specified by:
      getIndexDef in interface MOTable<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: SerializableManagedObject
      Tests if this instance of a SerializableManagedObject should be serialized or deserialized through persistent storage load or save operation.
      Specified by:
      isVolatile in interface RandomAccessManagedObject<R extends MOTableRow>
      Specified by:
      isVolatile in interface SerializableManagedObject<R extends MOTableRow>
      Returns:
      true if SerializableManagedObject.load(org.snmp4j.agent.io.MOInput) and SerializableManagedObject.save(org.snmp4j.agent.io.MOOutput) should not be called through a persistent storage operation and false if these method should be called.
    • getLowerBound

      public org.snmp4j.smi.OID getLowerBound()
      Description copied from interface: MOScope
      Gets the lower bound OID of the scope. Whether the lower bound is included or excluded from the scope's region is determined by MOScope.isLowerIncluded().
      Specified by:
      getLowerBound in interface MOScope
      Returns:
      an OID.
    • getUpperBound

      public org.snmp4j.smi.OID getUpperBound()
      Description copied from interface: MOScope
      Gets the upper bound OID of the scope. Whether the upper bound is included or excluded from the scope's region is determined by MOScope.isUpperIncluded().
      Specified by:
      getUpperBound in interface MOScope
      Returns:
      OID
    • isLowerIncluded

      public boolean isLowerIncluded()
      Description copied from interface: MOScope
      Indicates whether the lower bound OID is included in the scope or not.
      Specified by:
      isLowerIncluded in interface MOScope
      Returns:
      true if the lower bound is included.
    • isUpperIncluded

      public boolean isUpperIncluded()
      Description copied from interface: MOScope
      Indicates whether the upper bound OID is included in the scope or not.
      Specified by:
      isUpperIncluded in interface MOScope
      Returns:
      true if the upper bound is included.
    • isCovered

      public boolean isCovered(MOScope other)
      Description copied from interface: MOScope
      Checks whether the supplied scope is covered by this scope.
      Specified by:
      isCovered in interface MOScope
      Parameters:
      other - the MOScope to check
      Returns:
      true if the lower bound of other is greater or equal than the lower bound of this scope and if the upper bound of other is lower or equal than the upper bound of this scope.
    • isOverlapping

      public boolean isOverlapping(MOScope other)
      Description copied from interface: MOScope
      Checks whether the supplied scope overlap with this one, thus sharing at least one OID with the supplied one.
      Specified by:
      isOverlapping in interface MOScope
      Parameters:
      other - a MOScope.
      Returns:
      true if there exists at least one OID that is included in both scopes.
    • addMOChangeListener

      public void addMOChangeListener(MOChangeListener l)
      Description copied from interface: ChangeableManagedObject
      Adds a MOChangeListener that needs to be informed about state changes of this ManagedObject.
      Specified by:
      addMOChangeListener in interface ChangeableManagedObject<R extends MOTableRow>
      Parameters:
      l - a MOChangeListener instance.
    • removeMOChangeListener

      public void removeMOChangeListener(MOChangeListener l)
      Description copied from interface: ChangeableManagedObject
      Removes a MOChangeListener from this ManagedObject.
      Specified by:
      removeMOChangeListener in interface ChangeableManagedObject<R extends MOTableRow>
      Parameters:
      l - a MOChangeListener instance.
    • fireBeforePrepareMOChange

      protected void fireBeforePrepareMOChange(MOChangeEvent changeEvent)
    • fireAfterPrepareMOChange

      protected void fireAfterPrepareMOChange(MOChangeEvent changeEvent)
    • fireBeforeMOChange

      protected void fireBeforeMOChange(MOChangeEvent changeEvent)
    • fireAfterMOChange

      protected void fireAfterMOChange(MOChangeEvent changeEvent)
    • addMOTableRowListener

      public void addMOTableRowListener(MOTableRowListener<R> l)
      Description copied from interface: MOTable
      Adds a MOTableRowListener listener that needs to be informed about row changes (creation, addition, removal).
      Specified by:
      addMOTableRowListener in interface MOTable<R extends MOTableRow,C extends MOColumn,M extends MOTableModel<R>>
      Parameters:
      l - a MOTableRowListener instance.
    • 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 a MOTableRelation) with the provided table entry object identifier.
      Parameters:
      dependentTableID - the OID of the MOTable that is linked with a MOTableRelation as dependent table.
      index - the row index of the dependent's table row that should be returned.
      Returns:
      a MOTableRow if such a row exists or null otherwise.
      Since:
      3.0
    • fireRowExistsEvent

      protected void fireRowExistsEvent(MOTableRowListener<R> l)
      Fires a MOTableRowEvent.EXISTS for all rows in this table if the provided listener actively subscribes to all such events this time by setting MOTableRowEvent.setSendNextEventsOfSameOrigin(boolean) to true on the first rows and following events.
      Parameters:
      l - the table row listener.
    • removeMOTableRowListener

      public void removeMOTableRowListener(MOTableRowListener<R> l)
      Description copied from interface: MOTable
      Removes MOTableRowListener instance.
      Specified by:
      removeMOTableRowListener in interface MOTable<R extends MOTableRow,C extends MOColumn,M extends MOTableModel<R>>
      Parameters:
      l - a MOTableRowListener instance.
    • fireRowChanged

      protected void fireRowChanged(MOTableRowEvent<R> event)
    • importInstance

      public boolean importInstance(org.snmp4j.smi.OID instanceID, List<org.snmp4j.smi.VariableBinding> data, ImportMode importMode)
      Description copied from interface: RandomAccessManagedObject
      Imports the data that internally represents the instance specified by the OID suffix instanceID from the byte data provided which can be encoded in any representation the ManagedObject is able to understand.
      Specified by:
      importInstance in interface RandomAccessManagedObject<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 be null!
      Returns:
      true if the import was successful, false otherwise.
    • 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 secret OctetString convert OctetString to SecretOctetString.
      Parameters:
      rawValues - the complete raw values (including regular columns).
      startIndexHidden - the array index of rawValues where the hidden columns start.
      Returns:
      the restored raw values, including any hidden columns. By default rawValues is 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:
      isVolatile in interface RandomAccessManagedObject<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:
      true if the specified sub-instance exists and is StorageType.volatile_.
      Since:
      3.2.0
    • exportInstance

      public List<org.snmp4j.smi.VariableBinding> exportInstance(org.snmp4j.smi.OID instanceID)
      Description copied from interface: RandomAccessManagedObject
      Exports the byte representation of an instance of the ManagedObject.
      Specified by:
      exportInstance in interface RandomAccessManagedObject<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

      public Iterator<org.snmp4j.smi.OID> instanceIterator()
      Specified by:
      instanceIterator in interface RandomAccessManagedObject<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 as importInstance(OID, List, ImportMode), exportInstance(OID), and instanceIterator().
      Specified by:
      getInstanceSubID in interface RandomAccessManagedObject<R extends MOTableRow>
      Parameters:
      instanceOID - the fully qualified OID of a SNMP Variable.
      Returns:
      the instance ID that uniquely identifies the object instance the specified Variable belongs to within this RandomAccessManagedObject.
    • instanceCount

      public int instanceCount()
      Returns the number of instances managed by this ManagedObject.
      Specified by:
      instanceCount in interface RandomAccessManagedObject<R extends MOTableRow>
      Returns:
      the number of instances managed by this object.
    • getID

      public org.snmp4j.smi.OID getID()
      Description copied from interface: RegisteredManagedObject
      Gets the unique object ID of the managed object.
      Specified by:
      getID in interface RegisteredManagedObject<R extends MOTableRow>
      Returns:
      an OID.
    • load

      public void load(MOInput input) throws IOException
      Description copied from interface: SerializableManagedObject
      Loads the content of the managed object from the specified input (stream).
      Specified by:
      load in interface SerializableManagedObject<R extends MOTableRow>
      Parameters:
      input - a MOInput instance.
      Throws:
      IOException - if an MOInput operation fails.
    • loadRow

      protected void loadRow(org.snmp4j.smi.OID rowIndex, org.snmp4j.smi.Variable[] rawRowValues, int importMode)
    • save

      public void save(MOOutput output) throws IOException
      Description copied from interface: SerializableManagedObject
      Saves the (non-volatile) content of this managed object to the specified output (stream).
      Specified by:
      save in interface SerializableManagedObject<R extends MOTableRow>
      Parameters:
      output - a MOOutput instance.
      Throws:
      IOException - if an MOOutput operation fails.
    • getPersistentValues

      protected org.snmp4j.smi.Variable[] getPersistentValues(MOTableRow row)
      Gets the values of a row that need to be made persistent on behalf of a save(MOOutput output) call.
      Parameters:
      row - a MOTableRow that is being saved into a MOOutput stream.
      Returns:
      an array of Variable instances 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: MOTable
      Returns 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 not null and contains that default value.
      Specified by:
      getDefaultValues in interface MOTable<R extends MOTableRow,C extends MOColumn,M extends MOTableModel<R>>
      Returns:
      the default variables for a newly created row as an array of Variable instances.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • covers

      public boolean covers(org.snmp4j.smi.OID oid)
      Description copied from interface: MOScope
      Checks if this scope covers the supplied OID.
      Specified by:
      covers in interface MOScope
      Parameters:
      oid - an OID.
      Returns:
      true if oid is greater or equal the scope's lower bound and if it is less or equal its upper bound.
    • setValue

      public boolean setValue(org.snmp4j.smi.VariableBinding newValueAndInstancceOID)
      Description copied from interface: ManagedObjectValueAccess
      Sets the value of a particular MIB object instance managed by this ManagedObject. This is a low level operation, thus no change events will be fired.
      Specified by:
      setValue in interface ManagedObjectValueAccess<R extends MOTableRow>
      Parameters:
      newValueAndInstancceOID - a VariableBinding identifying the object instance to modify by its OID and the new value by its variable part.
      Returns:
      true if the object instance exists and has been modified successfully, false otherwise.
    • isConfigurable

      public boolean isConfigurable()
      Description copied from interface: SerializableManagedObject
      Defines if this managed object can be configured even though SerializableManagedObject.isVolatile() returns true, i.e., initialized once the server enters its AgentConfigManager.configure() phase. If SerializableManagedObject.isVolatile() returns false, the value of this method is false too, then an initial configuration is rejected (ignored) but the value of the object will be persistent though.
      Specified by:
      isConfigurable in interface SerializableManagedObject<R extends MOTableRow>
      Returns:
      true if this object can be configured by AgentConfigManager.configure(), otherwise its value will not be changed during agent configuration phase. Default is true.
    • setConfigurable

      public void setConfigurable(boolean configurable)
      Sets the isConfigurable flag which allows configuration of this table during AgentConfigManager.configure() even if isVolatile() is true.
      Parameters:
      configurable - set this to false to reject any changes to this table even if only donw during configuration. Default is true.
      Since:
      3.7.0