com.adventnet.snmp.snmp2.agent
Class BaseTrapForwardingTable

java.lang.Object
  extended by com.adventnet.snmp.snmp2.agent.SimpleRequestHandler
      extended by com.adventnet.snmp.snmp2.agent.BaseTrapForwardingTable
All Implemented Interfaces:
TrapForwardingTableInterface, VarBindRequestListener, AgentEventListener
Direct Known Subclasses:
SimpleTrapForwardingTable

public class BaseTrapForwardingTable
extends SimpleRequestHandler
implements TrapForwardingTableInterface

Handles all the requests for the trapForwardingTable. This will be instantiated if this Table needs RemoteConfiguration.

Both SimpleTrapForwardingTable and MicroTrapForwardingTable extend this class.

See Also:
SimpleTrapForwardingTable, MicroTrapForwardingTable

Field Summary
(package private) static int COLUMNCOUNT
           
(package private) static int COMMUNITY
           
(package private)  BaseForwardingTable forwardingTable
           
(package private)  int[] forwardingTableOidRep
           
(package private) static int MANAGERHOST
           
(package private) static int MANAGERHOSTTYPE
           
(package private) static int MANAGERPORT
           
(package private) static int RETRIES
           
(package private) static int ROWSTATUS
           
(package private) static int TIMEOUT
           
(package private)  AgentTableModel tModelComplete
           
(package private) static int VERSION
           
 
Fields inherited from class com.adventnet.snmp.snmp2.agent.SimpleRequestHandler
instrumentHandler, listener, tableListener, writeEachTime
 
Constructor Summary
BaseTrapForwardingTable()
          Primary Constructor
BaseTrapForwardingTable(BaseForwardingTable forTable)
          Constructor with the BaseForwardingTable reference.
 
Method Summary
(package private)  boolean checkForRowStatus(ForwardingEntry entry)
           
static ForwardingEntry createForwardingEntry(java.lang.Integer managerHostType, java.lang.String managerHost, java.lang.Integer managerPort, java.lang.Integer version, java.lang.String community, java.lang.Long timeout, java.lang.Long retries)
          Creates a ForwardingEntry object for the V1V2ForwardingTable with RowStatus Value as Active.
static ForwardingEntry createForwardingEntry(java.lang.Integer managerHostType, java.lang.String managerHost, java.lang.Integer managerPort, java.lang.Integer version, java.lang.String community, java.lang.Long timeout, java.lang.Long retries, java.lang.Integer status)
          Creates a ForwardingEntry object for the V1V2ForwardingTable.
static ForwardingEntry createForwardingEntry(java.lang.String managerHost, java.lang.Integer managerPort, java.lang.Integer version, java.lang.String community, java.lang.Long timeout, java.lang.Long retries)
          Deprecated. - make use of the method with extra argument as the index has been changed. Creates a ForwardingEntry object for the V1V2ForwardingTable with RowStatus Value as Active.
static ForwardingEntry createForwardingEntry(java.lang.String managerHost, java.lang.Integer managerPort, java.lang.Integer version, java.lang.String community, java.lang.Long timeout, java.lang.Long retries, java.lang.Integer status)
          Deprecated. - make use of the method with extra argument as the index has been changed. Creates a ForwardingEntry object for the V1V2ForwardingTable.
 ForwardingEntry getForwardingEntry(int index)
          Gets the Entry at the given index.
 int getNumRows()
          Gets the number of rows of a table.
 int[] getOidRep()
          This method returns the OID representation of the Entry node of the TrapForwardingTable
protected  int[] getSubidList()
          This method returns the subId list of the columns in the TrapForwardingTable
 java.util.Vector getTableVector()
          Deprecated. use the method in BaseForwardingTable. Getter of the Table Vector of the BaseTrapForwardingTable
 java.lang.String getV1v2ManagerHost(int index)
          Gets the manager host name to which we need to send the Traps.
 int getV1v2ManagerPort(int index)
          The manager port to which we need to send the Traps to
 int getV1v2ManagerStatus(int index)
          Gets the row status of the table.
protected  void processGetNextRequest(java.util.Vector varbinds, java.util.Vector nodes, VarBindRequestEvent pe)
          This method is used for processing the incoming GETNEXT Requests
protected  void processGetRequest(java.util.Vector varbinds, java.util.Vector nodes, VarBindRequestEvent pe)
          This method along with processReadRequest is used for processing the GET Requests
