public class XsltAggregationStrategy
extends org.apache.camel.support.service.ServiceSupport
implements org.apache.camel.AggregationStrategy, org.apache.camel.CamelContextAware
Since XSLT does not directly support providing multiple XML payloads as an input, this aggregator injects the new
incoming XML document (newExchange) into the oldExchange as an exchange property of type
Document. The old exchange therefore remains accessible as the root context. This exchange property can then
be accessed from your XSLT by declaring an <xsl:param /> at the top of your stylesheet:
The exchange property name defaults to new-exchange but can be changed through
setPropertyName(String).
Some code bits have been copied from the XsltEndpoint.
| Constructor and Description |
|---|
XsltAggregationStrategy(String xslFileLocation)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
org.apache.camel.Exchange |
aggregate(org.apache.camel.Exchange oldExchange,
org.apache.camel.Exchange newExchange) |
protected void |
configureOutput(XsltBuilder xslt,
String output) |
static XsltAggregationStrategy |
create(String xslFile) |
protected XsltBuilder |
createXsltBuilder() |
protected void |
doInit() |
protected void |
doStart() |
protected void |
doStop() |
org.apache.camel.CamelContext |
getCamelContext() |
String |
getPropertyName() |
protected void |
loadResource(String resourceUri)
Loads the resource.
|
void |
setCamelContext(org.apache.camel.CamelContext camelContext) |
void |
setOutput(XsltOutput output) |
void |
setPropertyName(String propertyName) |
void |
setTransformerFactory(TransformerFactory transformerFactory) |
void |
setTransformerFactoryClass(String transformerFactoryClass) |
void |
setUriResolver(URIResolver uriResolver) |
void |
setXslt(XsltBuilder xslt) |
XsltAggregationStrategy |
withOutput(XsltOutput output) |
XsltAggregationStrategy |
withPropertyName(String propertyName) |
XsltAggregationStrategy |
withTransformerFactoryClass(String clazz) |
XsltAggregationStrategy |
withUriResolver(URIResolver resolver) |
build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaggregate, canPreComplete, onCompletion, onOptimisticLockFailure, preComplete, timeoutpublic XsltAggregationStrategy(String xslFileLocation)
xslFileLocation - location of the XSL transformationpublic org.apache.camel.CamelContext getCamelContext()
getCamelContext in interface org.apache.camel.CamelContextAwarepublic void setCamelContext(org.apache.camel.CamelContext camelContext)
setCamelContext in interface org.apache.camel.CamelContextAwarepublic org.apache.camel.Exchange aggregate(org.apache.camel.Exchange oldExchange,
org.apache.camel.Exchange newExchange)
aggregate in interface org.apache.camel.AggregationStrategypublic void setOutput(XsltOutput output)
public void setXslt(XsltBuilder xslt)
public void setUriResolver(URIResolver uriResolver)
public void setTransformerFactoryClass(String transformerFactoryClass)
public void setTransformerFactory(TransformerFactory transformerFactory)
public String getPropertyName()
public void setPropertyName(String propertyName)
protected void configureOutput(XsltBuilder xslt, String output) throws Exception
Exceptionprotected void loadResource(String resourceUri) throws TransformerException, IOException
resourceUri - the resource to loadTransformerException - is thrown if error loading resourceIOException - is thrown if error loading resourcepublic static XsltAggregationStrategy create(String xslFile)
public XsltAggregationStrategy withPropertyName(String propertyName)
public XsltAggregationStrategy withOutput(XsltOutput output)
public XsltAggregationStrategy withUriResolver(URIResolver resolver)
public XsltAggregationStrategy withTransformerFactoryClass(String clazz)
protected XsltBuilder createXsltBuilder()
protected void doInit()
throws Exception
doInit in class org.apache.camel.support.service.BaseServiceExceptionprotected void doStart()
throws Exception
doStart in class org.apache.camel.support.service.BaseServiceExceptionApache Camel