com.adventnet.snmp.snmp2.agent.community
Class SnmpCommunityTableRequestHandler

java.lang.Object
  extended by com.adventnet.snmp.snmp2.agent.SimpleRequestHandler
      extended by com.adventnet.snmp.snmp2.agent.community.SnmpCommunityTableRequestHandler
All Implemented Interfaces:
VarBindRequestListener, AgentEventListener

public class SnmpCommunityTableRequestHandler
extends SimpleRequestHandler

This class is responsible for handling all the requests under SnmpCommunityTable group


Field Summary
(package private)  SnmpAgent agentName
           
(package private)  SnmpAPI api
           
(package private) static int COLUMNCOUNT
           
(package private)  SnmpCommunityTable communityTable
           
(package private)  java.lang.String fileDir
           
(package private)  java.lang.String format
           
(package private) static int SNMPCOMMUNITYCONTEXTENGINEID
           
(package private) static int SNMPCOMMUNITYCONTEXTNAME
           
(package private)  java.util.Vector snmpCommunityEntryVector
           
(package private) static int SNMPCOMMUNITYINDEX
           
(package private) static int SNMPCOMMUNITYNAME
           
(package private) static int SNMPCOMMUNITYSECURITYNAME
           
(package private) static int SNMPCOMMUNITYSTATUS
           
(package private) static int SNMPCOMMUNITYSTORAGETYPE
           
(package private) static int SNMPCOMMUNITYTRANSPORTTAG
           
(package private)  SnmpCommunityTableXMLToVector xmlToVector
           
 
Fields inherited from class com.adventnet.snmp.snmp2.agent.SimpleRequestHandler
instrumentHandler, listener, tableListener
 
Constructor Summary
SnmpCommunityTableRequestHandler(SnmpAgent agentRef)
          Constructor that takes a SnmpAgent as an argument.
SnmpCommunityTableRequestHandler(SnmpAgent agentRef, java.lang.String dirStr, java.lang.String fileName, java.lang.String format)
          Constructor that takes a SnmpAgent as an argument.
 
Method Summary
(package private)  boolean checkForRowStatus(SnmpCommunityEntry entry)
           
 boolean createAndAddCommunityEntry(java.lang.String communityIndex, java.lang.String communityName, java.lang.String securityName, java.lang.String contextID, java.lang.String contextName, java.lang.String communityTag, java.lang.Integer storageType, java.lang.Integer rowStatus)
          The method to create and Add a new Entry to the CommunityTable.
static SnmpCommunityEntry createCommunityEntry(java.lang.String communityIndex, java.lang.String communityName, java.lang.String securityName, java.lang.String contextID, java.lang.String contextName, java.lang.String transportTag, java.lang.Integer storageType, java.lang.Integer rowStatus)
          The Static method to create new SnmpCommunityEntry.
 int[] getOidRep()
          Retrives the integer representation of OID
static int[] getSnmpCommunityTableOidRep()
          Getter method for the OID rep of the SnmpCommunityTable.
protected  int[] getSubidList()
          Gets the subid list of the oid.
 java.util.Vector getTableVector()
          The method to get the Vector of SnmpCommunityEntries present in the SnmpCommunityTable.
protected  void processGetNextRequest(SnmpVarBind varb, AgentNode node, VarBindRequestEvent pe)
          Process the GetNext Request message which is received from PduRequestHandler.
protected  void processGetRequest(SnmpVarBind varb, AgentNode node, VarBindRequestEvent pe)
          Process the Get Request message which is received from PduRequestHandler.
protected  void processGetRequest(SnmpVarBind varb, int req, VarBindRequestEvent pe, SnmpCommunityEntry entry, byte[] communityIndex)
           
protected  void processSetRequest(SnmpVarBind varb, AgentNode node, VarBindRequestEvent pe)
          Process the Set Request message which is received from PduRequestHandler.
 void serialize(java.io.ObjectOutputStream outMain)
          Method to serialize the CommunityTable.
 void setTableVector(java.util.Vector comVec)
          The method to set the Vector of SnmpCommunityEntries.
 
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