protected  java.util.Vector processReadRequest(VarBindRequestEvent pe, ForwardingEntry entry, java.util.Vector attributesList, java.util.Hashtable varbindIndexHash)
          This method along with processGetRequest, will be used for processing the incoming GET Requests
protected  void processSetRequest(java.util.Vector varbinds, java.util.Vector nodes, VarBindRequestEvent pe)
          This method along with processWriteRequest is used for processing the incoming SET Requests
 java.util.Vector processWriteRequest(java.lang.String instanceString, java.util.Vector list, VarBindRequestEvent pe, java.util.Hashtable varbindIndexHash)
          This method along with the ProcessSetRequest is used for processing the Incoming Set Requests
(package private)  void setOidRep(int[] oidRep)
           
 void setTableVector(java.util.Vector tableVector)
          Deprecated. use the method in BaseForwardingTable. Setter for the Table Vector of the BaseTrapForwardingTable
 
Methods inherited from class com.adventnet.snmp.snmp2.agent.SimpleRequestHandler
addInstrumentHandler, addRegistrationListener, addTableListener, addUpdateListener, getInstrument, getMibVarHash, getNextRequest, getNextRequest, getObjectHash, getObjectTypeHash, getRequest, getTableListener, getUpdateListener, isWriteEachTime, processGetNextRequest, processGetRequest, processSetRequest, removeRegistrationListener, removeUpdateListener, setRequest, setWriteEachTime, writeIntoFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MANAGERHOSTTYPE

static final int MANAGERHOSTTYPE
See Also:
Constant Field Values

MANAGERHOST

static final int MANAGERHOST
See Also:
Constant Field Values

MANAGERPORT

static final int MANAGERPORT
See Also:
Constant Field Values

VERSION

static final int VERSION
See Also:
Constant Field Values

COMMUNITY

static final int COMMUNITY
See Also:
Constant Field Values

TIMEOUT

static final int TIMEOUT
See Also:
Constant Field Values

RETRIES

static final int RETRIES
See Also:
Constant Field Values

ROWSTATUS

static final int ROWSTATUS
See Also:
Constant Field Values

COLUMNCOUNT

static final int COLUMNCOUNT
See Also:
Constant Field Values

forwardingTableOidRep

int[] forwardingTableOidRep

forwardingTable

BaseForwardingTable forwardingTable

tModelComplete

AgentTableModel tModelComplete
Constructor Detail

BaseTrapForwardingTable

public BaseTrapForwardingTable()
Primary Constructor


BaseTrapForwardingTable

public BaseTrapForwardingTable(BaseForwardingTable forTable)
Constructor with the BaseForwardingTable reference.

Parameters:
forTable - the BaseForwardingTable instance.
Method Detail

getOidRep

public int[] getOidRep()
This method returns the OID representation of the Entry node of the TrapForwardingTable

Overrides:
getOidRep in class SimpleRequestHandler
Returns:
int array of the ForwardingEntry OID

setOidRep

void setOidRep(int[] oidRep)

getSubidList

protected int[] getSubidList()
This method returns the subId list of the columns in the TrapForwardingTable

Overrides:
getSubidList in class SimpleRequestHandler
Returns:
int Array of the subIds available i.e., column subIds

setTableVector

public void setTableVector(java.util.Vector tableVector)
Deprecated. use the method in BaseForwardingTable. Setter for the Table Vector of the BaseTrapForwardingTable

Parameters:
tableVector - a Vector of ForwardingEntry objects sorted according to the instance
Since:
AdventNet Agent Toolkit (Java/JMX Edition) 5.0
See Also:
getTableVector()

getTableVector

public java.util.Vector getTableVector()
Deprecated. use the method in BaseForwardingTable. Getter of the Table Vector of the BaseTrapForwardingTable

Returns:
Table Vector containing ForwardingEntry objects
Since:
AdventNet Agent Toolkit (Java/JMX Edition) 5.0
See Also:
setTableVector(Vector tableVector)

createForwardingEntry

public static ForwardingEntry createForwardingEntry(java.lang.String managerHost,
                                                    java.lang.Integer managerPort,
                                                    java.lang.Integer version,
                                                    java.lang.String community,
                                                    java.lang.Long timeout,
                                                    java.lang.Long retries)
Deprecated. - make use of the method with extra argument as the index has been changed. Creates a ForwardingEntry object for the V1V2ForwardingTable with RowStatus Value as Active.

