com.adventnet.snmp.beans
Class SnmpTable

java.lang.Object
  |
  +--com.adventnet.snmp.beans.SnmpServer
        |
        +--com.adventnet.snmp.beans.SnmpTarget
              |
              +--com.adventnet.snmp.beans.SnmpTable
All Implemented Interfaces:
CustomizerTemplate, java.util.EventListener, java.lang.Runnable, java.io.Serializable, java.beans.VetoableChangeListener
Direct Known Subclasses:
ClippedTable, SnmpAugmentTable, SnmpTableModel

public class SnmpTable
extends SnmpTarget
implements java.lang.Runnable

The SnmpTable class handles polling for SNMP tables. It has been designed to support the Model-View-Controller design of JFC/swing applications, although this class can be used without JFC. An extension of this class in the com.adventnet.snmp.ui package is explicitly for JFC.

To use the table class, instantiate, and identify the SNMP table to be used. Then perform operations on the table, or register for table change events. For example,

  	SnmpTable table = new SnmpTable();
  	table.setTargetHost( "localhost" ); // set the agent hostname
  	table.loadMibs("rfc1213-mib"); // load MIBs
  
table.addSnmpTableListener(listener); // specify the listener
table.setTableOID("ifTable"); // this starts polling of table data

The resources used by this class are automatically garbage collected. No need to close sessions, or other cleanup by the user.

See the getSnmpTable.java application in the applications directory.

See Also:
Serialized Form

Field Summary
static int SNMP_VARIABLE_BINDING_DATA
          Constant to specify the format in which the data has to be returned.
static int SNMP_VARIABLE_DATA
          Constant to specify the format in which the data has to be returned.
static int STRING_DATA
          Constant to specify the format in which the data has to be returned.String is the default.
 
Fields inherited from class com.adventnet.snmp.beans.SnmpTarget
serialize, SNMPGET, SNMPGETBULK, SNMPGETNEXT, SNMPINFORM, SNMPREPORT, SNMPRESPONSE, SNMPSET, SNMPTRAP, SNMPV2TRAP, VERSION1, VERSION2C, VERSION3
 
Fields inherited from class com.adventnet.snmp.beans.SnmpServer
AUTH_NO_PRIV, AUTH_PRIV, CBC_3DES, CBC_DES, CFB_AES_128, CFB_AES_192, CFB_AES_256, MD5_AUTH, NO_AUTH, NO_AUTH_NO_PRIV, NO_PRIV, oidList, SHA_AUTH
 
Constructor Summary
SnmpTable()
          Use this constructor for applications.
SnmpTable(java.applet.Applet applet)
          Use this constructor for applets.
SnmpTable(int protocol, ProtocolOptions options)
          Use this constructor for applications which uses protocols other than UDP/IP.
SnmpTable(int port, java.lang.String session)
          Use this constructor for creating a new session for this application.
SnmpTable(SnmpSession ses, MibOperations mib)
          This constructor is used to create an SnmpTable instance with a specified SnmpSession and MibOperations.
 
Method Summary
 void addRow(boolean Status, java.lang.String[] oidlist, java.lang.String[] s)
          To add a new row of data into the table.
 void addSnmpTableListener(SnmpTableListener l)
          Adds a SnmpTableListener instance to the listener's list.Whenever a change in SnmpTable occurs all the registered listeners will be notified.
protected  void checkDifferences(java.util.Vector oldData)
          This method compares current table data with old data and notifies registered listeners of changes
protected  void compareRow(int row, java.util.Vector oldData)
          This method compares current data with old data for a given row and notifies registered listeners of changes
 void deleteRow(java.lang.String oid)
          To delete a row of data from the table.
 void deleteTableRow(java.lang.String oid)
          To delete a row of data from the table.
protected  void finalize()
          Cleans up an object when there are no more references to the object.
protected  void genTableEvent(SnmpTableEvent evt)
          Generate the table events to the listeners.
 java.lang.Object getCellValue(java.lang.String tableOID, int rowIndex, int columnIndex)
          To get the value for the cell specified by the row and column index.
 java.lang.String[] getColumn(int columnIndex)
          Returns a string array of data for a column in the Table,represented by the index.
 java.lang.String[] getColumn(java.lang.String columnName)
          Returns a string array of data for a column in the Table, represented by the column name.Set the tableOID using setTableOID().
 java.lang.Class getColumnClass(int columnIndex)
          Returns the class to be used as renderer and editor for the column.
 int getColumnCount()
          Returns the number of columns in the table corresponding to the table OID already set.
 MibNode getColumnMibNode(int columnIndex)
          To Get the MibNode corresponding to the table column specified by the column index
 java.lang.String getColumnName(int columnIndex)
          Returns the name of the column specified by the column index.
 int getDataType()
          Returns the datatype in which the table data will be returned.
 int[] getHoles()
          Returns the index of the not-implemented columns.Holes are the columns that are not defined in the agent.
 java.lang.String[][] getIndices()
          Returns the indices of the SnmpTable.
 java.lang.String[][] getNotAccessibleIndex()
          Returns the values for the not-accessible indices in the table.
 java.lang.String[] getNotAccessibleIndexColumns()
          Returns the names of the not-accessible index columns in the table.
 boolean getPerformSets()
          To check if the values will get set if some change is made in any table field which has write access(any editable cell).
 void getPerformSets(boolean allowSets)
          To Activate/Deactivate an editable table field (cell).
 int getPollInterval()
          Returns the current polling interval in seconds.
 boolean getRetrievalMode()
          Returns the mode of retrieval of table data.
 SnmpVarBind[] getRow(int index)
          To get data for a table row,specified by its position in the table.
 java.lang.String[] getRow(java.lang.String tableOID, java.lang.String index)
          Returns the data for a row of the Table specified by the index .
 int getRowCount()
          Returns the number of rows of data available in the SnmpTable.
 java.lang.String getTableOID()
          To get table oid used with this SnmpTable instance.
 java.lang.Object getValueAt(int rowIndex, int columnIndex)
          To get the value for the cell specified by the row and column index.
 boolean isCellEditable(int rowIndex, int columnIndex)
          To check if the cell at the specified index is editable or not.
 void refreshTable()
          Refreshes the table data.
 void removeSnmpTableListener(SnmpTableListener l)
          Remove a listener from the list that's notified each time a change in the SNMP Table occurs.
 void run()
          The run method does polling and updates of the table at specified polling itervals.
 void setCellValue(java.lang.String tableOID, java.lang.Object aValue, int rowIndex, int columnIndex)
          Sets the value for the cell specified by the row and column index.
 void setColumnsPolled(java.util.Vector index)
          Sets the columns that needs to be polled.
 void setDataType(int type)
          Set the type in which the data has to be returned when the table data is got using the getValueAt or getCellValue methods.By default these methods will return table data as String objects.To get the table data as SnmpVar or SnmpVarBind object, the respective constant can be set using setDataType() method.
 void setObjectIDList(java.lang.String[] s)
          Sets the column names of the table that need to be polled.
 void setParams(java.lang.String host, java.lang.String mib, java.lang.String tableOID)
          To set multiple parameters like TargetHost,MibModule and TableOID
 void setPollInterval(int i)
          To set the polling interval in seconds.
 void setRetrievalMode(boolean mode)
          To set the mode of retrieval.
 void setTableOID(java.lang.String tableOID)
          Sets the table OID to be used with this SnmpTable instance.
 void setTableOIDWoStart(java.lang.String tableOID)
          To set the table OID without starting polling.
 void setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)
          Sets the value for the cell specified by the row and column index.
protected  void showErrorMessage(java.lang.String str)
           
 void startPollingTable()
          Method to start the polling of Table.This can be used after setting the table column oids using setObjectIDList.If the method setTableOID is used to set the oid of the table,this method need not be called explicitly as the setTableOID() method calls this method internally.
 void stopPollingTable()
          Method to stop the polling of Table.
 
