com.adventnet.snmp.snmp2
Class SnmpEngineTable

java.lang.Object
  |
  +--com.adventnet.snmp.snmp2.SnmpEngineTable
All Implemented Interfaces:
java.io.Serializable

public class SnmpEngineTable
extends java.lang.Object
implements java.io.Serializable

The SnmpEngineTable maintains a lsit of SnmpEngineEntry objects and provides methods to operate on list. Methods are povided to add, retrive and remove SnmpEngineEntry objects. The API users need not instantiate this class as it is instantiated from the SnmpAPI constructor. The SnmpAPI provides methods to access the SnmpEngineTable instance.

This class also provides methods to serialize and deSerialize the list of SnmpEngineEntry objects. The SnmpEngineEntry objects are always serialized in the file EngineEntry.ser. The serialization will not work in case of applets using the serialization methods. This will be fixed in the future release.

See Also:
SnmpEngineEntry, SnmpAPI, Serialized Form

Method Summary
 boolean addEntry(SnmpEngineEntry entry)
          Adds the SnmpEngineEntry to the list of SnmpEngineEntry objects maintained in this class.
 void deSerialize()
          DeSerializes the file "EngineEntry.ser" to get a list of SnmpEngineEntry objects.
 SnmpEngineEntry getEntry(java.lang.String address, int port)
          Returns the SnmpEngineEntry object corresponding to the particular host and port from the list SnmpEngineEntry objects.
 java.util.Enumeration getEnumeration()
          Returns an enumeration of all the SnmpEngineEntry objects maintained.
 boolean isV3DatabaseFlag()
          Gets the Database flag for this SnmpAPI instance.
 void readFromDatabase()
          Gets a list of SnmpEngineEntry objects and puts it in the hashtable.
 void removeEntry(SnmpEngineEntry entry)
          Delets the particular SnmpEngineEntry from the list of SnmpEngineEntry objects.
 void removeEntry(java.lang.String address, int port)
          Deletes the SnmpEngineEntry from the list of SnmpEngineEntry objects corresponding to the hostName and port specified.
 void serialize()
          Stores the list of SnmpEngineEntry objects in the serialized file "EngineEntry.ser".
 void setNullTable()
          Clears the list of SnmpEngineEntry objects.
 void setV3DatabaseFlag(boolean dbFlag)
          Sets the Database flag.
 void writeToDatabase()
          Stores the list of SnmpEngineEntry objects in the database
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getEnumeration

public java.util.Enumeration getEnumeration()
Returns an enumeration of all the SnmpEngineEntry objects maintained.
Returns:
an enumeration of all the SnmpEngineEntry objects maintained by this class.

setNullTable

public void setNullTable()
Clears the list of SnmpEngineEntry objects. Removes all the SnmpEngineEntry objects maintained by this class.

setV3DatabaseFlag

public void setV3DatabaseFlag(boolean dbFlag)
Sets the Database flag.
Parameters:
dbFlag - the database flag to be set on this SnmpAPI instance.

isV3DatabaseFlag

public boolean isV3DatabaseFlag()
Gets the Database flag for this SnmpAPI instance.

addEntry

public boolean addEntry(SnmpEngineEntry entry)
Adds the SnmpEngineEntry to the list of SnmpEngineEntry objects maintained in this class.
Parameters:
entry - The SnmpEngineEntry which needs to be added to the list of SnmpEngineEntry objects.
Returns:
True if the SnmpEngineEntry is successfully added to the list. False if the SnmpEngineEntry object is already present in the list.

getEntry

public SnmpEngineEntry getEntry(java.lang.String address,
                                int port)
Returns the SnmpEngineEntry object corresponding to the particular host and port from the list SnmpEngineEntry objects.
Parameters:
adddress - The hostName of the SnmpEngineEntry object to be retrived.
port - The port of the SnmpEngineEntry object to be retrived. It should be passed as -1 in the case of independent protocol.
Returns:
The SnmpEngineEntry corresponding to the hostName and port specified in the input parameters. Returns Null if the corresponding SnmpEngineEntry is not in the list of SnmpEngineEntry objects.

removeEntry

public void removeEntry(java.lang.String address,
                        int port)
Deletes the SnmpEngineEntry from the list of SnmpEngineEntry objects corresponding to the hostName and port specified.
Parameters:
adddress - The hostName of the SnmpEngineEntry object to be deleted.
port - The port of the SnmpEngineEntry object to be deleted. It should be passed as -1 in the case of independent protocols.

removeEntry

public void removeEntry(SnmpEngineEntry entry)
Delets the particular SnmpEngineEntry from the list of SnmpEngineEntry objects.
Parameters:
entry - The SnmpEngineEntry which is to be deleted from the list of SnmpEngineEntry objects.

serialize

public void serialize()
Stores the list of SnmpEngineEntry objects in the serialized file "EngineEntry.ser".

deSerialize

public void deSerialize()
DeSerializes the file "EngineEntry.ser" to get a list of SnmpEngineEntry objects.

writeToDatabase

public void writeToDatabase()
Stores the list of SnmpEngineEntry objects in the database

readFromDatabase

public void readFromDatabase()
                      throws java.sql.SQLException
Gets a list of SnmpEngineEntry objects and puts it in the hashtable.


Copyright (c)AdventNet Inc., 1996-2004