Re: How to configure TraxProcessor in 2.2?

2019-12-11 Thread Mark H. Wood
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.









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.




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,
 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!

-- 
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


signature.asc
Description: PGP signature


Re: How to configure TraxProcessor in 2.2?

2019-12-11 Thread gelo1234
Wow, you Haka-Smart guy :) No need for a Saxon commercial licence anymore
with Saxon-HE :)
That was what we missed with new Saxon-HE :) Thanks! Good Job!
With C3 (Cocoon 3.0) you can use Java-only code with no cocoon-sitemap
config dependency :)

Such a little thing and I get a big smile on my mouth :)
Man, you made my day!!!

Greetings,
Greg



śr., 11 gru 2019 o 14:59 Mark H. Wood  napisał(a):

> On Tue, Dec 10, 2019 at 11:21:09PM +0100, gelo1234 wrote:
> > I don't think this is the proper way to do this and if it's possible at
> > all. Extension functions are only available in commercial releases of
> Saxon
> > (PE and EE).
> > I'm afraid they are not available in open-source Saxon-HE. We were trying
> > to use Saxon-HE with Cocoon 3.0 and extension-functions without success.
> > You either have to use OLDER release of Saxon or pay for the license.
>
> No.  Before trying this in Cocoon, I wrote a tiny test application,
> and it succeeded in defining integrated extension functions.
>
> https://github.com/mwoodiupui/confman-demo
>
> What one cannot do in Saxon-HE is register integrated extension
> functions using a configuration file, as one can in -PE or -EE.  This
> is why I need to do configuration in Java.
>
> > wt., 10 gru 2019 o 21:19 Mark H. Wood  napisał(a):
> >
> > > On Tue, Dec 10, 2019 at 12:10:41AM +0100, gelo1234 wrote:
> > > > Mark,
> > > >
> > > > Why do you need a Custom XSLT Processor other than Saxon actually??
> Saxon
> > > > should do the right thing. Why wrapping it inside any "upper-level"
> > > > Transformer? It's getting kinda weird. You can always add a new Java
> > > class
> > > > to standard Cocoon Processors/Transformers.
> > >
> > > Because, as I said, I need to configure Saxon, and Saxon-HE can only
> > > be configured programmatically.  So, if I want to register an
> > > Integrated Extension Function, I have to gain access to the
> > > TransformerFactory being created somewhere in the bowels of Cocoon,
> > > get its Configuration, and call #registerExtensionFunction on that.
> > >
> > > To do this, I've created a class which extends TransformerFactoryImpl,
> > > added a @PostConstruct method (which Spring should call after
> > > instantiating the bean) to do the registration, and now I'm trying to
> > > tell Cocoon to use my factory instead of the one that
> > > javax.xml.transform.TransformerFactory will conjure up by default out
> > > of the service provider framework when Saxon is present.
> > >
> > > > https://mrhaki.blogspot.com/2008/09/use-saxon-in-cocoon-22.html
> > >
> > > I've seen that.  So far it hasn't helped.
> > >
> > > > Greetings,
> > > > Greg
> > > >
> > > >
> > > > pon., 9 gru 2019 o 23:02 Mark H. Wood  napisał(a):
> > > >
> > > > > On Thu, Dec 05, 2019 at 04:13:08PM +0100, Javier Puerto wrote:
> > > > > > I recommend you to use the Spring configuration. I never had this
> > > > > > requirement before but by the error message and the configuration
> > > > > fragment
> > > > > > that you have sent the NPE is caused because you are not passing
> an
> > > > > > instance of "org.dspace.saxon.ConfigurableTransformerFactory",
> you
> > > are
> > > > > > passing a String instead.
> > > > > >
> > > > > >  > > > > >
> > >  value='org.dspace.saxon.ConfigurableTransformerFactory'/>
> > > > > >
> > > > > > IIRC you should change it to:
> > > > > > 
> > > > > >   
> > > > > > 
> > > > > >
> > > > > > The attribute "value" is for literal values. You can also define
> the
> > > bean
> > > > > > with an ID and then use the attribute "ref" with the ID of the
> bean.
> > > > > > I hope that helps.
> > > > >
> > > > > It would have made more sense for this to take a bean reference,
> but
> > > > > the Javadoc for TraxProcessor says that setTransformerFactory()
> takes
> > > > > a String argument.  That seems to be correct:  when I change it to
> a
> > > > > reference, I get:
> > > > >
> > > > > 09-Dec-2019 15:12:39.128 SEVERE [localhost-startStop-24]
> > > > > org.apache.catalina.cor
> > > > > e.StandardContext.listenerStart Exception sending context
> initialized
> > > > > event to l
> > > > > istener instance of class
> > > > > [org.springframework.web.context.ContextLoaderListener
> > > > > ]
> > > > > org.springframework.beans.factory.BeanCreationException:
> Error
> > > > > creating
> > > > > bean with name 'org.apache.excalibur.xml.xslt.XSLTProcessor/saxon'
> > > defined
> > > > > in Se
> > > > > rvletContext resource [/WEB-INF/spring/applicationContext.xml]:
> > > > > Initialization o
> > > > > f bean failed; nested exception is
> > > > > org.springframework.beans.ConversionNotSuppor
> > > > > tedException: Failed to convert property value of type
> > > > > 'org.dspace.saxon.Configu
> > > > > rableTransformerFactory' to required type 'java.lang.String' for
> > > property
> > > > > 'trans
> > > > > formerFactory'; nested exception is
> java.lang.IllegalStateException:
> > > > > Cannot conv
> > > > > ert value of type
> 

