|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--com.adventnet.snmp.snmp2.agent.SimpleRequestHandler
|
+--com.adventnet.snmp.mibs.agent.SnmpDBAdaptor
SnmpDBAdaptor class is used to implement the database adaptor bean. The associated requests are converted to SQL queries.
This class extends SimpleRequestHandler
SimpleRequestHandler| Field Summary | |
(package private) static int |
_QUERY
|
(package private) static int |
_UPDATE
|
(package private) boolean |
getNextFlag
|
(package private) JDBCAdapter |
jdbc
|
(package private) AgentMibOperations |
mibOps
|
(package private) boolean |
msAccessDb
|
(package private) boolean |
mysqlDb
|
(package private) boolean |
oracleDb
|
(package private) java.lang.String |
registeredOid
|
(package private) boolean |
tableNameIsNull
|
| Fields inherited from class com.adventnet.snmp.snmp2.agent.SimpleRequestHandler |
instrumentHandler,
listener,
tableListener,
writeEachTime |
| Constructor Summary | |
SnmpDBAdaptor()
constructor creates JDBCAdapter and initializes with default arguments. |
|
| Method Summary | |
void |
addRegistrationListener(RegistrationListener rl)
This method is called by BeanInfo for adding Registration Listener with PduRequestHandler |
AgentMibOperations |
getAgentMibOperations()
Getter for AgentMibOperations. |
java.lang.Integer |
getColumnProperty(java.lang.String columnName)
This method can be used to get the maximum length for a column value. |
java.lang.String |
getDriverName()
get the driverName. |
java.lang.String |
getMibFiles()
getter for the mib file name(s) for which this bean aware of. |
int[] |
getOidRep()
Retrives the integer representation of OID |
java.lang.String |
getPassword()
get the password. |
java.lang.String |
getRegisteredOid()
getter for the OID which needs to be proxied. |
int[] |
getSubidList()
Gets the subid list of the oid. |
java.lang.String |
getTableName()
getter for the tablename in the database to which the queries are made for the snmp request. |
java.lang.String[] |
getUrlList()
get the urlList. |
java.lang.String |
getUserName()
get the userName. |
protected void |
processGetNextRequest(SnmpVarBind varb,
AgentNode node,
VarBindRequestEvent pe)
This handles the get next requests from the manager. |
protected void |
processGetRequest(SnmpVarBind varb,
AgentNode node,
VarBindRequestEvent pe)
This handles the get requests from the manager. |
protected void |
processSetRequest(SnmpVarBind varb,
AgentNode node,
VarBindRequestEvent pe)
This handles the set requests from the manager. |
void |
removeRegistrationListener(RegistrationListener rl)
This method is called by BeanInfo for removing Registration Listener from PduRequestHandler |
void |
setAgentMibOperations(AgentMibOperations mibs)
setter for AgentMibOperations. |
void |
setColumnProperty(java.lang.String columnName,
java.lang.Integer maxLength)
This method can be used to set the maximum length for a column value. |
void |
setDataBase(java.lang.String dataBase)
To set the DataBase where the Table values are stored. |
void |
setDriverName(java.lang.String driverName)
set the driverName. |
void |
setMibFiles(java.lang.String mibFiles)
setter for the mib file name(s) for which this bean aware of. |
void |
setPassword(java.lang.String password)
set the password. |
void |
setRegisteredOid(java.lang.String oid)
setter for the OID which needs to be proxied. |
void |
setScalarProperties(java.lang.String url,
java.lang.String userName,
java.lang.String passwd,
java.lang.String driverName,
java.lang.String getStatement,
java.lang.String setStatement,
java.lang.String scalarOid,
java.lang.String scalarName,
java.lang.String scalarType,
int scalarAccess)
This method will be useful in database access through SNMP for the specified scalar object. |
void |
setSqlGetForScalar(java.lang.String sqlGetForScalar)
setter for the Sql get statement for scalar objects. |
void |
setSqlSetForScalar(java.lang.String sqlSetForScalar)
setter for the Sql get statement for scalar objects. |
void |
setTableName(java.lang.String tableName)
setter for the tablename in the database to which the queries are made for the snmp request. |
void |
setTableProperties(java.lang.String url,
java.lang.String userName,
java.lang.String passwd,
java.lang.String driverName,
java.lang.String tableName,
java.lang.String entryOID,
java.lang.String[] columnNames,
java.lang.String[] types,
int[] access,
int[] subidList,
java.lang.String[] indexNames)
This method will be useful in making database table SNMP accessible. |
void |
setTableProperties(java.lang.String url,
java.lang.String userName,
java.lang.String passwd,
java.lang.String driverName,
java.lang.String tableName,
java.lang.String entryOID,
java.lang.String[] columnNames,
java.lang.String[] types,
int[] access,
int[] subidList,
java.lang.String[] indexNames,
java.lang.String[] externalmoduleName)
|
void |
setUrlList(java.lang.String[] urlList)
set the urlList. |
void |
setUserName(java.lang.String userName)
set the userName. |
| Methods inherited from class com.adventnet.snmp.snmp2.agent.SimpleRequestHandler |
addInstrumentHandler,
addTableListener,
addUpdateListener,
getInstrument,
getMibVarHash,
getNextRequest,
getObjectHash,
getObjectTypeHash,
getRequest,
getTableListener,
isWriteEachTime,
processGetNextRequest,
processGetRequest,
processSetRequest,
removeUpdateListener,
setRequest,
setWriteEachTime,
writeIntoFile |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
static final int _QUERY
static final int _UPDATE
java.lang.String registeredOid
JDBCAdapter jdbc
boolean oracleDb
boolean mysqlDb
boolean msAccessDb
AgentMibOperations mibOps
boolean tableNameIsNull
boolean getNextFlag
| Constructor Detail |
public SnmpDBAdaptor()
SimpleRequestHandler| Method Detail |
public void setRegisteredOid(java.lang.String oid)
oid - value of the OID()public java.lang.String getRegisteredOid()
setRegisteredOid()public void setTableName(java.lang.String tableName)
getTableName()public java.lang.String getTableName()
setTableName()public void setSqlGetForScalar(java.lang.String sqlGetForScalar)
setSqlSetForScalar()public void setSqlSetForScalar(java.lang.String sqlSetForScalar)
setSqlGetForScalar()public java.lang.String[] getUrlList()
setUrlList()public void setUrlList(java.lang.String[] urlList)
getUrlList()public java.lang.String getDriverName()
setDriverName()public void setDriverName(java.lang.String driverName)
getDriverName()public java.lang.String getUserName()
setUsrName()public void setUserName(java.lang.String userName)
getUsrName()public java.lang.String getPassword()
setPassword()public void setPassword(java.lang.String password)
getPassword()public void setDataBase(java.lang.String dataBase)
public AgentMibOperations getAgentMibOperations()
setAgentMibOperations()public void setAgentMibOperations(AgentMibOperations mibs)
getAgentMibOperations()public java.lang.String getMibFiles()
public void setMibFiles(java.lang.String mibFiles)
public void addRegistrationListener(RegistrationListener rl)
rl - the registration listener for an OID.removeRegistrationListener()public void removeRegistrationListener(RegistrationListener rl)
rl - the registration listener for an OID.addRegistrationListener()
public void setColumnProperty(java.lang.String columnName,
java.lang.Integer maxLength)
columnName - The name of the columnmaxLength - The maximum length of the column valuepublic java.lang.Integer getColumnProperty(java.lang.String columnName)
columnName - The name of the column
protected void processGetRequest(SnmpVarBind varb,
AgentNode node,
VarBindRequestEvent pe)
throws AgentSnmpException
It overrides the method in com.adventnet.snmp.snmp2.agent.SimpleRequestHandler.java
varb - The received varbind .node - The node for which Get Request is to be done.pe - The VarBind Request Event created by this Get request.
protected void processGetNextRequest(SnmpVarBind varb,
AgentNode node,
VarBindRequestEvent pe)
throws AgentSnmpException
It overrides the method in com.adventnet.snmp.snmp2.agent.SimpleRequestHandler.java
varb - The received varbind.node - The node for which Get Next Request is to be done.pe - The VarBind Request Event created by this GetNext request.
protected void processSetRequest(SnmpVarBind varb,
AgentNode node,
VarBindRequestEvent pe)
throws AgentSnmpException
It overrides the method in com.adventnet.snmp.snmp2.agent.SimpleRequestHandler.java
varb - The received varbind.node - The node for which Get Next Request is to be done.pe - The VarBind Request Event created by this GetNext request.
public void setTableProperties(java.lang.String url,
java.lang.String userName,
java.lang.String passwd,
java.lang.String driverName,
java.lang.String tableName,
java.lang.String entryOID,
java.lang.String[] columnNames,
java.lang.String[] types,
int[] access,
int[] subidList,
java.lang.String[] indexNames)
SnmpDBAdaptor dbAdaptor1 = new SnmpDBAdaptor();
dbAdaptor1.setTableProperties(
"jdbc:odbc:Elections_DB",
"user",
"passwd",
"sun.jdbc.odbc.JdbcOdbcDriver",
"ElectionResultsTable",
".1.3.6.1.4.1.2162.4.9.1.1",
new String[]{"electionResultsId", "candidate", "percentage", "electoral"},
new String[]{"INTEGER", "DisplayString", "INTEGER", "INTEGER"},
new int[]{SnmpAPI.RONLY, SnmpAPI.RWRITE, SnmpAPI.RWRITE, SnmpAPI.RWRITE},
new int[]{1,2,3,4},
new String[]{"electionResultsId"}
);
dbAdaptor1.addRegistrationListener(hdlr);//hdlr is the RegistrationListener(PduRequestHandler)//
The above code allows us to register a database table for SNMP access.
url - the URL of the databaseuserName - the user name for the database access.passwd - the password for the database access.driverName - the name of the drivertableName - the name of the table in the databaseentryOID - the entry level OID of the table defined in the MIB relevant to the
database table.columnName - the string array specifying the name of the columns present in the table.types - the string array specifying the SNMP data types of the columns respectively.acces - the string array specifying the access of the column as specified by the static values
in the class com.adventnet.snmp.snmp2.SnmpAPIsubidList - the subid's of the columns.indexNames - the string array specifying the column names which are indexed for the table.
public void setTableProperties(java.lang.String url,
java.lang.String userName,
java.lang.String passwd,
java.lang.String driverName,
java.lang.String tableName,
java.lang.String entryOID,
java.lang.String[] columnNames,
java.lang.String[] types,
int[] access,
int[] subidList,
java.lang.String[] indexNames,
java.lang.String[] externalmoduleName)
public void setScalarProperties(java.lang.String url,
java.lang.String userName,
java.lang.String passwd,
java.lang.String driverName,
java.lang.String getStatement,
java.lang.String setStatement,
java.lang.String scalarOid,
java.lang.String scalarName,
java.lang.String scalarType,
int scalarAccess)
SnmpDBAdaptor dbAdaptor1 = new SnmpDBAdaptor();
dbAdaptor1.setScalarTableProperties(
);"jdbc:odbc:Elections_DB", "user", "passwd", "sun.jdbc.odbc.JdbcOdbcDriver", "select sysdescr from admin_topoobject where name='Sudhir'", "update admin_topoobject set sysdescr = $value where name='Sudhir'", ".1.3.6.1.4.1.2162.4.9.5", "acreateTable", "DisplayString", SnmpAPI.RWRITE
dbAdaptor1.addRegistrationListener(hdlr);//hdlr is the RegistrationListener(PduRequestHandler)//
The above code allows us to register a database for SNMP access.
url - the URL of the databaseuserName - the user name for the database access.passwd - the password for the database access.driverName - the name of the drivergetStatement - the SQL statement for this scalar object which should be executed
when a SNMP get request is made on this scalar object(i.e for the specified OID)setStatement - the SQL statement for this scalar object which should be executed
when a SNMP set request is made on this scalar object(i.e for the specified OID). The
value sent during the SET is substitued for the $value and the SQL query is executed.tableName - the name of the table in the databasescalarOid - the OID of the scalar defined in the MIB.scalarName - the string specifying the name of the scalar object.scalarType - the string specifying the SNMP data type of the scalar object.scalarAcces - the string specifying the access of the scalar as specified by the static values
in the class com.adventnet.snmp.snmp2.SnmpAPIpublic int[] getOidRep()
public int[] getSubidList()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||