コード例 #1
0
    /**
     * Process the received events. For each event, use the EventExpander to look up matching
     * eventconf entry and load info from that match, expand event parms, add event to database and
     * send event to appropriate listeners.
     */
    @Override
    public void run() {
      Events events = m_eventLog.getEvents();
      if (events == null || events.getEventCount() <= 0) {
        // no events to process
        return;
      }

      for (final Event event : events.getEventCollection()) {
        final ThreadCategory log = log();
        if (log.isDebugEnabled()) {
          // Log the uei, source, and other important aspects
          final String uuid = event.getUuid();
          log.debug("Event {");
          log.debug("  uuid  = " + (uuid != null && uuid.length() > 0 ? uuid : "<not-set>"));
          log.debug("  uei   = " + event.getUei());
          log.debug("  src   = " + event.getSource());
          log.debug("  iface = " + event.getInterface());
          log.debug("  time  = " + event.getTime());
          if (event.getParmCollection().size() > 0) {
            log.debug("  parms {");
            for (final Parm parm : event.getParmCollection()) {
              if ((parm.getParmName() != null) && (parm.getValue().getContent() != null)) {
                log.debug(
                    "    ("
                        + parm.getParmName().trim()
                        + ", "
                        + parm.getValue().getContent().trim()
                        + ")");
              }
            }
            log.debug("  }");
          }
          log.debug("}");
        }

        for (final EventProcessor eventProcessor : m_eventProcessors) {
          try {
            eventProcessor.process(m_eventLog.getHeader(), event);
          } catch (SQLException e) {
            log.warn(
                "Unable to process event using processor "
                    + eventProcessor
                    + "; not processing with any later processors.  Exception: "
                    + e,
                e);
            break;
          } catch (Throwable t) {
            log.warn(
                "Unknown exception processing event with processor "
                    + eventProcessor
                    + "; not processing with any later processors.  Exception: "
                    + t,
                t);
            break;
          }
        }
      }
    }