Methods inherited from class com.adventnet.snmp.beans.SnmpTarget
addLogClient, addLogClient, addObjectID, addResultListener, addSnmpOID, addSnmpPropertyListener, addUserError, addV3HandShakeResultListener, enableDebugForPDU, genEvent, genTimeoutEvent, getAttemptComplete, getAttemptPartial, getAuthPassword, getAuthProtocol, getCommunity, getCompleteResponse, getContextID, getContextName, getDebug, getEngineID, getErrorCode, getErrorCodes, getErrorIndex, getErrorString, getExceptionCode, getExceptionCodes, getIgnoreSpecificControlCodes, getMaxNumRows, getMaxRepetitions, getMibModules, getMibOperations, getNonRepeaters, getObjectID, getObjectID, getObjectIDList, getPduErrorIndex, getPrincipal, getPrivPassword, getPrivProtocol, getRetries, getSecurityLevel, getSecurityModel, getSendTimeoutEvents, getSnmpOID, getSnmpOIDList, getSnmpVersion, getTargetHost, getTargetPort, getTimeout, getUserErrorCode, getUserErrorString, getVarBindCount, getWriteCommunity, isInSubTree, isSerialize, loadMibs, releaseResources, removeLogClient, removeResultListener, removeSnmpPropertyListener, removeV3HandShakeListener, setAttemptComplete, setAttemptPartial, setAuthPassword, setAuthProtocol, setClientID, setCommunity, setContextID, setContextName, setDebug, setEngineID, setIgnoreSpecificControlCodes, setMaxNumRows, setMaxRepetitions, setMibModules, setNonRepeaters, setObjectID, setObjectID, setParams, setParams, setPrincipal, setPrivPassword, setPrivProtocol, setRetries, setSecurityLevel, setSecurityModel, setSendTimeoutEvents, setSnmpOID, setSnmpOIDList, setSnmpVersion, setTargetHost, setTargetPort, setTimeout, setVarBindCount, setWriteCommunity, snmpGet, snmpGet, snmpGetAllList, snmpGetAllVariableBindings, snmpGetAllVariables, snmpGetBulkList, snmpGetBulkVariableBindings, snmpGetBulkVariables, snmpGetList, snmpGetList, snmpGetNext, snmpGetNext, snmpGetNextList, snmpGetNextList, snmpGetNextVariable, snmpGetNextVariableBinding, snmpGetNextVariableBindings, snmpGetNextVariables, snmpGetVariable, snmpGetVariableBinding, snmpGetVariableBindings, snmpGetVariables, snmpSendInformAcknowledgement, snmpSendInformRequest, snmpSendInformRequest, snmpSendNotification, snmpSendNotification, snmpSendTrap, snmpSendTrap, snmpSet, snmpSet, snmpSetList, snmpSetVariable, snmpSetVariableList, snmpSetVariables, vetoableChange
 
Methods inherited from class com.adventnet.snmp.beans.SnmpServer
async_create_v3_tables, create_v3_tables, genEvent, getCharacterEncoding, getHostAddress, getLocalAddresses, getMibPath, getOverwriteCMI, getPacketBufferSize, getSecLevelForTimeSync, getSecurityProvider, getSecurityTable, getSerializedMibFileName, getSimpleDateFormat, getSnmpEngineID, getSnmpEngineTable, getTimeoutInMilliSec, getTimeToWait, getUSMTable, getV3ConfigTable, getV3MsgMaxSize, initJdbcParams, initSecurityProvider, isBroadcastFeatureEnable, isLoadFromCompiledMibs, isLoadFromSerializedMibs, isLoadMibsFromDatabase, isOverwriteCMI, isOverwriteMibsInDatabase, isReadDesc, isSendPDUByGroup, isSerializeMibs, isSetAutoInformResponse, isSupportedSecurityModel, isV3DatabaseFlag, isValidateUser, manage_v3_tables, managing_v3_tables, reestablish, restoreDefaultTimeoutPolicy, setAutoInformResponse, setBroadcastFeatureEnable, setCharacterEncoding, setErrorFlagEnable, setLoadFromCompiledMibs, setLoadFromSerializedMibs, setLoadMibsFromDatabase, setMibOperations, setMibPath, setOverwriteCMI, setOverwriteMibsInDatabase, setPacketBufferSize, setReadDesc, setReceiveBufferSize, setSecLevelForTimeSync, setSendPDUByGroup, setSerializedMibFileName, setSerializeMibs, setSimpleDateFormat, setSnmpEngineBoots, setSnmpEngineID, setTimeoutInMilliSec, setTimeoutPolicy, setTimeToWait, setV3ConfigTable, setV3DatabaseFlag, setV3MsgMaxSize, setWaitTimeToRetry, validateUser
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.adventnet.snmp.beans.CustomizerTemplate
create_v3_tables, getSnmpEngineTable, getUSMTable, initSecurityProvider, isSupportedSecurityModel, manage_v3_tables
 

Field Detail

STRING_DATA

public static final int STRING_DATA
Constant to specify the format in which the data has to be returned.String is the default.

