Search in sources :

Example 1 with EventWindow

use of org.opennms.features.vaadin.events.EventWindow in project opennms by OpenNMS.

the class MibCompilerPanel method showEventsWindow.

/**
     * Shows the events window.
     *
     * @param logger the logger
     * @param fileName the file name
     * @param ueiBase the UEI base
     */
private void showEventsWindow(final Logger logger, final String fileName, final String ueiBase) {
    final Events events = mibParser.getEvents(ueiBase);
    if (events == null) {
        Notification.show("The MIB couldn't be processed for events because: " + mibParser.getFormattedErrors(), Notification.Type.ERROR_MESSAGE);
    } else {
        if (events.getEvents().size() > 0) {
            try {
                logger.info("Found " + events.getEvents().size() + " events.");
                final String eventsFileName = fileName.replaceFirst("\\..*$", ".events.xml");
                final File configDir = new File(ConfigFileConstants.getHome(), "etc" + File.separatorChar + "events");
                final File eventFile = new File(configDir, eventsFileName);
                final EventWindow w = new EventWindow(eventsDao, eventsProxy, eventFile, events, logger);
                getUI().addWindow(w);
            } catch (Throwable t) {
                Notification.show(t.getMessage(), Notification.Type.ERROR_MESSAGE);
            }
        } else {
            Notification.show("The MIB doesn't contain any notification/trap", Notification.Type.WARNING_MESSAGE);
        }
    }
}
Also used : Events(org.opennms.netmgt.xml.eventconf.Events) EventWindow(org.opennms.features.vaadin.events.EventWindow) File(java.io.File)

Aggregations

File (java.io.File)1 EventWindow (org.opennms.features.vaadin.events.EventWindow)1 Events (org.opennms.netmgt.xml.eventconf.Events)1