com.adventnet.utils.agent
Class DynamicRegistration

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

public class DynamicRegistration
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 [])

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


Field Summary
(package private)  java.util.Vector addVector
           
(package private)  RegistrationListener agent
           
(package private) static java.lang.String className
           
(package private)  DynamicXMLToVector fileToVector
           
(package private)  UpdateListener listener
           
(package private)  java.lang.String managerHost
           
(package private) static int PROXYCOMMUNITY
           
(package private) static int PROXYHOST
           
(package private) static int PROXYOID
           
(package private) static int PROXYPORTNUMBER
           
(package private) static int PROXYRETRIES
           
(package private) static int PROXYROWSTATUS
           
(package private) static int PROXYTIMEOUT
           
(package private) static int PROXYVERSION
           
(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
DynamicRegistration()
          The default constructor for the Class
DynamicRegistration(boolean persistence)
          The primary constructor for the Class with the persistence flag.
DynamicRegistration(boolean fToVPersistence, java.lang.String dirStr, java.lang.String fileName)
          The secondary constructor for the Class for specifying the persistence format XML/FToV.
DynamicRegistration(java.lang.String className, boolean persistence)
          This constructor is used to specify the SnmpProxy class used by the DynamicRegistration for Proxying.
 
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 agentHost, java.lang.Integer agentPort, java.lang.Integer version, java.lang.String community, java.lang.Long timeOut, java.lang.Long retries)
          The static method for creating a DynamicRegistrationEntry with RowStatus value as Active(1).
static DynamicRegistrationEntry createDynamicRegistrationEntry(java.lang.String proxyingOID, java.lang.String agentHost, java.lang.Integer agentPort, java.lang.Integer version, java.lang.String community, java.lang.Long timeOut, java.lang.Long retries, java.lang.Integer status)
          The 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. use the other method with additional parameters. 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.
 SnmpProxy getProxyCommand(java.lang.String oid)
          Getter for the Proxy command related to the oid registration specified.
 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 for the Table Vector.
 boolean isPersistence()
          Getter of the persistence flag of the persistence to the fileSystem.
protected  void processGetNextRequest(SnmpVarBind varb, AgentNode node, VarBindRequestEvent pe)
          Processes the GetNextRequest message from the manager for the aProxyTable.
protected  void processGetRequest(SnmpVarBind varb, AgentNode node, VarBindRequestEvent pe)
          Processes the GetRequest message from the manager for the aProxyTable.
protected  void processGetRequest(SnmpVarBind varb, int req, VarBindRequestEvent pe, DynamicRegistrationEntry entry)
          Processes the GetRequest message from the manager for the aProxyTable.
protected  void processSetRequest(SnmpVarBind varb, AgentNode node, VarBindRequestEvent pe)
          Processes the SetRequest message from the manager for the aProxyTable.
 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 for file name.
 void setFToVPersistence(boolean fToVPersistence)
          Setter for 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 for the persistence of the Table Values to fileSystem.
 void setRegisteredOid(java.lang.String oid)
          Setter for registered oid.
 void setTableVector(java.util.Vector tableVector)
          Setter for 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

className

static java.lang.String className

fileToVector

DynamicXMLToVector fileToVector

PROXYOID

static final int PROXYOID

PROXYHOST

static final int PROXYHOST

PROXYPORTNUMBER

static final int PROXYPORTNUMBER

PROXYVERSION

static final int PROXYVERSION

PROXYCOMMUNITY

static final int PROXYCOMMUNITY

PROXYTIMEOUT

static final int PROXYTIMEOUT

PROXYRETRIES

static final int PROXYRETRIES

PROXYROWSTATUS

static final int PROXYROWSTATUS

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

DynamicRegistration

public DynamicRegistration()
The default constructor for the Class

DynamicRegistration

public DynamicRegistration(boolean persistence)
The primary constructor for the Class with the persistence flag.
Parameters:
persistence - The persistence flag for the persistence of the Table values in fileSystem.
Since:
AdventNet Agent Toolkit (Java Edition) 4.2 release.

DynamicRegistration

public DynamicRegistration(boolean fToVPersistence,
                           java.lang.String dirStr,
                           java.lang.String fileName)
The secondary constructor for the Class for specifying the persistence format XML/FToV.
Parameters:
fToVPersistence - The fToVPersistence flag for the persistence of the Table values in fileSystem as an FToV file.
dirStr - The directory of persistence.
fileName - The fileName of persistence.
Since:
AdventNet Agent Toolkit (Java Edition) 4.2 release.

DynamicRegistration

public DynamicRegistration(java.lang.String className,
                           boolean persistence)
This constructor is used to specify the SnmpProxy class used by the DynamicRegistration for Proxying. It is a hook to add the User's Own SnmpProxy Object to the DyanmicRegistration.
Parameters:
className - The Name of the Class to be used as the SnmpProxy.
persistence - The persistence flag for the persistence of the Table values in 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 - specifies the Entry Node OID of the Table which implements the Proxy Table (by default the Registered OID is ".1.3.6.1.4.1.2162.10.3.1.2.3.2.1" Entry OID of aProxyTable).
See Also:
getRegisteredOid()

getRegisteredOid

