org.apache.camel.builder.xml
Class XsltBuilder

java.lang.Object
  extended by org.apache.camel.builder.xml.XsltBuilder
All Implemented Interfaces:
Processor

public class XsltBuilder
extends Object
implements Processor

Creates a Processor which performs an XSLT transformation of the IN message body.

Will by defult output the result as a String. You can chose which kind of output you want using the outputXXX methods.

Version:
$Revision: 19451 $

Constructor Summary
XsltBuilder()
           
XsltBuilder(Templates templates)
           
 
Method Summary
protected  void addParameters(Transformer transformer, Map<String,Object> map)
           
protected  void configureTransformer(Transformer transformer, Exchange exchange)
          Configures the transformer with exchange specific parameters
 XmlConverter getConverter()
           
 Map<String,Object> getParameters()
           
 ResultHandlerFactory getResultHandlerFactory()
           
protected  Source getSource(Exchange exchange)
          Converts the inbound body to a Source
 Templates getTemplate()
           
 URIResolver getUriResolver()
           
 boolean isFailOnNullBody()
           
 XsltBuilder outputBytes()
          Sets the output as being a byte[]
 XsltBuilder outputDOM()
          Sets the output as being a DOM
 XsltBuilder outputFile()
          Sets the output as being a File where the filename must be provided in the Exchange.XSLT_FILE_NAME header.
 XsltBuilder outputString()
          Sets the output as being a String
 XsltBuilder parameter(String name, Object value)
           
 void process(Exchange exchange)
          Processes the message exchange
 void setConverter(XmlConverter converter)
           
 void setFailOnNullBody(boolean failOnNullBody)
           
 void setParameters(Map<String,Object> parameters)
           
 void setResultHandlerFactory(ResultHandlerFactory resultHandlerFactory)
           
 void setTemplate(Templates template)
           
 void setTransformerFile(File xslt)
          Sets the XSLT transformer from a File
 void setTransformerInputStream(InputStream in)
          Sets the XSLT transformer from the given input stream
 void setTransformerSource(Source source)
          Sets the XSLT transformer from a Source
 void setTransformerURL(URL url)
          Sets the XSLT transformer from a URL
 void setUriResolver(URIResolver uriResolver)
           
 String toString()
           
 XsltBuilder uriResolver(URIResolver uriResolver)
          Sets a custom URI resolver to be used
static XsltBuilder xslt(File xslt)
          Creates an XSLT processor using the given XSLT source
static XsltBuilder xslt(InputStream xslt)
          Creates an XSLT processor using the given XSLT source
static XsltBuilder xslt(Source xslt)
          Creates an XSLT processor using the given XSLT source
static XsltBuilder xslt(Templates templates)
          Creates an XSLT processor using the given templates instance
static XsltBuilder xslt(URL xslt)
          Creates an XSLT processor using the given XSLT source
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XsltBuilder

public XsltBuilder()

XsltBuilder

public XsltBuilder(Templates templates)
Method Detail

toString

public String toString()
Overrides:
toString in class Object

process

public void process(Exchange exchange)
             throws Exception
Description copied from interface: Processor
Processes the message exchange

Specified by:
process in interface Processor
Parameters:
exchange - the message exchange
Throws:
Exception - if an internal processing error has occurred.

xslt

public static XsltBuilder xslt(Templates templates)
Creates an XSLT processor using the given templates instance


xslt

public static XsltBuilder xslt(Source xslt)
                        throws TransformerConfigurationException
Creates an XSLT processor using the given XSLT source

Throws:
TransformerConfigurationException

xslt

public static XsltBuilder xslt(File xslt)
                        throws TransformerConfigurationException
Creates an XSLT processor using the given XSLT source

Throws:
TransformerConfigurationException

xslt

public static XsltBuilder xslt(URL xslt)
                        throws TransformerConfigurationException,
                               IOException
Creates an XSLT processor using the given XSLT source

Throws:
TransformerConfigurationException
IOException

xslt

public static XsltBuilder xslt(InputStream xslt)
                        throws TransformerConfigurationException,
                               IOException
Creates an XSLT processor using the given XSLT source

Throws:
TransformerConfigurationException
IOException

outputBytes

public XsltBuilder outputBytes()
Sets the output as being a byte[]


outputString

public XsltBuilder outputString()
Sets the output as being a String


outputDOM

public XsltBuilder outputDOM()
Sets the output as being a DOM


outputFile

public XsltBuilder outputFile()
Sets the output as being a File where the filename must be provided in the Exchange.XSLT_FILE_NAME header.


parameter

public XsltBuilder parameter(String name,
                             Object value)

uriResolver

public XsltBuilder uriResolver(URIResolver uriResolver)
Sets a custom URI resolver to be used


getParameters

public Map<String,Object> getParameters()

setParameters

public void setParameters(Map<String,Object> parameters)

setTemplate

public void setTemplate(Templates template)

getTemplate

public Templates getTemplate()

isFailOnNullBody

public boolean isFailOnNullBody()

setFailOnNullBody

public void setFailOnNullBody(boolean failOnNullBody)

getResultHandlerFactory

public ResultHandlerFactory getResultHandlerFactory()

setResultHandlerFactory

public void setResultHandlerFactory(ResultHandlerFactory resultHandlerFactory)

setTransformerSource

public void setTransformerSource(Source source)
                          throws TransformerConfigurationException
Sets the XSLT transformer from a Source

Parameters:
source - the source
Throws:
TransformerConfigurationException - is thrown if creating a XSLT transformer failed.

setTransformerFile

public void setTransformerFile(File xslt)
                        throws TransformerConfigurationException
Sets the XSLT transformer from a File

Throws:
TransformerConfigurationException

setTransformerURL

public void setTransformerURL(URL url)
                       throws TransformerConfigurationException,
                              IOException
Sets the XSLT transformer from a URL

Throws:
TransformerConfigurationException
IOException

setTransformerInputStream

public void setTransformerInputStream(InputStream in)
                               throws TransformerConfigurationException,
                                      IOException
Sets the XSLT transformer from the given input stream

Throws:
TransformerConfigurationException
IOException

getConverter

public XmlConverter getConverter()

setConverter

public void setConverter(XmlConverter converter)

getUriResolver

public URIResolver getUriResolver()

setUriResolver

public void setUriResolver(URIResolver uriResolver)

getSource

protected Source getSource(Exchange exchange)
Converts the inbound body to a Source


configureTransformer

protected void configureTransformer(Transformer transformer,
                                    Exchange exchange)
Configures the transformer with exchange specific parameters


addParameters

protected void addParameters(Transformer transformer,
                             Map<String,Object> map)


Apache CAMEL