Re: How to configure TraxProcessor in 2.2?

2019-12-11 Thread Mark H. Wood
On Tue, Dec 10, 2019 at 11:21:09PM +0100, gelo1234 wrote:
> I don't think this is the proper way to do this and if it's possible at
> all. Extension functions are only available in commercial releases of Saxon
> (PE and EE).
> I'm afraid they are not available in open-source Saxon-HE. We were trying
> to use Saxon-HE with Cocoon 3.0 and extension-functions without success.
> You either have to use OLDER release of Saxon or pay for the license.

No.  Before trying this in Cocoon, I wrote a tiny test application,
and it succeeded in defining integrated extension functions.

https://github.com/mwoodiupui/confman-demo

What one cannot do in Saxon-HE is register integrated extension
functions using a configuration file, as one can in -PE or -EE.  This
is why I need to do configuration in Java.

> wt., 10 gru 2019 o 21:19 Mark H. Wood  napisał(a):
> 
> > On Tue, Dec 10, 2019 at 12:10:41AM +0100, gelo1234 wrote:
> > > Mark,
> > >
> > > Why do you need a Custom XSLT Processor other than Saxon actually?? Saxon
> > > should do the right thing. Why wrapping it inside any "upper-level"
> > > Transformer? It's getting kinda weird. You can always add a new Java
> > class
> > > to standard Cocoon Processors/Transformers.
> >
> > Because, as I said, I need to configure Saxon, and Saxon-HE can only
> > be configured programmatically.  So, if I want to register an
> > Integrated Extension Function, I have to gain access to the
> > TransformerFactory being created somewhere in the bowels of Cocoon,
> > get its Configuration, and call #registerExtensionFunction on that.
> >
> > To do this, I've created a class which extends TransformerFactoryImpl,
> > added a @PostConstruct method (which Spring should call after
> > instantiating the bean) to do the registration, and now I'm trying to
> > tell Cocoon to use my factory instead of the one that
> > javax.xml.transform.TransformerFactory will conjure up by default out
> > of the service provider framework when Saxon is present.
> >
> > > https://mrhaki.blogspot.com/2008/09/use-saxon-in-cocoon-22.html
> >
> > I've seen that.  So far it hasn't helped.
> >
> > > Greetings,
> > > Greg
> > >
> > >
> > > pon., 9 gru 2019 o 23:02 Mark H. Wood  napisał(a):
> > >
> > > > On Thu, Dec 05, 2019 at 04:13:08PM +0100, Javier Puerto wrote:
> > > > > I recommend you to use the Spring configuration. I never had this
> > > > > requirement before but by the error message and the configuration
> > > > fragment
> > > > > that you have sent the NPE is caused because you are not passing an
> > > > > instance of "org.dspace.saxon.ConfigurableTransformerFactory", you
> > are
> > > > > passing a String instead.
> > > > >
> > > > >  > > > >
> >  value='org.dspace.saxon.ConfigurableTransformerFactory'/>
> > > > >
> > > > > IIRC you should change it to:
> > > > > 
> > > > >   
> > > > > 
> > > > >
> > > > > The attribute "value" is for literal values. You can also define the
> > bean
> > > > > with an ID and then use the attribute "ref" with the ID of the bean.
> > > > > I hope that helps.
> > > >
> > > > It would have made more sense for this to take a bean reference, but
> > > > the Javadoc for TraxProcessor says that setTransformerFactory() takes
> > > > a String argument.  That seems to be correct:  when I change it to a
> > > > reference, I get:
> > > >
> > > > 09-Dec-2019 15:12:39.128 SEVERE [localhost-startStop-24]
> > > > org.apache.catalina.cor
> > > > e.StandardContext.listenerStart Exception sending context initialized
> > > > event to l
> > > > istener instance of class
> > > > [org.springframework.web.context.ContextLoaderListener
> > > > ]
> > > > org.springframework.beans.factory.BeanCreationException: Error
> > > > creating
> > > > bean with name 'org.apache.excalibur.xml.xslt.XSLTProcessor/saxon'
> > defined
> > > > in Se
> > > > rvletContext resource [/WEB-INF/spring/applicationContext.xml]:
> > > > Initialization o
> > > > f bean failed; nested exception is
> > > > org.springframework.beans.ConversionNotSuppor
> > > > tedException: Failed to convert property value of type
> > > > 'org.dspace.saxon.Configu
> > > > rableTransformerFactory' to required type 'java.lang.String' for
> > property
> > > > 'trans
> > > > formerFactory'; nested exception is java.lang.IllegalStateException:
> > > > Cannot conv
> > > > ert value of type [org.dspace.saxon.ConfigurableTransformerFactory] to
> > > > required
> > > > type [java.lang.String] for property 'transformerFactory': no matching
> > > > editors o
> > > > r conversion strategy found
> > > >
> > > > When I change it back to the literal name of the class, the
> > > > webapp. starts normally.  But it still errors out when it tries to run
> > > > the XSLT transformer.
> > > >
> > > > It begins to look as though one can't really wire up TraxProcessor
> > > > using Spring.  (By this I mean:  using Spring's normal 
> > > >  etc.)  I'm guessing that it blows up because nothing has
> > > > called #parameterize(Parameters), because #parameterize() 