public java.lang.String getRegisteredOid()
Getter for registered oid.
Returns:
The Entry Node OID of the Table which implements the Proxy Table(by default the Registered OID is ".1.3.6.1.4.1.2162.10.3.1.2.3.2.1" Entry OID of aProxyTable).
See Also:
setRegisteredOid(String oid)

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.

setTableVector

public void setTableVector(java.util.Vector tableVector)
Setter for Table Elements.
Parameters:
tableVector - specifies the Vector of Row Entries (DynamicRegistrationEntry objects of the aProxyTable).
See Also:
getTableVector()

getTableVector

public java.util.Vector getTableVector()
Getter for the Table Vector.
Returns:
The Vector of Row Entries (DynamicRegistrationEntry objects of the aProxyTable).
See Also:
setTableVector(Vector tableVector)

setFileName

public void setFileName(java.lang.String fileName)
Setter for file name.
Parameters:
fileName - specifies the fileName with which the file system stores the Table entries persistently with the directory structure(by default the value is "conf"+File.separator+"ProxyTable.xml").
See Also:
getFileName().

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.4.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.4.2
Parameters:
The - LinkUpOid 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.

getFileName

public java.lang.String getFileName()
Getter for file name.
Returns:
The fileName with the directory structure which stores the Table entries persistently in the file system(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:
integer array {1,2,3,4,5,6,7,8} The subid list of the aProxyTable.

processGetRequest

protected void processGetRequest(SnmpVarBind varb,
                                 AgentNode node,
                                 VarBindRequestEvent pe)
                          throws AgentSnmpException
Processes the GetRequest message from the manager for the aProxyTable.
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 -  

processGetRequest

protected void processGetRequest(SnmpVarBind varb,
                                 int req,
                                 VarBindRequestEvent pe,
                                 DynamicRegistrationEntry entry)
                          throws AgentSnmpException
Processes the GetRequest message from the manager for the aProxyTable.
Parameters:
varb - specifies the VarBind.
req - The column for which the Get Request is processed
pe - The VarBindRequestEvent created for the Get Request.
entry - specifies the Row Entry for which the Get Request is processed.
Throws:
AgentSnmpException -  

processSetRequest

protected void processSetRequest(SnmpVarBind varb,
                                 AgentNode node,
                                 VarBindRequestEvent pe)
                          throws AgentSnmpException
Processes the SetRequest message from the manager for the aProxyTable.
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 -  

processGetNextRequest

protected void processGetNextRequest(SnmpVarBind varb,
                                     AgentNode node,
                                     VarBindRequestEvent pe)
                              throws AgentSnmpException
Processes the GetNextRequest message from the manager for the aProxyTable.
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 -  

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 for updating the file System.
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 - specifies the registration Listener to handle 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 - specifies the registration Listener to handle 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 is handling Requests from the manager.
See Also:
addRegistrationListener(RegistrationListener l, boolean remoteAccess)

createDynamicRegistrationEntry

public static DynamicRegistrationEntry createDynamicRegistrationEntry(java.lang.String proxyingOID,
                                                                      java.lang.String agentHost,
                                                                      java.lang.Integer agentPort,
                                                                      java.lang.Integer version,
                                                                      java.lang.String community,
                                                                      java.lang.Long timeOut,
                                                                      java.lang.Long retries)
The static method for creating a DynamicRegistrationEntry with RowStatus value as Active(1).
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).
agentPort - specifies the Port at which the subAgent is running.
version - specifies the timeOut parameter for the request to subAgent.
community - specifies the community of the proxied subAgent.
timeOut - specifies the timeOut parameter for the request to subAgent.
retries - specifies the retries parameter for the request to subAgent.
Returns:
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 agentHost,
                                                                      java.lang.Integer agentPort,
                                                                      java.lang.Integer version,
                                                                      java.lang.String community,
                                                                      java.lang.Long timeOut,
                                                                      java.lang.Long retries,
                                                                      java.lang.Integer status)
The 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).
agentPort - specifies the Port at which the subAgent is running.
version - specifies the timeOut parameter for the request to subAgent.
community - specifies the community of the proxied subAgent.
timeOut - specifies the timeOut parameter for the request to subAgent.
retries - specifies the retries parameter for the request to subAgent.
Returns:
The DynamicRegistrationEntry created with the above details.
Since:
AdventNet Agent Toolkit (Java Edition) 5.1.0.

setPersistence

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

isPersistence

public boolean isPersistence()
Getter of the persistence flag of the persistence to the fileSystem.
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 FToV Persistence flag.
Parameters:
fToVPersistence - The FToV Persistence flag.

getProxyCommand

public SnmpProxy getProxyCommand(java.lang.String oid)
Getter for the Proxy command related to the oid registration specified.
Parameters:
oid - The OID registered as the SubAgent.
Returns:
The SnmpProxy object which implements the Proxy operations.

createDynamicRegistrationEntry

public static DynamicRegistrationEntry createDynamicRegistrationEntry(java.lang.String proxyingOID,
                                                                      java.lang.String agentHost,
                                                                      java.lang.String community,
                                                                      long timeOut,
                                                                      int agentPort)
Deprecated. use the other method with additional parameters. 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:
The DynamicRegistrationEntry created with the above details.
Since:
AdventNet Agent Toolkit (Java Edition) 5.0 release.