|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.ikasan.framework.component.transformation.XsltTransformer
public class XsltTransformer
This class is an XSLT Transformer component that acts on all an Event's Payloads,
transforming them using the supplied style sheet.
This implementation is notable for the following reasons:
Transformer as a
new instance is created for every payload. Each instance of this class will
associate to one and only one style sheet during its life, and as such instances will be good for only one type of
transformation only.Payloads through the configuration of a content
specific XMLReader; e.g. an XMLReader implementation capable of reading fixed length flat
files can be setter-injected thus allowing flat file (fixed length) payloads to be directly transformed with
XSLT. See setXmlReader(XMLReader)setExternalResources(Map)ErrorListener this transformer supplies its own implementation
designed to propagate the exceptions thrown for parse time errors and warnings. This can be overridden by using
Setter setErrorListener(ErrorListener)ConfiguredResource contract.
The configuration object allows for configuring use of translets (compiling a stylesheet) and the stylesheet's location
Gotchas to be aware of...
xsl:import and/or
xsl:include elements, then a custom URIResolver implementation capable of loading resources from classpath
must be set on constructor-injected TransformerFactory. Also, if any of stylesheets load files using
document()function, the custome URIResolver must also be set on the Transformer
object created. This dictated by javax.xml.transform API peculiar design!
ClasspathURIResolver,
XsltConfiguration,
ExceptionThrowingErrorListener| Constructor Summary | |
|---|---|
XsltTransformer(TransformerFactory transformerFactory)
Constructor |
|
| Method Summary | |
|---|---|
XsltConfiguration |
getConfiguration()
Set configuration. |
String |
getConfiguredResourceId()
Get the id for this configured resource |
ErrorListener |
getErrorListener()
Accessor |
Map<String,Object> |
getExternalResources()
Accessor |
String |
getPayloadName()
Accessor |
Map<String,String> |
getTransformationParameters()
Accessor |
XMLReader |
getXmlReader()
Accessor |
void |
onEvent(Event event)
Transforms or otherwise changes the passed in Event |
void |
setConfiguration(XsltConfiguration configuration)
Set configuration. |
void |
setConfiguredResourceId(String id)
Set the id for this configured resource |
void |
setErrorListener(ErrorListener errorListener)
Mutator |
void |
setExternalResources(Map<String,Object> externalResources)
Mutator |
void |
setPayloadName(String payloadName)
Mutator for payloadName |
protected void |
setPayloadParameters(Transformer transformer)
Creates a parameter list of known fields derived from the Payload and makes these available to the
transformer |
void |
setTransformationParameters(Map<String,String> transformationParameters)
Mutator |
void |
setURIResolver(URIResolver resolver)
Override the default URIResolver provided
by transformer library. |
void |
setXmlReader(XMLReader xmlReader)
Mutator |
void |
startManagedResource()
Provision for starting a managed resource. |
void |
stopManagedResource()
Provision for stopping a managed resource. |
protected void |
transform(Payload payload)
Transforms the payload content. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XsltTransformer(TransformerFactory transformerFactory)
transformerFactory - - Transformer Factory to use| Method Detail |
|---|
public String getPayloadName()
public void setPayloadName(String payloadName)
payloadName - - The payload name to setpublic void setURIResolver(URIResolver resolver)
URIResolver provided
by transformer library.
resolver - custom URIResolver implementationpublic XMLReader getXmlReader()
public void setXmlReader(XMLReader xmlReader)
xmlReader - the xmlReader to setpublic Map<String,String> getTransformationParameters()
public void setTransformationParameters(Map<String,String> transformationParameters)
transformationParameters - the transformationParameters to setpublic Map<String,Object> getExternalResources()
public void setExternalResources(Map<String,Object> externalResources)
externalResources - the externalDataBeans to setpublic ErrorListener getErrorListener()
public void setErrorListener(ErrorListener errorListener)
errorListener - the errorListener to setpublic String getConfiguredResourceId()
ConfiguredResource
getConfiguredResourceId in interface ConfiguredResource<XsltConfiguration>public void setConfiguredResourceId(String id)
ConfiguredResource
setConfiguredResourceId in interface ConfiguredResource<XsltConfiguration>public XsltConfiguration getConfiguration()
ConfiguredResource
getConfiguration in interface ConfiguredResource<XsltConfiguration>public void setConfiguration(XsltConfiguration configuration)
ConfiguredResource
setConfiguration in interface ConfiguredResource<XsltConfiguration>
public void onEvent(Event event)
throws TransformationException
TransformerEvent
onEvent in interface Transformerevent - Event to transform
TransformationException - Exception if we could not transformprotected void setPayloadParameters(Transformer transformer)
Payload and makes these available to the
transformer
transformer - - Transformer to set the parameters on
protected void transform(Payload payload)
throws TransformerException
payload - The payload to be transformed
TransformerException - if an error occurs while transforming.public void startManagedResource()
ManagedResource
startManagedResource in interface ManagedResourcepublic void stopManagedResource()
ManagedResource
stopManagedResource in interface ManagedResource
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||