org.jboss.soa.esb.smooks
Class SmooksAction
java.lang.Object
   org.jboss.soa.esb.actions.AbstractActionLifecycle
org.jboss.soa.esb.actions.AbstractActionLifecycle
       org.jboss.soa.esb.actions.AbstractActionPipelineProcessor
org.jboss.soa.esb.actions.AbstractActionPipelineProcessor
           org.jboss.soa.esb.smooks.SmooksAction
org.jboss.soa.esb.smooks.SmooksAction
- All Implemented Interfaces: 
- ActionLifecycle, ActionPipelineProcessor
- Direct Known Subclasses: 
- SmooksAction
- public class SmooksAction 
- extends AbstractActionPipelineProcessor
Smooks action pipeline processor.
 
 Usage:
 
 <action name="transform" class="org.jboss.soa.esb.smooks.SmooksAction">
        <property name="smooksConfig" value="smooks-config.xml" />
 </action>
 
 Optional properties:
 
 <property name="get-payload-location" value="input" />
 <property name="set-payload-location" value="ouput" />
 <property name="excludeNonSerializables" value="false" />
 <property name="resultType" value="STRING" />
 <property name="reportPath" value="/tmp/smooks-report.html" />
 <property name="messageProfile" value="fromServiceA" />
 
 Description of configuration properties:
 
 - smooksConfig - the Smooks configuration file. Can be a path on the file system or on the classpath.
 
- get-payload-location - the body location which contains the object to be transformed.  See MessagePayloadProxy.
- set-payload-location - the body location where the transformed object will be placed.  See MessagePayloadProxy.
- excludeNonSerializables - if true, non serializable attributes from the Smooks ExecutionContext will no be included. Default is true.
 
- resultType - type of result expected from Smooks ("STRING", "BYTES", "JAVA", "NORESULT"). Default is "STRING".  For more
                         on specifying and controlling the Smooks filtering result, see Specifying the Source and Result Types.
 
- javaResultBeanId - specifies the Smooks bean context beanId to be mapped as the result when the resultType is "JAVA".  If not specified,
                               the whole bean context bean Map is mapped as the result.
 
- reportPath - specifies the path and file name for generating a Smooks Execution Report.  This is a development tool.
 
- messageProfile - specifies the default message "profile" name to be used in creation of the Smooks ExecutionContext.
                             See Message Profiling.
Exposing the Smooks ExecutionContext to other ESB Actions
 After Smooks has performed the filtering operation on the message payload, it maps 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 );
 
 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.
- Author:
- tom.fennelly@jboss.com, daniel.bevenius@gmail.com
 
 
 
 
 
 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
 
 
EXECUTION_CONTEXT_ATTR_MAP_KEY
public static final java.lang.String EXECUTION_CONTEXT_ATTR_MAP_KEY
- See Also:
- Constant Field Values
SmooksAction
public SmooksAction(ConfigTree configTree)
             throws ConfigurationException
- Throws:
- ConfigurationException
process
public Message process(Message message)
                throws ActionProcessingException
- Executes the actual Smooks tranformation.
 
- 
- Parameters:
- message- The ESB Message object
- Returns:
- The ESB Message object with the output of the transformation.
- Throws:
- ActionProcessingException- for errors during processing.
 
destroy
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:
- destroyin interface- ActionLifecycle
- Overrides:
- destroyin class- AbstractActionLifecycle
 
- 
- Throws:
- ActionLifecycleException
 
getSerializableObjectsMap
protected java.util.Map getSerializableObjectsMap(java.util.Map smooksAttribuesMap)
- Will return a Map containing only the Serializable objects
 that exist in the passed-in Map if excludeNonSerializablesis true.
 
- 
- Parameters:
- smooksAttribuesMap- - Map containing attributes from the Smooks ExecutionContext
- Returns:
- Map     - Map containing only the Serializable objects from the passed-in map.