Package org.snmp4j.agent.mo.snmp
Class NotificationOriginatorImpl
java.lang.Object
org.snmp4j.agent.mo.snmp.NotificationOriginatorImpl
- All Implemented Interfaces:
NotificationOriginator
The
NotificationOriginatorImpl
class implements a notification originator application for SNMP4J.
See also RFC 3411 for a description of notification originators.
- Version:
- 3.0.0
- Author:
- Frank Fock
-
Constructor Summary
ConstructorDescriptionNotificationOriginatorImpl
(org.snmp4j.Session session, VACM vacm, SysUpTime sysUpTime, SnmpTargetMIB targetMIB, SnmpNotificationMIB notificationMIB) Creates a notification originator.NotificationOriginatorImpl
(org.snmp4j.Session session, VACM vacm, SysUpTime sysUpTime, SnmpTargetMIB targetMIB, SnmpNotificationMIB notificationMIB, SnmpCommunityMIB communityMIB) Creates a notification originator. -
Method Summary
Modifier and TypeMethodDescriptionvoid
protected void
notify
(org.snmp4j.smi.OctetString context, org.snmp4j.smi.OID notificationID, org.snmp4j.smi.TimeTicks sysUpTime, org.snmp4j.smi.VariableBinding[] vbs) Sends notifications (traps) to all appropriate notification targets.notify
(org.snmp4j.smi.OctetString context, org.snmp4j.smi.OID notificationID, org.snmp4j.smi.VariableBinding[] vbs) Sends notifications (traps) to all appropriate notification targets.void
protected void
setContextEngineID
(org.snmp4j.ScopedPDU scopedPDU, org.snmp4j.smi.OctetString context, org.snmp4j.smi.OID notificationID) Sets the context engine ID of the scoped PDU to the local engine ID provided by thetargetMIB
member.void
setSession
(org.snmp4j.Session snmpSession) Sets the SNMP session to used by this notification originator for sending notifications.
-
Constructor Details
-
NotificationOriginatorImpl
public NotificationOriginatorImpl(org.snmp4j.Session session, VACM vacm, SysUpTime sysUpTime, SnmpTargetMIB targetMIB, SnmpNotificationMIB notificationMIB) Creates a notification originator.- Parameters:
session
- the SNMP Session instance to be used to send the notifications/informs.vacm
- the VACM to be used to check access for notifications.sysUpTime
- the sysUpTime instance to be used to determine sysUpTime.0 when sending notifications without specifically specified sysUpTime.targetMIB
- the SnmpTargetMIB containing notification target information.notificationMIB
- SnmpNotificationMIB
-
NotificationOriginatorImpl
public NotificationOriginatorImpl(org.snmp4j.Session session, VACM vacm, SysUpTime sysUpTime, SnmpTargetMIB targetMIB, SnmpNotificationMIB notificationMIB, SnmpCommunityMIB communityMIB) Creates a notification originator.- Parameters:
session
- the Snmp instance to be used to send the notifications/informs.vacm
- the VACM to be used to check access for notifications.sysUpTime
- the sysUpTime instance to be used to determine sysUpTime.0 when sending notifications without specifically specified sysUpTime.targetMIB
- the SnmpTargetMIB containing notification target information.notificationMIB
- the SnmpNotificationMIB containing notification filtering information.communityMIB
- the community MIB for coexistence information.
-
-
Method Details
-
notify
public Object notify(org.snmp4j.smi.OctetString context, org.snmp4j.smi.OID notificationID, org.snmp4j.smi.VariableBinding[] vbs) Sends notifications (traps) to all appropriate notification targets.- Specified by:
notify
in interfaceNotificationOriginator
- Parameters:
context
- the context name of the context on whose behalf this notification has been generated.notificationID
- the object ID that uniquely identifies this notification. For SNMPv1 traps, the notification ID has to be build using the rules provided by RFC 2576.vbs
- an array ofVariableBinding
instances representing the payload of the notification.- Returns:
- an array of ResponseEvent instances. Since the
NotificationOriginator
determines on behalf of the SNMP-NOTIFICTON-MIB contents whether a notification is sent as trap/notification or as inform request, the returned array contains an element for each addressed target, but only a response PDU for inform targets.
-
setContextEngineID
protected void setContextEngineID(org.snmp4j.ScopedPDU scopedPDU, org.snmp4j.smi.OctetString context, org.snmp4j.smi.OID notificationID) Sets the context engine ID of the scoped PDU to the local engine ID provided by thetargetMIB
member.- Parameters:
scopedPDU
- the scopedPDU to modify.context
- the context associated with the notification/inform PDU.notificationID
- the notification ID of the notification/inform PDU.- Since:
- 1.2.1
-
notify
public Object notify(org.snmp4j.smi.OctetString context, org.snmp4j.smi.OID notificationID, org.snmp4j.smi.TimeTicks sysUpTime, org.snmp4j.smi.VariableBinding[] vbs) Description copied from interface:NotificationOriginator
Sends notifications (traps) to all appropriate notification targets. The targets to notify are determined through the SNMP-TARGET-MIB and the SNMP-NOTIFICATION-MIB.- Specified by:
notify
in interfaceNotificationOriginator
- Parameters:
context
- the context name of the context on whose behalf this notification has been generated.notificationID
- the object ID that uniquely identifies this notification. For SNMPv1 traps, the notification ID has to be build using the rules provided by RFC 2576.sysUpTime
- the value of the sysUpTime for the contextcontext
. This value will be included in the generated notification assysUpTime.0
.vbs
- an array ofVariableBinding
instances representing the payload of the notification.- Returns:
- an array of ResponseEvent instances. Since the
NotificationOriginator
determines on behalf of the SNMP-NOTIFICTON-MIB contents whether a notification is sent as trap/notification or as inform request, the returned array contains an element for each addressed target, but only a response PDU for inform targets.
-
setSession
public void setSession(org.snmp4j.Session snmpSession) Sets the SNMP session to used by this notification originator for sending notifications.- Parameters:
snmpSession
- the Snmp instance to be used to send the notifications/informs.- Since:
- 1.9.1
-
addNotificationLogListener
-
removeNotificationLogListener
-
fireNotificationLogEvent
-