See Also:
Constant Field Values

SNMP_VARIABLE_DATA

public static final int SNMP_VARIABLE_DATA
Constant to specify the format in which the data has to be returned.

See Also:
Constant Field Values

SNMP_VARIABLE_BINDING_DATA

public static final int SNMP_VARIABLE_BINDING_DATA
Constant to specify the format in which the data has to be returned.

See Also:
Constant Field Values
Constructor Detail

SnmpTable

public SnmpTable(SnmpSession ses,
                 MibOperations mib)
This constructor is used to create an SnmpTable instance with a specified SnmpSession and MibOperations. Using this constructor the user can decide which SnmpSession and MibOperations instance should be used by SnmpTable.

Parameters:
ses - Instance of SnmpSession but not null and also the created SnmpSession should be opened before using in this constructor.
mib - Instance of MibOperations

SnmpTable

public SnmpTable()
Use this constructor for applications.


SnmpTable

public SnmpTable(int protocol,
                 ProtocolOptions options)
Use this constructor for applications which uses protocols other than UDP/IP.


SnmpTable

public SnmpTable(int port,
                 java.lang.String session)
Use this constructor for creating a new session for this application. If the session name is same the tables will share the same session. If the port is 0 it will use the available free port.


SnmpTable

public SnmpTable(java.applet.Applet applet)
Use this constructor for applets.

Method Detail

setParams

public void setParams(java.lang.String host,
                      java.lang.String mib,
                      java.lang.String tableOID)
To set multiple parameters like TargetHost,MibModule and TableOID

Parameters:
host - target host
mib - mib file
tableOID - OID of the table

getRowCount

public int getRowCount()
Returns the number of rows of data available in the SnmpTable.

Returns:
number of rows in the Table.

getColumnCount

public int getColumnCount()
Returns the number of columns in the table corresponding to the table OID already set.

Returns:
the number of columns available in the SnmpTable.

getColumnName

public java.lang.String getColumnName(int columnIndex)
Returns the name of the column specified by the column index.

Parameters:
columnIndex - index of the column in the table.
Returns:
the name of the column.

getColumnClass

public java.lang.Class getColumnClass(int columnIndex)
Returns the class to be used as renderer and editor for the column.

Parameters:
columnIndex - index of the column in the table
Returns:
the Class to be used as renderer and editor for the column and null if the columnIndex is invalid.

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
To check if the cell at the specified index is editable or not.

Parameters:
rowIndex - index of the row to which the cell belongs
columnIndex - index of the column to which the cell belongs
Returns:
true if the cell is editable and false otherwise.

getCellValue

public java.lang.Object getCellValue(java.lang.String tableOID,
                                     int rowIndex,
                                     int columnIndex)
To get the value for the cell specified by the row and column index. The row and column index represent the position of the row and column in the table,both starting with zero. TableOID need not be set separately.If the object to be returned is required as a SnmpVar or SnmpVarBind object,then it can be set using setDataType() method. By default a String object will be returned. The following errorcodes can be set MIB_NODE_UNAVAIL,INVALID_TABLE_OID

Parameters:
tableOID - OID of the table to which the cell belongs.
rowIndex - position of the row whose value is to be looked up.
columnIndex - position of the column whose value is to be looked up.
Returns:
the value for the cell as a String data.Null if tableOID is invalid.
See Also:
ErrorMessages, SnmpTarget.getErrorString(), SnmpTarget.getErrorCode(), setDataType(int type), setCellValue(String tableOID,Object aValue, int rowIndex,int columnIndex)

getValueAt

public java.lang.Object getValueAt(int rowIndex,
                                   int columnIndex)
To get the value for the cell specified by the row and column index. The row and column index represent the position of the row and column in the table,both starting with zero. TableOID should be set seperately using setTableOID(). If the object to be returned is required as an object of SnmpVar or SnmpVarBind, then it can be set using setDataType() method.By Default String data will be returned.

Parameters:
rowIndex - position of the row whose value is to be looked up.
columnIndex - position of the column whose value is to be looked up.
Returns:
the value for the cell as a String data.Null if TableOID is invalid.
See Also:
setDataType(int type), setValueAt(Object aValue, int rowIndex,int columnIndex)

setValueAt

public void setValueAt(java.lang.Object aValue,
                       int rowIndex,
                       int columnIndex)
