You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jörn Nettingsmeier <ne...@apache.org> on 2006/10/19 10:05:50 UTC

flowscript caching and evaluation question

hi !



the lenya cms provides a usecase framework with a generic flowscript 
that allows users to create their own usecases and views easily without 
touching javascript *if* their flow needs are very simple.

to allow for more flexibility, i would like to add a way for users to 
add their own flow code to their usecases.

it is supposed to work like this:

the generic usecase handler checks if the user provided a custom 
flowscript uri with the usecase configuration (usecases are Configurable 
avalon components), which implements the functions "customLoopFlow" and 
"customSubmitFlow" the former is used while the usecase is "looping", 
i.e. not yet submitted or cancelled, and the latter is invoked when user 
finally submits or cancels.

it then uses cocoon.load(customUri) to load the custom code.

the question is:
will the flowscript always be re-evaluated? the sitemap just says 
"<map:flow src="genericUsecaseHandler.js"/>, so cocoon might well think 
it can cache and/or even precompile the flowscript once and re-use it. 
(my tests suggest that this is indeed the case.)

the reason i'm using cocoon.load rather than parsing the customUri file 
myself and create the custom functions with "new Function() {}" (which 
would be guaranteed to be re-evaluated each time) is that those 
on-the-fly function objects are a nightmare to debug because you do not 
get line numbers in case of an error.

how can i solve this? any hints or pointers to flowscript 
caching/compiling/evaluation docs (even code) are appreciated.

regards,

jörn


-- 
Jörn Nettingsmeier

"Hofstadter's Law: It always takes longer than you expect,
even when you take into account Hofstadter's Law."
	- Douglas R. Hofstadter

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: flowscript caching and evaluation question

Posted by Geert Josten <ge...@daidalos.nl>.
> iiuc, i can configure it to check the flowscript for 
> modification each time (at a performance penalty). but how 
> does cocoon determine "modification"? if it only looks at the 
> file timestamp, i still have problems, because i have the 
> parameterised "cocoon.load" call in there - which means that 
> the cache is only valid if the flowscript *and* all 
> cocoon.load()ed resources are unchanged.

Yes, setting reload to true makes Cocoon check file stamp, though with a
delay of xxx milliseconds if you specify a number (one of the other
parameters). Dynamically loading code might not work as expected, though
if you put the cocoon.load() *inside* a function, it might work
afterall.

> are there docs on cocoon.load()?

Really dunno. Ask on cocoon-dev or try reading the code.. :-P

> > I also know
> > that there is something special about continuations. It's a weird 
> > situation if you request a continuation, but your script has been 
> > changed in the meantime. I believe continuations are 
> invalidated for 
> > that reason if something like that occurs.
> 
> eek. looks like i have to ditch my current approach with 
> cocoon.load() and use dynamically generated function objects then.

Not sure, but make sure to test thoroughly! :-)

Kind regards,
Geert
   
 
Drs. G.P.H. Josten
Consultant
 
 

Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665  JZ  Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
www.daidalos.nl
KvK 27164984


De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: flowscript caching and evaluation question

Posted by Joern Nettingsmeier <ne...@folkwang-hochschule.de>.
thanks for your reply, geert!

Geert Josten wrote:
> Hi Jörn,
> 
> I do not really know that much about FlowScript, but I have been
> wondering about caching and reloading of flowscripts as well. I do
> know that there is an entry in cocoon.xconf to configer the js
> interpreter, look for 'flow-interpreter' and you'll find. 

iiuc, i can configure it to check the flowscript for modification each 
time (at a performance penalty). but how does cocoon determine 
"modification"? if it only looks at the file timestamp, i still have 
problems, because i have the parameterised "cocoon.load" call in there - 
which means that the cache is only valid if the flowscript *and* all 
cocoon.load()ed resources are unchanged.

are there docs on cocoon.load()?

> I also know
> that there is something special about continuations. It's a weird
> situation if you request a continuation, but your script has been
> changed in the meantime. I believe continuations are invalidated for
> that reason if something like that occurs.

eek. looks like i have to ditch my current approach with cocoon.load() 
and use dynamically generated function objects then.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: flowscript caching and evaluation question

Posted by Geert Josten <ge...@daidalos.nl>.
Hi Jörn,

I do not really know that much about FlowScript, but I have been wondering about caching and reloading of flowscripts as well. I do know that there is an entry in cocoon.xconf to configer the js interpreter, look for 'flow-interpreter' and you'll find. I also know that there is something special about continuations. It's a weird situation if you request a continuation, but your script has been changed in the meantime. I believe continuations are invalidated for that reason if something like that occurs.

Kind regards,
Geert 

> 
   
 
Drs. G.P.H. Josten
Consultant
 
 

Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665  JZ  Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
www.daidalos.nl
KvK 27164984


De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend.
 

> Van: Jörn Nettingsmeier [mailto:nettings@apache.org] 
> Verzonden: donderdag 19 oktober 2006 10:06
> Aan: users@cocoon.apache.org
> Onderwerp: flowscript caching and evaluation question
> 
> hi !
> 
> 
> 
> the lenya cms provides a usecase framework with a generic 
> flowscript that allows users to create their own usecases and 
> views easily without touching javascript *if* their flow 
> needs are very simple.
> 
> to allow for more flexibility, i would like to add a way for 
> users to add their own flow code to their usecases.
> 
> it is supposed to work like this:
> 
> the generic usecase handler checks if the user provided a 
> custom flowscript uri with the usecase configuration 
> (usecases are Configurable avalon components), which 
> implements the functions "customLoopFlow" and 
> "customSubmitFlow" the former is used while the usecase is 
> "looping", i.e. not yet submitted or cancelled, and the 
> latter is invoked when user finally submits or cancels.
> 
> it then uses cocoon.load(customUri) to load the custom code.
> 
> the question is:
> will the flowscript always be re-evaluated? the sitemap just 
> says "<map:flow src="genericUsecaseHandler.js"/>, so cocoon 
> might well think it can cache and/or even precompile the 
> flowscript once and re-use it. 
> (my tests suggest that this is indeed the case.)
> 
> the reason i'm using cocoon.load rather than parsing the 
> customUri file myself and create the custom functions with 
> "new Function() {}" (which would be guaranteed to be 
> re-evaluated each time) is that those on-the-fly function 
> objects are a nightmare to debug because you do not get line 
> numbers in case of an error.
> 
> how can i solve this? any hints or pointers to flowscript 
> caching/compiling/evaluation docs (even code) are appreciated.
> 
> regards,
> 
> jörn
> 
> 
> --
> Jörn Nettingsmeier
> 
> "Hofstadter's Law: It always takes longer than you expect, 
> even when you take into account Hofstadter's Law."
> 	- Douglas R. Hofstadter
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org