com.adventnet.snmp.snmp2.agent
Class Cache

java.lang.Object
  |
  +--com.adventnet.snmp.snmp2.agent.Cache
Direct Known Subclasses:
BaseSnmpStore, InterprettedAgent

public abstract class Cache
extends java.lang.Object
implements java.io.Serializable

This class holds a Hashtable which is used by other classes to store and share AgentMibOperations ,Sessions, API etc across.

See Also:
SnmpStore, Serialized Form

Field Summary
(package private) static java.util.Hashtable cache
          Static hashtable which holds all the resources required by the agent and related classes
(package private)  boolean debug
           
 
Constructor Summary
protected Cache()
          The no arg constructor which initialises the cache hashtable.
 
Method Summary
 java.lang.Object getFromCache(java.lang.String key)
          Gets the object corresponding to the key from the Cache hashtable.
 java.lang.Object getMibOperations()
          Gets the miboperation object from the cache hashtable for key "MIBS"
 boolean isDebug()
          To check the debug mode is set or not.
 void putInCache(java.lang.String key, java.lang.Object toStore)
          This method allows objects to be stored in the cache
 void setDebug(boolean val)
          Setter flag for debug messages
 void setMibOperations(java.lang.Object mibOps)
          Setter for MibOperations which is set by the first class which uses the AgentMibOperations for loading MIB modules
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cache

static java.util.Hashtable cache
Static hashtable which holds all the resources required by the agent and related classes

debug

boolean debug
Constructor Detail

Cache

protected Cache()
The no arg constructor which initialises the cache hashtable.
Method Detail

putInCache

public void putInCache(java.lang.String key,
                       java.lang.Object toStore)
This method allows objects to be stored in the cache
Parameters:
key - The Key to use
toStore - The Object to store

getFromCache

public java.lang.Object getFromCache(java.lang.String key)
Gets the object corresponding to the key from the Cache hashtable.
Parameters:
key - the string to search in the hashtable.
Returns:
the Object stored with the key specified

getMibOperations

public java.lang.Object getMibOperations()
Gets the miboperation object from the cache hashtable for key "MIBS"
Returns:
MibOperations instance which is filled by the first class using it

setMibOperations

public void setMibOperations(java.lang.Object mibOps)
Setter for MibOperations which is set by the first class which uses the AgentMibOperations for loading MIB modules
Parameters:
mibOps - the mibOpertation object

setDebug

public void setDebug(boolean val)
Setter flag for debug messages
Parameters:
val - true to set debug false to unset

isDebug

public boolean isDebug()
To check the debug mode is set or not.
Returns:
true if debug is on