|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.adventnet.adaptors.AbstractAdaptor
com.adventnet.adaptors.snmp.SnmpAdaptor
public class SnmpAdaptor
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:
| 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 |
|---|
protected transient javax.management.MBeanServer server
javax.management.modelmbean.ModelMBeanAttributeInfo[] adss
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.
AgentSnmpGroup grp
SnmpTrapService trapListener
boolean viewBasedFlag
| Constructor Detail |
|---|
public SnmpAdaptor()
preRegister(MBeanServer, ObjectName)public SnmpAdaptor(java.lang.String ipAddress)
ipAddress - The IpAddress in which the SnmpAdaptor should listen for requests.preRegister(MBeanServer, ObjectName)public SnmpAdaptor(java.lang.Integer port)
port - The port in which the SnmpAdaptor should listen for requests.preRegister(MBeanServer, ObjectName)public SnmpAdaptor(int port)
port - The port in which the SnmpAdaptor should listen for requests.preRegister(MBeanServer, ObjectName)
public SnmpAdaptor(java.lang.Integer port,
javax.management.MBeanServer server)
port - The port in which the SnmpAdaptor should listen for requests.server - The MBeanServerpreRegister(MBeanServer, ObjectName)| Method Detail |
|---|
public static Log getLogger()
public void setPort(java.lang.Integer port)
throws java.lang.Exception
java.lang.Exceptionpublic void registrationPerformed(RegistrationEvent ev)
registrationPerformed in interface RegistrationListenerev - the RegistrationEvent which has the VarBindRequestListeners
registartion information.RegistrationEventpublic boolean processSnmpRequest(SnmpSession session, SnmpPDU pdu, int reqid)
session - the session on which agent is communicating.pdu - the Snmp PDU.reqid - the value of reqid.
public void sendResponse(SnmpPDU responsePdu) throws SnmpException
newPdu - the response PDU.
SnmpException - on send errors or
if the session is not alivepublic boolean authenticatePDU(SnmpPDU pdu, java.lang.String community)
pdu - the Snmp PDU.community - the value of the community.
SnmpClientpublic java.lang.Integer getMaximumThreads()
public void setMaximumThreads(java.lang.Integer maximumThreads)
maximumThreads - gives the no:of threadspublic java.lang.Boolean getAsynchronousMode()
public void setAsynchronousMode(java.lang.Boolean asynchronousMode)
asynchronousMode - the Boolean value to be set.public java.lang.String[] getReadCommunities()
public java.lang.String[] getWriteCommunities()
public void setReadCommunities(java.lang.String[] readCommunities)
readCommunities - The ReadCommunities String[]public void setWriteCommunities(java.lang.String[] writeCommunities)
writeCommunities - The WriteCommunities String[]public java.lang.Long getUpTime()
public java.lang.String getSerializeFileName()
public void setSerializeFileName(java.lang.String fileName)
throws java.lang.Exception
fileName - The fileName into which the SNMPv3 configuration tables can be serialized
java.lang.Exception - if the method is invoked before the version is set to V3.public PropertyRegistrationListener getPropertyRegistrationListener()
public javax.management.MBeanInfo getMBeanInfo()
getMBeanInfo in interface javax.management.DynamicMBean
public java.lang.Object getAttribute(java.lang.String attribute)
throws javax.management.AttributeNotFoundException,
javax.management.MBeanException,
javax.management.ReflectionException
getAttribute in interface javax.management.DynamicMBeanattribute - A String specifying the name of the
attribute to be retrieved.
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.public javax.management.AttributeList getAttributes(java.lang.String[] attributes)
getAttributes in interface javax.management.DynamicMBeanattributes - A list of attributes to be retrieved.
public java.lang.Object invoke(java.lang.String actionName,
java.lang.Object[] params,
java.lang.String[] signature)
throws javax.management.MBeanException,
javax.management.ReflectionException
invoke in interface javax.management.DynamicMBeanactionName - The name of the action to be invoked.params - An array containing the parameters to be
set when the action is invokedsignature - 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.
javax.management.MBeanException - for MBean exceptions.
javax.management.ReflectionException - this wraps all the
exceptions during Reflection.
public void setAttribute(javax.management.Attribute attribute)
throws javax.management.AttributeNotFoundException,
javax.management.InvalidAttributeValueException,
javax.management.MBeanException,
javax.management.ReflectionException
setAttribute in interface javax.management.DynamicMBeanattribute - The identification of the attribute to
be set and the value it is to be set to.
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.public javax.management.AttributeList setAttributes(javax.management.AttributeList attributes)
setAttributes in interface javax.management.DynamicMBeanattributes - A list of attributes: The identification
of the attributes to be set and the values they are to be set to.
public javax.management.ObjectName preRegister(javax.management.MBeanServer server,
javax.management.ObjectName name)
throws java.lang.Exception
AbstractAdaptor
preRegister in interface javax.management.MBeanRegistrationpreRegister in class AbstractAdaptorjava.lang.Exceptionpublic void postRegister(java.lang.Boolean registrationDone)
postRegister in interface javax.management.MBeanRegistrationpostRegister in class AbstractAdaptorregistrationDone - 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.
public void preDeregister()
throws java.lang.Exception
preDeregister in interface javax.management.MBeanRegistrationpreDeregister in class AbstractAdaptorjava.langException - This exception should be caught by the MBeanServer and
re-thrown as an MBeanRegistrationException.
java.lang.Exceptionpublic void postDeregister()
postDeregister in interface javax.management.MBeanRegistrationpostDeregister in class AbstractAdaptorpublic void setNotificationMessageOID(java.lang.String oidValues)
public java.lang.String getNotificationMessageOID()
void addIntoSupportTable(java.lang.String name,
VarBindRequestListener listener)
void addIntoObjectNamePatternTable(java.lang.String objectNamePattern,
java.lang.String regObjNamePatternTable)
void addIntoClassNameTable(java.lang.String className,
VarBindRequestListener listener)
public void processNotification(javax.management.Notification notification,
java.lang.Object handback)
processNotification in class AbstractAdaptornotification - 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.
protected void processNotification(javax.management.Notification notification,
java.lang.Object handback,
java.lang.Object userObj)
public boolean isNotificationEnabled(javax.management.Notification notification,
javax.management.NotificationListener listener,
java.lang.Object handback)
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.
public boolean isNotificationEnabled(javax.management.Notification notification)
isNotificationEnabled in interface javax.management.NotificationFilterpublic void disableAllTypes()
public void disableType(java.lang.String prefix)
prefix - the prefix value for which notifications are dropped.public void enableType(java.lang.String prefix)
prefix - the prefix value for which notifications are filtered successfully.public java.util.Vector getEnabledTypes()
public void registerModelMBeanImpl(VarBindRequestListenerSupport listener, java.lang.String objName) throws java.lang.Exception
java.lang.Exceptionpublic java.lang.String getSnmpVersion()
public void setSnmpVersion(java.lang.String version)
version - the Snmp version.
public void setSnmpVersion(java.lang.String version,
boolean restart)
version - the Snmp version.restart - boolean true to restart the Agent.public java.lang.String getObjectName()
public java.lang.String getAdaptorVersion()
getAdaptorVersion in interface AdaptorgetAdaptorVersion in class AbstractAdaptorpublic java.lang.String getProtocol()
getProtocol in interface AdaptorgetProtocol in class AbstractAdaptorpublic java.lang.Integer getSnmpDebugLevel()
public void setSnmpDebugLevel(java.lang.Integer val)
val - the Integer value.public java.lang.Boolean getSnmpGroupEnabled()
public void setSnmpGroupEnabled(java.lang.Boolean value)
value - allows the snmpgroup mbean to get registered with the MBeanServer.public void setTrapHandler(java.lang.Object th)
th - the trap handler object.public java.lang.Object getTrapHandler()
public int[] getOidRep(javax.management.ObjectName name)
name - the ObjectName of the mbean.
public int[] getSubidList(javax.management.ObjectName name)
name - the ObjectName of the mbean.
public java.util.Vector getTableVector(javax.management.ObjectName name)
name - the ObjectName of the mbean.
public SnmpVar getOidValue(javax.management.ObjectName name, SnmpOID oid)
name - the ObjectName of the mbean.oid - the SnmpOID for which the snmpget to be applied on this mbean.
public void setTrapSourceDefault(boolean flag)
flag - This flag is by default true to use the DEFAULT option.
This flag is set false for using the TFTable option.public void addTrapRequestListener(SnmpTrapService trapListener)
trapListener - The Trap Request Listener.public SnmpAgent getSnmpAgent()
public void enableAuthentication(boolean flag)
AbstractAdaptor
enableAuthentication in interface AdaptorenableAuthentication in class AbstractAdaptorprotected void destroyAdaptor()
AbstractAdaptor
destroyAdaptor in class AbstractAdaptorprotected void bind()
AbstractAdaptor
bind in class AbstractAdaptorprotected void unbind()
AbstractAdaptor
unbind in class AbstractAdaptor
protected void instantiateAdaptor()
throws java.lang.InstantiationException
AbstractAdaptor
instantiateAdaptor in class AbstractAdaptorjava.lang.InstantiationExceptionprotected void processClientRequests()
public void enableAuthorisation(boolean flag)
throws java.lang.UnsupportedOperationException
AbstractAdaptor
enableAuthorisation in interface AdaptorenableAuthorisation in class AbstractAdaptorjava.lang.UnsupportedOperationException - when authorisation is not suppportedpublic javax.management.ObjectName getAdaptorObjectName()
AbstractAdaptor
getAdaptorObjectName in interface AdaptorgetAdaptorObjectName in class AbstractAdaptorpublic void setViewBasedAccess(boolean vbac)
vbac - boolean true to enable view based authorization.public boolean getViewBasedAccess()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||