com.adventnet.utils.agent
Class DynamicRegistrationWithCommunity

java.lang.Object
  |
  +--com.adventnet.snmp.snmp2.agent.SimpleRequestHandler
        |
        +--com.adventnet.utils.agent.DynamicRegistrationWithCommunity

public class DynamicRegistrationWithCommunity
extends SimpleRequestHandler

Dynamically registers with SnmpAgent for requests

You could attach this under any table defined in your enterprise MIB

Use the table entry to do a setRegisteredOid (int [])

The subids (columnar leafNodes under the table )are:

Currently this class implements all the six states for row status textual convention.

Since:
AdventNet Agent Toolkit (Java Edition) 4.1 release Patch release 3.0

Field Summary
(package private)  java.util.Vector addVector
           
(package private)  RegistrationListener agent
           
(package private)  UpdateListener listener
           
(package private)  java.lang.String managerHost
           
(package private) static int PROXYCONTEXTCOMMUNITY
           
(package private) static int PROXYCONTEXTHOST
           
(package private) static int PROXYCONTEXTNAME
           
(package private) static int PROXYCONTEXTOID
           
(package private) static int PROXYCONTEXTPORTNUMBER
           
(package private) static int PROXYCONTEXTRETRIES
           
(package private) static int PROXYCONTEXTROWSTATUS
           
(package private) static int PROXYCONTEXTTIMEOUT
           
(package private) static int PROXYCONTEXTVERSION
           
(package private)  java.util.Hashtable proxyTable
           
(package private)  AgentTableModel tModelComplete
           
(package private)  int trapPort
           
(package private)  int trapVersion
           
 
Fields inherited from class com.adventnet.snmp.snmp2.agent.SimpleRequestHandler
instrumentHandler, listener, tableListener, writeEachTime
 
Constructor Summary
DynamicRegistrationWithCommunity(SnmpAgent agentRef)
          The default constructor for the Class with Agent Reference.
DynamicRegistrationWithCommunity(SnmpAgent agentRef, boolean persistence)
          The secondary constructor with persistence flag
DynamicRegistrationWithCommunity(SnmpAgent agentRef, java.lang.String dirStr, java.lang.String fileStr, boolean fToVPersistence)
          The seccondary constructor for the Class with Agent Reference and persistence format.
 
Method Summary
 void addRegistrationListener(RegistrationListener l)
          This method is called by BeanInfo for adding Registration Listener with PduRequestHandler
 void addRegistrationListener(RegistrationListener l, boolean remoteAccess)
          Add RegistrationListener (agent) to the Listener table.
 void addUpdateListener(UpdateListener l)
          Setter for UpdateListener.
(package private)  boolean checkForRowStatus(DynamicRegistrationEntry entry)
           
 void checkSubAgentHeartBeat(boolean b, java.lang.Long pollingInterval, java.lang.Integer timeOut, java.lang.Integer retries, SnmpAgent agentRef)
          This method is to enable Polling the SubAgent to see whether its alive.
static DynamicRegistrationEntry createDynamicRegistrationEntry(java.lang.String proxyingOID, java.lang.String proxyName, java.lang.String agentHost, java.lang.Integer agentPort, java.lang.Integer agentVersion, java.lang.String community, java.lang.Long timeOut, java.lang.Long retries)
          This is static method for creating a DynamicRegistrationEntry with RowStatus value as Active(1).
static DynamicRegistrationEntry createDynamicRegistrationEntry(java.lang.String proxyingOID, java.lang.String proxyName, java.lang.String agentHost, java.lang.Integer agentPort, java.lang.Integer agentVersion, java.lang.String community, java.lang.Long timeOut, java.lang.Long retries, java.lang.Integer status)
          This is static method for creating a DynamicRegistrationEntry.
static DynamicRegistrationEntry createDynamicRegistrationEntry(java.lang.String proxyingOID, java.lang.String agentHost, java.lang.String community, long timeOut, int agentPort)
          Deprecated. - Make use of the new method with the additional argumnets. This is static method for creating a DynamicRegistrationEntry.
 java.util.Vector getExtraVarBind()
          Getter for the Vector of Additional VarBinds sent along with the SubAgent LinkUp or LinkDown Traps.
 java.lang.String getFileName()
          Getter for file name.
 java.lang.String getLinkDownOid()
          Getter for the LinkDownOid sent with the LinkUp Traps.
 java.lang.String getLinkUpOid()
          Getter for the LinkUpOid sent with the LinkUp Traps.
 java.lang.String getRegisteredOid()
          Getter for registered oid.
