Class SmooksAction

  extended by org.jboss.soa.esb.actions.AbstractActionLifecycle
      extended by org.jboss.soa.esb.actions.AbstractActionPipelineProcessor
          extended by org.jboss.soa.esb.smooks.SmooksAction
All Implemented Interfaces:
ActionLifecycle, ActionPipelineProcessor
Direct Known Subclasses:

public class SmooksAction
extends AbstractActionPipelineProcessor

Smooks action pipeline processor.


 <action name="transform" class="org.jboss.soa.esb.smooks.SmooksAction">
        <property name="smooksConfig" value="smooks-config.xml" />
Optional properties:
 <property name="get-payload-location" value="input" />
 <property name="set-payload-location" value="ouput" />
 <property name="mappedContextObjects" value="object1,object2" />
 <property name="resultType" value="STRING" />
 <property name="reportPath" value="/tmp/smooks-report.html" />
 <property name="messageProfile" value="fromServiceA" />
Description of configuration properties:

Exposing the Smooks ExecutionContext to other ESB Actions

After Smooks has performed the filtering operation on the message payload, it can map the contents of the ExecutionContext onto a Map on the the ESB message, making it available to other actions in the ESB. This Map can be accessed by using the EXECUTION_CONTEXT_ATTR_MAP_KEY key as follows:
 message.getBody().get( SmooksAction.EXECUTION_CONTEXT_ATTR_MAP_KEY );
The ExecutionContext objects to be mapped must be specified in the "mappedContextObjects" action property. The objects must also be Serializable.

Specifying the Source and Result Types

From the ESB Message data type, this action is able to automatically determine the type of Source to use (via the Smooks PayloadProcessor). The Result type to be used can be specified via the "resultType" property, as outlined above.

It is expected that the above mechanism will be satisfactory for most usecase, but not all. For the other usecases, this action supports SourceResult payloads on the ESB Message. This allows you to manually specify other Source and Result types, which is of particular interest with respect to the Result type e.g. for streaming the Result to a file etc.

Message Profiling

Smooks Profiling allows you to use a single Smooks instance to transform multiple source messages. As an example, imagine a situation where messages of different formats are delivered to a Service. Before consuming the messages, the Service needs to transform these message payloads to a common format. To accomplish this, you can use profiling.

The action can have the default profile name configured through the "messageProfile" property. Each incoming ESB message can specify it's profile name through the message property of the same name ("messageProfile"). For more on profiling, see the profiling example.


Field Summary
static java.lang.String EXECUTION_CONTEXT_ATTR_MAP_KEY
Fields inherited from interface org.jboss.soa.esb.actions.ActionPipelineProcessor
Constructor Summary
SmooksAction(ConfigTree configTree)
Method Summary
 void destroy()
          Destroy the action instance.
protected  java.util.Map getSerializableObjectsMap(java.util.Map smooksAttribuesMap)
          Will return a Map containing only the Serializable objects listed in the "mappedContextObjects" action property.
 Message process(Message message)
          Executes the actual Smooks tranformation.
Methods inherited from class org.jboss.soa.esb.actions.AbstractActionPipelineProcessor
processException, processSuccess
Methods inherited from class org.jboss.soa.esb.actions.AbstractActionLifecycle
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jboss.soa.esb.actions.ActionLifecycle

Field Detail


public static final java.lang.String EXECUTION_CONTEXT_ATTR_MAP_KEY
See Also:
Constant Field Values
Constructor Detail


public SmooksAction(ConfigTree configTree)
             throws ConfigurationException
Method Detail


public Message process(Message message)
                throws ActionProcessingException
Executes the actual Smooks tranformation.

message - The ESB Message object
The ESB Message object with the output of the transformation.
ActionProcessingException - for errors during processing.


public void destroy()
             throws ActionLifecycleException
Description copied from class: AbstractActionLifecycle
Destroy the action instance.

This method is called prior to the release of the action instance. All resources associated with this action instance should be released as the instance will no longer be used.

Specified by:
destroy in interface ActionLifecycle
destroy in class AbstractActionLifecycle


protected java.util.Map getSerializableObjectsMap(java.util.Map smooksAttribuesMap)
Will return a Map containing only the Serializable objects listed in the "mappedContextObjects" action property.

smooksAttribuesMap - - Map containing attributes from the Smooks ExecutionContext
Map - Map containing only the Serializable ExecutionContext objects listed in the "mappedContextObjects" action property.