HOME

com.ireasoning.protocol.snmp
Interface SnmpTableMBean

All Known Implementing Classes:
SnmpTable

public interface SnmpTableMBean

The MBean interface of SnmpTable class


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.
 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
 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.
 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.
 

Method Detail

addRow

public ArrayList addRow(SnmpTableEntry entry,
                        String suffix)
Adds a new row.

Note: It's not the preferred method for adding rows in most cases. addRow(SnmpTableEntry entry) method should be used instead.

Parameters:
entry - the new row to be added
suffix - the index suffix
Returns:
an arraylist of newly added OIDTreeNode objects. If nothing added, an empty arraylist is returned.
See Also:
addRow(SnmpTableEntry)

addRow

public ArrayList addRow(SnmpTableEntry entry)
Adds a new row.

Parameters:
entry - the new row to be added
Returns:
an arraylist of newly added OIDTreeNode objects. If nothing added, an empty arraylist is returned.

addRow

public ArrayList addRow(Collection varbinds)
Adds a new row.

Parameters:
varbinds - an array of SnmpVarBind objects, which contain the name/value of each column.
Returns:
an ArrayList of newly added OIDTreeNode objects. If nothing added, an empty arraylist is returned.

deleteRow

public ArrayList deleteRow(SnmpTableEntry entry)
Deletes the specified entry

Returns:
A collection of SnmpOID objects which are the deleted nodes' SnmpOID

deleteRow

public ArrayList deleteRow(String indexSuffix)
Removes the row with the passed indexSuffix

Parameters:
indexSuffix - the index suffix of the row to be removed
Returns:
An ArrayList of SnmpOID objects which are the deleted nodes' SnmpOID. An empty ArrayList object is returned if nothing is deleted.

getIndexSuffix

public String getIndexSuffix(int index)
Returns the index suffix of row at specified index

Parameters:
index - the row index
Throws:
IndexOutOfBoundsException - if index is out of range (index < 0 || index >= size()).

getRowCount

public int getRowCount()
Returns the number of rows in this table


getColumnCount

public int getColumnCount()
Returns the number of columns in this table


getRow

public SnmpTableEntry getRow(int index)
Returns row at specified index

Parameters:
index - the row index
Throws:
IndexOutOfBoundsException - if index is out of range (index < 0 || index >= size()).

getRow

public SnmpTableEntry getRow(String indexSuffix)
Returns row whose index suffix is equal to the passed indexSuffix

Returns:
the SnmpTableEntry object. Or null if nothing found.

getRows

public Vector getRows()
Returns all rows in a Vector object. Each element in the vector is a SnmpTableEntry object.


preAddRow

public boolean preAddRow(SnmpTableEntry entry)
Gets called before this row is added. Subclass can override this method if it wants to do some checkings before adding row.

Parameters:
entry - an instance of SnmpTableEntry or its sub class
Returns:
return true to add row; return false not to add row

postAddRow

public void postAddRow(SnmpTableEntry entry)
Gets called after this row is added

Parameters:
entry - an instance of SnmpTableEntry or its sub class

preDeleteRow

public boolean preDeleteRow(SnmpTableEntry entry)
Gets called before this row is deleted. Subclass can override this method if it wants to do some checkings before deleting row.

Parameters:
entry - an instance of SnmpTableEntry or its sub class
Returns:
true if continue to delete row, false so this row won't be deleted.

postDeleteRow

public void postDeleteRow(SnmpTableEntry entry)
Gets called after this row is deleted

Parameters:
entry - an instance of SnmpTableEntry or its sub class

preSetValue

public 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.

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()

Parameters:
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 value
newValue - the new value which is being processed
pdu - PDU object received
Returns:
true if no error; otherwise it indicates an unknown error
Throws:
SnmpException - Throw an SnmpException if the passed newValue is not acceptable, and you need to set SnmpException object's errorStatus field, which will be used in the response PDU's errorStatus field.

preSetValue

public boolean preSetValue(SnmpTableEntry entry,
                           SnmpVarBind newValue,
                           Collection varbinds)
Deprecated, use preSetValue instead


postSetValue

public void postSetValue(SnmpTableEntry entry,
                         SnmpVarBind newValue,
                         SnmpPdu pdu)
Gets called after setting new value to the passed entry object.

Parameters:
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 value
newValue - the new value which is being processed
pdu - PDU object received

postSetValue

public void postSetValue(SnmpTableEntry entry,
                         SnmpVarBind newValue,
                         Collection varbinds)
Deprecated, use postSetValue instead


getNextOID

public 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. The returned SnmpTableEntry object will be passed to corresponding getter/setter methods. If it's not feasible to create a meaningful SnmpTableEntry, you can just create a empty SnmpTableEntry object with the next oid.

If setProcessSnmpRequestDirectly(true) is invoked for the table, this method is required, otherwise this method won't be used.

Parameters:
oid - oid to be processed
pdu - PDU object received

getNextOID

public 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. The returned SnmpTableEntry object will be passed to corresponding getter/setter methods. If it's not feasible to create a meaningful SnmpTableEntry, you can just create a empty SnmpTableEntry object with the next oid.

If setProcessSnmpRequestDirectly(true) is invoked for the table, this method is required, otherwise this method won't be used.


getOID

public 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.

If setProcessSnmpRequestDirectly(true) is invoked for the table, this method is required, otherwise this method won't be used.

Parameters:
oid - oid to be processed
pdu - PDU object received

getOID

public 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.

If setProcessSnmpRequestDirectly(true) is invoked for the table, this method is required, otherwise this method won't be used.


HOME

Copyright © 2002 iReasoning Inc. All Rights Reserved.