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 transformation.
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="validation" value="true"/>
<property name="schemaFile" value="/sample.xsd"/>
<property name="schemaLanguage" value="http://www.w3.org/2001/XMLSchema"/>
<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.
- validation:
If true will cause an invalid source document to cause an exception to be thrown.
If false validation will not occur, although well-formed documents are enforced.
Default is false if not specified.
Please refer to Validation Configuration chart below.
- schemaFile:
The input schema file (xsd) to use, located on the classpath.
Default is null (unset) if not specified.
Please refer to Validation Configuration chart below.
- schemaLanguage:
The input schema language to use.
Default is null (unset) if not specified.
Please refer to Validation Configuration chart below.
- uriResolver:
Fully qualified class name of a class that implements
URIResolver
.
This will be set on the transformation factory. Optional
- factory.feature.*:
Factory features that will be set for the transformation 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 transformation factory. Optional.
The attribute name should be specified after the 'factory.attribute.' prefix.
For example:
factory.attribute.someVendorAttributename
Validation Configuration |
XML Input |
Processing Outcome |
Default
nothingor
<property name="validation" value="false"/>
|
|
|
|
|
|
- transformation may fail
- pipeline continues
|
DTD
<property name="validation" value="true"/>
<property name="schemaLanguage" value="http://www.w3.org/TR/REC-xml"/>
or
<property name="validation" value="true"/>
<property name="schemaLanguage" value=""/>
|
|
|
|
|
|
|
W3C XML Schema or RELAX NG
<property name="validation" value="true"/>
or
<property name="validation" value="true"/>
<property name="schemaLanguage" value="http://www.w3.org/2001/XMLSchema"/>
or
<property name="validation" value="true"/>
<property name="schemaLanguage" value="http://relaxng.org/ns/structure/1.0"/>
|
|
|
|
|
|
|
W3C XML Schema or RELAX NG with included schemaFile
<property name="validation" value="true"/>
<property name="schemaFile" value="/example.xsd"/>
or
<property name="validation" value="true"/>
<property name="schemaLanguage" value="http://www.w3.org/2001/XMLSchema"/>
<property name="schemaFile" value="/example.xsd"/>
or
<property name="validation" value="true"/>
<property name="schemaLanguage" value="http://relaxng.org/ns/structure/1.0"/>
<property name="schemaFile" value="/example.rng"/>
|
|
|
|
|
|
|
- Since:
- 4.6
- Author:
- Daniel Bevenius, dward at jboss.org
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 'templateFile' has not been set.
process
public Message process(Message message)
throws ActionProcessingException
- Performs the xsl transformation 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
getNumberOfPooledTransfomers
public int getNumberOfPooledTransfomers()