Parameters:
managerHost - The IpAddress String specifying the HostName of the Manager to which the Notification or Trap is to be forwarded. - default value 127.0.0.l
managerPort - The Integer specifying Manager's Port to which the Notification or Trap is to be forwarded - default value 8003
version - The Integer specifying Snmp Version with which the TrapPDU is to be sent - default value is 2 (v2c)
community - The String specifying community of the TrapPDU that is to be sent - default value is public
timeout - The Long value specifying the TrapPDU's Timeout value - default value is 5000
retiries - The Long value specifying the TrapPDU's retries count - default value is 0
Returns:
ForwardingEntry created with the values specified.

createForwardingEntry

public static ForwardingEntry createForwardingEntry(java.lang.String managerHost,
                                                    java.lang.Integer managerPort,
                                                    java.lang.Integer version,
                                                    java.lang.String community,
                                                    java.lang.Long timeout,
                                                    java.lang.Long retries,
                                                    java.lang.Integer status)
Deprecated. - make use of the method with extra argument as the index has been changed. Creates a ForwardingEntry object for the V1V2ForwardingTable.

Parameters:
managerHost - The IpAddress String specifying the HostName of the Manager to which the Notification or Trap is to be forwarded. - default value 127.0.0.l
managerPort - The Integer specifying Manager's Port to which the Notification or Trap is to be forwarded - default value 8003
version - The Integer specifying Snmp Version with which the TrapPDU is to be sent - default value is 2 (v2c)
community - The String specifying community of the TrapPDU that is to be sent - default value is public
timeout - The Long value specifying the TrapPDU's Timeout value - default value is 5000
retiries - The Long value specifying the TrapPDU's retries count - default value is 0
status - The Integer value specifying the RowStatus value(1 - 5) - default value is 1
Returns:
ForwardingEntry created with the values specified.

processReadRequest

protected java.util.Vector processReadRequest(VarBindRequestEvent pe,
                                              ForwardingEntry entry,
                                              java.util.Vector attributesList,
                                              java.util.Hashtable varbindIndexHash)
This method along with processGetRequest, will be used for processing the incoming GET Requests

Parameters:
pe - VarbindRequestEvent
entry - Entry Object, which contains getter/setter methods for the attributes in this Table Group
attributesList - List of SnmpVarbinds of Attributes for which GET Request is to be perfortmed
varbindIndexHash - Hashtable for storing the index of the incoming varbinds
Returns:
List of Objects, for which GET is failed

processWriteRequest

public java.util.Vector processWriteRequest(java.lang.String instanceString,
                                            java.util.Vector list,
                                            VarBindRequestEvent pe,
                                            java.util.Hashtable varbindIndexHash)
This method along with the ProcessSetRequest is used for processing the Incoming Set Requests

Parameters:
instanceString - Index of the row in which SET Request is to be performed
list - List of SnmpVarbinds of Attributes for which SET is performed
pe - VarbindRequest Event
varbindIndexHash - Hashtable for storing the index of the incoming varbinds
Returns:
List of Objects, for which SET is failed

processGetRequest

protected void processGetRequest(java.util.Vector varbinds,
                                 java.util.Vector nodes,
                                 VarBindRequestEvent pe)
This method along with processReadRequest is used for processing the GET Requests

Overrides:
processGetRequest in class SimpleRequestHandler
Parameters:
varbinds - List of SnmpVarbinds for which GET Request is to be performed
nodes - List of Agent Nodes for which GET Request is performed
pe - VarbindRequest Event

processSetRequest

protected void processSetRequest(java.util.Vector varbinds,
                                 java.util.Vector nodes,
                                 VarBindRequestEvent pe)
This method along with processWriteRequest is used for processing the incoming SET Requests

Overrides:
processSetRequest in class SimpleRequestHandler
Parameters:
varbinds - List of SnmpVarbinds for which SET Request is performed
nodes - List of Agent Nodes for which SET Request is performed
pe - VarbindRequest Event

processGetNextRequest

protected void processGetNextRequest(java.util.Vector varbinds,
                                     java.util.Vector nodes,
                                     VarBindRequestEvent pe)
This method is used for processing the incoming GETNEXT Requests

Overrides:
processGetNextRequest in class SimpleRequestHandler
Parameters:
varbinds - List of varbinds for which the GETNEXT Request is to be performed
nodes - List of AgentNodes for which GETNEXT Request is to be performed
pe - VarbindRequest Event