protected  int[] getSubidList()
          This is the subid List which is registered with the source of SnmpPduRequestEvents.
 java.util.Vector getTableVector()
          Getter of table elements
 boolean isPersistence()
          Getter of the persistence flag.
protected  void processGetNextRequest(SnmpVarBind varb, AgentNode node, VarBindRequestEvent pe)
          Processes the GetNextRequest message from the manager for the contextBasedProxyTable.
protected  void processGetRequest(SnmpVarBind varb, AgentNode node, VarBindRequestEvent pe)
          Processes the GetRequest message from the manager for the contextBasedProxyTable.
protected  void processGetRequest(SnmpVarBind varb, int req, VarBindRequestEvent pe, DynamicRegistrationEntry entry)
          Processes the GetRequest message from the manager for the contextBasedProxyTable.
protected  void processSetRequest(SnmpVarBind varb, AgentNode node, VarBindRequestEvent pe)
          Processes the SetRequest message from the manager for the contextBasedProxyTable.
 void removeRegistrationListener(RegistrationListener l)
          Removes RegistrationListener(agent) from Listener Table.
 void removeUpdateListener()
          Sets UpdateListener to null.
 void setExtraVarBind(java.util.Vector addVector)
          Method to set Additional VarBinds to be sent along with the SubAgent LinkUp or LinkDown Traps.
 void setFileName(java.lang.String fileName)
          Setter of file name.
 void setFToVPersistence(boolean fToVPersistence)
          Setter for the FToV Persistence flag.
 void setLinkDownOid(java.lang.String linkDownOid)
          Setter for the LinkDownTrap OID.
 void setLinkUpOid(java.lang.String linkUpOid)
          Setter for the LinkUpTrap OID.
 void setManagerHost(java.lang.String managerHost)
          Deprecated. The method is no Longer used. The Traps will be sent to the Entries in the ForwardingTable.
 void setPersistence(boolean persistence)
          Setter of the persistence flag.
 void setRegisteredOid(java.lang.String oid)
          Setter for registered oid.
 void setTableVector(java.util.Vector tableVector)
          Setter of Table Elements.
 void setTrapPort(int trapPort)
          Deprecated. The method is no Longer used. The Traps will be sent to the Entries in the ForwardingTable.
 void setTrapVersion(int trapVersion)
          Deprecated. The method is no Longer used. The Traps will be sent to the Entries in the ForwardingTable.
 
Methods inherited from class com.adventnet.snmp.snmp2.agent.SimpleRequestHandler
addInstrumentHandler, addTableListener, getInstrument, getMibVarHash, getNextRequest, getObjectHash, getObjectTypeHash, getOidRep, getRequest, getTableListener, isWriteEachTime, processGetNextRequest, processGetRequest, processSetRequest, setRequest, setWriteEachTime, writeIntoFile
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROXYCONTEXTOID

static final int PROXYCONTEXTOID

PROXYCONTEXTNAME

static final int PROXYCONTEXTNAME

PROXYCONTEXTHOST

static final int PROXYCONTEXTHOST

PROXYCONTEXTPORTNUMBER

static final int PROXYCONTEXTPORTNUMBER

PROXYCONTEXTVERSION

static final int PROXYCONTEXTVERSION

PROXYCONTEXTCOMMUNITY

static final int PROXYCONTEXTCOMMUNITY

PROXYCONTEXTTIMEOUT

static final int PROXYCONTEXTTIMEOUT

PROXYCONTEXTRETRIES

static final int PROXYCONTEXTRETRIES

PROXYCONTEXTROWSTATUS

static final int PROXYCONTEXTROWSTATUS

proxyTable

java.util.Hashtable proxyTable

tModelComplete

AgentTableModel tModelComplete

trapPort

int trapPort

managerHost

java.lang.String managerHost

trapVersion

int trapVersion

addVector

java.util.Vector addVector

listener

UpdateListener listener

agent

RegistrationListener agent
Constructor Detail

DynamicRegistrationWithCommunity

public DynamicRegistrationWithCommunity(SnmpAgent agentRef)
The default constructor for the Class with Agent Reference.
Parameters:
agentRef - The agent Name reference to update the community with every addition of SubAgent entry.
Since:
AdventNet Agent Toolkit (Java Edition) 4.2 release.

DynamicRegistrationWithCommunity

public DynamicRegistrationWithCommunity(SnmpAgent agentRef,
                                        java.lang.String dirStr,
                                        java.lang.String fileStr,
                                        boolean fToVPersistence)
