Class XsltAggregationStrategy
- All Implemented Interfaces:
AutoCloseable,org.apache.camel.AggregationStrategy,org.apache.camel.CamelContextAware,org.apache.camel.Service,org.apache.camel.ShutdownableService,org.apache.camel.spi.HasCamelContext,org.apache.camel.StatefulService,org.apache.camel.SuspendableService
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:
<xsl:param name="new-exchange" />
<xsl:template match="/">
The exchange property name defaults to new-exchange but can be changed through
setPropertyName(String).
Some code bits have been copied from the XsltEndpoint.
-
Field Summary
Fields inherited from class org.apache.camel.support.service.BaseService
BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.camel.Exchangeaggregate(org.apache.camel.Exchange oldExchange, org.apache.camel.Exchange newExchange) protected voidconfigureOutput(XsltBuilder xslt, String output) static XsltAggregationStrategyprotected XsltBuilderprotected voiddoInit()protected voiddoStart()protected voiddoStop()org.apache.camel.CamelContextprotected voidloadResource(String resourceUri) Loads the resource.voidsetCamelContext(org.apache.camel.CamelContext camelContext) voidsetOutput(XsltOutput output) voidsetPropertyName(String propertyName) voidsetTransformerFactory(TransformerFactory transformerFactory) voidsetTransformerFactoryClass(String transformerFactoryClass) voidsetUriResolver(URIResolver uriResolver) voidsetXslt(XsltBuilder xslt) withOutput(XsltOutput output) withPropertyName(String propertyName) withUriResolver(URIResolver resolver) Methods inherited from class org.apache.camel.support.service.BaseService
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, suspendMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.camel.AggregationStrategy
aggregate, canPreComplete, onCompletion, onCompletion, onOptimisticLockFailure, preComplete, timeoutMethods inherited from interface org.apache.camel.Service
build, close, init, start, stopMethods inherited from interface org.apache.camel.ShutdownableService
shutdownMethods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspendingMethods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Constructor Details
-
XsltAggregationStrategy
Constructor.- Parameters:
xslFileLocation- location of the XSL transformation
-
-
Method Details
-
getCamelContext
public org.apache.camel.CamelContext getCamelContext()- Specified by:
getCamelContextin interfaceorg.apache.camel.spi.HasCamelContext
-
setCamelContext
public void setCamelContext(org.apache.camel.CamelContext camelContext) - Specified by:
setCamelContextin interfaceorg.apache.camel.CamelContextAware
-
aggregate
public org.apache.camel.Exchange aggregate(org.apache.camel.Exchange oldExchange, org.apache.camel.Exchange newExchange) - Specified by:
aggregatein interfaceorg.apache.camel.AggregationStrategy
-
setOutput
-
setXslt
-
setUriResolver
-
setTransformerFactoryClass
-
setTransformerFactory
-
getPropertyName
-
setPropertyName
-
configureOutput
- Throws:
Exception
-
loadResource
Loads the resource.- Parameters:
resourceUri- the resource to load- Throws:
TransformerException- is thrown if error loading resourceIOException- is thrown if error loading resource
-
create
-
withPropertyName
-
withOutput
-
withUriResolver
-
withTransformerFactoryClass
-
createXsltBuilder
-
doInit
- Overrides:
doInitin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStart
- Overrides:
doStartin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStop
- Overrides:
doStopin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-