org.jboss.soa.esb.actions.transformation.xslt
Class XsltAction
java.lang.Object
org.jboss.soa.esb.actions.AbstractActionLifecycle
org.jboss.soa.esb.actions.AbstractActionPipelineProcessor
org.jboss.soa.esb.actions.transformation.xslt.XsltAction
- All Implemented Interfaces:
- ActionLifecycle, ActionPipelineProcessor
public class XsltAction
- extends AbstractActionPipelineProcessor
ESB Action that performs xslt tranformation.
Example configuration:
<action name="xslt-transform" class="org.jboss.soa.esb.actions.transformation.xslt.XsltAction">
<property name="templateFile" value="/sample.xsl"/>
<property name="failOnWarning" value="true"/>
<property name="resultType" value="STRING"/>
</action>
Configuration Properties
templateFile:
The path to the xsl template to be used. Mandatory
resultType:
This property controls the output result of the transformation.
The following values are currently available:
ResultType.STRING
- will produce a string.
ResultType.BYTES
- will produce a byte[].
ResultType.DOM
- will produce a DOMResult
.
ResultType.SAX
- will produce a SAXResult
.
If the above does not suite your needs then you have the option of specifying both the
Source and Result by creating SourceResult
object instance. This is a simple
object that holds both a Source
and a Result
.
You need to create this object prior to calling this action and the type of Result
returned will be the type that was used to create the SourceResult
.
failOnWarning:
If true will cause a transformation warning to cause an exception to be thrown.
If false the failure will be logged. Default is true if not specified.
uriResolver:
Fully qualified class name of a class that implements URIResolver
.
This will be set on the tranformation factory. Optional
factory.feature.*:
Factory features that will be set for the tranformation factory. Optional.
The feature name, which are fully qualified URIs will should be specified
after the 'factory.feature.' prefix. For example:
factory.feature.http://javax.xml.XMLConstants/feature/secure-processing
factory.attribute.*:
Factory attributes that will be set for the tranformation factory. Optional.
The attribute name should be specified after the 'factory.attribute.' prefix.
For example:
factory.attribute.someVendorAttributename
- Since:
- 4.6
- Author:
- Daniel Bevenius
Constructor Summary |
XsltAction(ConfigTree config)
Sole constructor that parses the passed-in ConfigTree for
mandatory attributes and sets the fields of this instance. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
XsltAction
public XsltAction(ConfigTree config)
throws ConfigurationException
- Sole constructor that parses the passed-in
ConfigTree
for
mandatory attributes and sets the fields of this instance.
- Parameters:
config
- The ConfigTree
instance.
- Throws:
ConfigurationException
- if the mandatory attribute 'xslt' has not been set.
process
public Message process(Message message)
throws ActionProcessingException
- Performs the xsl tranformation of the message payload.
- Parameters:
message
- The ESB Message
object whose payload should be transformed.
The payload is extracted and set using contract specified by MessagePayloadProxy
.
- Returns:
Message
The same ESB Message instance passed-in but with it payload transformed.
- Throws:
ActionProcessingException
- if an error occurs while trying to perform the transformation.
initialise
public void initialise()
throws ActionLifecycleException
- Creates the XSLTemplate.
- Specified by:
initialise
in interface ActionLifecycle
- Overrides:
initialise
in class AbstractActionLifecycle
- Throws:
ActionLifecycleException
- if the Templates
could not be created.
getTranformerConfig
public TransformerFactoryConfig getTranformerConfig()
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object