The seccondary constructor for the Class with Agent Reference and persistence format.
Parameters:
agentRef - The agent Name reference to update the community with every addition of SubAgent entry.
dirStr - The directory Name for the persistent file.
fileStr - The file Name for the persistent file.
fToVPersistence - The FToV Persistence flag for type of persistence(FToV or XML).
Since:
AdventNet Agent Toolkit (Java Edition) 4.2 release.

DynamicRegistrationWithCommunity

public DynamicRegistrationWithCommunity(SnmpAgent agentRef,
                                        boolean persistence)
The secondary constructor with persistence flag
Parameters:
agentRef - The agent Name reference to update the community with every addition of SubAgent entry.
persistence - The persistnce flag for the persistence of the Table Values in the FileSystem.
Since:
AdventNet Agent Toolkit (Java Edition) 4.2 release.
Method Detail

setRegisteredOid

public void setRegisteredOid(java.lang.String oid)
Setter for registered oid.
Parameters:
oid - The String representation of OID of the Entry Node of the Table which is used as the contextBasedProxyTable(default value is ".1.3.6.1.4.1.2162.10.3.1.2.3.3.1" Entry Node OID of contextBasedProxyTable in AGENT-SNMP-CONFIG-MIB).
See Also:
getRegisteredOid()

getRegisteredOid

public java.lang.String getRegisteredOid()
Getter for registered oid.
Returns:
oid - The String representation of OID of the Entry Node of the Table which is used as the contextBasedProxyTable which is registered through setRegisteredOid method(default value ".1.3.6.1.4.1.2162.10.3.1.2.3.3.1" Entry Node OID of contextBasedProxyTable in AGENT-SNMP-CONFIG-MIB).
See Also:
setRegisteredOid(String oid)

setTableVector

public void setTableVector(java.util.Vector tableVector)
Setter of Table Elements.
Parameters:
tableVector - specifies the tableVector with all the row entries (DynamicRegistrationEntry objects of contextBasedProxyTable).
See Also:
getTableVector()

getTableVector

public java.util.Vector getTableVector()
Getter of table elements
Returns:
The Vector of all row entries(DynamicRegistrationEntry objects of contextBasedProxyTable).
See Also:
setTableVector(Vector tableVector)

setExtraVarBind

public void setExtraVarBind(java.util.Vector addVector)
Method to set Additional VarBinds to be sent along with the SubAgent LinkUp or LinkDown Traps.
Parameters:
addVector - the Vector of additional VarBinds.

getExtraVarBind

public java.util.Vector getExtraVarBind()
Getter for the Vector of Additional VarBinds sent along with the SubAgent LinkUp or LinkDown Traps.
Returns:
the Vector of additional VarBinds.

setTrapPort

public void setTrapPort(int trapPort)
Deprecated. The method is no Longer used. The Traps will be sent to the Entries in the ForwardingTable.

Since:
AdventNet Agent Toolkit (Java/JMX Edition) 5.0

setManagerHost

public void setManagerHost(java.lang.String managerHost)
Deprecated. The method is no Longer used. The Traps will be sent to the Entries in the ForwardingTable.

Since:
AdventNet Agent Toolkit (Java/JMX Edition) 5.0

setTrapVersion

public void setTrapVersion(int trapVersion)
Deprecated. The method is no Longer used. The Traps will be sent to the Entries in the ForwardingTable.

Since:
AdventNet Agent Toolkit (Java/JMX Edition) 5.0

setLinkUpOid

public void setLinkUpOid(java.lang.String linkUpOid)
Setter for the LinkUpTrap OID. Default value will be .1.3.6.1.4.1.2162.10.3.1.5.1
Parameters:
The - LinkUpOid to be sent with the Traps.

getLinkUpOid

public java.lang.String getLinkUpOid()
Getter for the LinkUpOid sent with the LinkUp Traps.
Returns:
The LinkUp Oid String.

setLinkDownOid

public void setLinkDownOid(java.lang.String linkDownOid)
Setter for the LinkDownTrap OID. Default value will be .1.3.6.1.4.1.2162.10.3.1.5.2
Parameters:
The - LinkDown Oid to be sent with the Traps.

getLinkDownOid

public java.lang.String getLinkDownOid()
Getter for the LinkDownOid sent with the LinkUp Traps.
Returns:
The LinkUp Oid String.

checkSubAgentHeartBeat

public void checkSubAgentHeartBeat(boolean b,
                                   java.lang.Long pollingInterval,
                                   java.lang.Integer timeOut,
                                   java.lang.Integer retries,
                                   SnmpAgent agentRef)
