|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mule.transformers.AbstractTransformer
org.mule.transformers.xml.AbstractXmlTransformer
org.mule.transformers.xml.XsltTransformer
public class XsltTransformer
XsltTransformer
performs an XSLT transform on a DOM (or other XML-ish)
object.
Nested Class Summary | |
---|---|
protected class |
XsltTransformer.DefaultErrorListener
|
protected class |
XsltTransformer.PooledXsltTransformerFactory
|
Nested classes/interfaces inherited from class org.mule.transformers.xml.AbstractXmlTransformer |
---|
AbstractXmlTransformer.ResultHolder |
Field Summary | |
---|---|
protected GenericObjectPool |
transformerPool
|
Fields inherited from class org.mule.transformers.AbstractTransformer |
---|
DEFAULT_TRUNCATE_LENGTH, endpoint, logger, name, nextTransformer, returnClass, sourceTypes |
Constructor Summary | |
---|---|
XsltTransformer()
|
Method Summary | |
---|---|
Object |
clone()
|
Object |
doTransform(Object src,
String encoding)
Transform, using XSLT, a XML String to another String. |
protected Object |
evaluateTransformParameter(String name,
Object value)
Returns the value to be set for the parameter. |
int |
getMaxActiveTransformers()
|
int |
getMaxIdleTransformers()
|
protected StreamSource |
getStreamSource()
Returns the StreamSource corresponding to xslFile |
Map |
getTransformParameters()
Gets the parameters to be used when applying the transformation |
String |
getXslFile()
|
String |
getXslt()
|
String |
getXslTransformerFactory()
Returns the name of the currently configured javax.xml.transform.Transformer factory class used to create XSLT Transformers. |
void |
initialise()
Template method were deriving classes can do any initialisation after the properties have been set on this transformer |
void |
setMaxActiveTransformers(int maxActiveTransformers)
Sets the the current maximum number of idle transformer objects allowed in the pool |
void |
setMaxIdleTransformers(int maxIdleTransformers)
Sets the the current maximum number of idle transformer objects allowed in the pool |
void |
setTransformParameters(Map transformParameters)
Sets the parameters to be used when applying the transformation |
void |
setXslFile(String xslFile)
|
void |
setXslt(String xslt)
|
void |
setXslTransformerFactory(String xslTransformerFactory)
Configures the javax.xml.transform.Transformer factory class |
Methods inherited from class org.mule.transformers.xml.AbstractXmlTransformer |
---|
convertToBytes, convertToText, convertToText, getOutputEncoding, getResultHolder, getXmlSource, setOutputEncoding |
Methods inherited from class org.mule.transformers.AbstractTransformer |
---|
checkReturnClass, generateTransformerName, getEndpoint, getFinalReturnClass, getName, getNextTransformer, getReturnClass, isAcceptNull, isIgnoreBadInput, isSourceTypeSupported, isSourceTypeSupported, nextTransform, registerSourceType, setEndpoint, setIgnoreBadInput, setName, setNextTransformer, setReturnClass, toString, transform, unregisterSourceType |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final GenericObjectPool transformerPool
Constructor Detail |
---|
public XsltTransformer()
Method Detail |
---|
public void initialise() throws InitialisationException
AbstractTransformer
initialise
in interface Initialisable
initialise
in class AbstractTransformer
InitialisationException
- if a fatal error occurs causing the Mule
instance to shutdown
RecoverableException
- if an error occurs that can be recovered fromInitialisable.initialise()
public Object doTransform(Object src, String encoding) throws TransformerException
doTransform
in class AbstractTransformer
src
- The source XML (String, byte[], DOM, etc.)
TransformerException
public String getXslTransformerFactory()
null
if none has been
configuredpublic void setXslTransformerFactory(String xslTransformerFactory)
xslTransformerFactory
- the name of the TransformerFactory class to usepublic String getXslFile()
public void setXslFile(String xslFile)
xslFile
- The xslFile to set.public String getXslt()
public void setXslt(String xslt)
protected StreamSource getStreamSource() throws InitialisationException
InitialisationException
public Object clone() throws CloneNotSupportedException
clone
in interface UMOBaseTransformer
clone
in class AbstractTransformer
CloneNotSupportedException
public int getMaxActiveTransformers()
public void setMaxActiveTransformers(int maxActiveTransformers)
maxActiveTransformers
- New maximum size to setpublic int getMaxIdleTransformers()
public void setMaxIdleTransformers(int maxIdleTransformers)
maxIdleTransformers
- New maximum size to setpublic Map getTransformParameters()
Transformer.setParameter(java.lang.String,
java.lang.Object)
public void setTransformParameters(Map transformParameters)
transformParameters
- a map of the parameter names and associated valuesTransformer.setParameter(java.lang.String,
java.lang.Object)
protected Object evaluateTransformParameter(String name, Object value) throws TransformerException
Returns the value to be set for the parameter. This method is called for each parameter before it is set on the transformer. The purpose of this method is to allow dynamic parameters related to the event (usually message properties) to be used. Any attribute of the current UMOEventContext can be accessed using JXPath.
For example: If the current event's message has a property named "myproperty", to pass this in you would set the transform parameter's value to be "#getProperty(message,'myproperty')".
Example Configuration:
<transformer name="MyXsltTransformer" className="org.mule.transformers.xml.XsltTransformer"> <properties> <property name="xslFile" value="myXslFile.xsl"/> <map name="transformParameters"> <property name="myParameter" value="#getProperty(message,'myproperty')"/> </map> </properties> </transformer>
Only parameter values that begin with # are evalued in this maner. Values that do not start with # are returned as is. Values that start with ## are returned as is starting from the second character. For example "##myparameter" would be passed into the transformer as "#myparameter"
This method may be overloaded by a sub class to provide a different dynamic parameter implementation.
name
- the name of the parametervalue
- the value of the paramter
TransformerException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |