public class ThreadSafeTraxProcessor extends AbstractLogEnabled implements XSLTProcessor, Serviceable, Initializable, Disposable, Parameterizable, URIResolver, Contextualizable
Templates
cache, for performance purpose.Modifier and Type | Class and Description |
---|---|
private class |
ThreadSafeTraxProcessor.CachedTemplates |
static class |
ThreadSafeTraxProcessor.CacheValidity
The validity of the current stylesheet.
|
static class |
ThreadSafeTraxProcessor.ExtendedTransformerHandlerAndValidity
Special
XSLTProcessor.TransformerHandlerAndValidity with information about the cache state of the underlying Templates . |
private static class |
ThreadSafeTraxProcessor.ResolvedURI |
private static class |
ThreadSafeTraxProcessor.UnresolvedURI |
XSLTProcessor.TransformerHandlerAndValidity
Modifier and Type | Field and Description |
---|---|
private static String |
__URI_CACHE_ATTR |
private Context |
_context |
private SAXTransformerFactory |
_factory
The trax TransformerFactory this component uses
|
private boolean |
_incrementalProcessing
Is incremental processing turned on? (default for Xalan: no)
|
private ServiceManager |
_manager
The ServiceManager
|
private SourceResolver |
_resolver
Resolver used to resolve XSLT document() calls, imports and includes
|
private Map<String,Collection<ThreadSafeTraxProcessor.CachedTemplates>> |
_templatesCache |
private String |
_transformerFactory
The configured transformer factory to use
|
private XMLizer |
_xmlizer |
ROLE
Constructor and Description |
---|
ThreadSafeTraxProcessor() |
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
private static final String __URI_CACHE_ATTR
private String _transformerFactory
private SAXTransformerFactory _factory
private boolean _incrementalProcessing
private SourceResolver _resolver
private ServiceManager _manager
private Map<String,Collection<ThreadSafeTraxProcessor.CachedTemplates>> _templatesCache
public ThreadSafeTraxProcessor()
public void contextualize(Context context) throws ContextException
contextualize
in interface Contextualizable
ContextException
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
public void initialize() throws Exception
initialize
in interface Initializable
Exception
public void dispose()
dispose
in interface Disposable
public void parameterize(Parameters params) throws ParameterException
parameterize
in interface Parameterizable
ParameterException
public void setTransformerFactory(String classname)
setTransformerFactory
in interface XSLTProcessor
public TransformerHandler getTransformerHandler(Source stylesheet) throws XSLTProcessorException
getTransformerHandler
in interface XSLTProcessor
XSLTProcessorException
public TransformerHandler getTransformerHandler(Source stylesheet, XMLFilter filter) throws XSLTProcessorException
getTransformerHandler
in interface XSLTProcessor
XSLTProcessorException
public XSLTProcessor.TransformerHandlerAndValidity getTransformerHandlerAndValidity(Source stylesheet) throws XSLTProcessorException
getTransformerHandlerAndValidity
in interface XSLTProcessor
XSLTProcessorException
public XSLTProcessor.TransformerHandlerAndValidity getTransformerHandlerAndValidity(Source stylesheet, XMLFilter filter) throws XSLTProcessorException
getTransformerHandlerAndValidity
in interface XSLTProcessor
XSLTProcessorException
private Pair<Templates,ThreadSafeTraxProcessor.CacheValidity> _getTemplates(Source stylesheet, XMLFilter filter) throws XSLTProcessorException, IOException
XSLTProcessorException
IOException
private Pair<ThreadSafeTraxProcessor.CachedTemplates,ThreadSafeTraxProcessor.CacheValidity> _getCachedTemplates(Collection<ThreadSafeTraxProcessor.CachedTemplates> cachedTemplates, Source stylesheet, Map<ThreadSafeTraxProcessor.UnresolvedURI,ThreadSafeTraxProcessor.ResolvedURI> resolutionCache) throws IOException
IOException
private Map<ThreadSafeTraxProcessor.UnresolvedURI,ThreadSafeTraxProcessor.ResolvedURI> _getResolutionCache()
private ThreadSafeTraxProcessor.CacheValidity _isValid(ThreadSafeTraxProcessor.CachedTemplates templates, Source stylesheet, Map<ThreadSafeTraxProcessor.UnresolvedURI,ThreadSafeTraxProcessor.ResolvedURI> resolutionCache) throws IOException
IOException
private Templates _createTemplates(SAXTransformerFactory factory, Source stylesheet, XMLFilter filter) throws XSLTProcessorException
XSLTProcessorException
private void _sourceToSAX(Source source, ContentHandler handler) throws SAXException, IOException, SourceException
SAXException
IOException
SourceException
public void transform(Source source, Source stylesheet, Parameters params, Result result) throws XSLTProcessorException
transform
in interface XSLTProcessor
XSLTProcessorException
private SAXTransformerFactory _createTransformerFactory(String factoryName)
factoryName
- The name of the factory class to createpublic Source resolve(String href, String base) throws TransformerException
resolve
in interface URIResolver
href
- An href attribute, which may be relative or absolute.base
- The base URI in effect when the href attribute was encountered.TransformerException
- if an error occurs when trying to resolve the URI.private Source _resolve(String href, String base) throws IOException
IOException
Source _resolve(String href, String base, Collection<String> rawURIs, Collection<String> baseURIs, Collection<Long> timestamps, Collection<String> resolvedURIs)
private InputSource _getInputSource(Source source) throws IOException, SourceException
InputSource
object that uses the InputStream
and the system ID of the Source
object.source
- The source concernedIOException
- if I/O error occurred.SourceException
- if an error occurred.