|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--com.adventnet.adaptors.AbstractAdaptor
|
+--com.adventnet.adaptors.snmp.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:
| Inner classes inherited from class com.adventnet.adaptors.AbstractAdaptor |
AbstractAdaptor.ProcessNotification |
| Field Summary | |
(package private) ModelMBeanAttributeInfo[] |
adss
This method is an implementation of MBeanRegistration interface. |
(package private) AgentSnmpGroup |
grp
|
protected MBeanServer |
server
MBeanServer Reference. |
(package private) SnmpTrapService |
trapListener
|
(package private) boolean |
viewBasedFlag
|
| Fields inherited from class com.adventnet.adaptors.AbstractAdaptor |
handleNotificationinNewThread,
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,
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) static void |
|
(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. |
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. |
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 |
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(ObjectName name)
Retrieves the integer representation of OID. |
SnmpVar |
getOidValue(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(ObjectName name)
Gets the subid list of the oid. |
java.util.Vector |
getTableVector(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(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. |
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. |
ObjectName |
preRegister(MBeanServer server,
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(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(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(Attribute attribute)
Sets the value of a specific attribute of this MBean. |
AttributeList |
setAttributes(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 |
| Field Detail |
protected transient MBeanServer server
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,
MBeanServer server)
port - The port in which the SnmpAdaptor should listen for requests.server - The MBeanServerpreRegister(MBeanServer, ObjectName)| Method Detail |
static void()
public static Log getLogger()
public void setPort(java.lang.Integer port)
throws java.lang.Exception
public void registrationPerformed(RegistrationEvent ev)
ev - the RegistrationEvent which has the VarBindRequestListeners
registartion information.public 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.public 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 serializedpublic PropertyRegistrationListener getPropertyRegistrationListener()
public MBeanInfo getMBeanInfo()
public java.lang.Object getAttribute(java.lang.String attribute)
throws AttributeNotFoundException,
MBeanException,
ReflectionException
attribute - A String specifying the name of the
attribute to be retrieved.public AttributeList getAttributes(java.lang.String[] attributes)
attributes - 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 MBeanException,
ReflectionException
actionName - 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.public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException
attribute - The identification of the attribute to
be set and the value it is to be set to.public AttributeList setAttributes(AttributeList attributes)
attributes - A list of attributes: The identification
of the attributes to be set and the values they are to be set to.public ObjectName preRegister(MBeanServer server, ObjectName name) throws java.lang.Exception
server - The MBean server in which the MBean will be registered.name - The object name of the MBean. This name is null if
the name parameter to one of the createMBean or
registerMBean methods in the MBeanServer
interface is null. In that case, this method must return a
non-null ObjectName for the new MBean.name
parameter is not null, it will usually but not necessarily be
the returned value.MBeanRegistrationException or a RuntimeMBeanException.public void postRegister(java.lang.Boolean registrationDone)
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.
public void preDeregister()
throws java.lang.Exception
public void postDeregister()
public 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(Notification notification, java.lang.Object handback)
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.protected void processNotification(Notification notification, java.lang.Object handback, java.lang.Object userObj)
public boolean isNotificationEnabled(Notification notification, 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(Notification notification)
notification - The notification to be sent.true if the notification has to be sent to
the listener, false otherwise.public 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
public 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()
public java.lang.String getProtocol()
public 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(ObjectName name)
name - the ObjectName of the mbean.public int[] getSubidList(ObjectName name)
name - the ObjectName of the mbean.public java.util.Vector getTableVector(ObjectName name)
name - the ObjectName of the mbean.public SnmpVar getOidValue(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)
protected void destroyAdaptor()
protected void bind()
protected void unbind()
protected void instantiateAdaptor()
throws java.lang.InstantiationException
protected void processClientRequests()
public void enableAuthorisation(boolean flag)
throws java.lang.UnsupportedOperationException
public ObjectName getAdaptorObjectName()
public void setViewBasedAccess(boolean vbac)
vbac - boolean true to enable view based authorization.public boolean getViewBasedAccess()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||