This method is to enable Polling the SubAgent to see whether its alive. If the SubAgent fails to respond within the specified timeout and retries values, the MasterAgent will stop proxying the Requests to the SubAgent until it comes back alive.
Parameters:
b - true to enable polling.
pollingInterval - The TimeInterval between consecutive polls.
timeOut - The TimeOut value for which this Poller should wait to getback the Response from the SubAgnet.
retries - the Retries value to specify the number of polls to get back the response.
agentRef - the SnmpAgent reference.

setFileName

public void setFileName(java.lang.String fileName)
Setter of file name.
Parameters:
fileName - specifies the fileName of the file in which all the registration entries are stored with the directory structure(similar to "conf"+File.separator+ "ProxyTable.xml").
See Also:
getFileName()

getFileName

public java.lang.String getFileName()
Getter for file name.
Returns:
The fileName in which the Entries are stored persistently with the directory structure(by default the value is "conf/ProxyTable.xml").
See Also:
setFileName(String fileName)

getSubidList

protected int[] getSubidList()
This is the subid List which is registered with the source of SnmpPduRequestEvents.
Overrides:
getSubidList in class SimpleRequestHandler
Returns:
subidList {1,2,3,4,5,6,7,8,9} The subId list of the contextBasedProxyTable.

processGetRequest

protected void processGetRequest(SnmpVarBind varb,
                                 AgentNode node,
                                 VarBindRequestEvent pe)
                          throws AgentSnmpException
Processes the GetRequest message from the manager for the contextBasedProxyTable.
Overrides:
processGetRequest in class SimpleRequestHandler
Parameters:
varb - specifies the VarBind.
node - The node for which the Get Request is given.
pe - The VarBindRequestEvent created for the Get Request.
Throws:
AgentSnmpException - This Wraps all the Exceptions thrown while processing this Event.

processGetRequest

protected void processGetRequest(SnmpVarBind varb,
                                 int req,
                                 VarBindRequestEvent pe,
                                 DynamicRegistrationEntry entry)
                          throws AgentSnmpException
Processes the GetRequest message from the manager for the contextBasedProxyTable.
Parameters:
varb - specifies the VarBind.
req - specifies the subId for which the request is processed.
pe - The VarBindRequestEvent created for the Get Request.
entry - The entry in which the Get Request is processed.
Throws:
AgentSnmpException - This Wraps all the Exceptions thrown while processing this Event.

processSetRequest

protected void processSetRequest(SnmpVarBind varb,
                                 AgentNode node,
                                 VarBindRequestEvent pe)
                          throws AgentSnmpException
Processes the SetRequest message from the manager for the contextBasedProxyTable.
Overrides:
processSetRequest in class SimpleRequestHandler
Parameters:
varb - specifies the VarBind.
node - The node for which the Set Request is given.
pe - The VarBindRequestEvent created for the Set Request.
Throws:
AgentSnmpException - This Wraps all the Exceptions thrown while processing this Event.

processGetNextRequest

protected void processGetNextRequest(SnmpVarBind varb,
                                     AgentNode node,
                                     VarBindRequestEvent pe)
                              throws AgentSnmpException
Processes the GetNextRequest message from the manager for the contextBasedProxyTable.
Overrides:
processGetNextRequest in class SimpleRequestHandler
Parameters:
varb - specifies the VarBind.
node - The node for which the Get Next Request is given.
pe - The VarBindRequestEvent created for the Get Next Request.
Throws:
AgentSnmpException - This Wraps all the Exceptions thrown while processing this Event.

checkForRowStatus

boolean checkForRowStatus(DynamicRegistrationEntry entry)
                    throws AgentSnmpException

addUpdateListener

public void addUpdateListener(UpdateListener l)
Setter for UpdateListener.
Overrides:
addUpdateListener in class SimpleRequestHandler
Parameters:
l - specifies the UpdateListener which updates the fileSystem.
See Also:
removeUpdateListener()

removeUpdateListener

public void removeUpdateListener()
Sets UpdateListener to null.
Overrides:
removeUpdateListener in class SimpleRequestHandler
See Also:
addUpdateListener(UpdateListener l)

addRegistrationListener

public void addRegistrationListener(RegistrationListener l)
Deprecated. - use the other method. Add RegistrationListener(agent) to the Listener table. Registration Listener methods

Description copied from class: SimpleRequestHandler
This method is called by BeanInfo for adding Registration Listener with PduRequestHandler
Overrides:
addRegistrationListener in class SimpleRequestHandler
Parameters:
l - specfies the RegistrationListener which processes the Requests from the manager.
See Also:
removeRegistrationListener(RegistrationListener l)

addRegistrationListener

public void addRegistrationListener(RegistrationListener l,
                                    boolean remoteAccess)