Sets the value for the cell specified by the row and column index. The row and column index represent the position of the row and column in the table,both starting with zero. TableOID should be set using setTableOID(). The new value can be a String or SnmpVar or SnmpVarBind object.

The following errorCodes can be set SNMP_NOT_INIT, INVALID_VERSION, OID_NOT_SPECIFIED, REQ_TIMEDOUT, EMPTY_VAR_BIND, IP_ADDR_NOT_SPECIFIED, SESSION_REMOTE_HOST_UNKNOWN, SECURITYEXP_CONNECTING_REMOTE_HOST, UNKNOWN_ERR, SNMP errors defined in ErrorMessages. v3 only INVALID_CONTEXT_NAME ,INVALID_CONTEXT_ID.

Parameters:
aValue - the new value that needs to be set.
rowIndex - position of the row whose value is to be changed.
columnIndex - position of the column whose value is to be changed.
See Also:
getValueAt(int rowIndex, int columnIndex), ErrorMessages, SnmpTarget.getErrorCode(), SnmpTarget.getErrorString()

showErrorMessage

protected void showErrorMessage(java.lang.String str)

setCellValue

public void setCellValue(java.lang.String tableOID,
                         java.lang.Object aValue,
                         int rowIndex,
                         int columnIndex)
Sets the value for the cell specified by the row and column index. The row and column index represent the position of the row and column in the table,both starting with zero. If this method is used to set the value,then the Table OID need not be set seperately using setTableOID() method. The new value can be a String or SnmpVar or SnmpVarBind object.

The following errorCodes can be set SNMP_NOT_INIT, INVALID_VERSION, OID_NOT_SPECIFIED, REQ_TIMEDOUT, EMPTY_VAR_BIND, IP_ADDR_NOT_SPECIFIED, SESSION_REMOTE_HOST_UNKNOWN, SECURITYEXP_CONNECTING_REMOTE_HOST, UNKNOWN_ERR, SNMP errors defined in ErrorMessages. v3 only INVALID_CONTEXT_NAME ,INVALID_CONTEXT_ID.

Parameters:
tableOID - OID of the table to which the cell belongs.
aValue - the new value that needs to be set.
rowIndex - position of the row whose value is to be changed.
columnIndex - position of the column whose value is to be changed.
See Also:
getCellValue(String tableOID, int rowIndex, int columnIndex), ErrorMessages, SnmpTarget.getErrorCode(), SnmpTarget.getErrorString()

addSnmpTableListener

public void addSnmpTableListener(SnmpTableListener l)
Adds a SnmpTableListener instance to the listener's list.Whenever a change in SnmpTable occurs all the registered listeners will be notified.

Parameters:
l - an instance of SnmpTableListener to be added.A instance of a class implementing SnmpTableListener interface.
See Also:
SnmpTableListener

removeSnmpTableListener

public void removeSnmpTableListener(SnmpTableListener l)
Remove a listener from the list that's notified each time a change in the SNMP Table occurs.

Parameters:
l - an instance of SnmpTableListener which needs to be removed from the list.
See Also:
SnmpTableListener

getTableOID

public java.lang.String getTableOID()
To get table oid used with this SnmpTable instance. MIB containing this table must be loaded in this VM.

Returns:
the Table OID as a String value.

setTableOIDWoStart

public void setTableOIDWoStart(java.lang.String tableOID)
                        throws DataException
To set the table OID without starting polling.

Parameters:
tableOID - OID of the table as a String
Throws:
DataException - is thrown if data is invalid The following errorcodes can be set MIB_NODE_UNAVAIL,INVALID_TABLE_OID
See Also:
ErrorMessages, SnmpTarget.getErrorString(), SnmpTarget.getErrorCode()

setObjectIDList

public void setObjectIDList(java.lang.String[] s)
Sets the column names of the table that need to be polled. The setTableOID will poll all the columns of the table. Setting the column names using this method will make the bean poll only the specified columns. It also starts polling the specified columns immediately.

Overrides:
setObjectIDList in class SnmpTarget
Parameters:
s - a one dimensional array of column names

setTableOID

public void setTableOID(java.lang.String tableOID)
                 throws DataException
Sets the table OID to be used with this SnmpTable instance. MIB containing this table must be loaded in this VM. This method starts polling of table data and updates the table.

