*/
public Message process( final Message message) throws ActionProcessingException
{
// Create Smooks ExecutionContext.
final String messageProfofile = (String) message.getProperties().getProperty(Properties.MESSAGE_PROFILE, defaultMessageProfile);
final ExecutionContext executionContext = smooks.createExecutionContext(messageProfofile);
if(reportPath != null) {
try {
executionContext.setEventListener(new HtmlReportGenerator(reportPath));
} catch (IOException e) {
throw new ActionProcessingException("Failed to create HtmlReportGenerator instance.", e);
}
}
// Use the Smooks PayloadProcessor to execute the transformation....
final Object payload;
try {
payload = payloadProxy.getPayload(message);
} catch (MessageDeliverException e) {
throw new ActionProcessingException("MessgeDeliveryException while trying to retrieve the message payload:", e);
}
final Object newPayload = payloadProcessor.process( payload, executionContext );
// Set the ExecutionContext's attributes on the message instance so other actions can access them.
message.getBody().add( EXECUTION_CONTEXT_ATTR_MAP_KEY, getSerializableObjectsMap( executionContext.getAttributes() ) );
try {
payloadProxy.setPayload( message, newPayload );
} catch (MessageDeliverException e) {
throw new ActionProcessingException("MessgeDeliveryException while trying to retrieve the message payload:", e);