Package org.ametys.runtime.cocoon
Class ThreadSafeTraxProcessor
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.runtime.cocoon.ThreadSafeTraxProcessor
-
- All Implemented Interfaces:
URIResolver
,Disposable
,Initializable
,Component
,LogEnabled
,Parameterizable
,Serviceable
,XSLTProcessor
public class ThreadSafeTraxProcessor extends AbstractLogEnabled implements XSLTProcessor, Serviceable, Initializable, Disposable, Parameterizable, URIResolver
Adaptation of Excalibur's XSLTProcessor implementation to allow for better error reporting. This implementation is also threadsafe.
It also handles aTemplates
cache, for performance purpose.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ThreadSafeTraxProcessor.CacheValidity
The validity of the current stylesheet.static class
ThreadSafeTraxProcessor.ExtendedTransformerHandlerAndValidity
SpecialXSLTProcessor.TransformerHandlerAndValidity
with information about the cache state of the underlyingTemplates
.-
Nested classes/interfaces inherited from interface org.apache.excalibur.xml.xslt.XSLTProcessor
XSLTProcessor.TransformerHandlerAndValidity
-
-
Field Summary
-
Fields inherited from interface org.apache.excalibur.xml.xslt.XSLTProcessor
ROLE
-
-
Constructor Summary
Constructors Constructor Description ThreadSafeTraxProcessor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
DisposableTransformerHandler
getTransformerHandler(Source stylesheet)
TransformerHandler
getTransformerHandler(Source stylesheet, XMLFilter filter)
XSLTProcessor.TransformerHandlerAndValidity
getTransformerHandlerAndValidity(Source stylesheet)
XSLTProcessor.TransformerHandlerAndValidity
getTransformerHandlerAndValidity(Source stylesheet, XMLFilter filter)
void
initialize()
Initializevoid
parameterize(Parameters params)
Configure the componentSource
resolve(String href, String base)
Called by the processor when it encounters an xsl:include, xsl:import, or document() function.void
service(ServiceManager manager)
Compose.void
setTransformerFactory(String classname)
void
transform(Source source, Source stylesheet, Parameters params, Result result)
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Constructor Detail
-
ThreadSafeTraxProcessor
public ThreadSafeTraxProcessor()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
Compose. Try to get the store- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
initialize
public void initialize() throws Exception
Initialize- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
dispose
public void dispose()
Disposable- Specified by:
dispose
in interfaceDisposable
-
parameterize
public void parameterize(Parameters params) throws ParameterException
Configure the component- Specified by:
parameterize
in interfaceParameterizable
- Throws:
ParameterException
-
setTransformerFactory
public void setTransformerFactory(String classname)
- Specified by:
setTransformerFactory
in interfaceXSLTProcessor
-
getTransformerHandler
public TransformerHandler getTransformerHandler(Source stylesheet) throws XSLTProcessorException
- Specified by:
getTransformerHandler
in interfaceXSLTProcessor
- Throws:
XSLTProcessorException
-
getTransformerHandler
public TransformerHandler getTransformerHandler(Source stylesheet, XMLFilter filter) throws XSLTProcessorException
- Specified by:
getTransformerHandler
in interfaceXSLTProcessor
- Throws:
XSLTProcessorException
-
getTransformerHandlerAndValidity
public XSLTProcessor.TransformerHandlerAndValidity getTransformerHandlerAndValidity(Source stylesheet) throws XSLTProcessorException
- Specified by:
getTransformerHandlerAndValidity
in interfaceXSLTProcessor
- Throws:
XSLTProcessorException
-
getTransformerHandlerAndValidity
public XSLTProcessor.TransformerHandlerAndValidity getTransformerHandlerAndValidity(Source stylesheet, XMLFilter filter) throws XSLTProcessorException
- Specified by:
getTransformerHandlerAndValidity
in interfaceXSLTProcessor
- Throws:
XSLTProcessorException
-
transform
public void transform(Source source, Source stylesheet, Parameters params, Result result) throws XSLTProcessorException
- Specified by:
transform
in interfaceXSLTProcessor
- Throws:
XSLTProcessorException
-
resolve
public Source resolve(String href, String base) throws TransformerException
Called by the processor when it encounters an xsl:include, xsl:import, or document() function.- Specified by:
resolve
in interfaceURIResolver
- Parameters:
href
- An href attribute, which may be relative or absolute.base
- The base URI in effect when the href attribute was encountered.- Returns:
- A Source object, or null if the href cannot be resolved, and the processor should try to resolve the URI itself.
- Throws:
TransformerException
- if an error occurs when trying to resolve the URI.
-
-