Re: How to configure TraxProcessor in 2.2?
"Mark H. Wood" <[email protected]> Wed, 11 Dec 2019 16:25:29 -0500
| Newsgroups | gmane.text.xml.cocoon.user |
|---|---|
| Message-ID | <[email protected]> |
--nFreZHaLTZJo0R7j
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
After enumerating all the ways that don't work, I think I have this
figured out.
(I'm trying to wrap Saxon's TransformerFactoryImpl so that I can
configure it with our own Java function implementations as Saxon
Integrated Extension Function classes.)
XSLTProcessor *must* be defined Avalon-style. I couldn't find a way
to get it properly initialized using Spring XML configuration.
<?xml version=3D"1.0" encoding=3D"UTF-8"?>
<components>
<component role=3D"org.apache.excalibur.xml.xslt.XSLTProcessor/saxon"
class=3D"org.apache.cocoon.components.xslt.TraxProcessor">
<parameter name=3D"use-store" value=3D"true"/>
<parameter name=3D"transformer-factory"
value=3D"org.dspace.saxon.ConfigurableTransformerFactory=
"/>
</component>
</components>
I define the bean in Spring XML, since I like that better. The bean
definition may not be needed at all -- couldn't find detailed
documentation for Avalon/Excalibur configuration. I put it in
prototype scope because I couldn't find anything to say whether the
Saxon class I'm extending has per-instance state.
<!-- Configure a Saxon-based transformer factory for Cocoon.
This will be injected Avalon-style since nothing else works. -->
<bean class=3D'org.dspace.saxon.ConfigurableTransformerFactory'
scope=3D'prototype'/>
I could find no way to use Avalon-style configuration to inject a
list/set/array as a parameter. Cocoon's Avalon bridge seems to
prevent any kind of Spring DI taking place, despite (I am told) using
Spring internally -- @PostConstruct didn't work, @Inject didn't work,
<constructor-argument> didn't work (by making my class invisible to
the bridge). So I added a list-valued property to our own
application's configuration file, composed of class names, and
instantiate them in the wrapper's constructor.
I found it helpful to enable DEBUG logging for the packages
org.apache.cocoon.spring.configurator
and
org.apache.cocoon.core.container.spring.avalon.
At last I see Saxon successfully calling my functions when referenced by
transforms fed to the Cocoon XSLT transformer!
--=20
Mark H. Wood
Lead Technology Analyst
University Library
Indiana University - Purdue University Indianapolis
755 W. Michigan Street
Indianapolis, IN 46202
317-274-0749
www.ulib.iupui.edu
--nFreZHaLTZJo0R7j
Content-Type: application/pgp-signature; name="signature.asc"
-----BEGIN PGP SIGNATURE-----
iF0EABEIAB0WIQQuzJQcdfZrSe3FFBWz81Hgm5MobwUCXfFeyQAKCRCz81Hgm5Mo
b1XNAJ9D8beXnXWd1yZkrXH3OQ912zgGbQCgmVXYBxwZRic33GwVyeWxGDxxacw=
=H7jj
-----END PGP SIGNATURE-----
--nFreZHaLTZJo0R7j--