SNMPCOMMUNITYINDEX

static final int SNMPCOMMUNITYINDEX
See Also:
Constant Field Values

SNMPCOMMUNITYNAME

static final int SNMPCOMMUNITYNAME
See Also:
Constant Field Values

SNMPCOMMUNITYSECURITYNAME

static final int SNMPCOMMUNITYSECURITYNAME
See Also:
Constant Field Values

SNMPCOMMUNITYCONTEXTENGINEID

static final int SNMPCOMMUNITYCONTEXTENGINEID
See Also:
Constant Field Values

SNMPCOMMUNITYCONTEXTNAME

static final int SNMPCOMMUNITYCONTEXTNAME
See Also:
Constant Field Values

SNMPCOMMUNITYTRANSPORTTAG

static final int SNMPCOMMUNITYTRANSPORTTAG
See Also:
Constant Field Values

SNMPCOMMUNITYSTORAGETYPE

static final int SNMPCOMMUNITYSTORAGETYPE
See Also:
Constant Field Values

SNMPCOMMUNITYSTATUS

static final int SNMPCOMMUNITYSTATUS
See Also:
Constant Field Values

COLUMNCOUNT

static final int COLUMNCOUNT
See Also:
Constant Field Values

agentName

SnmpAgent agentName

api

SnmpAPI api

communityTable

SnmpCommunityTable communityTable

snmpCommunityEntryVector

java.util.Vector snmpCommunityEntryVector

xmlToVector

SnmpCommunityTableXMLToVector xmlToVector

format

java.lang.String format

fileDir

java.lang.String fileDir
Constructor Detail

SnmpCommunityTableRequestHandler

public SnmpCommunityTableRequestHandler(SnmpAgent agentRef)
Constructor that takes a SnmpAgent as an argument.

Parameters:
agentRef - instance of SnmpAgent.

SnmpCommunityTableRequestHandler

public SnmpCommunityTableRequestHandler(SnmpAgent agentRef,
                                        java.lang.String dirStr,
                                        java.lang.String fileName,
                                        java.lang.String format)
Constructor that takes a SnmpAgent as an argument.

Parameters:
agentRef - Instance of SnmpAgent.
dirStr - the directory location String of the File.
fileName - The XML fileName from where the entries are to be stored.
format - "xml" to say that the file is of XML Format.
Method Detail

getSnmpCommunityTableOidRep

public static int[] getSnmpCommunityTableOidRep()
Getter method for the OID rep of the SnmpCommunityTable.

Returns:
the int[] representation of {1,3,6,1,6,3,18,1,1,1}

getOidRep

public int[] getOidRep()
Description copied from class: SimpleRequestHandler
Retrives the integer representation of OID

Overrides:
getOidRep in class SimpleRequestHandler
Returns:
the integer array of OID

getSubidList

protected int[] getSubidList()
Description copied from class: SimpleRequestHandler
Gets the subid list of the oid.

Overrides:
getSubidList in class SimpleRequestHandler
Returns:
the integer array of subid list

processGetRequest

protected void processGetRequest(SnmpVarBind varb,
                                 AgentNode node,
                                 VarBindRequestEvent pe)
                          throws AgentSnmpException
Description copied from class: SimpleRequestHandler
Process the Get Request message which is received from PduRequestHandler.

Overrides:
processGetRequest in class SimpleRequestHandler
Parameters:
varb - The received varbind .
node - The node for which Get Request is to be done.
pe - The VarBind Request Event created by this Get request.
Throws:
AgentSnmpException - This wraps all the Exceptions thrown while Processing the Event.

processGetRequest

protected void processGetRequest(SnmpVarBind varb,
                                 int req,
                                 VarBindRequestEvent pe,
                                 SnmpCommunityEntry entry,
                                 byte[] communityIndex)
                          throws AgentSnmpException
Throws:
AgentSnmpException

processSetRequest

protected void processSetRequest(SnmpVarBind varb,
                                 AgentNode node,
                                 VarBindRequestEvent pe)
                          throws AgentSnmpException
Description copied from class: SimpleRequestHandler
Process the Set Request message which is received from PduRequestHandler.

Overrides:
processSetRequest in class SimpleRequestHandler
Parameters:
varb - The received varbind.
node - The node for which Get Next Request is to be done.
pe - The VarBind Request Event created by this GetNext request.
Throws:
AgentSnmpException - This wraps all the Exceptions thrown while Processing the Event.

processGetNextRequest

protected void processGetNextRequest(SnmpVarBind varb,
                                     AgentNode node,
                                     VarBindRequestEvent pe)
                              throws AgentSnmpException
Description copied from class: SimpleRequestHandler
Process the GetNext Request message which is received from PduRequestHandler.

Overrides:
processGetNextRequest in class SimpleRequestHandler
Parameters:
varb - The received varbind.
node - The node for which Get Next Request is to be done.
pe - The VarBind Request Event created by this GetNext request.
Throws:
AgentSnmpException - This wraps all the Exceptions thrown while Processing the Event.

checkForRowStatus

boolean checkForRowStatus(SnmpCommunityEntry entry)
                    throws AgentException
Throws:
AgentException

serialize

public void serialize(java.io.ObjectOutputStream outMain)
Method to serialize the CommunityTable.

Parameters:
outMain - the ObjectOutputStream for serializing.

createAndAddCommunityEntry

public boolean createAndAddCommunityEntry(java.lang.String communityIndex,
                                          java.lang.String communityName,
                                          java.lang.String securityName,
                                          java.lang.String contextID,
                                          java.lang.String contextName,
                                          java.lang.String communityTag,
                                          java.lang.Integer storageType,
                                          java.lang.Integer rowStatus)
The method to create and Add a new Entry to the CommunityTable.

Parameters:
communityIndex - The communityIndex with which the entry is to be created.
communityName - The communityName with which the entry is to be created.
securityName - The securityName with which the entry is to be created.
contextID - The contextID with which the entry is to be created.
contextName - The contextName with which the entry is to be created.
communityTag - The communityTag with which the entry is to be created.
storageType - The storageType for the Entry.
rowStatus - The RowStatus Integer for the Entry.
Returns:
boolean specifying whether the Entry is successfully added.
See Also:
createCommunityEntry.

createCommunityEntry

public static SnmpCommunityEntry createCommunityEntry(java.lang.String communityIndex,
                                                      java.lang.String communityName,
                                                      java.lang.String securityName,
                                                      java.lang.String contextID,
                                                      java.lang.String contextName,
                                                      java.lang.String transportTag,
                                                      java.lang.Integer storageType,
                                                      java.lang.Integer rowStatus)
The Static method to create new SnmpCommunityEntry.

Parameters:
communityIndex - The communityIndex with which the entry is to be created.
communityName - The communityName with which the entry is to be created.
securityName - The securityName with which the entry is to be created.
contextID - The contextID with which the entry is to be created.
contextName - The contextName with which the entry is to be created.
communityTag - The communityTag with which the entry is to be created.
storageType - The storageType for the Entry.
rowStatus - The RowStatus Integer for the Entry.
Returns:
boolean specifying whether the Entry is successfully added.
See Also:
createAndAddCommunityEntry.

setTableVector

public void setTableVector(java.util.Vector comVec)
The method to set the Vector of SnmpCommunityEntries.

Parameters:
comVec - The Vector of SnmpCommunityEntries.

getTableVector

public java.util.Vector getTableVector()
The method to get the Vector of SnmpCommunityEntries present in the SnmpCommunityTable.

Returns:
The Vector of SnmpCommunityEntries.