*/
public static DefaultMessage mapSwitchYardToCamel(
org.switchyard.Exchange syExchange,
org.apache.camel.Exchange camelExchange) {
DefaultMessage camelMessage = new SwitchYardMessage();
camelMessage.setBody(syExchange.getMessage().getContent());
for (Property property : syExchange.getContext().getProperties()) {
if (property.hasLabel(BehaviorLabel.TRANSIENT.label())
|| ContextPropertyUtil.isReservedProperty(property.getName(), property.getScope())) {
continue;
}
if (Scope.EXCHANGE.equals(property.getScope())) {
camelExchange.setProperty(property.getName(), property.getValue());
} else {
camelMessage.setHeader(property.getName(), property.getValue());
}
}
for (String attachmentName : syExchange.getMessage().getAttachmentMap().keySet()) {
camelMessage.addAttachment(attachmentName,
new DataHandler(syExchange.getMessage().getAttachment(attachmentName)));
}
return camelMessage;
}