org.opennms.netmgt.xml.event.Events.getEvent()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(151)

本文整理了Java中org.opennms.netmgt.xml.event.Events.getEvent()方法的一些代码示例,展示了Events.getEvent()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Events.getEvent()方法的具体详情如下:
包路径:org.opennms.netmgt.xml.event.Events
类名称:Events
方法名:getEvent

Events.getEvent介绍

[英]Method getEvent.Returns the contents of the collection in an Array.

Note: Just in case the collection contents are changing in another thread, we pass a 0-length Array of the correct type into the API call. This way we know that the Array returned is of exactly the correct length.
[中]

代码示例

代码示例来源:origin: OpenNMS/opennms

@Override
public void process(Log eventLog) throws EventProcessorException {
  if (eventLog != null && eventLog.getEvents() != null && eventLog.getEvents().getEvent() != null) {
    try(Context ctx = expandTimer.time()) {
      for (Event event : eventLog.getEvents().getEvent()) {
        expandEvent(event);
      }
    }
  }
}

代码示例来源:origin: org.opennms.features.events/org.opennms.features.events.daemon

@Override
public void process(Log eventLog) throws EventProcessorException {
  if (eventLog != null && eventLog.getEvents() != null && eventLog.getEvents().getEvent() != null) {
    try(Context ctx = expandTimer.time()) {
      for (Event event : eventLog.getEvents().getEvent()) {
        expandEvent(event);
      }
    }
  }
}

代码示例来源:origin: OpenNMS/opennms

@Override
public void process(Log eventLog) throws EventProcessorException {
  if (eventLog != null && eventLog.getEvents() != null && eventLog.getEvents().getEvent() != null) {
    for (Event eachEvent : eventLog.getEvents().getEvent()) {
      process(eachEvent);
    }
  }
}

代码示例来源:origin: OpenNMS/opennms

@Override
public Event unmarshalSingleMessage(byte[] bytes) {
  Log log = unmarshal(bytes);
  return log.getEvents().getEvent(0);
}

代码示例来源:origin: OpenNMS/opennms

@Override
public void process(Log eventLog, boolean synchronous) throws EventProcessorException {
  if (eventLog != null && eventLog.getEvents() != null && eventLog.getEvents().getEvent() != null) {
    try (Context context = logBroadcastTimer.time()) {
      for(Event eachEvent : eventLog.getEvents().getEvent()) {
        process(eventLog.getHeader(), eachEvent, synchronous);
        eventBroadcastMeter.mark();
      }
    }
  }
}

代码示例来源:origin: OpenNMS/opennms

@Override
public void process(Log eventLog, boolean synchronous) throws EventProcessorException {
  if (eventLog != null && eventLog.getEvents() != null && eventLog.getEvents().getEvent() != null) {
    for (Event event : eventLog.getEvents().getEvent()) {
      process(event);
    }
  }
}

代码示例来源:origin: org.opennms.features.events/org.opennms.features.events.daemon

@Override
public Event unmarshalSingleMessage(byte[] bytes) {
  Log log = unmarshal(bytes);
  return log.getEvents().getEvent(0);
}

代码示例来源:origin: org.opennms.features.events/org.opennms.features.events.daemon

@Override
public void process(Log eventLog) throws EventProcessorException {
  if (eventLog != null && eventLog.getEvents() != null && eventLog.getEvents().getEvent() != null) {
    for (Event eachEvent : eventLog.getEvents().getEvent()) {
      process(eachEvent);
    }
  }
}

代码示例来源:origin: org.opennms.features.events/org.opennms.features.events.daemon

@Override
public void process(Log eventLog, boolean synchronous) throws EventProcessorException {
  if (eventLog != null && eventLog.getEvents() != null && eventLog.getEvents().getEvent() != null) {
    try (Context context = logBroadcastTimer.time()) {
      for(Event eachEvent : eventLog.getEvents().getEvent()) {
        process(eventLog.getHeader(), eachEvent, synchronous);
        eventBroadcastMeter.mark();
      }
    }
  }
}

代码示例来源:origin: org.opennms/opennms-dao-mock

@Override
public void process(Log eventLog, boolean synchronous) throws EventProcessorException {
  if (eventLog != null && eventLog.getEvents() != null && eventLog.getEvents().getEvent() != null) {
    for (Event event : eventLog.getEvents().getEvent()) {
      process(event);
    }
  }
}