Add RegistrationListener (agent) to the Listener table. Registration Listener methods
Parameters:
l - specfies the RegistrationListener which processes the Requests from the manager.
remoteAccess - specifies whether this proxyTable is to be remotely Accessible or not.
See Also:
removeRegistrationListener(RegistrationListener l)

removeRegistrationListener

public void removeRegistrationListener(RegistrationListener l)
Removes RegistrationListener(agent) from Listener Table. makes the registration Listener null.
Overrides:
removeRegistrationListener in class SimpleRequestHandler
Parameters:
l - The Registration Listener which handles the Requests from the manager.
See Also:
addRegistratioListener(RegistrationListener l, boolean remoteAccess)

createDynamicRegistrationEntry

public static DynamicRegistrationEntry createDynamicRegistrationEntry(java.lang.String proxyingOID,
                                                                      java.lang.String proxyName,
                                                                      java.lang.String agentHost,
                                                                      java.lang.Integer agentPort,
                                                                      java.lang.Integer agentVersion,
                                                                      java.lang.String community,
                                                                      java.lang.Long timeOut,
                                                                      java.lang.Long retries)
This is static method for creating a DynamicRegistrationEntry with RowStatus value as Active(1).
Parameters:
proxyingOID - specifies the actual proxying OID in the subAgent.
proxyName - specifies the context for which the subAgent is to be contacted.
agentHost - specifies the Host in which the subAgent is running(it may be in IpAddress or the Host name format).
agentPort - specifies the Port at which the subAgent is running.
agentPort - specifies the Version with which the subAgent is to be proxied.
community - specifies the community parameter for the request to subAgent.
timeOut - specifies the timeOut parameter for the request to subAgent.
Returns:
DynamicRegistrationEntry entry - The DynamicRegistrationEntry created with the above details.
Since:
AdventNet Agent Toolkit (Java Edition) 5.0 beta release.

createDynamicRegistrationEntry

public static DynamicRegistrationEntry createDynamicRegistrationEntry(java.lang.String proxyingOID,
                                                                      java.lang.String proxyName,
                                                                      java.lang.String agentHost,
                                                                      java.lang.Integer agentPort,
                                                                      java.lang.Integer agentVersion,
                                                                      java.lang.String community,
                                                                      java.lang.Long timeOut,
                                                                      java.lang.Long retries,
                                                                      java.lang.Integer status)
This is static method for creating a DynamicRegistrationEntry.
Parameters:
proxyingOID - specifies the actual proxying OID in the subAgent.
proxyName - specifies the context for which the subAgent is to be contacted.
agentHost - specifies the Host in which the subAgent is running(it may be in IpAddress or the Host name format).
agentPort - specifies the Port at which the subAgent is running.
agentPort - specifies the Version with which the subAgent is to be proxied.
community - specifies the community parameter for the request to subAgent.
timeOut - specifies the timeOut parameter for the request to subAgent.
status - specifies the RowStatus value for this Entry (0 - 5).
Returns:
DynamicRegistrationEntry entry - The DynamicRegistrationEntry created with the above details.
Since:
AdventNet Agent Toolkit (Java Edition) 5.1.0.

setPersistence

public void setPersistence(boolean persistence)
Setter of the persistence flag.
Parameters:
persistence - The persistence flag for the persistence of the Table Values to the fileSystem.
Since:
AdventNet Agent Toolkit (Java Edition) 4.2 release.

isPersistence

public boolean isPersistence()
Getter of the persistence flag.
Returns:
true if the persistence is turned ON.
Since:
AdventNet Agent Toolkit (Java Edition) 4.2 release.

setFToVPersistence

public void setFToVPersistence(boolean fToVPersistence)
Setter for the FToV Persistence flag.
Parameters:
fToVPersistence - The FToV Persistence flag for type of persistence.

createDynamicRegistrationEntry

public static DynamicRegistrationEntry createDynamicRegistrationEntry(java.lang.String proxyingOID,
                                                                      java.lang.String agentHost,
                                                                      java.lang.String community,
                                                                      long timeOut,
                                                                      int agentPort)
Deprecated. - Make use of the new method with the additional argumnets. This is static method for creating a DynamicRegistrationEntry.

Parameters:
proxyingOID - specifies the actual proxying OID in the subAgent.
agentHost - specifies the Host in which the subAgent is running(it may be in IpAddress or the Host name format).
community - specifies the community of the proxied subAgent.
timeOut - specifies the timeOut parameter for the request to subAgent.
agentPort - specifies the Port at which the subAgent is running.
Returns:
DynamicRegistrationEntry entry - The DynamicRegistrationEntry created with the above details.
Since:
AdventNet Agent Toolkit (Java Edition) 4.2 release.