com.adventnet.adaptors.snmp
Class SnmpAdaptor

java.lang.Object
  extended by com.adventnet.adaptors.AbstractAdaptor
      extended by com.adventnet.adaptors.snmp.SnmpAdaptor
All Implemented Interfaces:
Adaptor, RegistrationListener, AgentEventListener, java.io.Serializable, java.util.EventListener, javax.management.DynamicMBean, javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationFilter, javax.management.NotificationListener

public class SnmpAdaptor
extends AbstractAdaptor
implements javax.management.DynamicMBean, javax.management.NotificationListener, javax.management.NotificationFilter, RegistrationListener

This class acts as a JMX adaptor for SNMP protocol.

This itself acts as a mbean for exposing the SNMP properties.

The port number of the service can be specified in the ObjectName with key-value pair as, port=8001(by default)

For example, to start the Snmp agent at 8500, you can specify the following object name:

  • DefaultDomain:type=com.adventnet.adaptors.snmp.SnmpAdaptor,protocol=snmp,port=8500

    See Also:
    Serialized Form

    Nested Class Summary
     
    Nested classes/interfaces inherited from class com.adventnet.adaptors.AbstractAdaptor
    AbstractAdaptor.ProcessNotification
     
    Field Summary
    (package private)  javax.management.modelmbean.ModelMBeanAttributeInfo[] adss
              This method is an implementation of MBeanRegistration interface.
    (package private)  AgentSnmpGroup grp
               
    protected  javax.management.MBeanServer server
              MBeanServer Reference.
    (package private)  SnmpTrapService trapListener
               
    (package private)  boolean viewBasedFlag
               
     
    Fields inherited from class com.adventnet.adaptors.AbstractAdaptor
    notifications, port, processnotification, state
     
    Constructor Summary
    SnmpAdaptor()
              The NoArg constructor used to initialize the SnmpAdaptor in forming the MBeanInfo and getting the reference of the MBeanServer using the MBeanServer.findJMXAgent(...) method.
    SnmpAdaptor(int port)
              The one Arg constructor used to initialize the SnmpAdaptor in the given port in forming the MBeanInfo and getting the reference of the MBeanServer using the MBeanServer.findJMXAgent(...) method.
    SnmpAdaptor(java.lang.Integer port)
              The one Arg constructor used to initialize the SnmpAdaptor in the given port in forming the MBeanInfo and getting the reference of the MBeanServer using the MBeanServer.findJMXAgent(...) method.
    SnmpAdaptor(java.lang.Integer port, javax.management.MBeanServer server)
              This constructor is used to initialize the SnmpAdaptor in the given port in forming the MBeanInfo and getting the reference of the MBeanServer using the MBeanServer.findJMXAgent(...) method.
    SnmpAdaptor(java.lang.String ipAddress)
              The one Arg constructor used to initialize the SnmpAdaptor in the given IpAddress in forming the MBeanInfo and getting the reference of the MBeanServer using the MBeanServer.findJMXAgent(...) method.
     
    Method Summary
    (package private)  void addIntoClassNameTable(java.lang.String className, VarBindRequestListener listener)
               
    (package private)  void addIntoObjectNamePatternTable(java.lang.String objectNamePattern, java.lang.String regObjNamePatternTable)
               
    (package private)  void addIntoSupportTable(java.lang.String name, VarBindRequestListener listener)
               
     void addTrapRequestListener(SnmpTrapService trapListener)
              Add Trap Request Listener.
     boolean authenticatePDU(SnmpPDU pdu, java.lang.String community)
              This method is called before the processSnmpRequest and related processing methods are called.
    protected  void bind()
              Must be used to bind to a naming service or to bind to a ServerSocket
    protected  void destroyAdaptor()
              Kills the adaptor and releases all its resources
     void disableAllTypes()
              Useful in filtering the Notifications.
     void disableType(java.lang.String prefix)
              Useful in filtering.
     void enableAuthentication(boolean flag)
              This abstract method needs to be implemented by the Adaptor for providing Authentication
     void enableAuthorisation(boolean flag)
              This abstract method needs to be implemented by the Adaptor for providing Authorisation
     void enableType(java.lang.String prefix)
              Useful in filtering.
     javax.management.ObjectName getAdaptorObjectName()
              Returns the adaptor object name
     java.lang.String getAdaptorVersion()
              Gets the version of the adaptor.
     java.lang.Boolean getAsynchronousMode()
              Getter which specifies whether the snmp agent processes the pdu asynchronously
     java.lang.Object getAttribute(java.lang.String attribute)
              Gets the value of a specific attribute of this MBean.
     javax.management.AttributeList getAttributes(java.lang.String[] attributes)
              Enables the values of several attributes of this MBean.
     java.util.Vector getEnabledTypes()
              Returns the enabled types of this NotificationFilter as Vector of String values.
    static Log getLogger()
              Method to be used by the SnmpAdaptor to log messages.
     java.lang.Integer getMaximumThreads()
              Gets the number of threads to be started for asynchronous processing of snmp pdu
     javax.management.MBeanInfo getMBeanInfo()
              This method discovers the attributes and operations this MBean exposes for management.
     java.lang.String getNotificationMessageOID()
              Here i am getting the default oid.
     java.lang.String getObjectName()
              Returns the ObjectName of this adaptor with which it has been registered with the MBeanServer.
     int[] getOidRep(javax.management.ObjectName name)
              Retrieves the integer representation of OID.
     SnmpVar getOidValue(javax.management.ObjectName name, SnmpOID oid)
              This method will be useful in getting the value of any OID present in a mbean specified.
     PropertyRegistrationListener getPropertyRegistrationListener()
              Gets the PropertyRegistrationListener which has detailed properties of this snmp adaptor.
     java.lang.String getProtocol()
              Gets the protocol supported by this adaptor.
     java.lang.String[] getReadCommunities()
              Gets the ReadCommunities string array for the snmp agent
     java.lang.String getSerializeFileName()
              Get the name of the serialized file which the SnmpAdaptor uses to configure the V3 settings.
     SnmpAgent getSnmpAgent()
              Getter for SnmpAgent
     java.lang.Integer getSnmpDebugLevel()
              Returns the Logging Level of the Snmp Adaptor 0 - DISABLED 1 - FATAL 2 - ERROR 3 - WARN 4 - INFO 5 - DEBUG 6 - TRACE
     java.lang.Boolean getSnmpGroupEnabled()
              Specifies whether this SnmpAgent is instrumented for RFC1213-MIB i.e the SnmpGroup mbean is registered with the server.
     java.lang.String getSnmpVersion()
              Returns the SnmpVersion of the SnmpAgent.
     int[] getSubidList(javax.management.ObjectName name)
              Gets the subid list of the oid.
     java.util.Vector getTableVector(javax.management.ObjectName name)
              Contains vector of TableEntry corresponding to the each columns in the table.
     java.lang.Object getTrapHandler()
               
     java.lang.Long getUpTime()
              Gets the up time of the agent
     boolean getViewBasedAccess()
              Getter to know whether ViewBased Authorization is enabled.
     java.lang.String[] getWriteCommunities()
              Gets the WriteCommunities string array for the snmp agent
    protected  void instantiateAdaptor()
              Must be implemented by the adaptor and should be used to instantiate itsefl
     java.lang.Object invoke(java.lang.String actionName, java.lang.Object[] params, java.lang.String[] signature)
              Invokes an action on this MBean.
     boolean isNotificationEnabled(javax.management.Notification notification)
               
     boolean isNotificationEnabled(javax.management.Notification notification, javax.management.NotificationListener listener, java.lang.Object handback)
              Invoked before sending the specified notification to the listener.
     void postDeregister()
              Allows this MBean to perform any operations needed after having been de-registered in the MBeanServer.
     void postRegister(java.lang.Boolean registrationDone)
              Allows this MBean to perform any operations needed after having been registered in the MBeanServer or after the registration has failed.
     void preDeregister()
              Allows this MBean to perform any operations it needs before being de-registered by the MBeanServer.
     javax.management.ObjectName preRegister(javax.management.MBeanServer server, javax.management.ObjectName name)
              This method must be overriden by the Adaptor if the Adaptor wants to perform any Pre registration tasks
    protected  void processClientRequests()
              Method to process the clients requests made to this Adaptor.
     void processNotification(javax.management.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.
    protected  void processNotification(javax.management.Notification notification, java.lang.Object handback, java.lang.Object userObj)
               
     boolean processSnmpRequest(SnmpSession session, SnmpPDU pdu, int reqid)
              This method will be called when any PDU reaches the session of the snmp agent.
     void registerModelMBeanImpl(VarBindRequestListenerSupport listener, java.lang.String objName)
               
     void registrationPerformed(RegistrationEvent ev)
              Implementation of RegistrationListener.
     void sendResponse(SnmpPDU responsePdu)
              This method will be called before sending the response pdu to the manager.
     void setAsynchronousMode(java.lang.Boolean asynchronousMode)
              Setter which specifies whether the snmp agent processes the pdu asynchronously
     void setAttribute(javax.management.Attribute attribute)
              Sets the value of a specific attribute of this MBean.
     javax.management.AttributeList setAttributes(javax.management.AttributeList attributes)
              Sets the values of several attributes of this MBean.
     void setMaximumThreads(java.lang.Integer maximumThreads)
              Sets the number of threads to be started for asynchronous processing of snmp pdu
     void setNotificationMessageOID(java.lang.String oidValues)
              Here i am setting the default oid.
     void setPort(java.lang.Integer port)
               
     void setReadCommunities(java.lang.String[] readCommunities)
              Sets the ReadCommunities string array for the snmp agent
     void setSerializeFileName(java.lang.String fileName)
              Set the fileName into which the SNMPv3 configuration tables are serialized.
     void setSnmpDebugLevel(java.lang.Integer val)
              Sets the snmp debug level.
     void setSnmpGroupEnabled(java.lang.Boolean value)
              Specifies whether this SnmpAgent is instrumented for RFC1213-MIB i.e the SnmpGroup mbean is registered with the server.
     void setSnmpVersion(java.lang.String version)
              Sets the version of the Snmp agent.
     void setSnmpVersion(java.lang.String version, boolean restart)
              Sets the version of the Snmp agent and restarts the Agent if specifed.
     void setTrapHandler(java.lang.Object th)
              The trap handler object is expected to have the trap sending methods(with varbind-Vector as parameter) that are described in the xml notification's type field.The type field of notification in the xml file is represented in the form , for example com.adventnet.traps.frDLCIStatusChange where, the frDLCIStatusChange is the trap-type defined in the mib prefixed with "com.adventnet.traps."
     void setTrapSourceDefault(boolean flag)
              Setter for TrapSourceDefault flag to enable or disable TFTable option.
     void setViewBasedAccess(boolean vbac)
              Setter for the ViewBased Flag.
     void setWriteCommunities(java.lang.String[] writeCommunities)
              Sets the WriteCommunities string array for the snmp agent
    protected  void unbind()
              Must be used to unbind from a naming service or to relese a ServerSocket
     
    Methods inherited from class com.adventnet.adaptors.AbstractAdaptor
    addNotificationListener, changeState, getHost, getNotificationInfo, getPort, getState, getStateInString, handleNotification, isActive, isSecure, removeNotificationListener, setPort, startService, stopService
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     
    Methods inherited from interface javax.management.NotificationListener
    handleNotification
     

    Field Detail

    server

    protected transient javax.management.MBeanServer server
    MBeanServer Reference.


    adss

    javax.management.modelmbean.ModelMBeanAttributeInfo[] adss
    This method is an implementation of MBeanRegistration interface. Allows this MBean to perform any operations it needs before being registered in the MBeanServer. If the name of the MBean is not specified, the MBean can provide a name for its registration. If any exception is raised, the MBean will not be registered in the MBeanServer.

    This method is called by the MBeanServer before this mbean getting registered with the server. If the passed objectName is invalid the returned objectName is taken as valid name to get registered with the server.

    The snmp agent gets actually started only inside this method at the specified port mentioned in the key "port" . If the key "port" is absent, then the service(SNMP agent) gets started at the default port 8001.


    grp

    AgentSnmpGroup grp

    trapListener

    SnmpTrapService trapListener

    viewBasedFlag

    boolean viewBasedFlag
    Constructor Detail

    SnmpAdaptor

    public SnmpAdaptor()
    The NoArg constructor used to initialize the SnmpAdaptor in forming the MBeanInfo and getting the reference of the MBeanServer using the MBeanServer.findJMXAgent(...) method.

    See Also:
    preRegister(MBeanServer, ObjectName)

    SnmpAdaptor

    public SnmpAdaptor(java.lang.String ipAddress)
    The one Arg constructor used to initialize the SnmpAdaptor in the given IpAddress in forming the MBeanInfo and getting the reference of the MBeanServer using the MBeanServer.findJMXAgent(...) method.

    Parameters:
    ipAddress - The IpAddress in which the SnmpAdaptor should listen for requests.
    See Also:
    preRegister(MBeanServer, ObjectName)

    SnmpAdaptor

    public SnmpAdaptor(java.lang.Integer port)
    The one Arg constructor used to initialize the SnmpAdaptor in the given port in forming the MBeanInfo and getting the reference of the MBeanServer using the MBeanServer.findJMXAgent(...) method.

    Parameters:
    port - The port in which the SnmpAdaptor should listen for requests.
    See Also:
    preRegister(MBeanServer, ObjectName)

    SnmpAdaptor

    public SnmpAdaptor(int port)
    The one Arg constructor used to initialize the SnmpAdaptor in the given port in forming the MBeanInfo and getting the reference of the MBeanServer using the MBeanServer.findJMXAgent(...) method.

    Parameters:
    port - The port in which the SnmpAdaptor should listen for requests.
    See Also:
    preRegister(MBeanServer, ObjectName)

    SnmpAdaptor

    public SnmpAdaptor(java.lang.Integer port,
                       javax.management.MBeanServer server)
    This constructor is used to initialize the SnmpAdaptor in the given port in forming the MBeanInfo and getting the reference of the MBeanServer using the MBeanServer.findJMXAgent(...) method.

    Parameters:
    port - The port in which the SnmpAdaptor should listen for requests.
    server - The MBeanServer
    See Also:
    preRegister(MBeanServer, ObjectName)
    Method Detail

    getLogger

    public static Log getLogger()
    Method to be used by the SnmpAdaptor to log messages.


    setPort

    public void setPort(java.lang.Integer port)
                 throws java.lang.Exception
    Throws:
    java.lang.Exception

    registrationPerformed

    public void registrationPerformed(RegistrationEvent ev)
    Implementation of RegistrationListener. Performs registration with the PduRequestHandler.

    Specified by:
    registrationPerformed in interface RegistrationListener
    Parameters:
    ev - the RegistrationEvent which has the VarBindRequestListeners registartion information.
    See Also:
    RegistrationEvent

    processSnmpRequest

    public boolean processSnmpRequest(SnmpSession session,
                                      SnmpPDU pdu,
                                      int reqid)
    This method will be called when any PDU reaches the session of the snmp agent. This method gives a hook for the API users for handling the pdu before it get processed by this adaptor. API users can override this method for pdu processing. The pdu gets processed by the agent after this method call.

    Parameters:
    session - the session on which agent is communicating.
    pdu - the Snmp PDU.
    reqid - the value of reqid.
    Returns:
    the boolean, which says whether the agent should continue processing. By default returns true.

    sendResponse

    public void sendResponse(SnmpPDU responsePdu)
                      throws SnmpException
    This method will be called before sending the response pdu to the manager. This method gives a hook for the API users for handling the pdu before it is sent to the manager.API users can override this method for pdu processing before sending the response.The response pdu will be sent by the agent after this method call.

    Parameters:
    newPdu - the response PDU.
    Throws:
    SnmpException - on send errors or if the session is not alive

    authenticatePDU

    public boolean authenticatePDU(SnmpPDU pdu,
                                   java.lang.String community)
    This method is called before the processSnmpRequest and related processing methods are called. It has a simple checks based on the community of the pdu which has been received.

    Parameters:
    pdu - the Snmp PDU.
    community - the value of the community.
    Returns:
    false if the pdu doesnt satisy authentication mechanism
    See Also:
    SnmpClient

    getMaximumThreads

    public java.lang.Integer getMaximumThreads()
    Gets the number of threads to be started for asynchronous processing of snmp pdu

    Returns:
    the Integer value.

    setMaximumThreads

    public void setMaximumThreads(java.lang.Integer maximumThreads)
    Sets the number of threads to be started for asynchronous processing of snmp pdu

    Parameters:
    maximumThreads - gives the no:of threads

    getAsynchronousMode

    public java.lang.Boolean getAsynchronousMode()
    Getter which specifies whether the snmp agent processes the pdu asynchronously

    Returns:
    the Boolean value

    setAsynchronousMode

    public void setAsynchronousMode(java.lang.Boolean asynchronousMode)
    Setter which specifies whether the snmp agent processes the pdu asynchronously

    Parameters:
    asynchronousMode - the Boolean value to be set.

    getReadCommunities

    public java.lang.String[] getReadCommunities()
    Gets the ReadCommunities string array for the snmp agent

    Returns:
    The ReadCommunities supported as a String[]

    getWriteCommunities

    public java.lang.String[] getWriteCommunities()
    Gets the WriteCommunities string array for the snmp agent

    Returns:
    The WriteCommunities supported as a String[]

    setReadCommunities

    public void setReadCommunities(java.lang.String[] readCommunities)
    Sets the ReadCommunities string array for the snmp agent

    Parameters:
    readCommunities - The ReadCommunities String[]

    setWriteCommunities

    public void setWriteCommunities(java.lang.String[] writeCommunities)
    Sets the WriteCommunities string array for the snmp agent

    Parameters:
    writeCommunities - The WriteCommunities String[]

    getUpTime

    public java.lang.Long getUpTime()
    Gets the up time of the agent

    Returns:
    The AgentUpTime in Long.

    getSerializeFileName

    public java.lang.String getSerializeFileName()
    Get the name of the serialized file which the SnmpAdaptor uses to configure the V3 settings.

    Returns:
    fileName The Serialized file name where the configurations are stored if the version is V3, null otherwise.

    setSerializeFileName

    public void setSerializeFileName(java.lang.String fileName)
                              throws java.lang.Exception
    Set the fileName into which the SNMPv3 configuration tables are serialized. This method enables the agent to initialize the V3 configurations as defined in the given serialized file.Please note that the agent's version must be set to V3 before setting the serialized file name otherwise the method throws an SnmpException.

    Parameters:
    fileName - The fileName into which the SNMPv3 configuration tables can be serialized
    Throws:
    java.lang.Exception - if the method is invoked before the version is set to V3.

    getPropertyRegistrationListener

    public PropertyRegistrationListener getPropertyRegistrationListener()
    Gets the PropertyRegistrationListener which has detailed properties of this snmp adaptor.

    Returns:
    The PropertyRegistrationListener of this adaptor

    getMBeanInfo

    public javax.management.MBeanInfo getMBeanInfo()
    This method discovers the attributes and operations this MBean exposes for management.

    Specified by:
    getMBeanInfo in interface javax.management.DynamicMBean
    Returns:
    An instance of MBeanInfo allowing to retrieve all attributes and operations of this MBean.

    getAttribute

    public java.lang.Object getAttribute(java.lang.String attribute)
                                  throws javax.management.AttributeNotFoundException,
                                         javax.management.MBeanException,
                                         javax.management.ReflectionException
    Gets the value of a specific attribute of this MBean.

    Specified by:
    getAttribute in interface javax.management.DynamicMBean
    Parameters:
    attribute - A String specifying the name of the attribute to be retrieved.
    Returns:
    The value of the retrieved attribute.
    Throws:
    javax.management.AttributeNotFoundException - if the attibute is not found.
    javax.management.MBeanException - for MBean exceptions.
    javax.management.ReflectionException - this wraps all the exceptions during Reflection.

    getAttributes

    public javax.management.AttributeList getAttributes(java.lang.String[] attributes)
    Enables the values of several attributes of this MBean.

    Specified by:
    getAttributes in interface javax.management.DynamicMBean
    Parameters:
    attributes - A list of attributes to be retrieved.
    Returns:
    The value of the retrieved attributes as attributeList.

    invoke

    public java.lang.Object invoke(java.lang.String actionName,
                                   java.lang.Object[] params,
                                   java.lang.String[] signature)
                            throws javax.management.MBeanException,
                                   javax.management.ReflectionException
    Invokes an action on this MBean.

    Specified by:
    invoke in interface javax.management.DynamicMBean
    Parameters:
    actionName - The name of the action to be invoked.
    params - An array containing the parameters to be set when the action is invoked
    signature - An array containing the signature of the action. The class objects will be loaded using the same class loader as the one used for loading the MBean on which the action was invoked.
    Returns:
    The object returned by the action, which represents the result ofinvoking the action on the specified MBean.
    Throws:
    javax.management.MBeanException - for MBean exceptions.
    javax.management.ReflectionException - this wraps all the exceptions during Reflection.

    setAttribute

    public void setAttribute(javax.management.Attribute attribute)
                      throws javax.management.AttributeNotFoundException,
                             javax.management.InvalidAttributeValueException,
                             javax.management.MBeanException,
                             javax.management.ReflectionException
    Sets the value of a specific attribute of this MBean.

    Specified by:
    setAttribute in interface javax.management.DynamicMBean
    Parameters:
    attribute - The identification of the attribute to be set and the value it is to be set to.
    Throws:
    javax.management.AttributeNotFoundException - if the attibute is not found.
    javax.management.InvalidAttributeValueException - if the value of the attibute is not valid.
    javax.management.MBeanException - for MBean exceptions.
    javax.management.ReflectionException - this wraps all the exceptions during Reflection.

    setAttributes

    public javax.management.AttributeList setAttributes(javax.management.AttributeList attributes)
    Sets the values of several attributes of this MBean.

    Specified by:
    setAttributes in interface javax.management.DynamicMBean
    Parameters:
    attributes - A list of attributes: The identification of the attributes to be set and the values they are to be set to.
    Returns:
    The list of attributes that were set, with their new values.

    preRegister

    public javax.management.ObjectName preRegister(javax.management.MBeanServer server,
                                                   javax.management.ObjectName name)
                                            throws java.lang.Exception
    Description copied from class: AbstractAdaptor
    This method must be overriden by the Adaptor if the Adaptor wants to perform any Pre registration tasks

    Specified by:
    preRegister in interface javax.management.MBeanRegistration
    Overrides:
    preRegister in class AbstractAdaptor
    Throws:
    java.lang.Exception

    postRegister

    public void postRegister(java.lang.Boolean registrationDone)
    Allows this MBean to perform any operations needed after having been registered in the MBeanServer or after the registration has failed.

    Specified by:
    postRegister in interface javax.management.MBeanRegistration
    Overrides:
    postRegister in class AbstractAdaptor
    Parameters:
    registrationDone - Indicates whether or not the MBean has been successfully registered in the MBeanServer. The value false means that either the registration phase has failed.
    registrationDone - indicates whether the mbean is registered properly with the server.

    preDeregister

    public void preDeregister()
                       throws java.lang.Exception
    Allows this MBean to perform any operations it needs before being de-registered by the MBeanServer.

    Specified by:
    preDeregister in interface javax.management.MBeanRegistration
    Overrides:
    preDeregister in class AbstractAdaptor
    Throws:
    java.langException - This exception should be caught by the MBeanServer and re-thrown as an MBeanRegistrationException.
    java.lang.Exception

    postDeregister

    public void postDeregister()
    Allows this MBean to perform any operations needed after having been de-registered in the MBeanServer.

    Specified by:
    postDeregister in interface javax.management.MBeanRegistration
    Overrides:
    postDeregister in class AbstractAdaptor

    setNotificationMessageOID

    public void setNotificationMessageOID(java.lang.String oidValues)
    Here i am setting the default oid.


    getNotificationMessageOID

    public java.lang.String getNotificationMessageOID()
    Here i am getting the default oid.


    addIntoSupportTable

    void addIntoSupportTable(java.lang.String name,
                             VarBindRequestListener listener)

    addIntoObjectNamePatternTable

    void addIntoObjectNamePatternTable(java.lang.String objectNamePattern,
                                       java.lang.String regObjNamePatternTable)

    addIntoClassNameTable

    void addIntoClassNameTable(java.lang.String className,
                               VarBindRequestListener listener)

    processNotification

    public void processNotification(javax.management.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.

    Overrides:
    processNotification in class AbstractAdaptor
    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.

    processNotification

    protected void processNotification(javax.management.Notification notification,
                                       java.lang.Object handback,
                                       java.lang.Object userObj)

    isNotificationEnabled

    public boolean isNotificationEnabled(javax.management.Notification notification,
                                         javax.management.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(javax.management.Notification notification)
    Specified by:
    isNotificationEnabled in interface javax.management.NotificationFilter

    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.

    registerModelMBeanImpl

    public void registerModelMBeanImpl(VarBindRequestListenerSupport listener,
                                       java.lang.String objName)
                                throws java.lang.Exception
    Throws:
    java.lang.Exception

    getSnmpVersion

    public java.lang.String getSnmpVersion()
    Returns the SnmpVersion of the SnmpAgent. By default the version is "v2c"

    Returns:
    the String representation of version of the SNMP agent.

    setSnmpVersion

    public void setSnmpVersion(java.lang.String version)
    Sets the version of the Snmp agent.

    Parameters:
    version - the Snmp version.

    setSnmpVersion

    public void setSnmpVersion(java.lang.String version,
                               boolean restart)
    Sets the version of the Snmp agent and restarts the Agent if specifed.

    Parameters:
    version - the Snmp version.
    restart - boolean true to restart the Agent.

    getObjectName

    public java.lang.String getObjectName()
    Returns the ObjectName of this adaptor with which it has been registered with the MBeanServer.

    Returns:
    the ObjectName

    getAdaptorVersion

    public java.lang.String getAdaptorVersion()
    Gets the version of the adaptor.

    Specified by:
    getAdaptorVersion in interface Adaptor
    Overrides:
    getAdaptorVersion in class AbstractAdaptor
    Returns:
    the Version string of this Adaptor.

    getProtocol

    public java.lang.String getProtocol()
    Gets the protocol supported by this adaptor.

    Specified by:
    getProtocol in interface Adaptor
    Specified by:
    getProtocol in class AbstractAdaptor
    Returns:
    The protocol of this Adaptor - "SNMP"

    getSnmpDebugLevel

    public java.lang.Integer getSnmpDebugLevel()
    Returns the Logging Level of the Snmp Adaptor
  • 0 - DISABLED
  • 1 - FATAL
  • 2 - ERROR
  • 3 - WARN
  • 4 - INFO
  • 5 - DEBUG
  • 6 - TRACE

    Returns:
    the Integer object of the snmp debug level

  • setSnmpDebugLevel

    public void setSnmpDebugLevel(java.lang.Integer val)
    Sets the snmp debug level.

    Parameters:
    val - the Integer value.

    getSnmpGroupEnabled

    public java.lang.Boolean getSnmpGroupEnabled()
    Specifies whether this SnmpAgent is instrumented for RFC1213-MIB i.e the SnmpGroup mbean is registered with the server.

    Returns:
    the Boolean object.

    setSnmpGroupEnabled

    public void setSnmpGroupEnabled(java.lang.Boolean value)
    Specifies whether this SnmpAgent is instrumented for RFC1213-MIB i.e the SnmpGroup mbean is registered with the server.

    Parameters:
    value - allows the snmpgroup mbean to get registered with the MBeanServer.

    setTrapHandler

    public void setTrapHandler(java.lang.Object th)
    The trap handler object is expected to have the trap sending methods(with varbind-Vector as parameter) that are described in the xml notification's type field.The type field of notification in the xml file is represented in the form , for example
  • com.adventnet.traps.frDLCIStatusChange where, the frDLCIStatusChange is the trap-type defined in the mib prefixed with "com.adventnet.traps."

    Parameters:
    th - the trap handler object.

  • getTrapHandler

    public java.lang.Object getTrapHandler()

    getOidRep

    public int[] getOidRep(javax.management.ObjectName name)
    Retrieves the integer representation of OID. If the mbean repesented by this object name is of table handler, then the returned int[] specifies the entry level oid.

    Parameters:
    name - the ObjectName of the mbean.
    Returns:
    the integer array of OID

    getSubidList

    public int[] getSubidList(javax.management.ObjectName name)
    Gets the subid list of the oid.

    Parameters:
    name - the ObjectName of the mbean.
    Returns:
    the integer array of subid list

    getTableVector

    public java.util.Vector getTableVector(javax.management.ObjectName name)
    Contains vector of TableEntry corresponding to the each columns in the table. If the mbean specified by this ObjectName doesn't handle tabular data's, then null will be returned.

    Parameters:
    name - the ObjectName of the mbean.
    Returns:
    the vector containing the TableEntry's.

    getOidValue

    public SnmpVar getOidValue(javax.management.ObjectName name,
                               SnmpOID oid)
    This method will be useful in getting the value of any OID present in a mbean specified. The returned value will be of SnmpVar.

    Parameters:
    name - the ObjectName of the mbean.
    oid - the SnmpOID for which the snmpget to be applied on this mbean.
    Returns:
    the SnmpVar value of the OID.

    setTrapSourceDefault

    public void setTrapSourceDefault(boolean flag)
    Setter for TrapSourceDefault flag to enable or disable TFTable option.

    Parameters:
    flag - This flag is by default true to use the DEFAULT option. This flag is set false for using the TFTable option.

    addTrapRequestListener

    public void addTrapRequestListener(SnmpTrapService trapListener)
    Add Trap Request Listener.

    Parameters:
    trapListener - The Trap Request Listener.

    getSnmpAgent

    public SnmpAgent getSnmpAgent()
    Getter for SnmpAgent

    Returns:
    The SnmpAgent object

    enableAuthentication

    public void enableAuthentication(boolean flag)
    Description copied from class: AbstractAdaptor
    This abstract method needs to be implemented by the Adaptor for providing Authentication

    Specified by:
    enableAuthentication in interface Adaptor
    Specified by:
    enableAuthentication in class AbstractAdaptor

    destroyAdaptor

    protected void destroyAdaptor()
    Description copied from class: AbstractAdaptor
    Kills the adaptor and releases all its resources

    Specified by:
    destroyAdaptor in class AbstractAdaptor

    bind

    protected void bind()
    Description copied from class: AbstractAdaptor
    Must be used to bind to a naming service or to bind to a ServerSocket

    Specified by:
    bind in class AbstractAdaptor

    unbind

    protected void unbind()
    Description copied from class: AbstractAdaptor
    Must be used to unbind from a naming service or to relese a ServerSocket

    Specified by:
    unbind in class AbstractAdaptor

    instantiateAdaptor

    protected void instantiateAdaptor()
                               throws java.lang.InstantiationException
    Description copied from class: AbstractAdaptor
    Must be implemented by the adaptor and should be used to instantiate itsefl

    Specified by:
    instantiateAdaptor in class AbstractAdaptor
    Throws:
    java.lang.InstantiationException

    processClientRequests

    protected void processClientRequests()
    Method to process the clients requests made to this Adaptor.


    enableAuthorisation

    public void enableAuthorisation(boolean flag)
                             throws java.lang.UnsupportedOperationException
    Description copied from class: AbstractAdaptor
    This abstract method needs to be implemented by the Adaptor for providing Authorisation

    Specified by:
    enableAuthorisation in interface Adaptor
    Specified by:
    enableAuthorisation in class AbstractAdaptor
    Throws:
    java.lang.UnsupportedOperationException - when authorisation is not suppported

    getAdaptorObjectName

    public javax.management.ObjectName getAdaptorObjectName()
    Description copied from class: AbstractAdaptor
    Returns the adaptor object name

    Specified by:
    getAdaptorObjectName in interface Adaptor
    Specified by:
    getAdaptorObjectName in class AbstractAdaptor

    setViewBasedAccess

    public void setViewBasedAccess(boolean vbac)
    Setter for the ViewBased Flag. setting this to true enables ViewBased Authorisation for this Adaptor.

    Parameters:
    vbac - boolean true to enable view based authorization.

    getViewBasedAccess

    public boolean getViewBasedAccess()
    Getter to know whether ViewBased Authorization is enabled.

    Returns:
    true if View Based Authorization is enabled else a false.