代码示例来源:origin: OpenNMS/opennms

/**
 * Call {@link AggregatingMessageProducer#dispatch(Object)} to synchronously
 * dispatch the events.
 */
@Override
public void sendNowSync(Log eventLog) {
  if (eventLog != null && eventLog.getEvents() != null) {
    producer.dispatch(Arrays.asList(eventLog.getEvents().getEvent()));
  }
}

代码示例来源:origin: OpenNMS/opennms

@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
  try {
    if (!(msg instanceof ByteBuf)) {
      LOG.warn("Expected message to be of type {} but received {}. Ignoring message.", ByteBuf.class, msg == null ? null : msg.getClass());
      return;
    }
    final ByteBuf buffer = (ByteBuf) msg;
    final Log eventLog = getEventLog(buffer);
    if (eventLog.getEvents() != null
        && eventLog.getEvents().getEvent() != null
        && eventLog.getEvents().getEvent().length != 0) {
      final Optional<String> receipt = process(eventLog);
      if (receipt.isPresent()) {
        ctx.write(receipt.get());
        LOG.debug("Sent Event Receipt: {}", receipt.get());
      }
    } else {
      LOG.debug("The agent sent an empty event stream.");
    }
  } finally {
    ctx.fireChannelRead(msg);
  }
}

代码示例来源:origin: org.opennms.features.events/org.opennms.features.events.daemon

@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
  try {
    if (!(msg instanceof ByteBuf)) {
      LOG.warn("Expected message to be of type {} but received {}. Ignoring message.", ByteBuf.class, msg == null ? null : msg.getClass());
      return;
    }
    final ByteBuf buffer = (ByteBuf) msg;
    final Log eventLog = getEventLog(buffer);
    if (eventLog.getEvents() != null
        && eventLog.getEvents().getEvent() != null
        && eventLog.getEvents().getEvent().length != 0) {
      final Optional<String> receipt = process(eventLog);
      if (receipt.isPresent()) {
        ctx.write(receipt.get());
        LOG.debug("Sent Event Receipt: {}", receipt.get());
      }
    } else {
      LOG.debug("The agent sent an empty event stream.");
    }
  } finally {
    ctx.fireChannelRead(msg);
  }
}

代码示例来源:origin: org.opennms.features/org.opennms.features.opennms-es-rest

/**
 * Call {@link AggregatingMessageProducer#dispatch(Object)} to synchronously
 * dispatch the events.
 */
@Override
public void sendNowSync(Log eventLog) {
  if (eventLog != null && eventLog.getEvents() != null) {
    producer.dispatch(Arrays.asList(eventLog.getEvents().getEvent()));
  }
}

代码示例来源:origin: org.opennms.plugins/opennms-es-rest.main-module

/**
 * Call {@link AggregatingMessageProducer#dispatch(Object)} to synchronously
 * dispatch the events.
 */
@Override
public void sendNowSync(Log eventLog) {
  if (eventLog != null && eventLog.getEvents() != null) {
    producer.dispatch(Arrays.asList(eventLog.getEvents().getEvent()));
  }
}

代码示例来源:origin: OpenNMS/opennms

@Override
public void sendNow(Log eventLog) {
  if (eventLog != null && eventLog.getEvents() != null) {
    for (Event event : eventLog.getEvents().getEvent()) {
      sendNow(event);
    }
  }
}

代码示例来源:origin: org.opennms.plugins/opennms-es-rest.main-module

@Override
public void sendNow(Log eventLog) {
  if (eventLog != null && eventLog.getEvents() != null) {
    for (Event event : eventLog.getEvents().getEvent()) {
      sendNow(event);
    }
  }
}

代码示例来源:origin: org.opennms.features/org.opennms.features.opennms-es-rest

@Override
public void sendNow(Log eventLog) {
  if (eventLog != null && eventLog.getEvents() != null) {
    for (Event event : eventLog.getEvents().getEvent()) {
      sendNow(event);
    }
  }
}

代码示例来源:origin: org.opennms.plugins/opennms-es-rest.main-module

@Override
public void sendNow(Log eventLog) {
  if (eventLog != null && eventLog.getEvents() != null) {
    for (Event event : eventLog.getEvents().getEvent()) {
      sendNow(event);
    }
  }
}

代码示例来源:origin: OpenNMS/opennms

private Optional<String> process(Log eventLog) {
  final Event[] events = eventLog.getEvents().getEvent();

相关文章