Module org.snmp4j.agent
Package org.snmp4j.agent.mo
Class MOColumn<V extends org.snmp4j.smi.Variable>
- java.lang.Object
-
- org.snmp4j.agent.mo.MOColumn<V>
-
- All Implemented Interfaces:
Comparable<MOColumn<V>>
- Direct Known Subclasses:
MOMutableColumn
,TimeStamp
public class MOColumn<V extends org.snmp4j.smi.Variable> extends Object implements Comparable<MOColumn<V>>
TheMOColumn
class represents columnar SMI objects. It represents all instances of a table's column not only a single instance (cell).Objects represented by
MOColumn
cannot be modified via SNMP, thusMOColumn
supports read-only maximum access only.- Version:
- 2.6
- Author:
- Frank Fock
- See Also:
MOMutableColumn
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(MOColumn<V> column)
Compares this managed object column by its ID with another column.void
get(SubRequest<?> subRequest, MOTableRow row, int column)
Process a get sub-request for the specified table row and column.MOAccess
getAccess()
int
getColumnID()
org.snmp4j.smi.Variable
getRestoreValue(org.snmp4j.smi.Variable[] rowValues, int column)
Return the restore value for this column and the given row.org.snmp4j.smi.Variable
getStoreValue(MOTableRow row, int column)
Return the content of this column's value of the given row for persistent storage.int
getSyntax()
MOTable
getTable()
V
getValue(MOTableRow row, int column, SubRequest<?> subRequest)
Gets the value of the specified column from the provided row.boolean
isVolatile(MOTableRow row, int column)
Tests if the supplied row is volatile or persistent.void
setAccess(MOAccess access)
void
setColumnID(int columnID)
void
setSyntax(int syntax)
<R extends MOTableRow>
voidsetTable(MOTable<R,? extends MOColumn,? extends MOTableModel<R>> table)
Sets the table instance this columnar object is contained in.String
toString()
-
-
-
Constructor Detail
-
MOColumn
public MOColumn(int columnID, int syntax)
Creates a read-only column object with the given column and syntax.- Parameters:
columnID
- the column ID which is ID the last sub-identifier of the corresponding OBJECT-TYPE definition.syntax
- the syntax of the objects in this column. SeeSMIConstants
for possible values.
-
MOColumn
public MOColumn(int columnID, int syntax, MOAccess access)
Creates a column object with the given column, syntax, and maximum access. SinceMOColumn
only supports read-only columns the only reasonable values foraccess
are 'not-accessible' and 'read-only'. Generally this constructor should not be called directly.- Parameters:
columnID
- the column ID which is ID the last sub-identifier of the corresponding OBJECT-TYPE definition.syntax
- the syntax of the objects in this column. SeeSMIConstants
for possible values.access
- the maximum access of the column.
-
-
Method Detail
-
setColumnID
public void setColumnID(int columnID)
-
setSyntax
public void setSyntax(int syntax)
-
setAccess
public void setAccess(MOAccess access)
-
setTable
public <R extends MOTableRow> void setTable(MOTable<R,? extends MOColumn,? extends MOTableModel<R>> table)
Sets the table instance this columnar object is contained in. This method should be called byMOTable
instance to register the table with the column.- Type Parameters:
R
- theMOTableRow
type supported by the table.- Parameters:
table
- theMOTable
instance where this column is contained in.
-
getColumnID
public int getColumnID()
-
getSyntax
public int getSyntax()
-
getAccess
public MOAccess getAccess()
-
getTable
public MOTable getTable()
-
getValue
public V getValue(MOTableRow row, int column, SubRequest<?> subRequest)
Gets the value of the specified column from the provided row. The optionalsubRequest
parameter provides information on the currently processed SNMP request if the value retrieval is trigger by a SNMP command.- Parameters:
row
- the row with the value to be returned.column
- the column index pointing to the column to return in the above row.subRequest
- an optional sub-request on which behalf this value retrieval is executed.- Returns:
- the value as a pointer to the cell value or
null
if such a value does not exist. - Since:
- 2.6
-
isVolatile
public boolean isVolatile(MOTableRow row, int column)
Tests if the supplied row is volatile or persistent. If volatile then the row will not be saved when the table is saved to persistent storage.- Parameters:
row
- a row of the table where this column is part of.column
- the column index of this column inrow
.- Returns:
true
ifrow
should not be
-
getRestoreValue
public org.snmp4j.smi.Variable getRestoreValue(org.snmp4j.smi.Variable[] rowValues, int column)
Return the restore value for this column and the given row.- Parameters:
rowValues
- a row of the table where this column is part of.column
- the column index of this column inrow
.- Returns:
- the restored value. By default this is
rowValues[column]
. - Since:
- 2.4
-
getStoreValue
public org.snmp4j.smi.Variable getStoreValue(MOTableRow row, int column)
Return the content of this column's value of the given row for persistent storage.- Parameters:
row
- a row of the table where this column is part of.column
- the column index of this column inrow
.- Returns:
- the value to be stored persistently for this
row
andcolumn
. - Since:
- 2.4
-
compareTo
public int compareTo(MOColumn<V> column)
Compares this managed object column by its ID with another column.- Specified by:
compareTo
in interfaceComparable<V extends org.snmp4j.smi.Variable>
- Parameters:
column
- anotherMOColumn
.- Returns:
- int a negative integer, zero, or a positive integer as this column ID is less than, equal to, or greater than the specified object's column ID.
-
get
public void get(SubRequest<?> subRequest, MOTableRow row, int column)
Process a get sub-request for the specified table row and column.- Parameters:
subRequest
- the GET sub-request to execute.row
- the row that contains the value to return in the GET response PDU.column
- the column index of the value to return insubRequest
-
-