Parameters:
tableOID - the Object ID of the table, e.g. ifTable
Throws:
DataException - is thrown if data is invalid The following errorcodes can be set MIB_NODE_UNAVAIL,INVALID_TABLE_OID
See Also:
ErrorMessages, SnmpTarget.getErrorString(), SnmpTarget.getErrorCode()

getNotAccessibleIndex

public java.lang.String[][] getNotAccessibleIndex()
Returns the values for the not-accessible indices in the table.

Returns:
two dimensional array of Not Accessible Indices in the table. Null if the table do not have not-accessible index columns.

getNotAccessibleIndexColumns

public java.lang.String[] getNotAccessibleIndexColumns()
Returns the names of the not-accessible index columns in the table.

Returns:
the names of the not-accessible columns as a one dimensional String array and null if the table do not have not-accessible columns.

addRow

public void addRow(boolean Status,
                   java.lang.String[] oidlist,
                   java.lang.String[] s)
            throws DataException
To add a new row of data into the table. Rows can be added to a table only if, the table is a SMIv1 table with EntryStatus defined or SMIv2 table with RowStatus defined.

Parameters:
Status - true if the table has EntryStatus column and false if it has RowStatus column.
oidlist - string array of Object ids of the table columns for which the data has to be set.
s - string array of values to be set in the row.
Throws:
DataException - is thrown on errors.

deleteRow

public void deleteRow(java.lang.String oid)
To delete a row of data from the table. Rows can be deleted from a table only if, the table is a SMIv1 table with EntryStatus column defined or a SMIv2 table with RowStatus column defined.

Parameters:
oid - rowStatus.index .Index represent the instance value of the row which needs to be deleted from the table.

deleteTableRow

public void deleteTableRow(java.lang.String oid)
                    throws DataException
To delete a row of data from the table. Rows can be deleted from a table only if, the table is a SMIv1 table with EntryStatus column defined or a SMIv2 table with RowStatus column defined. Throws DataException in case of any errors, which will allow the API users to catch the exception and display a suitable message.

Parameters:
oid - rowStatus.index .Index represent the instance value of the row which needs to be deleted from the table.
Throws:
DataException - is thrown on errors.
Since:
AdventNet SNMP API 4 SP4 ( Release 4.0.4 )

getIndices

public java.lang.String[][] getIndices()
Returns the indices of the SnmpTable. Before calling this method,call the method setTableOIDWoStart(tableOID).

Returns:
the indices of the Table as a two dimensional String array.

startPollingTable

public void startPollingTable()
Method to start the polling of Table.This can be used after setting the table column oids using setObjectIDList.If the method setTableOID is used to set the oid of the table,this method need not be called explicitly as the setTableOID() method calls this method internally.


stopPollingTable

public void stopPollingTable()
Method to stop the polling of Table.


refreshTable

public void refreshTable()
Refreshes the table data.


getDataType

public int getDataType()
Returns the datatype in which the table data will be returned.

Returns:
an int value corresponding to the datatype which can be any one of STRING_DATA, SNMP_VARIABLE_DATA or SNMP_VARIABLE_BINDING_DATA
See Also:
setDataType(int type)

setDataType

public void setDataType(int type)
Set the type in which the data has to be returned when the table data is got using the getValueAt or getCellValue methods.By default these methods will return table data as String objects.To get the table data as SnmpVar or SnmpVarBind object, the respective constant can be set using setDataType() method. The constants are STRING_DATA, SNMP_VARIABLE_DATA or SNMP_VARIABLE_BINDING_DATA.

Parameters:
type - STRING_DATA to get String values, SNMP_VARIABLE_DATA to get SnmpVar values,SNMP_VARIABLE_BINDING_DATA to get data as SnmpVarBinds.

setColumnsPolled

public void setColumnsPolled(java.util.Vector index)
Sets the columns that needs to be polled. The index vector elements can be Integer objects of the indices of the columns that needs to be polled. The indices should represent the position of the columns in the table.

Parameters:
index - vector of column indices that needs to be polled.

getRetrievalMode

public boolean getRetrievalMode()
Returns the mode of retrieval of table data.

Returns:
true if GetNext is used for retrieving the table data and false if the mode of retrieval of table data.

setRetrievalMode

public void setRetrievalMode(boolean mode)
To set the mode of retrieval. This should be set to true to retrieve the table data using successive getnext. By default this is set to true. To retrieve using getbulk this should be set to false.

