com.adventnet.adaptors.snmp
Class VarBindRequestListenerSupport

java.lang.Object
  |
  +--com.adventnet.snmp.snmp2.agent.SimpleRequestHandler
        |
        +--com.adventnet.adaptors.snmp.VarBindRequestListenerSupport

public class VarBindRequestListenerSupport
extends SimpleRequestHandler
implements NotificationListener, NotificationFilter

This class acts as the VarBindRequestListener object for each mbean that registers with the server. For SNMP support a separate registration tree is maintained at the PduRequestHandler, to which this VarBindRequestListener gets registered.

See Also:
Serialized Form

Field Summary
(package private)  SnmpAdaptor adaptor
           
(package private)  ModelMBeanAttributeInfo[] adss
           
(package private)  int count
           
(package private)  boolean implementsModelListener
           
(package private)  java.lang.String[] indexNames
           
(package private)  AgentTableModel insTable
           
(package private)  UpdateListener listener
           
(package private)  java.lang.String msClassName
           
(package private)  ModelMBeanNotificationInfo[] ndss
           
(package private)  int nonIndexCount
           
(package private)  java.lang.String objectName
           
(package private)  ObjectInstance oi
           
(package private)  int[] oidRep
           
(package private)  boolean rowStatus
           
(package private)  java.lang.String rowStatusName
           
(package private)  java.lang.String rowStatusOid
           
(package private)  MBeanServer server
           
(package private)  int[] subidList
           
(package private)  boolean tabular
           
(package private)  java.util.Hashtable tempTable
           
 
Fields inherited from class com.adventnet.snmp.snmp2.agent.SimpleRequestHandler
instrumentHandler, listener, tableListener, writeEachTime
 
Constructor Summary
VarBindRequestListenerSupport()
           
VarBindRequestListenerSupport(MBeanServer server, ObjectInstance oi)
           
VarBindRequestListenerSupport(MBeanServer server, java.lang.String objectName, ModelMBeanInfo mmInfo)
           
VarBindRequestListenerSupport(MBeanServer server, java.lang.String wsClassName, ModelMBeanInfo mmInfo, SnmpAdaptor adaptor)
          The following is a constructor newly added to register the StandardMBean and DynamicMBean with the SnmpAgent.
 
Method Summary
 void addRow(TableEntry entry)
           
 void addUpdateListener(UpdateListener l)
          Addition of UpdateListener for persistence storage of Table values.
(package private)  boolean checkForRowStatus(CompositeData entry, int msgType)
           
 void disableAllTypes()
          Useful in filtering the Notifications.
 void disableType(java.lang.String prefix)
          Useful in filtering.
 void enableType(java.lang.String prefix)
          Useful in filtering.
 java.util.Vector getEnabledTypes()
          Returns the enabled types of this NotificationFilter as Vector of String values.
 ModelMBeanInfo getModelMBeanInfo()
           
 int[] getOidRep()
          Retrives the integer representation of OID
 int[] getSubidList()
          Gets the subid list of the oid.
 boolean getViewBasedFlag()
           
 void handleNotification(Notification notification, java.lang.Object handback)
          The unique call-back method which will be called by an MBean(notification broadcaster) when it emits a notification.
 boolean isNotificationEnabled(Notification notification)
          Invoked before sending the specified notification to the listener.
 boolean isNotificationEnabled(Notification notification, NotificationListener listener, java.lang.Object handback)
          Invoked before sending the specified notification to the listener.
static int[] makeInstanceOID(byte[] type, java.lang.Object[] array, boolean[] implied)
           
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 processSetRequest(SnmpVarBind varb, AgentNode node, VarBindRequestEvent pe)
          Process the Set Request message which is received from PduRequestHandler.
protected  void processTabularSetRequest(SnmpVarBind varb, AgentNode node, VarBindRequestEvent pe)
           
 void remove(TableEntry entry)
           
 void removeUpdateListener()
          Removal of UpdateListener for persistence storage of Table values.
 void setTrapHandler(java.lang.Object th)
           
 void setViewBasedFlag(boolean vbac)
           
 
Methods inherited from class com.adventnet.snmp.snmp2.agent.SimpleRequestHandler
addInstrumentHandler, addRegistrationListener, addTableListener, getInstrument, getMibVarHash, getNextRequest, getObjectHash, getObjectTypeHash, getRequest, getTableListener, isWriteEachTime, processGetNextRequest, processGetRequest, processSetRequest, removeRegistrationListener, setRequest, setWriteEachTime, writeIntoFile
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

oidRep

int[] oidRep

subidList

int[] subidList

tempTable

java.util.Hashtable tempTable

adss

ModelMBeanAttributeInfo[] adss

ndss

ModelMBeanNotificationInfo[] ndss

oi

ObjectInstance oi

objectName

java.lang.String objectName

msClassName

java.lang.String msClassName

adaptor

SnmpAdaptor adaptor

server

MBeanServer server

tabular

boolean tabular

implementsModelListener

boolean implementsModelListener

count

int count

insTable

AgentTableModel insTable

rowStatus

boolean rowStatus

rowStatusOid

