- java.lang.Object
-
- org.snmp4j.agent.mo.snmp.NotificationOriginatorImpl
-
- All Implemented Interfaces:
NotificationOriginator
public class NotificationOriginatorImpl extends Object implements NotificationOriginator
TheNotificationOriginatorImplclass 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
Constructors Constructor Description NotificationOriginatorImpl(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddNotificationLogListener(NotificationLogListener l)protected voidfireNotificationLogEvent(NotificationLogEvent<?> event)Objectnotify(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.Objectnotify(org.snmp4j.smi.OctetString context, org.snmp4j.smi.OID notificationID, org.snmp4j.smi.VariableBinding[] vbs)Sends notifications (traps) to all appropriate notification targets.voidremoveNotificationLogListener(NotificationLogListener l)protected voidsetContextEngineID(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 thetargetMIBmember.voidsetSession(org.snmp4j.Session snmpSession)Sets the SNMP session to used by this notification originator for sending notifications.
-
-
-
Constructor Detail
-
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 Detail
-
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:
notifyin 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 ofVariableBindinginstances representing the payload of the notification.- Returns:
- an array of ResponseEvent instances. Since the
NotificationOriginatordetermines on behalf of the SNMP-NOTIFICATION-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 thetargetMIBmember.- 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:NotificationOriginatorSends 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:
notifyin 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 ofVariableBindinginstances representing the payload of the notification.- Returns:
- an array of ResponseEvent instances. Since the
NotificationOriginatordetermines on behalf of the SNMP-NOTIFICATON-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
public void addNotificationLogListener(NotificationLogListener l)
-
removeNotificationLogListener
public void removeNotificationLogListener(NotificationLogListener l)
-
fireNotificationLogEvent
protected void fireNotificationLogEvent(NotificationLogEvent<?> event)
-
-