Interface MOTable<R extends MOTableRow,C extends MOColumn,M extends MOTableModel<R>>

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addMOTableRowListener​(MOTableRowListener<R> l)
      Adds a MOTableRowListener listener that needs to be informed about row changes (creation, addition, removal).
      R 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 calls addRow(MOTableRow).
      boolean addRow​(R row)
      Adds the supplied row to the underlying table model and fires the appropriate MOTableRowEvent.
      R createRow​(org.snmp4j.smi.OID index)
      Creates a new row for this table with the supplied index and default values.
      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.
      org.snmp4j.smi.OID find​(MOScope range)
      Finds the object identifier of the first object instance in the specified range.
      MOTableCellInfo getCellInfo​(org.snmp4j.smi.OID oid)
      Returns a MOTableCellInfo instance for the supplied cell OID.
      C getColumn​(int index)
      Gets the column definition for the specified column.
      int getColumnCount()
      Returns the number of columns in this table.
      int getColumnIndex​(int id)
      Returns the zero based column index for the specified column sub-identifier.
      C[] getColumns()
      Gets the column definitions for this table.
      org.snmp4j.smi.Variable[] getDefaultValues()
      Returns an array of variables where each variable corresponds to the column with the same index.
      MOTableIndex getIndexDef()
      Gets the index definition of this table.
      org.snmp4j.smi.OID getIndexPart​(org.snmp4j.smi.OID instanceIdentifier)
      Returns the index part of a column instance identifier of this table.
      M getModel()
      Gets the table model of this table.
      org.snmp4j.smi.OID getOID()
      Returns the OID of the table entry.
      org.snmp4j.smi.Variable getValue​(org.snmp4j.smi.OID cellOID)
      Gets the value of the cell instance with the specified instance OID.
      org.snmp4j.smi.Variable getValue​(org.snmp4j.smi.OID index, int col)
      Gets the value of the cell instance in the specified column and row.
      void removeMOTableRowListener​(MOTableRowListener<R> l)
      Removes MOTableRowListener instance.
      R removeRow​(org.snmp4j.smi.OID index)
      Removes the row with the specified index and returns it if the operation was successful.
    • Method Detail

      • find

        org.snmp4j.smi.OID find​(MOScope range)
        Finds the object identifier of the first object instance in the specified range.
        Specified by:
        find in interface ManagedObject<R extends MOTableRow>
        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.
      • getColumnIndex

        int getColumnIndex​(int id)
        Returns the zero based column index for the specified column sub-identifier.
        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 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.
      • getColumns

        C[] getColumns()
        Gets the column definitions for this table.
        Returns:
        an array with the column definitions of this table.
      • getColumn

        C getColumn​(int index)
        Gets the column definition for the specified column.
        Parameters:
        index - the (zero-based) column index.
        Returns:
        a MOColumn instance describing the attributes of requested column.
      • getCellInfo

        MOTableCellInfo getCellInfo​(org.snmp4j.smi.OID oid)
        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.
        Parameters:
        oid - cell instance OID.
        Returns:
        a MOTableCellInfo instance with the index, column index and column ID of the specified cell if available.
      • getColumnCount

        int getColumnCount()
        Returns the number of columns in this table.
        Returns:
        the column count.
      • getIndexDef

        MOTableIndex getIndexDef()
        Gets the index definition of this table.
        Returns:
        a MOTableIndex instance containing the sub-index definitions for this table.
      • getIndexPart

        org.snmp4j.smi.OID getIndexPart​(org.snmp4j.smi.OID instanceIdentifier)
        Returns the index part of a column instance identifier of this table.
        Parameters:
        instanceIdentifier - 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.
      • getModel

        M getModel()
        Gets the table model of this table.
        Returns:
        a MOTableModel instance.
      • getOID

        org.snmp4j.smi.OID getOID()
        Returns the OID of the table entry.
        Returns:
        a table entry OID (including the .1 suffix).
      • getDefaultValues

        org.snmp4j.smi.Variable[] getDefaultValues()
        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.
        Returns:
        the default variables for a newly created row as an array of Variable instances.
      • getValue

        org.snmp4j.smi.Variable getValue​(org.snmp4j.smi.OID cellOID)
        Gets the value of the cell instance with the specified instance OID.
        Specified by:
        getValue in interface ManagedObjectValueAccess<R extends MOTableRow>
        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

        org.snmp4j.smi.Variable getValue​(org.snmp4j.smi.OID index,
                                         int col)
        Gets the value of the cell instance in the specified column and row.
        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.
      • addMOTableRowListener

        void addMOTableRowListener​(MOTableRowListener<R> l)
        Adds a MOTableRowListener listener that needs to be informed about row changes (creation, addition, removal).
        Parameters:
        l - a MOTableRowListener instance.
      • removeMOTableRowListener

        void removeMOTableRowListener​(MOTableRowListener<R> l)
        Removes MOTableRowListener instance.
        Parameters:
        l - a MOTableRowListener instance.
      • createRow

        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 one of the MOTableRowListener deny the row creation attempt then null will be returned.
        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.
      • addNewRow

        R 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 calls addRow(MOTableRow). If one of the MOTableRowListener deny the row creation attempt then null will be returned and 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;
         
        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.
        Since:
        2.2
      • createRow

        R createRow​(org.snmp4j.smi.OID index)
        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.
        Parameters:
        index - the index OID of the new row.
        Returns:
        the created MOTableRow instance or null if the row cannot be created.
      • addRow

        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
        Parameters:
        row - the MOTableRow to add.
        Returns:
        true if the row has been added or false if it could not be added.
      • removeRow

        R removeRow​(org.snmp4j.smi.OID index)
        Removes the row with the specified index and returns it if the operation was successful.
        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.