[PATCH] XQueryGenerator (request+flow parameters)

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] XQueryGenerator (request+flow parameters)

BURGHARD Éric
Hi,

I've made a patch that add 2 new parameters to the Generator
 * "use-request-parameters" shared among several generator/transformers in
cocoon and self-explaining. That way your scripts can use request
parameters without the request extension (and remain pure XQuery),
 * "use-flow-parameters" which add parameters from flow context to xquery
context. For example :
   * cocoon.sendPage('xquery/script.xq', {dom: document}) adds $dom to
xquery context
   * cocoon.sendPage('xquery/script.xq', document) adds $flowObject to
xquery context

I've made some cleanups:
 * no needs for parametrize since you have configurable and setup is given
all sitemap parameters,
 * rename optionalParameters to xqueryParameters (to emphasize the
difference between component and script parameters),
 * the cache key is made with all parameters (and not only
optionalParameters).

There's only a small difference (backward compatible)
 * the source validity is always check because IMHO it's not an option: if
you change modify the script the generator must not send an old result back
(really annoying for new users i guess). cache-validity must be deprecated
because you can already achieve the same thing with the expires pipeline
caching policy in your sitemap (<map:pipeline
type="expires">...</map:pipeline>).

It adds a rhino depency.

Regards.

XQueryGenerator.java.patch (8K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] XQueryGenerator (request+flow parameters)

BURGHARD Éric
I must apologize for the noise.

This patch was not enough tested. There's an important caching issue. Will
correct, full-test and resubmit.

Regards




-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] XQueryGenerator (request+flow parameters)

BURGHARD Éric
> I must apologize for the noise.
>
> This patch was not enough tested. There's an important caching issue. Will
> correct, full-test and resubmit.
>
This one should work better.

Just use <map:parameter name="use-request-parameters" value="true"/> if you
don't want to have some caching issues with request parameters.

Regards.

XQueryGenerator.java.patch (8K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] XQueryGenerator (request+flow parameters)

Jean-Baptiste Quenot-2
In reply to this post by BURGHARD Éric
* BURGHARD Éric:

> cache-validity    must   be    deprecated   because    you   can
> already   achieve    the   same    thing   with    the   expires
> pipeline   caching  policy   in   your  sitemap   (<map:pipeline
> type="expires">...</map:pipeline>).

AFAICT  the  ExpiresCachingProcessingPipeline  can have  only  one
value of  "cache-expires" for  the whole  sitemap.  The  idea with
"cache-validity" of  XQueryGenerator is  to be  able to  specify a
different value for every pipeline.
--
Jean-Baptiste Quenot
Systèmes d'Information
ANYWARE TECHNOLOGIES
Tel : +33 (0)5 61 00 52 90
Fax : +33 (0)5 61 00 51 46
http://www.anyware-tech.com/


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] XQueryGenerator (request+flow parameters)

BURGHARD Éric
Jean-Baptiste Quenot wrote:

>> cache-validity    must   be    deprecated   because    you   can
>> already   achieve    the   same    thing   with    the   expires
>> pipeline   caching  policy   in   your  sitemap   (<map:pipeline
>> type="expires">...</map:pipeline>).
>
> AFAICT  the  ExpiresCachingProcessingPipeline  can have  only  one
> value of  "cache-expires" for  the whole  sitemap.  The  idea with
> "cache-validity" of  XQueryGenerator is  to be  able to  specify a
> different value for every pipeline.

But can't you have as many ExpiresCachingProcessingPipeline as you want ?

I could write for example

<map:pipe name="expires180"
src="org.apache.cocoon.components.pipeline.impl.ExpiresCachingProcessingPipeline">
        <parameter name="cache-expires" value="180"/> <!-- Expires in secondes -->
</map:pipe>
<map:pipe name="expires60"
src="org.apache.cocoon.components.pipeline.impl.ExpiresCachingProcessingPipeline">
        <parameter name="cache-expires" value="60"/> <!-- Expires in secondes -->
</map:pipe>

And just use these 2 differents pipe types

<map:pipelines>
  <map:pipeline type="expires180">
    <map:match "xquery/..."/>
       ....
    </map:match>
  </map:pipeline>
  <map:pipeline type="expires60">
    <map:match "xquery/..."/>
       ....
    </map:match>
  </map:pipeline>
</map:pipelines>

It's better IMHO as it factorize common behaviors among pipeline

WDYT ?




-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] XQueryGenerator (request+flow parameters)

Jean-Baptiste Quenot-2
In reply to this post by BURGHARD Éric
* Éric BURGHARD:

> > AFAICT  the  ExpiresCachingProcessingPipeline  can have  only  one
> > value of  "cache-expires" for  the whole  sitemap.  The  idea with
> > "cache-validity" of  XQueryGenerator is  to be  able to  specify a
> > different value for every pipeline.
>
> But can't you have as many ExpiresCachingProcessingPipeline as you want ?
>
> I could write for example
>
> <map:pipe name="expires180"
> src="org.apache.cocoon.components.pipeline.impl.ExpiresCachingProcessingPipeline">
>         <parameter name="cache-expires" value="180"/> <!-- Expires in secondes
> -->
> </map:pipe>
> <map:pipe name="expires60"
> src="org.apache.cocoon.components.pipeline.impl.ExpiresCachingProcessingPipeline">
>         <parameter name="cache-expires" value="60"/> <!-- Expires in secondes
> -->
> </map:pipe>
>
> And just use these 2 differents pipe types
>
> <map:pipelines>
>   <map:pipeline type="expires180">
>     <map:match "xquery/..."/>
>        ....
>     </map:match>
>   </map:pipeline>
>   <map:pipeline type="expires60">
>     <map:match "xquery/..."/>
>        ....
>     </map:match>
>   </map:pipeline>
> </map:pipelines>
>
> It's better IMHO as it factorize common behaviors among pipeline

OK you are right, but the difference is that the validity of the
XQuery file is not taken into account: when the XQuery is
modified, the cache is still valid, whereas
XQueryGenerator.getValidity() also takes into account the last
modification of the XQuery.
--
Jean-Baptiste Quenot
Systèmes d'Information
ANYWARE TECHNOLOGIES
Tel : +33 (0)5 61 00 52 90
Fax : +33 (0)5 61 00 51 46
http://www.anyware-tech.com/


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] XQueryGenerator (request+flow parameters)

BURGHARD Éric
>
> OK you are right, but the difference is that the validity of the
> XQuery file is not taken into account: when the XQuery is
> modified, the cache is still valid, whereas
> XQueryGenerator.getValidity() also takes into account the last
> modification of the XQuery.

Exactly that's the problem and that what i changed in the patch.

For cocoon user used to play with cache validity, a time counter on a pipe
means "keep the thing in cache during x amount of s, whatever the event".
So it's normal if you setup such a pipe, that you get an old result even
when after modifying the source if you do it during the time range.

Here it's annoying to setup nothing and to get an old result even after
modifying the source. It's even more annoying to setup a 180 counter and to
see that the result change when the script change. And with this quite
weird managment there's a little drawback: there's no way to say "keep the
thing in cache as long as the source is valid", because the source will
always be invalidated after the end of the counter.

WDYT.

Regards.




-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open