本文整理了Java中org.opennms.netmgt.xml.event.Event.setSource()
方法的一些代码示例,展示了Event.setSource()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Event.setSource()
方法的具体详情如下:
包路径:org.opennms.netmgt.xml.event.Event
类名称:Event
方法名:setSource
[英]Sets the value of field 'source'.
[中]设置字段“源”的值。
代码示例来源:origin: OpenNMS/opennms
/**
* <p>setSource</p>
*
* @param source a {@link java.lang.String} object.
* @return a {@link org.opennms.netmgt.model.events.EventBuilder} object.
*/
public EventBuilder setSource(final String source) {
m_event.setSource(source);
return this;
}
代码示例来源:origin: org.opennms.features.amqp/org.opennms.features.amqp.event-receiver
@Override
public void process(final Exchange exchange) throws Exception {
final String eventXml = exchange.getIn().getBody(String.class);
final Event event = JaxbUtils.unmarshal(Event.class, eventXml);
final String systemId = exchange.getIn().getHeader(EVENT_HEADER_SYSTEMID, String.class);
if (event.getNodeid() > 0) {
String foreignSource = exchange.getIn().getHeader(EVENT_HEADER_FOREIGNSOURCE, String.class);
String foreignId = exchange.getIn().getHeader(EVENT_HEADER_FOREIGNID, String.class);
OnmsNode node = nodeDao.findByForeignId(foreignSource, foreignId);
if (node != null && node.getId() != null) {
event.setNodeid(node.getId().longValue());
event.setDistPoller(systemId);
event.setSource("Endpoint="+systemId+":"+event.getSource());
} else {
LOG.warn("Could not find node {}/{} in the database, cannot update node ID to local value; discarding event", foreignSource, foreignId);
// Halt the route if we cannot translate the node ID
exchange.setProperty(Exchange.ROUTE_STOP, Boolean.TRUE);
}
}
exchange.getIn().setBody(event, Event.class);
}
代码示例来源:origin: OpenNMS/opennms
@Override
public void process(final Exchange exchange) throws Exception {
final String eventXml = exchange.getIn().getBody(String.class);
final Event event = JaxbUtils.unmarshal(Event.class, eventXml);
final String systemId = exchange.getIn().getHeader(EVENT_HEADER_SYSTEMID, String.class);
if (event.getNodeid() > 0) {
String foreignSource = exchange.getIn().getHeader(EVENT_HEADER_FOREIGNSOURCE, String.class);
String foreignId = exchange.getIn().getHeader(EVENT_HEADER_FOREIGNID, String.class);
OnmsNode node = nodeDao.findByForeignId(foreignSource, foreignId);
if (node != null && node.getId() != null) {
event.setNodeid(node.getId().longValue());
event.setDistPoller(systemId);
event.setSource("Endpoint="+systemId+":"+event.getSource());
} else {
LOG.warn("Could not find node {}/{} in the database, cannot update node ID to local value; discarding event", foreignSource, foreignId);
// Halt the route if we cannot translate the node ID
exchange.setProperty(Exchange.ROUTE_STOP, Boolean.TRUE);
}
}
exchange.getIn().setBody(event, Event.class);
}
代码示例来源:origin: org.opennms.features.activemq/org.opennms.features.activemq.event-receiver
@Override
public void process(final Exchange exchange) throws Exception {
final Event event = exchange.getIn().getBody(Event.class);
String systemId = exchange.getIn().getHeader(EVENT_HEADER_SYSTEMID, String.class);
if (event.getNodeid() > 0) {
String foreignSource = exchange.getIn().getHeader(EVENT_HEADER_FOREIGNSOURCE, String.class);
String foreignId = exchange.getIn().getHeader(EVENT_HEADER_FOREIGNID, String.class);
OnmsNode node = nodeDao.findByForeignId(foreignSource, foreignId);
if (node != null && node.getId() != null) {
event.setNodeid(node.getId().longValue());
event.setDistPoller(systemId);
event.setSource("Endpoint="+systemId+":"+event.getSource());
} else {
LOG.warn("Could not find node {}/{} in the database, cannot update node ID to local value; discarding event", foreignSource, foreignId);
// Halt the route if we cannot translate the node ID
exchange.setProperty(Exchange.ROUTE_STOP, Boolean.TRUE);
}
}
}
}
代码示例来源:origin: OpenNMS/opennms
@Override
public void processRow(ResultSet rs) throws SQLException {
event.setDbid(rs.getInt("eventid"));
event.setUei(rs.getString("eventuei"));
event.setNodeid(rs.getLong("nodeid"));
event.setTime(rs.getDate("eventtime"));
event.setHost(rs.getString("eventhost"));
event.setInterface(rs.getString("ipaddr"));
event.setSnmphost(rs.getString("eventsnmphost"));
event.setService(getServiceName(rs.getInt("serviceid")));
event.setCreationTime(rs.getDate("eventcreatetime"));
event.setSeverity(rs.getString("eventseverity"));
event.setPathoutage(rs.getString("eventpathoutage"));
Tticket tticket = new Tticket();
tticket.setContent(rs.getString("eventtticket"));
tticket.setState(rs.getString("eventtticketstate"));
event.setTticket(tticket);
event.setSource(rs.getString("eventsource"));
}
代码示例来源:origin: OpenNMS/opennms
public Event translate(Event srcEvent) {
Event targetEvent = cloneEvent(srcEvent);
for (AssignmentSpec assignSpec : getAssignmentSpecs()) {
if (assignSpec.matches(srcEvent)) {
assignSpec.apply(srcEvent, targetEvent);
} else {
if (assignSpec.getAssignment().hasDefault()) {
assignSpec.setValue(targetEvent, assignSpec.getAssignment().getDefault());
} else {
return null;
}
}
}
targetEvent.setSource(TRANSLATOR_NAME);
return targetEvent;
}
代码示例来源:origin: OpenNMS/opennms
event.setSource(alarm.getLastEvent().getEventSource());
内容来源于网络,如有侵权,请联系作者删除!