This is a follow-up to the previous question. I found org.opennms.netmgt.xml.event.Event, and I can get the event from NotificationFactory based on the EventId in the notification. The problem is that the event retrieved is incomplete. It is missing the parameters (which are passed to the notification, because they appear in my description).
* No parameters show up in the xml produced by Event.marshal(). * Event.getParms() returns null (1) Is this a bug in org.opennms.netmgt.xml.event.Event? (2) Is this a bug in org.opennms.netmgt.xml.event.NotificationFactory.getEvent()? (Producing an incomplete Event) (3) Is there an alternative way to get the original event from the notification? (I thought that EventFactory would be the way to go, but that is not accessible from a NotificationStrategy.) I am trying to forward the event to another system. If necessary, I can put enough information into the notification description so that I can manually construct the event, but it seems like a fragile solution. If there is a way to capture the event *before* it gets to be a notification, that would be even better. An EventListener would be ideal. (This is where the Uses page would be very helpful.) Is there a way to register a new EventListener? Gary Levin RRC 1N345 Telcordia Technologies > -----Original Message----- > From: Levin, Gary Marc [mailto:[EMAIL PROTECTED] > Sent: Friday, October 31, 2008 3:56 PM > To: opennms-devel@lists.sourceforge.net > Subject: [opennms-devel] Fetching an Event in a NotificationStrategy > I need to fetch the Event that triggered a Notification. I have written an implementation of NotificationStrategy, which is correctly invoked by notifd. The notification places the eventId into the text message, which is included in the list of arguments passed to NotificationStrategy.send(). I log this information, so I am sure it is being received correctly. My code then extracts the eventId, parses it into an integer, eid, and tries calling EventFactory.getEvent(eid). It gets to that point, but the call never returns. I catch SQLException, and that is not thrown either. I tried catching Throwable and found the problem to be java.lang.NoClassDefFoundError: org/opennms/web/event/EventFactory I am guessing this is caused by the EventFactory being loaded by a different classloader than my NotificationStrategy. This had me go look for another way to get the event, using the jars in lib and not web-apps. I was trying to learn more about the API and noticed that although http://www.opennms.org/documentation/java-apidocs-stable/ org/opennms/netmgt/xml/event/Event.html exists, if you go to the frame view, this class and its package are not in the list of packages and classes. I found that what I needed was org.opennms.netmgt.xml.event.Event, which I can get from org.opennms.netmgt.xml.event.NotificationFactory. This would have been easier to find if the Javadoc included that package. Also,having the Uses page when I am trying to learn an API. This lets me work backwards from what I want, in this case an Event.
smime.p7s
Description: S/MIME cryptographic signature
------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________ Please read the OpenNMS Mailing List FAQ: http://www.opennms.org/index.php/Mailing_List_FAQ opennms-devel mailing list To *unsubscribe* or change your subscription options, see the bottom of this page: https://lists.sourceforge.net/lists/listinfo/opennms-devel