Parameters:
mode - either true or false.

run

public void run()
The run method does polling and updates of the table at specified polling itervals. The following errorCodes can be set SNMP_NOT_INIT, INVALID_VERSION, OID_NOT_SPECIFIED, REQ_TIMEDOUT, EMPTY_VAR_BIND, IP_ADDR_NOT_SPECIFIED, SESSION_REMOTE_HOST_UNKNOWN, SECURITYEXP_CONNECTING_REMOTE_HOST, UNKNOWN_ERR, SNMP errors defined in ErrorMessages v3 only INVALID_CONTEXT_NAME ,INVALID_CONTEXT_ID.

Specified by:
run in interface java.lang.Runnable
See Also:
ErrorMessages, SnmpTarget.getErrorCode(), SnmpTarget.getErrorString()

checkDifferences

protected void checkDifferences(java.util.Vector oldData)
This method compares current table data with old data and notifies registered listeners of changes

Parameters:
oldData - is the data in the table before current poll

compareRow

protected void compareRow(int row,
                          java.util.Vector oldData)
This method compares current data with old data for a given row and notifies registered listeners of changes

Parameters:
row - the row which has to be compared
oldData - is the data in the table before current poll

genTableEvent

protected void genTableEvent(SnmpTableEvent evt)
Generate the table events to the listeners. Used in subclasses.

Parameters:
evt - an instance of SnmpTableEvent.

finalize

protected void finalize()
                 throws java.lang.Throwable
Cleans up an object when there are no more references to the object.

Overrides:
finalize in class SnmpServer
Throws:
java.lang.Throwable - - in case of finalization errors.

getColumn

public java.lang.String[] getColumn(int columnIndex)
Returns a string array of data for a column in the Table,represented by the index. Index represent the position of the column in the table. Set the TableOID using setTableOID().

Parameters:
columnIndex - position of the column whose value is required.
Returns:
the data for all the rows in the column as an array of String and null if the Table OID is not specified or if it is invalid.

getColumn

public java.lang.String[] getColumn(java.lang.String columnName)
Returns a string array of data for a column in the Table, represented by the column name.Set the tableOID using setTableOID().

Parameters:
columnName - name of the column
Returns:
the data for all the rows for the specified column as an array of String and null if the tableOID is not specified or if it is invalid.

getRow

public SnmpVarBind[] getRow(int index)
To get data for a table row,specified by its position in the table. Before calling this method,set tableOID using setTableOIDWoStart(tableOID). If the index(instance value) of the row is known, then getRow(String tableOID,String index) can be used.

Parameters:
index - position of the row in the table.
Returns:
the row values as an array of SnmpVarBind.Null if a row does not exist at that position.
See Also:
getRow(String tableOID,String index)

getRow

public java.lang.String[] getRow(java.lang.String tableOID,
                                 java.lang.String index)
Returns the data for a row of the Table specified by the index . Index represent the instance value of the column OIDs. TableOID need not be set seperately. If the instance value of the column OIDs is not known,then getRow(int index) method can be used to get the row data.

Parameters:
tableOID - the OID of the table to which the row belongs.
index - instance value of the row in the table.
Returns:
the row values as an array of String. Null if a row with that index does not exist.
See Also:
getRow(int index)

getPollInterval

public int getPollInterval()
Returns the current polling interval in seconds.

Returns:
poll interval in seconds.

setPollInterval

public void setPollInterval(int i)
To set the polling interval in seconds.

Parameters:
i - poll interval in seconds.

getColumnMibNode

public MibNode getColumnMibNode(int columnIndex)
To Get the MibNode corresponding to the table column specified by the column index

Parameters:
columnIndex - index of the column
Returns:
column MibNode

getPerformSets

public boolean getPerformSets()
To check if the values will get set if some change is made in any table field which has write access(any editable cell).

Returns:
true if values can be set for a field and false otherwise.

getPerformSets

public void getPerformSets(boolean allowSets)
To Activate/Deactivate an editable table field (cell). If this is set to true,then values can be set for the table fields that have write access. If this is set to false,then values cannot be set for those fields.


getHoles

public int[] getHoles()
Returns the index of the not-implemented columns.Holes are the columns that are not defined in the agent.

Returns:
int[] int array of indices of columns that are not implemented in agent


Copyright (c)ZOHO Corp. 1996-2012