public interface MOTable<R extends MOTableRow,C extends MOColumn,M extends MOTableModel<R>> extends ManagedObject, ManagedObjectValueAccess
MOTable
interface describes SNMP conceptual tables.
In general, a conceptual table can be implemented in two different ways:
Modifier and Type | Method and Description |
---|---|
void |
addMOChangeListener(MOChangeListener l)
Adds a
MOChangeListener that needs to be informed about
state changes of this table. |
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 |
removeMOChangeListener(MOChangeListener l)
Removes a
MOChangeListener |
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.
|
setValue
org.snmp4j.smi.OID find(MOScope range)
find
in interface ManagedObject
range
- a MOScope
specifying the search range.null
if no such instance exists.int getColumnIndex(int id)
id
- a column sub-identifier (normally one based) as defined in the MIB
specification.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.C[] getColumns()
C getColumn(int index)
index
- the (zero-based) column index.MOColumn
instance describing the attributes of requested
column.MOTableCellInfo getCellInfo(org.snmp4j.smi.OID oid)
MOTableCellInfo
instance for the supplied
cell OID. The returned object contains the index, column index, and
column ID of the specified cell, if available.oid
- cell instance OID.MOTableCellInfo
instance with the index, column index
and column ID of the specified cell if available.int getColumnCount()
MOTableIndex getIndexDef()
org.snmp4j.smi.OID getIndexPart(org.snmp4j.smi.OID instanceIdentifier)
instanceIdentifier
- the OID of a column instance. The returned result is undefined, when
this OID is not a column instance OID.instanceIdentifier
column instance OID.M getModel()
org.snmp4j.smi.OID getOID()
org.snmp4j.smi.Variable[] getDefaultValues()
null
and contains that default value.Variable
instances.org.snmp4j.smi.Variable getValue(org.snmp4j.smi.OID cellOID)
getValue
in interface ManagedObjectValueAccess
cellOID
- the instance OID of the requested cell.null
if such a cell does not
exist.org.snmp4j.smi.Variable getValue(org.snmp4j.smi.OID index, int col)
index
- the row index of the cell.col
- the column index of the cell.null
if such a cell does not
exist.void addMOChangeListener(MOChangeListener l)
MOChangeListener
that needs to be informed about
state changes of this table.l
- a MOChangeListener
instance.void removeMOChangeListener(MOChangeListener l)
MOChangeListener
l
- a MOChangeListener
instance.void addMOTableRowListener(MOTableRowListener<R> l)
MOTableRowListener
listener that needs to be informed
about row changes (creation, addition, removal).l
- a MOTableRowListener
instance.void removeMOTableRowListener(MOTableRowListener<R> l)
MOTableRowListener
instance.l
- a MOTableRowListener
instance.R createRow(org.snmp4j.smi.OID index, org.snmp4j.smi.Variable[] initialValues)
MOTableRowListener
deny the row creation
attempt then null
will be returned.index
- the index OID of the new row.initialValues
- the initial values that should be assigned to the new row.MOTableRow
instance or null
if
the row cannot be created.R addNewRow(org.snmp4j.smi.OID index, org.snmp4j.smi.Variable[] initialValues)
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;
index
- the index OID of the new row.initialValues
- the initial values that should be assigned to the new row.MOTableRow
instance or null
if
the row cannot be created.R createRow(org.snmp4j.smi.OID index)
MOTableRowListener
deny the row creation attempt then null
will be returned.index
- the index OID of the new row.MOTableRow
instance or null
if
the row cannot be created.boolean addRow(R row)
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 therow
- the MOTableRow
to add.true
if the row has been added or false
if it could not be added.R removeRow(org.snmp4j.smi.OID index)
index
- the index OID of the row to remove.null
if the row cannot be found or
cannot be removed.Copyright © 2020 SNMP4J.org. All rights reserved.