Re: How to configure TraxProcessor in 2.2?

2019-12-10 Thread gelo1234
Hi Mark,

I don't think this is the proper way to do this and if it's possible at
all. Extension functions are only available in commercial releases of Saxon
(PE and EE).
I'm afraid they are not available in open-source Saxon-HE. We were trying
to use Saxon-HE with Cocoon 3.0 and extension-functions without success.
You either have to use OLDER release of Saxon or pay for the license. I
know it's sad. I used to "such stupidites" since Oracle stopped releasing
free JDK :(
Hopefully we got OpenJDK.

Greetings,
Greg



wt., 10 gru 2019 o 21:19 Mark H. Wood  napisał(a):

> On Tue, Dec 10, 2019 at 12:10:41AM +0100, gelo1234 wrote:
> > Mark,
> >
> > Why do you need a Custom XSLT Processor other than Saxon actually?? Saxon
> > should do the right thing. Why wrapping it inside any "upper-level"
> > Transformer? It's getting kinda weird. You can always add a new Java
> class
> > to standard Cocoon Processors/Transformers.
>
> Because, as I said, I need to configure Saxon, and Saxon-HE can only
> be configured programmatically.  So, if I want to register an
> Integrated Extension Function, I have to gain access to the
> TransformerFactory being created somewhere in the bowels of Cocoon,
> get its Configuration, and call #registerExtensionFunction on that.
>
> To do this, I've created a class which extends TransformerFactoryImpl,
> added a @PostConstruct method (which Spring should call after
> instantiating the bean) to do the registration, and now I'm trying to
> tell Cocoon to use my factory instead of the one that
> javax.xml.transform.TransformerFactory will conjure up by default out
> of the service provider framework when Saxon is present.
>
> > https://mrhaki.blogspot.com/2008/09/use-saxon-in-cocoon-22.html
>
> I've seen that.  So far it hasn't helped.
>
> > Greetings,
> > Greg
> >
> >
> > pon., 9 gru 2019 o 23:02 Mark H. Wood  napisał(a):
> >
> > > On Thu, Dec 05, 2019 at 04:13:08PM +0100, Javier Puerto wrote:
> > > > I recommend you to use the Spring configuration. I never had this
> > > > requirement before but by the error message and the configuration
> > > fragment
> > > > that you have sent the NPE is caused because you are not passing an
> > > > instance of "org.dspace.saxon.ConfigurableTransformerFactory", you
> are
> > > > passing a String instead.
> > > >
> > > >  > > >
>  value='org.dspace.saxon.ConfigurableTransformerFactory'/>
> > > >
> > > > IIRC you should change it to:
> > > > 
> > > >   
> > > > 
> > > >
> > > > The attribute "value" is for literal values. You can also define the
> bean
> > > > with an ID and then use the attribute "ref" with the ID of the bean.
> > > > I hope that helps.
> > >
> > > It would have made more sense for this to take a bean reference, but
> > > the Javadoc for TraxProcessor says that setTransformerFactory() takes
> > > a String argument.  That seems to be correct:  when I change it to a
> > > reference, I get:
> > >
> > > 09-Dec-2019 15:12:39.128 SEVERE [localhost-startStop-24]
> > > org.apache.catalina.cor
> > > e.StandardContext.listenerStart Exception sending context initialized
> > > event to l
> > > istener instance of class
> > > [org.springframework.web.context.ContextLoaderListener
> > > ]
> > > org.springframework.beans.factory.BeanCreationException: Error
> > > creating
> > > bean with name 'org.apache.excalibur.xml.xslt.XSLTProcessor/saxon'
> defined
> > > in Se
> > > rvletContext resource [/WEB-INF/spring/applicationContext.xml]:
> > > Initialization o
> > > f bean failed; nested exception is
> > > org.springframework.beans.ConversionNotSuppor
> > > tedException: Failed to convert property value of type
> > > 'org.dspace.saxon.Configu
> > > rableTransformerFactory' to required type 'java.lang.String' for
> property
> > > 'trans
> > > formerFactory'; nested exception is java.lang.IllegalStateException:
> > > Cannot conv
> > > ert value of type [org.dspace.saxon.ConfigurableTransformerFactory] to
> > > required
> > > type [java.lang.String] for property 'transformerFactory': no matching
> > > editors o
> > > r conversion strategy found
> > >
> > > When I change it back to the literal name of the class, the
> > > webapp. starts normally.  But it still errors out when it tries to run
> > > the XSLT transformer.
> > >
> > > It begins to look as though one can't really wire up TraxProcessor
> > > using Spring.  (By this I mean:  using Spring's normal 
> > >  etc.)  I'm guessing that it blows up because nothing has
> > > called #parameterize(Parameters), because #parameterize() knows how
> > > the properties must be set up and makes sure they are all sensible,
> > > and thus something was left unset.
> > >
> > > I tried adding
> > >
> > >   log4j.logger.org.apache.excalibur = DEBUG
> > >   log4j.logger.org.apache.avalon = DEBUG
> > >
> > > to our logging config. but it made no useful difference in the
> > > output.  I cannot see what paths are actually being consulted for
> > > Cocoon component configuration, but it seems that none of the places
> 

Re: How to configure TraxProcessor in 2.2?

2019-12-10 Thread Mark H. Wood
On Tue, Dec 10, 2019 at 12:10:41AM +0100, gelo1234 wrote:
> Mark,
> 
> Why do you need a Custom XSLT Processor other than Saxon actually?? Saxon
> should do the right thing. Why wrapping it inside any "upper-level"
> Transformer? It's getting kinda weird. You can always add a new Java class
> to standard Cocoon Processors/Transformers.

Because, as I said, I need to configure Saxon, and Saxon-HE can only
be configured programmatically.  So, if I want to register an
Integrated Extension Function, I have to gain access to the
TransformerFactory being created somewhere in the bowels of Cocoon,
get its Configuration, and call #registerExtensionFunction on that.

To do this, I've created a class which extends TransformerFactoryImpl,
added a @PostConstruct method (which Spring should call after
instantiating the bean) to do the registration, and now I'm trying to
tell Cocoon to use my factory instead of the one that
javax.xml.transform.TransformerFactory will conjure up by default out
of the service provider framework when Saxon is present.

> https://mrhaki.blogspot.com/2008/09/use-saxon-in-cocoon-22.html

I've seen that.  So far it hasn't helped.

> Greetings,
> Greg
> 
> 
> pon., 9 gru 2019 o 23:02 Mark H. Wood  napisał(a):
> 
> > On Thu, Dec 05, 2019 at 04:13:08PM +0100, Javier Puerto wrote:
> > > I recommend you to use the Spring configuration. I never had this
> > > requirement before but by the error message and the configuration
> > fragment
> > > that you have sent the NPE is caused because you are not passing an
> > > instance of "org.dspace.saxon.ConfigurableTransformerFactory", you are
> > > passing a String instead.
> > >
> > >  > > value='org.dspace.saxon.ConfigurableTransformerFactory'/>
> > >
> > > IIRC you should change it to:
> > > 
> > >   
> > > 
> > >
> > > The attribute "value" is for literal values. You can also define the bean
> > > with an ID and then use the attribute "ref" with the ID of the bean.
> > > I hope that helps.
> >
> > It would have made more sense for this to take a bean reference, but
> > the Javadoc for TraxProcessor says that setTransformerFactory() takes
> > a String argument.  That seems to be correct:  when I change it to a
> > reference, I get:
> >
> > 09-Dec-2019 15:12:39.128 SEVERE [localhost-startStop-24]
> > org.apache.catalina.cor
> > e.StandardContext.listenerStart Exception sending context initialized
> > event to l
> > istener instance of class
> > [org.springframework.web.context.ContextLoaderListener
> > ]
> > org.springframework.beans.factory.BeanCreationException: Error
> > creating
> > bean with name 'org.apache.excalibur.xml.xslt.XSLTProcessor/saxon' defined
> > in Se
> > rvletContext resource [/WEB-INF/spring/applicationContext.xml]:
> > Initialization o
> > f bean failed; nested exception is
> > org.springframework.beans.ConversionNotSuppor
> > tedException: Failed to convert property value of type
> > 'org.dspace.saxon.Configu
> > rableTransformerFactory' to required type 'java.lang.String' for property
> > 'trans
> > formerFactory'; nested exception is java.lang.IllegalStateException:
> > Cannot conv
> > ert value of type [org.dspace.saxon.ConfigurableTransformerFactory] to
> > required
> > type [java.lang.String] for property 'transformerFactory': no matching
> > editors o
> > r conversion strategy found
> >
> > When I change it back to the literal name of the class, the
> > webapp. starts normally.  But it still errors out when it tries to run
> > the XSLT transformer.
> >
> > It begins to look as though one can't really wire up TraxProcessor
> > using Spring.  (By this I mean:  using Spring's normal 
> >  etc.)  I'm guessing that it blows up because nothing has
> > called #parameterize(Parameters), because #parameterize() knows how
> > the properties must be set up and makes sure they are all sensible,
> > and thus something was left unset.
> >
> > I tried adding
> >
> >   log4j.logger.org.apache.excalibur = DEBUG
> >   log4j.logger.org.apache.avalon = DEBUG
> >
> > to our logging config. but it made no useful difference in the
> > output.  I cannot see what paths are actually being consulted for
> > Cocoon component configuration, but it seems that none of the places
> > I've put my .xconf is one of them.
> >
> > > El mié., 4 dic. 2019 a las 22:46, Mark H. Wood ()
> > escribió:
> > >
> > > > I'm using Cocoon 2.2.  I need to pass a custom XSLT transformer
> > > > factory (that wraps Saxon's to configure it) to TraxProcessor, and the
> > > > advice I've found in several places around the Web doesn't seem to be
> > > > working:  my factory class never gets instantiated.
> > > >
> > > > I've got a file META-INF/cocoon/avalon/cocoon-core-saxon-xslt.xconf:
> > > >
> > > > 
> > > > 
> > > >> > > class="org.apache.cocoon.components.xslt.TraxProcessor">
> > > > 
> > > >  > > >
> > value="org.dspace.saxon.ConfigurableTransformerFactory"/>
> > > >   
> > > > 
> > > >
> > > > I also tried copying it to WEB-INF/cocoon 

Re: How to configure TraxProcessor in 2.2?

2019-12-09 Thread gelo1234
Mark,

Why do you need a Custom XSLT Processor other than Saxon actually?? Saxon
should do the right thing. Why wrapping it inside any "upper-level"
Transformer? It's getting kinda weird. You can always add a new Java class
to standard Cocoon Processors/Transformers.

https://mrhaki.blogspot.com/2008/09/use-saxon-in-cocoon-22.html

Greetings,
Greg


pon., 9 gru 2019 o 23:02 Mark H. Wood  napisał(a):

> On Thu, Dec 05, 2019 at 04:13:08PM +0100, Javier Puerto wrote:
> > I recommend you to use the Spring configuration. I never had this
> > requirement before but by the error message and the configuration
> fragment
> > that you have sent the NPE is caused because you are not passing an
> > instance of "org.dspace.saxon.ConfigurableTransformerFactory", you are
> > passing a String instead.
> >
> >  > value='org.dspace.saxon.ConfigurableTransformerFactory'/>
> >
> > IIRC you should change it to:
> > 
> >   
> > 
> >
> > The attribute "value" is for literal values. You can also define the bean
> > with an ID and then use the attribute "ref" with the ID of the bean.
> > I hope that helps.
>
> It would have made more sense for this to take a bean reference, but
> the Javadoc for TraxProcessor says that setTransformerFactory() takes
> a String argument.  That seems to be correct:  when I change it to a
> reference, I get:
>
> 09-Dec-2019 15:12:39.128 SEVERE [localhost-startStop-24]
> org.apache.catalina.cor
> e.StandardContext.listenerStart Exception sending context initialized
> event to l
> istener instance of class
> [org.springframework.web.context.ContextLoaderListener
> ]
> org.springframework.beans.factory.BeanCreationException: Error
> creating
> bean with name 'org.apache.excalibur.xml.xslt.XSLTProcessor/saxon' defined
> in Se
> rvletContext resource [/WEB-INF/spring/applicationContext.xml]:
> Initialization o
> f bean failed; nested exception is
> org.springframework.beans.ConversionNotSuppor
> tedException: Failed to convert property value of type
> 'org.dspace.saxon.Configu
> rableTransformerFactory' to required type 'java.lang.String' for property
> 'trans
> formerFactory'; nested exception is java.lang.IllegalStateException:
> Cannot conv
> ert value of type [org.dspace.saxon.ConfigurableTransformerFactory] to
> required
> type [java.lang.String] for property 'transformerFactory': no matching
> editors o
> r conversion strategy found
>
> When I change it back to the literal name of the class, the
> webapp. starts normally.  But it still errors out when it tries to run
> the XSLT transformer.
>
> It begins to look as though one can't really wire up TraxProcessor
> using Spring.  (By this I mean:  using Spring's normal 
>  etc.)  I'm guessing that it blows up because nothing has
> called #parameterize(Parameters), because #parameterize() knows how
> the properties must be set up and makes sure they are all sensible,
> and thus something was left unset.
>
> I tried adding
>
>   log4j.logger.org.apache.excalibur = DEBUG
>   log4j.logger.org.apache.avalon = DEBUG
>
> to our logging config. but it made no useful difference in the
> output.  I cannot see what paths are actually being consulted for
> Cocoon component configuration, but it seems that none of the places
> I've put my .xconf is one of them.
>
> > El mié., 4 dic. 2019 a las 22:46, Mark H. Wood ()
> escribió:
> >
> > > I'm using Cocoon 2.2.  I need to pass a custom XSLT transformer
> > > factory (that wraps Saxon's to configure it) to TraxProcessor, and the
> > > advice I've found in several places around the Web doesn't seem to be
> > > working:  my factory class never gets instantiated.
> > >
> > > I've got a file META-INF/cocoon/avalon/cocoon-core-saxon-xslt.xconf:
> > >
> > > 
> > > 
> > >> > class="org.apache.cocoon.components.xslt.TraxProcessor">
> > > 
> > >  > >
> value="org.dspace.saxon.ConfigurableTransformerFactory"/>
> > >   
> > > 
> > >
> > > I also tried copying it to WEB-INF/cocoon and it didnt' seem to work
> > > there either.
> > >
> > > I do have  and  in the Spring
> > > config.
> > >
> > > Is there some way to debug component configuration and see if the file
> > > is even being looked for (and where *is* configuration looking)?  The
> > > Cocoon site directs me to Excalibur, which directs me to Avalon, which
> > > says that Avalon is wound up and directs me back to Excalibur
> > >
> > >
> > >
> > > I've also tried to configure the thing using Spring:
> > >
> > >  > >   class='org.apache.cocoon.components.xslt.TraxProcessor'
> > >   init-method='initialize'
> > >   destroy-method='dispose'>
> > >   
> > >> >
>  value='org.dspace.saxon.ConfigurableTransformerFactory'/>
> > > 
> > >
> > > but so far I'm missing something:  TraxProcessor.sourceToSAX throws an
> > > NPE.  I'm probably not setting the parameters correctly -- there isn't
> > > a setter for use-store at all, for example.
> > >
> > > I've found any number of pages that tell me 

Re: How to configure TraxProcessor in 2.2?

2019-12-09 Thread Mark H. Wood
On Thu, Dec 05, 2019 at 04:13:08PM +0100, Javier Puerto wrote:
> I recommend you to use the Spring configuration. I never had this
> requirement before but by the error message and the configuration fragment
> that you have sent the NPE is caused because you are not passing an
> instance of "org.dspace.saxon.ConfigurableTransformerFactory", you are
> passing a String instead.
> 
>  value='org.dspace.saxon.ConfigurableTransformerFactory'/>
> 
> IIRC you should change it to:
> 
>   
> 
> 
> The attribute "value" is for literal values. You can also define the bean
> with an ID and then use the attribute "ref" with the ID of the bean.
> I hope that helps.

It would have made more sense for this to take a bean reference, but
the Javadoc for TraxProcessor says that setTransformerFactory() takes
a String argument.  That seems to be correct:  when I change it to a
reference, I get:

09-Dec-2019 15:12:39.128 SEVERE [localhost-startStop-24] org.apache.catalina.cor
e.StandardContext.listenerStart Exception sending context initialized event to l
istener instance of class [org.springframework.web.context.ContextLoaderListener
]
org.springframework.beans.factory.BeanCreationException: Error creating 
bean with name 'org.apache.excalibur.xml.xslt.XSLTProcessor/saxon' defined in Se
rvletContext resource [/WEB-INF/spring/applicationContext.xml]: Initialization o
f bean failed; nested exception is org.springframework.beans.ConversionNotSuppor
tedException: Failed to convert property value of type 'org.dspace.saxon.Configu
rableTransformerFactory' to required type 'java.lang.String' for property 'trans
formerFactory'; nested exception is java.lang.IllegalStateException: Cannot conv
ert value of type [org.dspace.saxon.ConfigurableTransformerFactory] to required 
type [java.lang.String] for property 'transformerFactory': no matching editors o
r conversion strategy found

When I change it back to the literal name of the class, the
webapp. starts normally.  But it still errors out when it tries to run
the XSLT transformer.

It begins to look as though one can't really wire up TraxProcessor
using Spring.  (By this I mean:  using Spring's normal 
 etc.)  I'm guessing that it blows up because nothing has
called #parameterize(Parameters), because #parameterize() knows how
the properties must be set up and makes sure they are all sensible,
and thus something was left unset.

I tried adding

  log4j.logger.org.apache.excalibur = DEBUG
  log4j.logger.org.apache.avalon = DEBUG

to our logging config. but it made no useful difference in the
output.  I cannot see what paths are actually being consulted for
Cocoon component configuration, but it seems that none of the places
I've put my .xconf is one of them.

> El mié., 4 dic. 2019 a las 22:46, Mark H. Wood () escribió:
> 
> > I'm using Cocoon 2.2.  I need to pass a custom XSLT transformer
> > factory (that wraps Saxon's to configure it) to TraxProcessor, and the
> > advice I've found in several places around the Web doesn't seem to be
> > working:  my factory class never gets instantiated.
> >
> > I've got a file META-INF/cocoon/avalon/cocoon-core-saxon-xslt.xconf:
> >
> > 
> > 
> >> class="org.apache.cocoon.components.xslt.TraxProcessor">
> > 
> >  >value="org.dspace.saxon.ConfigurableTransformerFactory"/>
> >   
> > 
> >
> > I also tried copying it to WEB-INF/cocoon and it didnt' seem to work
> > there either.
> >
> > I do have  and  in the Spring
> > config.
> >
> > Is there some way to debug component configuration and see if the file
> > is even being looked for (and where *is* configuration looking)?  The
> > Cocoon site directs me to Excalibur, which directs me to Avalon, which
> > says that Avalon is wound up and directs me back to Excalibur
> >
> >
> >
> > I've also tried to configure the thing using Spring:
> >
> >  >   class='org.apache.cocoon.components.xslt.TraxProcessor'
> >   init-method='initialize'
> >   destroy-method='dispose'>
> >   
> >> value='org.dspace.saxon.ConfigurableTransformerFactory'/>
> > 
> >
> > but so far I'm missing something:  TraxProcessor.sourceToSAX throws an
> > NPE.  I'm probably not setting the parameters correctly -- there isn't
> > a setter for use-store at all, for example.
> >
> > I've found any number of pages that tell me Avalon configuration is
> > being replaced by Spring, but nothing practical on how to convert
> > Avalon configuration (such as the first sample above) to Spring, or
> > even how to write fresh Spring configuration for Cocoon components.
> > It would be nice to know how to do this even if I wind up using the
> > Avalon approach with the present task.
> >
> > --
> > 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
> >

-- 
Mark H. Wood

Re: How to configure TraxProcessor in 2.2?

2019-12-06 Thread gelo1234
Hi Mark,

Also make sure, you have that class:
org.dspace.saxon.ConfigurableTransformerFactory available on the CLASSPATH
(-> WEB-INF/lib/*.jar)
And a proper version/config for Saxon HE. Here is the guide:
https://stackoverflow.com/questions/22483436/using-saxon9-for-xslt-with-apache-cocoon-2-2

Greetings,
Greg


czw., 5 gru 2019 o 16:13 Javier Puerto  napisał(a):

> Hi Mark,
>
> I recommend you to use the Spring configuration. I never had this
> requirement before but by the error message and the configuration fragment
> that you have sent the NPE is caused because you are not passing an
> instance of "org.dspace.saxon.ConfigurableTransformerFactory", you are
> passing a String instead.
>
>  value='org.dspace.saxon.ConfigurableTransformerFactory'/>
>
> IIRC you should change it to:
> 
>   
> 
>
> The attribute "value" is for literal values. You can also define the bean
> with an ID and then use the attribute "ref" with the ID of the bean.
> I hope that helps.
>
> Salu2.
>
> El mié., 4 dic. 2019 a las 22:46, Mark H. Wood ()
> escribió:
>
>> I'm using Cocoon 2.2.  I need to pass a custom XSLT transformer
>> factory (that wraps Saxon's to configure it) to TraxProcessor, and the
>> advice I've found in several places around the Web doesn't seem to be
>> working:  my factory class never gets instantiated.
>>
>> I've got a file META-INF/cocoon/avalon/cocoon-core-saxon-xslt.xconf:
>>
>> 
>> 
>>   > class="org.apache.cocoon.components.xslt.TraxProcessor">
>> 
>> >value="org.dspace.saxon.ConfigurableTransformerFactory"/>
>>   
>> 
>>
>> I also tried copying it to WEB-INF/cocoon and it didnt' seem to work
>> there either.
>>
>> I do have  and  in the Spring
>> config.
>>
>> Is there some way to debug component configuration and see if the file
>> is even being looked for (and where *is* configuration looking)?  The
>> Cocoon site directs me to Excalibur, which directs me to Avalon, which
>> says that Avalon is wound up and directs me back to Excalibur
>>
>>
>>
>> I've also tried to configure the thing using Spring:
>>
>> >   class='org.apache.cocoon.components.xslt.TraxProcessor'
>>   init-method='initialize'
>>   destroy-method='dispose'>
>>   
>>   > value='org.dspace.saxon.ConfigurableTransformerFactory'/>
>> 
>>
>> but so far I'm missing something:  TraxProcessor.sourceToSAX throws an
>> NPE.  I'm probably not setting the parameters correctly -- there isn't
>> a setter for use-store at all, for example.
>>
>> I've found any number of pages that tell me Avalon configuration is
>> being replaced by Spring, but nothing practical on how to convert
>> Avalon configuration (such as the first sample above) to Spring, or
>> even how to write fresh Spring configuration for Cocoon components.
>> It would be nice to know how to do this even if I wind up using the
>> Avalon approach with the present task.
>>
>> --
>> 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
>>
>


Re: How to configure TraxProcessor in 2.2?

2019-12-05 Thread Javier Puerto
Hi Mark,

I recommend you to use the Spring configuration. I never had this
requirement before but by the error message and the configuration fragment
that you have sent the NPE is caused because you are not passing an
instance of "org.dspace.saxon.ConfigurableTransformerFactory", you are
passing a String instead.



IIRC you should change it to:

  


The attribute "value" is for literal values. You can also define the bean
with an ID and then use the attribute "ref" with the ID of the bean.
I hope that helps.

Salu2.

El mié., 4 dic. 2019 a las 22:46, Mark H. Wood () escribió:

> I'm using Cocoon 2.2.  I need to pass a custom XSLT transformer
> factory (that wraps Saxon's to configure it) to TraxProcessor, and the
> advice I've found in several places around the Web doesn't seem to be
> working:  my factory class never gets instantiated.
>
> I've got a file META-INF/cocoon/avalon/cocoon-core-saxon-xslt.xconf:
>
> 
> 
>class="org.apache.cocoon.components.xslt.TraxProcessor">
> 
> value="org.dspace.saxon.ConfigurableTransformerFactory"/>
>   
> 
>
> I also tried copying it to WEB-INF/cocoon and it didnt' seem to work
> there either.
>
> I do have  and  in the Spring
> config.
>
> Is there some way to debug component configuration and see if the file
> is even being looked for (and where *is* configuration looking)?  The
> Cocoon site directs me to Excalibur, which directs me to Avalon, which
> says that Avalon is wound up and directs me back to Excalibur
>
>
>
> I've also tried to configure the thing using Spring:
>
>class='org.apache.cocoon.components.xslt.TraxProcessor'
>   init-method='initialize'
>   destroy-method='dispose'>
>   
>value='org.dspace.saxon.ConfigurableTransformerFactory'/>
> 
>
> but so far I'm missing something:  TraxProcessor.sourceToSAX throws an
> NPE.  I'm probably not setting the parameters correctly -- there isn't
> a setter for use-store at all, for example.
>
> I've found any number of pages that tell me Avalon configuration is
> being replaced by Spring, but nothing practical on how to convert
> Avalon configuration (such as the first sample above) to Spring, or
> even how to write fresh Spring configuration for Cocoon components.
> It would be nice to know how to do this even if I wind up using the
> Avalon approach with the present task.
>
> --
> 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
>


Re: How to configure TraxProcessor in 2.2?

2019-12-04 Thread warrell harries
Hi Mark,

I never could get 2.2 working 

However, I'm using 2.12 every day, all over the world - mostly with Saxon
for XSLT 2.0

All I can advise, use 2.12...

Best regards

Warrell





On Wed, 4 Dec 2019, 9:46 pm Mark H. Wood,  wrote:

> I'm using Cocoon 2.2.  I need to pass a custom XSLT transformer
> factory (that wraps Saxon's to configure it) to TraxProcessor, and the
> advice I've found in several places around the Web doesn't seem to be
> working:  my factory class never gets instantiated.
>
> I've got a file META-INF/cocoon/avalon/cocoon-core-saxon-xslt.xconf:
>
> 
> 
>class="org.apache.cocoon.components.xslt.TraxProcessor">
> 
> value="org.dspace.saxon.ConfigurableTransformerFactory"/>
>   
> 
>
> I also tried copying it to WEB-INF/cocoon and it didnt' seem to work
> there either.
>
> I do have  and  in the Spring
> config.
>
> Is there some way to debug component configuration and see if the file
> is even being looked for (and where *is* configuration looking)?  The
> Cocoon site directs me to Excalibur, which directs me to Avalon, which
> says that Avalon is wound up and directs me back to Excalibur
>
>
>
> I've also tried to configure the thing using Spring:
>
>class='org.apache.cocoon.components.xslt.TraxProcessor'
>   init-method='initialize'
>   destroy-method='dispose'>
>   
>value='org.dspace.saxon.ConfigurableTransformerFactory'/>
> 
>
> but so far I'm missing something:  TraxProcessor.sourceToSAX throws an
> NPE.  I'm probably not setting the parameters correctly -- there isn't
> a setter for use-store at all, for example.
>
> I've found any number of pages that tell me Avalon configuration is
> being replaced by Spring, but nothing practical on how to convert
> Avalon configuration (such as the first sample above) to Spring, or
> even how to write fresh Spring configuration for Cocoon components.
> It would be nice to know how to do this even if I wind up using the
> Avalon approach with the present task.
>
> --
> 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
>