java.lang.String rowStatusOid

rowStatusName

java.lang.String rowStatusName

nonIndexCount

int nonIndexCount

indexNames

java.lang.String[] indexNames

listener

UpdateListener listener
Constructor Detail

VarBindRequestListenerSupport

public VarBindRequestListenerSupport()

VarBindRequestListenerSupport

public VarBindRequestListenerSupport(MBeanServer server,
                                     java.lang.String wsClassName,
                                     ModelMBeanInfo mmInfo,
                                     SnmpAdaptor adaptor)
                              throws java.lang.Exception
The following is a constructor newly added to register the StandardMBean and DynamicMBean with the SnmpAgent.

VarBindRequestListenerSupport

public VarBindRequestListenerSupport(MBeanServer server,
                                     java.lang.String objectName,
                                     ModelMBeanInfo mmInfo)
                              throws java.lang.Exception

VarBindRequestListenerSupport

public VarBindRequestListenerSupport(MBeanServer server,
                                     ObjectInstance oi)
                              throws java.lang.Exception
Method Detail

getModelMBeanInfo

public ModelMBeanInfo getModelMBeanInfo()

getOidRep

public int[] getOidRep()
Description copied from class: SimpleRequestHandler
Retrives the integer representation of OID
Overrides:
getOidRep in class SimpleRequestHandler
Tags copied from class: SimpleRequestHandler
Returns:
the integer array of OID

getSubidList

public int[] getSubidList()
Description copied from class: SimpleRequestHandler
Gets the subid list of the oid.
Overrides:
getSubidList in class SimpleRequestHandler
Tags copied from 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
Tags copied from 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.

makeInstanceOID

public static int[] makeInstanceOID(byte[] type,
                                    java.lang.Object[] array,
                                    boolean[] implied)

checkForRowStatus

boolean checkForRowStatus(CompositeData entry,
                          int msgType)

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
Tags copied from 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.

processTabularSetRequest

protected void processTabularSetRequest(SnmpVarBind varb,
                                        AgentNode node,
                                        VarBindRequestEvent pe)
                                 throws java.lang.Exception

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
Tags copied from 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.

addRow

public void addRow(TableEntry entry)

remove

public void remove(TableEntry entry)

addUpdateListener

public void addUpdateListener(UpdateListener l)
Description copied from class: SimpleRequestHandler
Addition of UpdateListener for persistence storage of Table values.
Overrides:
addUpdateListener in class SimpleRequestHandler
Tags copied from class: SimpleRequestHandler
Parameters:
l - The updateListener which implements the writeIntoFile method.

removeUpdateListener

public void removeUpdateListener()
Description copied from class: SimpleRequestHandler
Removal of UpdateListener for persistence storage of Table values. Makes the UpdateListener to null.
Overrides:
removeUpdateListener in class SimpleRequestHandler

handleNotification

public void handleNotification(Notification notification,
                               java.lang.Object handback)
The unique call-back method which will be called by an MBean(notification broadcaster) when it emits a notification.
Specified by:
handleNotification in interface NotificationListener
Parameters:
notification - The notification.
handback - An opaque object which helps the listener to associate information regarding the MBean emitter. This object was passed to the MBean during the addListener call and resend, without modification, to the listener. The MBean object should to use or modify the object.

isNotificationEnabled

public boolean isNotificationEnabled(Notification notification,
                                     NotificationListener listener,
                                     java.lang.Object handback)
Invoked before sending the specified notification to the listener. Only if this method returns true , the notification listener's handleNotification method will be invoked.
Parameters:
notification - The notification to be sent.
listener - The listener object which will handle the notification.
handback - An opaque object which helps the listener to associate information regarding the MBean emitter. This object is passed to the MBean during the addNotificationListener call and resent, without modification, to the listener.
Returns:
True if the notification has to be sent to the listener, false otherwise.

isNotificationEnabled

public boolean isNotificationEnabled(Notification notification)
Description copied from interface: NotificationFilter
Invoked before sending the specified notification to the listener.
Specified by:
isNotificationEnabled in interface NotificationFilter
Tags copied from interface: NotificationFilter
Parameters:
notification - The notification to be sent.
Returns:
true if the notification has to be sent to the listener, false otherwise.

disableAllTypes

public void disableAllTypes()
Useful in filtering the Notifications. In this case the filtering always returns false.

disableType

public void disableType(java.lang.String prefix)
Useful in filtering. The Notification of types starting with this prefix gets dropped and filter returns false.
Parameters:
prefix - the prefix value for which notifications are dropped.

enableType

public void enableType(java.lang.String prefix)
Useful in filtering. The Notification of types starting with this prefix gets filtered and given to the Notification listener.
Parameters:
prefix - the prefix value for which notifications are filtered successfully.

getEnabledTypes

public java.util.Vector getEnabledTypes()
Returns the enabled types of this NotificationFilter as Vector of String values.
Returns:
the vector of enabled notification types.

setTrapHandler

public void setTrapHandler(java.lang.Object th)

setViewBasedFlag

public void setViewBasedFlag(boolean vbac)

getViewBasedFlag

public boolean getViewBasedFlag()