"WEBNMS_5 API Docs"

com.adventnet.db
Class PopulateUserTable

java.lang.Object
  extended by com.adventnet.db.PopulateUserTable

public class PopulateUserTable
extends java.lang.Object

This is a Utility class used for populating/deleting the entries in the USERTABLE of the database. The USERTABLE stores the information like host name, port,securitylevel,AuthProtocol,PrivProtocol, PrivPassword,AuthPassword of the SnmpV3 Device which has to be discovered.Internally Web NMS framework will use the USERTABLE Table in the database to get the security level details of the SnmpV3 device during the Discovery process.This utility class should be use to populate/delete the entries for SnmpV3 device in the USERTABLE in the same JVM in which the NMS server is running.

The HOST column of the USERTABLE stores the IPAddress of the SNMPV3 Agent to be discovered.The DBKEY column is the primary key of the USERTABLE.The DBKEY column stores the combined information of the HOST,PORT and USERNAME of the SNMPV3 device to be discovered.
The AUTHPROTOCOL and PRIVPROTOCOL column of the USERTABLE table in the database will be populated with the constants depending upon the value assigned for the keys SECURITYLEVEL and AUTHPROTOCOL set as the Properties Object argument passed to the insertIntoUserTable(Properties prop,String[] ipArray) to populate the USERTABLE for SNMPV3 hosts

Here are some examples to state how the AUTHPROTOCOL and PRIVPROTOCOL columns of the USERTABLE table will be populated

1) If the value set for the Key SECURITYLEVEL is "NoAuthNoPriv" in the Properties object, then the AUTHPROTOCOL column and PRIVPROTOCOL column of the USERTABLE table of the database will be populated with the value as 20 and 51 respectively.

2) if the value set for the key SECURITYLEVEL is "AuthNoPriv" and value set for the key AUTHPROTOCOL is "MD5" then the AUTHPROTOCOL column and PRIVPROTOCOL column of the USERTABLE table of the database will be populated with the value as 21 and 51 respectively.

3) if the value set for the key SECURITYLEVEL is "AuthNoPriv" and value set for the key AUTHPROTOCOL is "SHA" then the AUTHPROTOCOL column and PRIVPROTOCOL column of the USERTABLE table of the database will be populated with the value as 22 and 51 respectively.

4) if the value set for the key SECURITYLEVEL is "AuthPriv" and value set for the key AUTHPROTOCOL is "MD5" then the AUTHPROTOCOL column and PRIVPROTOCOL column of the USERTABLE table of the database will be populated with the value as 21 and 50 respectively.

5) if the value set for the key SECURITYLEVEL is "AuthNoPriv" and value set for the key AUTHPROTOCOL is "SHA" then the AUTHPROTOCOL column and PRIVPROTOCOL column of the USERTABLE table of the database will be populated with the value as 22 and 50 respectively.


Constructor Summary
PopulateUserTable()
          Constructor to instantiate the PopulateUserTable.
 
Method Summary
 void deleteFromUserTable(java.lang.String[] ipString)
          This method is used to delete the entry from the USERTABLE for the given IpAddress of the SNMPV3 hosts in the database
static PopulateUserTable getInstance()
          This method can be used to get the instance of PopulateUserTable
 void insertIntoUserTable(java.util.Properties prop, java.lang.String[] ipArray)
          This method is used to populate the USERTABLE table in the database with the snmpv3 properties given for the ipAddress of the SNMPV3 hosts.
 boolean isInitialized()
          Returns whether the PopulateUserTable has been initialized or not.
 java.util.Vector selectFromUserTable(java.lang.String host)
          This method is used for internal Framework .
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PopulateUserTable

public PopulateUserTable()
Constructor to instantiate the PopulateUserTable.

Method Detail

getInstance

public static PopulateUserTable getInstance()
This method can be used to get the instance of PopulateUserTable

Returns:
instance of PopulateUserTable

isInitialized

public boolean isInitialized()
Returns whether the PopulateUserTable has been initialized or not. The PopulateUserTable can be used only after it has been initialized.

Returns:
true if PopulateUserTable has been initialized and can be used,false otherwise.

selectFromUserTable

public java.util.Vector selectFromUserTable(java.lang.String host)
This method is used for internal Framework . It is recommended not to use this method


deleteFromUserTable

public void deleteFromUserTable(java.lang.String[] ipString)
This method is used to delete the entry from the USERTABLE for the given IpAddress of the SNMPV3 hosts in the database

Parameters:
ipString - Array which contains the IpAddress of the SNMPV3 hosts to be deleted from the USERTABLE table in the database.
Throws:
java.sql.SQLException - if a database access error occurs during the delete operation in the database.

insertIntoUserTable

public void insertIntoUserTable(java.util.Properties prop,
                                java.lang.String[] ipArray)
This method is used to populate the USERTABLE table in the database with the snmpv3 properties given for the ipAddress of the SNMPV3 hosts. The snmpv3 properties like SECURITYLEVEL ,USERNAME,SNMPAGENT for the Ipddresses are set in the Properties object.It is important to set the value for SECURITYLEVEL parameter ( for eg AuthPriv/NoAuthNoPriv/AuthNoPriv) in the properties object for the SNMPV3 device . The HOST property of the USERTABLE table in the database will be populated with the Ipaddress contained in the ipArray Array object.

The following code snippet explains the usage of this method:

 
  String hostIpaddress[]= {"192.168.111.180"};
  Properties pro=new Properties();
  pro.put("SNMPAGENTPORT","161");
  pro.put("SECURITYLEVEL","AuthPriv");
  pro.put("AUTHPROTOCOL","MD5");
  pro.put("PRIVPROTOCOL","CBC-DES");
  pro.put("USERNAME","authUser");
  pro.put("AUTHPASSWORD","authUser");
  pro.put("PRIVPASSWORD","privUser");
  populateUserTable.insertIntoUserTable(pro,hostIpaddress);
   
The above code snippet will populate the USERTABLE for the host 192.168.111.180 with the properties given.

The DBKEY column of the USERTABLE is the PRIMARY key of the USERTABLE database.It stores the combined information of the HOST,PORT and USERNAME separated by ## .For the above code snippet you will find the DBKEY column of the USERTABLE table of the database populated with the value as 192.168.111.180##161##authUser.
If the PopulateUserTable has not be initialized ,then this method will not populate the USERTABLE table of the database. To check if the PopulateUserTable object has been initialized use of the isInitialized() method to check if the PopulateUserTable object has been initialized.This method returns true if the PopulateUserTable has been initialized properly

Parameters:
prop - (key,value)pairs to be set as snmpv3 properties for the given hosts
ipArray - Array which contains the IpAddress of the SNMPV3 hosts for which the USERTABLE should be populated with snmpv3 properties.If this array object is null or if its length=0 then
Throws:
java.sql.SQLException - if database base access occurs during the Insert opertion in the database.

"WEBNMS_5 API Docs"

Copyright © 2011 ZOHO Corp., All Rights Reserved.