|
HOME | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ireasoning.protocol.snmp.SnmpTable
This class is the base class of Snmp Table classes, such as IfTable in RFC1213.
Note: It's only intended to be used to represent MIB table on the agent side. It's not suitable for SNMP manager applications.
Field Summary | |
protected long |
_lastUpdateTime
Last update time |
protected Vector |
_rows
Rows contained in this table. |
protected OIDTreeNode |
_tableNode
The OIDTreeNode representation of this table node |
protected long |
_updateInterval
The interval for table update. |
Constructor Summary | |
SnmpTable(OIDTreeNode root,
String oid)
Constructor |
Method Summary | |
ArrayList |
addRow(Collection varbinds)
Adds a new row. |
ArrayList |
addRow(SnmpTableEntry entry)
Adds a new row. |
ArrayList |
addRow(SnmpTableEntry entry,
String suffix)
Adds a new row. |
void |
deleteAllRows()
Deletes all rows in this table |
ArrayList |
deleteRow(int index)
|
ArrayList |
deleteRow(SnmpTableEntry entry)
Deletes the specified entry |
ArrayList |
deleteRow(String indexSuffix)
Removes the row with the passed indexSuffix |
int |
getColumnCount()
Returns the number of columns in this table |
ArrayList |
getColumnOIDs()
Returns the OIDs of table column in an arraylist object |
String |
getIndexSuffix(int index)
Returns the index suffix of row at specified index |
SnmpTableEntry |
getNextOID(SnmpOID oid)
Returns null if next OID is out of this table's subtree; Its next oid is in this subtree, it returns an SnmpTableEntry object which contains the next OID (SnmpTableEntry.setOID method must be called, otherwise it may cause exceptions), caller will use SnmpTableEntry.getOID() to retrieve that OID value. |
SnmpTableEntry |
getNextOID(SnmpOID oid,
SnmpPdu pdu)
Returns null if next OID is out of this table's subtree; If the next oid is in this subtree, it returns an SnmpTableEntry object which contains the next OID (SnmpTableEntry.setOID method must be called, otherwise it may cause exceptions), caller will use SnmpTableEntry.getOID() to retrieve that OID value. |
SnmpTableEntry |
getOID(SnmpOID oid)
Returns null if passed oid doesn't exist in this subtree; a non-null object if this oid exists in this subtree. |
SnmpTableEntry |
getOID(SnmpOID oid,
SnmpPdu pdu)
Returns null if passed oid doesn't exist in this subtree; a non-null object if this oid exists in this subtree. |
SnmpTableEntry |
getRow(int index)
Returns row at specified index |
SnmpTableEntry |
getRow(String indexSuffix)
Returns row whose index suffix is equal to the passed indexSuffix |
int |
getRowCount()
Returns the number of rows in this table |
Vector |
getRows()
Returns all rows in a Vector object. |
OIDTreeNode |
getTableNode()
Returns the table node |
long |
getUpdateInterval()
Returns the interval to call update() method, in milliseconds |
boolean |
isProcessSnmpRequestDirectly()
Returns if this table processes snmp requests directly or not |
boolean |
isTimeToUpdate()
Tests if it's time to call update() method |
abstract SnmpTableEntry |
newEntryInstance()
Returns a new instance of SnmpTableEntry object |
void |
postAddRow(SnmpTableEntry entry)
Gets called after this row is added |
void |
postDeleteRow(SnmpTableEntry entry)
Gets called after this row is deleted |
void |
postSetValue(SnmpTableEntry entry,
SnmpVarBind newValue,
Collection varbinds)
Deprecated, use postSetValue instead |
void |
postSetValue(SnmpTableEntry entry,
SnmpVarBind newValue,
SnmpPdu pdu)
Gets called after setting new value to the passed entry object. |
boolean |
preAddRow(SnmpTableEntry entry)
Gets called before this row is added. |
boolean |
preDeleteRow(SnmpTableEntry entry)
Gets called before this row is deleted. |
boolean |
preSetValue(SnmpTableEntry entry,
SnmpVarBind newValue,
Collection varbinds)
Deprecated, use preSetValue instead |
void |
preSetValue(SnmpTableEntry entry,
SnmpVarBind newValue,
SnmpPdu pdu)
Gets called before setting new value to the passed entry object when agent receives an SNMP SET request. |
void |
setLastUpdateTime(long l)
Sets the last update time |
void |
setProcessSnmpRequestDirectly(boolean b)
If passed flag is true, SnmpBaseAgent class will relay SNMP request to this table object, and respective getter/setter methods of this table object will be invoked to process the requests falling into the subtree of this table |
void |
setTableNode(OIDTreeNode n)
Sets table node |
void |
setUpdateInterval(long interval)
Sets the interval to call update() method |
void |
update()
Deprecated. |
void |
update(SnmpPdu pdu,
SnmpOID currentOID)
This method will be called when agent gets new requests and update interval has already passed (similar to the cache functionalities. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected OIDTreeNode _tableNode
protected Vector _rows
protected long _updateInterval
protected long _lastUpdateTime
update(SnmpPdu pdu, SnmpOID currentOID)
Constructor Detail |
public SnmpTable(OIDTreeNode root, String oid)
root
- the root node of MIB treeoid
- the OID value of this table nodeMethod Detail |
public OIDTreeNode getTableNode()
public void setTableNode(OIDTreeNode n)
n
- the new table nodepublic abstract SnmpTableEntry newEntryInstance()
public ArrayList addRow(SnmpTableEntry entry, String suffix)
SnmpTableMBean
Note: It's not the preferred method for adding rows in most cases. addRow(SnmpTableEntry entry) method should be used instead.
addRow
in interface SnmpTableMBean
entry
- the new row to be addedsuffix
- the index suffix
SnmpTableMBean.addRow(SnmpTableEntry)
public ArrayList addRow(SnmpTableEntry entry)
SnmpTableMBean
addRow
in interface SnmpTableMBean
entry
- the new row to be added
public ArrayList addRow(Collection varbinds)
SnmpTableMBean
addRow
in interface SnmpTableMBean
varbinds
- an array of SnmpVarBind objects, which contain the name/value of each column.
public ArrayList deleteRow(int index)
public ArrayList deleteRow(String indexSuffix)
SnmpTableMBean
indexSuffix
deleteRow
in interface SnmpTableMBean
indexSuffix
- the index suffix of the row to be removed
public ArrayList deleteRow(SnmpTableEntry entry)
SnmpTableMBean
deleteRow
in interface SnmpTableMBean
public void deleteAllRows()
public String getIndexSuffix(int index)
SnmpTableMBean
getIndexSuffix
in interface SnmpTableMBean
index
- the row indexpublic int getRowCount()
SnmpTableMBean
getRowCount
in interface SnmpTableMBean
public int getColumnCount()
SnmpTableMBean
getColumnCount
in interface SnmpTableMBean
public Vector getRows()
SnmpTableMBean
Vector
object. Each element in the vector
is a SnmpTableEntry
object.
getRows
in interface SnmpTableMBean
public SnmpTableEntry getRow(int index)
SnmpTableMBean
getRow
in interface SnmpTableMBean
index
- the row indexpublic SnmpTableEntry getRow(String indexSuffix)
SnmpTableMBean
indexSuffix
getRow
in interface SnmpTableMBean
SnmpTableEntry
object. Or null if nothing found.public boolean isTimeToUpdate()
setUpdateInterval(long)
,
update(SnmpPdu pdu, SnmpOID currentOID)
public void update(SnmpPdu pdu, SnmpOID currentOID)
pdu
- received pducurrentOID
- the oid being processedpublic void update()
update(SnmpPdu pdu, SnmpOID currentOID)
instead.
update(SnmpPdu pdu, SnmpOID currentOID)
public void setUpdateInterval(long interval)
interval
- time interval, in millisecondsupdate(SnmpPdu pdu, SnmpOID currentOID)
public long getUpdateInterval()
update(SnmpPdu pdu, SnmpOID currentOID)
public void setLastUpdateTime(long l)
public boolean preAddRow(SnmpTableEntry entry)
SnmpTableMBean
preAddRow
in interface SnmpTableMBean
entry
- an instance of SnmpTableEntry or its sub class
public void postAddRow(SnmpTableEntry entry)
SnmpTableMBean
postAddRow
in interface SnmpTableMBean
entry
- an instance of SnmpTableEntry or its sub classpublic boolean preDeleteRow(SnmpTableEntry entry)
SnmpTableMBean
preDeleteRow
in interface SnmpTableMBean
entry
- an instance of SnmpTableEntry or its sub class
public void postDeleteRow(SnmpTableEntry entry)
SnmpTableMBean
postDeleteRow
in interface SnmpTableMBean
entry
- an instance of SnmpTableEntry or its sub classpublic void preSetValue(SnmpTableEntry entry, SnmpVarBind newValue, SnmpPdu pdu)
SnmpTableMBean
Because SNMP SET operation is atomic, you may need to override this method in
your table classes which accept SET operations, and check the validity of passed newValue
and the pdu object. If the value is not acceptable, SnmpException
needs to be thrown, so this SET operation fails
and proper error code is returned to SNMP manager.
Note: SNMP version information of the received packet
can be retrieved by calling pdu.getVersion()
preSetValue
in interface SnmpTableMBean
entry
- SnmpTableEntry object for the row affected. It is null if this table is self-managed or this
SET request is for creating a new row. For dynamic row creation, the passed entry
is null, overriding
preAddRow(SnmpTableEntry entry)
method to get its valuenewValue
- the new value which is being processedpdu
- PDU object received
public boolean preSetValue(SnmpTableEntry entry, SnmpVarBind newValue, Collection varbinds)
preSetValue
instead
preSetValue
in interface SnmpTableMBean
public void postSetValue(SnmpTableEntry entry, SnmpVarBind newValue, SnmpPdu pdu)
SnmpTableMBean
postSetValue
in interface SnmpTableMBean
entry
- SnmpTableEntry object for the row affected. It is null if this table is self-managed or this
SET request is for creating a new row. For dynamic row creation, the passed entry
is null, overriding
postAddRow(SnmpTableEntry entry)
method to get its valuenewValue
- the new value which is being processedpdu
- PDU object receivedpublic void postSetValue(SnmpTableEntry entry, SnmpVarBind newValue, Collection varbinds)
postSetValue
instead
postSetValue
in interface SnmpTableMBean
public void setProcessSnmpRequestDirectly(boolean b)
The default value is false. Setting it to true is NOT recommended for most tables. It's appropriate when table takes too much memory space if using its table entry class.
if setProcessSnmpRequestDirectly(true), then these two methods must be implemented:
getOID(SnmpOID oid)
and
getNextOID(SnmpOID oid)
public boolean isProcessSnmpRequestDirectly()
public SnmpTableEntry getNextOID(SnmpOID oid, SnmpPdu pdu)
SnmpTableMBean
If setProcessSnmpRequestDirectly(true)
is invoked for the table,
this method is required, otherwise this method won't be used.
getNextOID
in interface SnmpTableMBean
oid
- oid to be processedpdu
- PDU object receivedpublic SnmpTableEntry getNextOID(SnmpOID oid)
SnmpTableMBean
If setProcessSnmpRequestDirectly(true)
is invoked for the table,
this method is required, otherwise this method won't be used.
getNextOID
in interface SnmpTableMBean
public SnmpTableEntry getOID(SnmpOID oid, SnmpPdu pdu)
SnmpTableMBean
If setProcessSnmpRequestDirectly(true)
is invoked for the table,
this method is required, otherwise this method won't be used.
getOID
in interface SnmpTableMBean
oid
- oid to be processedpdu
- PDU object receivedpublic SnmpTableEntry getOID(SnmpOID oid)
SnmpTableMBean
If setProcessSnmpRequestDirectly(true)
is invoked for the table,
this method is required, otherwise this method won't be used.
getOID
in interface SnmpTableMBean
public ArrayList getColumnOIDs()
|
HOME | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |