Spring Web Services Framework

org.springframework.xml.transform
Class TransformerObjectSupport

java.lang.Object
  extended by org.springframework.xml.transform.TransformerObjectSupport
Direct Known Subclasses:
AbstractAddressingEndpointMapping, AbstractAddressingVersion, AbstractDom4jPayloadEndpoint, AbstractDomPayloadEndpoint, AbstractJDomPayloadEndpoint, AbstractLoggingInterceptor, AbstractMethodEndpointAdapter, AbstractSaxPayloadEndpoint, AbstractStaxPayloadEndpoint, AbstractValidatingInterceptor, AbstractValidatingInterceptor, AbstractXomPayloadEndpoint, AbstractXPathTemplate, DomPoxMessageFactory, InliningXsdSchemaTypesProvider, PayloadEndpointAdapter, PayloadTransformingInterceptor, WebServiceAccessor, WsdlDefinitionHandlerAdapter, WsdlDefinitionHttpHandler, XsdSchemaHandlerAdapter

public abstract class TransformerObjectSupport
extends Object

Convenient base class for objects that use a Transformer. Subclasses can call createTransformer() or transform(Source, Result). This should be done per thread (i.e. per incoming request), because Transformer instances are not thread-safe.

Since:
1.0.0
Author:
Arjen Poutsma
See Also:
Transformer

Field Summary
protected  Log logger
          Logger available to subclasses.
 
Constructor Summary
TransformerObjectSupport()
           
 
Method Summary
protected  Transformer createTransformer()
          Creates a new Transformer.
protected  TransformerFactory getTransformerFactory()
          Returns the TransformerFactory.
protected  TransformerFactory newTransformerFactory(Class transformerFactoryClass)
          Instantiate a new TransformerFactory.
 void setTransformerFactoryClass(Class transformerFactoryClass)
          Specify the TransformerFactory class to use.
protected  void transform(Source source, Result result)
          Transforms the given Source to the given Result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final Log logger
Logger available to subclasses.

Constructor Detail

TransformerObjectSupport

public TransformerObjectSupport()
Method Detail

setTransformerFactoryClass

public void setTransformerFactoryClass(Class transformerFactoryClass)
Specify the TransformerFactory class to use.


newTransformerFactory

protected TransformerFactory newTransformerFactory(Class transformerFactoryClass)
Instantiate a new TransformerFactory.

The default implementation simply calls TransformerFactory.newInstance(). If a "transformerFactoryClass" has been specified explicitly, the default constructor of the specified class will be called instead.

Can be overridden in subclasses.

Parameters:
transformerFactoryClass - the specified factory class (if any)
Returns:
the new TransactionFactory instance
See Also:
setTransformerFactoryClass(java.lang.Class), getTransformerFactory()

getTransformerFactory

protected TransformerFactory getTransformerFactory()
Returns the TransformerFactory.


createTransformer

protected final Transformer createTransformer()
                                       throws TransformerConfigurationException
Creates a new Transformer. Must be called per request, as transformers are not thread-safe.

Returns:
the created transformer
Throws:
TransformerConfigurationException - if thrown by JAXP methods

transform

protected final void transform(Source source,
                               Result result)
                        throws TransformerException
Transforms the given Source to the given Result. Creates a new Transformer for every call, as transformers are not thread-safe.

Parameters:
source - the source to transform from
result - the result to transform to
Throws:
TransformerException - if thrown by JAXP methods

Spring Web Services Framework

Copyright © 2005-2010 The Spring Web Services Framework. All Rights Reserved.