checkForRowStatus

boolean checkForRowStatus(ForwardingEntry entry)
                    throws AgentSnmpException
Throws:
AgentSnmpException

getNumRows

public int getNumRows()
Description copied from interface: TrapForwardingTableInterface
Gets the number of rows of a table.

Specified by:
getNumRows in interface TrapForwardingTableInterface
Returns:
number of rows in the Table

getV1v2ManagerHost

public java.lang.String getV1v2ManagerHost(int index)
Description copied from interface: TrapForwardingTableInterface
Gets the manager host name to which we need to send the Traps.

Specified by:
getV1v2ManagerHost in interface TrapForwardingTableInterface
Parameters:
index - The index of the table.
Returns:
the Manager to which trap is to be sent return null if there is no manager for the index

getV1v2ManagerPort

public int getV1v2ManagerPort(int index)
The manager port to which we need to send the Traps to

Specified by:
getV1v2ManagerPort in interface TrapForwardingTableInterface
Parameters:
row - index Note: if a -1 is returned port is assumed to be 162
Returns:
The Manager Port to which Trap is to be sent. If a -1 is returned port is assumed to be 162.

getV1v2ManagerStatus

public int getV1v2ManagerStatus(int index)
Description copied from interface: TrapForwardingTableInterface
Gets the row status of the table.

Specified by:
getV1v2ManagerStatus in interface TrapForwardingTableInterface
Parameters:
index - The index to which row status is to required.
Returns:
rowSatus of the Row. return 1 if active

getForwardingEntry

public ForwardingEntry getForwardingEntry(int index)
Description copied from interface: TrapForwardingTableInterface
Gets the Entry at the given index.

Specified by:
getForwardingEntry in interface TrapForwardingTableInterface
Parameters:
index - the index for which the Entry is required.
Returns:
The ForwardingEntry at the Given Index else a null.

createForwardingEntry

public static ForwardingEntry createForwardingEntry(java.lang.Integer managerHostType,
                                                    java.lang.String managerHost,
                                                    java.lang.Integer managerPort,
                                                    java.lang.Integer version,
                                                    java.lang.String community,
                                                    java.lang.Long timeout,
                                                    java.lang.Long retries)
Creates a ForwardingEntry object for the V1V2ForwardingTable with RowStatus Value as Active.

Parameters:
managerHostType - the type of the IPAddress of the Manager with which the Entry is to be created
managerHost - The IpAddress String specifying the HostName of the Manager to which the Notification or Trap is to be forwarded. - default value 127.0.0.l
managerPort - The Integer specifying Manager's Port to which the Notification or Trap is to be forwarded - default value 8003
version - The Integer specifying Snmp Version with which the TrapPDU is to be sent - default value is 2 (v2c)
community - The String specifying community of the TrapPDU that is to be sent - default value is public
timeout - The Long value specifying the TrapPDU's Timeout value - default value is 5000
retiries - The Long value specifying the TrapPDU's retries count - default value is 0
Returns:
ForwardingEntry created with the values specified.

createForwardingEntry

public static ForwardingEntry createForwardingEntry(java.lang.Integer managerHostType,
                                                    java.lang.String managerHost,
                                                    java.lang.Integer managerPort,
                                                    java.lang.Integer version,
                                                    java.lang.String community,
                                                    java.lang.Long timeout,
                                                    java.lang.Long retries,
                                                    java.lang.Integer status)
Creates a ForwardingEntry object for the V1V2ForwardingTable.

Parameters:
managerHostType - the type of the IPAddress of the Manager with which the Entry is to be created
managerHost - The IpAddress String specifying the HostName of the Manager to which the Notification or Trap is to be forwarded. - default value 127.0.0.l
managerPort - The Integer specifying Manager's Port to which the Notification or Trap is to be forwarded - default value 8003
version - The Integer specifying Snmp Version with which the TrapPDU is to be sent - default value is 2 (v2c)
community - The String specifying community of the TrapPDU that is to be sent - default value is public
timeout - The Long value specifying the TrapPDU's Timeout value - default value is 5000
retiries - The Long value specifying the TrapPDU's retries count - default value is 0
status - The Integer value specifying the RowStatus value(1 - 5) - default value is 1
Returns:
ForwardingEntry created with the values specified.