if (src instanceof Message)
{
return src;
}
Message result = new Message();
if (muleMessage.getExceptionPayload() != null)
{
result.setError(
new XMPPError(XMPPError.Condition.service_unavailable,
muleMessage.getExceptionPayload().getMessage()));
}
for (String propertyName : muleMessage.getOutboundPropertyNames())
{
if (propertyName.equals(XmppConnector.XMPP_THREAD))
{
result.setThread((String) muleMessage.getOutboundProperty(propertyName));
}
else if (propertyName.equals(XmppConnector.XMPP_SUBJECT))
{
result.setSubject((String) muleMessage.getOutboundProperty(propertyName));
}
else if (propertyName.equals(XmppConnector.XMPP_FROM))
{
result.setFrom((String) muleMessage.getOutboundProperty(propertyName));
}
else if (propertyName.equals(XmppConnector.XMPP_TO))
{
result.setTo((String) muleMessage.getOutboundProperty(propertyName));
}
else
{
result.setProperty(propertyName, muleMessage.<Object>getOutboundProperty(propertyName));
}
}
// copy the payload. Since it can only be a String (other objects wouldn't be passed in through
// AbstractTransformer) the following is safe.
result.setBody((String) src);
return result;
}