use of org.talend.esb.sam._2011._03.common.OriginatorType in project tesb-rt-se by Talend.
the class EventMapper method mapOriginator.
/**
* Mapping originator.
*
* @param originator the originator
* @return the originator type
*/
private static OriginatorType mapOriginator(Originator originator) {
if (originator == null) {
return null;
}
OriginatorType origType = new OriginatorType();
origType.setProcessId(originator.getProcessId());
origType.setIp(originator.getIp());
origType.setHostname(originator.getHostname());
origType.setCustomId(originator.getCustomId());
origType.setPrincipal(originator.getPrincipal());
return origType;
}
use of org.talend.esb.sam._2011._03.common.OriginatorType in project tesb-rt-se by Talend.
the class EventTypeMapperTest method testEmpty.
/**
* Test with empty eventType parts to check for Nullpointer exceptions
*/
@Test
public void testEmpty() {
EventType eventType = new EventType();
EventTypeMapper.map(eventType);
eventType.setCustomInfo(new CustomInfoType());
EventTypeMapper.map(eventType);
eventType.setMessageInfo(new MessageInfoType());
EventTypeMapper.map(eventType);
eventType.setOriginator(new OriginatorType());
EventTypeMapper.map(eventType);
}
use of org.talend.esb.sam._2011._03.common.OriginatorType in project tesb-rt-se by Talend.
the class AgentActivator method createEventType.
/**
* Creates the event type.
*
* @param type the EventEnumType
* @return the event type
*/
private EventType createEventType(EventEnumType type) {
EventType eventType = new EventType();
eventType.setTimestamp(Converter.convertDate(new Date()));
eventType.setEventType(type);
OriginatorType origType = new OriginatorType();
origType.setProcessId(Converter.getPID());
try {
InetAddress inetAddress = InetAddress.getLocalHost();
origType.setIp(inetAddress.getHostAddress());
origType.setHostname(inetAddress.getHostName());
} catch (UnknownHostException e) {
origType.setHostname("Unknown hostname");
origType.setIp("Unknown ip address");
}
eventType.setOriginator(origType);
String path = System.getProperty("karaf.home");
CustomInfoType ciType = new CustomInfoType();
CustomInfoType.Item cItem = new CustomInfoType.Item();
cItem.setKey("path");
cItem.setValue(path);
ciType.getItem().add(cItem);
eventType.setCustomInfo(ciType);
return eventType;
}
use of org.talend.esb.sam._2011._03.common.OriginatorType in project tesb-rt-se by Talend.
the class EventMapper method map.
/**
* convert Event bean to EventType manually.
*
* @param event the event
* @return the event type
*/
public static EventType map(Event event) {
EventType eventType = new EventType();
eventType.setTimestamp(Converter.convertDate(event.getTimestamp()));
eventType.setEventType(convertEventType(event.getEventType()));
OriginatorType origType = mapOriginator(event.getOriginator());
eventType.setOriginator(origType);
MessageInfoType miType = mapMessageInfo(event.getMessageInfo());
eventType.setMessageInfo(miType);
eventType.setCustomInfo(convertCustomInfo(event.getCustomInfo()));
eventType.setContentCut(event.isContentCut());
if (event.getContent() != null) {
DataHandler datHandler = getDataHandlerForString(event);
eventType.setContent(datHandler);
}
return eventType;
}
Aggregations