You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Jakob Praher <jp...@yahoo.de> on 2003/02/11 10:58:39 UTC

processing (lifecycle) events

hi all,

it would be somehow great, to get notified, when Cocoon.process, starts
and finishes its work.

I need to acquire resources for a processing phase and then would like
to automatically release it at processing end.

Is there a clean way to do this now (having looked at the sources, I
haven't found something, but maybe I overlooked it ... )

I could imagine doing it using a fake action or other sitemap component
(that implements dispoable), that will loaded on every processing phase,
but it is a little bit dirty ... .

doing it like the 2.3 servlet listeners, would be a cleaner way:

<map:listener event="processing" src="...." /> 

thanks for your help

-- Jakob


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


RE: processing (lifecycle) events

Posted by Carsten Ziegeler <cz...@s-und-n.de>.

> -----Original Message-----
> From: Sylvain Wallez [mailto:sylvain.wallez@anyware-tech.com]
> Sent: Thursday, February 13, 2003 6:37 PM
> To: cocoon-dev@xml.apache.org
> Subject: Re: processing (lifecycle) events
>
>
> Carsten Ziegeler wrote:
>
> >Hi Jakob,
> >
> >I think this is a great idea, (because) I need it in several areas
> >as well. Could you expand a little bit more on how to configure
> >the listeners and what their interface should/could look like.
> >This might then help to convince others that listeners are usefull
> >in some scenarios.
> >
> >
>
> Same here. In our in-house product, we have extended
> CocoonServlet.service() for this. But it's a real hack and I
> don't like it.
>
> Listeners would be good as there are several states in the sitemap
> execution where being notified makes sense :
> - start of pipeline construction (for this an action could be fine)
> - pipeline setup
> - pipeline processing (when setup has detected that cache content is not
> valid)
> - end of processing (including a status indicating cached-content /
> sucessfull execution / erroneous execution)
>
> We also have to find a way to distinguish between the different sitemap
> invocations that can occur within a single request with "cocoon:" sources.
>
Yes, sounds good to me. When is it finished? :)

I guess we should come up with an Interface, how/where to configure it
and which events we want to observe.

Carsten


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


Re: processing (lifecycle) events

Posted by Sylvain Wallez <sy...@anyware-tech.com>.
Carsten Ziegeler wrote:

>Hi Jakob,
>
>I think this is a great idea, (because) I need it in several areas
>as well. Could you expand a little bit more on how to configure
>the listeners and what their interface should/could look like.
>This might then help to convince others that listeners are usefull
>in some scenarios.
>  
>

Same here. In our in-house product, we have extended 
CocoonServlet.service() for this. But it's a real hack and I don't like it.

Listeners would be good as there are several states in the sitemap 
execution where being notified makes sense :
- start of pipeline construction (for this an action could be fine)
- pipeline setup
- pipeline processing (when setup has detected that cache content is not 
valid)
- end of processing (including a status indicating cached-content / 
sucessfull execution / erroneous execution)

We also have to find a way to distinguish between the different sitemap 
invocations that can occur within a single request with "cocoon:" sources.

Thoughts ?
Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }



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


RE: processing (lifecycle) events

Posted by Carsten Ziegeler <cz...@s-und-n.de>.

> -----Original Message-----
> From: Vadim Gritsenko [mailto:vadim.gritsenko@verizon.net]
> Sent: Thursday, February 13, 2003 4:29 PM
> To: cocoon-dev@xml.apache.org
> Subject: Re: processing (lifecycle) events
> 
> 
> >>
> >>>>I need to acquire resources for a processing phase and then would
> >>>>like to automatically release it at processing end.
> >>>>        
> >>>>
> >>Isn't this something RequestLifecycleComponent is intended for? I.e., 
> >>when you obtain this component it gets all the resources needed, and 
> >>when request processing is done, it gets recycled and releases those 
> >>resources.
> >>
> >>    
> >>
> >If you only want to cleanup afterwards, yes the 
> RequestLifecycleComponent 
> >is one possibility.
> >But I (and I thought Jakob as well) need a notification to a custom
> >object when the processing begins and ends.
> >
> 
> I've read that he needs to release resources, not to get a 
> notification... Then RequestLifecycleComponent should work. Using 
> notifications you can also hack something like this but I think writing 
> a proper component will result in cleaner architecture...
> 
> 
> > The beginning could be
> >done by a custom action at the top of the sitemap, but this is not
> >a nice solution. And the ending of the processing can not be notificated
> >right now (without hacking the servlet or something at least).
> >
> 
> *IF* you need notification at all. May be all you need is a component 
> doing the work with proper lifecycle...
> IMHO, of course.
> 
Yes, I need notification and *not* a mechanism that cleans up at the end
of the process.

Carsten

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


Re: processing (lifecycle) events

Posted by Vadim Gritsenko <va...@verizon.net>.
Carsten Ziegeler wrote:

>Vadim Gritsenko wrote:
>  
>
>>Carsten Ziegeler wrote:
>>
>>    
>>
>>>Hi Jakob,
>>>
>>>I think this is a great idea, (because) I need it in several areas
>>>as well. Could you expand a little bit more on how to configure
>>>the listeners and what their interface should/could look like.
>>>This might then help to convince others that listeners are usefull
>>>in some scenarios.
>>> 
>>>
>>>      
>>>
>>Carsten,
>>
>>    
>>
>>>>I need to acquire resources for a processing phase and then would
>>>>like to automatically release it at processing end.
>>>>        
>>>>
>>Isn't this something RequestLifecycleComponent is intended for? I.e., 
>>when you obtain this component it gets all the resources needed, and 
>>when request processing is done, it gets recycled and releases those 
>>resources.
>>
>>    
>>
>If you only want to cleanup afterwards, yes the RequestLifecycleComponent 
>is one possibility.
>But I (and I thought Jakob as well) need a notification to a custom
>object when the processing begins and ends.
>

I've read that he needs to release resources, not to get a 
notification... Then RequestLifecycleComponent should work. Using 
notifications you can also hack something like this but I think writing 
a proper component will result in cleaner architecture...


> The beginning could be
>done by a custom action at the top of the sitemap, but this is not
>a nice solution. And the ending of the processing can not be notificated
>right now (without hacking the servlet or something at least).
>

*IF* you need notification at all. May be all you need is a component 
doing the work with proper lifecycle...
IMHO, of course.

Vadim


>Carsten 
>
>Carsten Ziegeler 
>Open Source Group, S&N AG
>



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


RE: processing (lifecycle) events

Posted by Carsten Ziegeler <cz...@s-und-n.de>.
Vadim Gritsenko wrote:
> 
> Carsten Ziegeler wrote:
> 
> >Hi Jakob,
> >
> >I think this is a great idea, (because) I need it in several areas
> >as well. Could you expand a little bit more on how to configure
> >the listeners and what their interface should/could look like.
> >This might then help to convince others that listeners are usefull
> >in some scenarios.
> >  
> >
> 
> Carsten,
> 
> >> I need to acquire resources for a processing phase and then would
> >> like to automatically release it at processing end.
> 
> 
> Isn't this something RequestLifecycleComponent is intended for? I.e., 
> when you obtain this component it gets all the resources needed, and 
> when request processing is done, it gets recycled and releases those 
> resources.
> 
If you only want to cleanup afterwards, yes the RequestLifecycleComponent 
is one possibility.
But I (and I thought Jakob as well) need a notification to a custom
object when the processing begins and ends. The beginning could be
done by a custom action at the top of the sitemap, but this is not
a nice solution. And the ending of the processing can not be notificated
right now (without hacking the servlet or something at least).

Carsten 

Carsten Ziegeler 
Open Source Group, S&N AG


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


Re: processing (lifecycle) events

Posted by Vadim Gritsenko <va...@verizon.net>.
Carsten Ziegeler wrote:

>Hi Jakob,
>
>I think this is a great idea, (because) I need it in several areas
>as well. Could you expand a little bit more on how to configure
>the listeners and what their interface should/could look like.
>This might then help to convince others that listeners are usefull
>in some scenarios.
>  
>

Carsten,

>> I need to acquire resources for a processing phase and then would
>> like to automatically release it at processing end.


Isn't this something RequestLifecycleComponent is intended for? I.e., 
when you obtain this component it gets all the resources needed, and 
when request processing is done, it gets recycled and releases those 
resources.

Vadim


>Thanks
>Carsten 
>
>Carsten Ziegeler 
>Open Source Group, S&N AG
>
>
>  
>
>>-----Original Message-----
>>From: Jakob Praher [mailto:jpraher@yahoo.de]
>>Sent: Tuesday, February 11, 2003 10:59 AM
>>To: cocoon-dev@xml.apache.org
>>Subject: processing (lifecycle) events
>>
>>
>>hi all,
>>
>>it would be somehow great, to get notified, when Cocoon.process, starts
>>and finishes its work.
>>
>>I need to acquire resources for a processing phase and then would like
>>to automatically release it at processing end.
>>
>>Is there a clean way to do this now (having looked at the sources, I
>>haven't found something, but maybe I overlooked it ... )
>>
>>I could imagine doing it using a fake action or other sitemap component
>>(that implements dispoable), that will loaded on every processing phase,
>>but it is a little bit dirty ... .
>>
>>doing it like the 2.3 servlet listeners, would be a cleaner way:
>>
>><map:listener event="processing" src="...." /> 
>>
>>thanks for your help
>>
>>-- Jakob
>>
>>    
>>



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


RE: processing (lifecycle) events

Posted by Carsten Ziegeler <cz...@s-und-n.de>.
Hi Jakob,

I think this is a great idea, (because) I need it in several areas
as well. Could you expand a little bit more on how to configure
the listeners and what their interface should/could look like.
This might then help to convince others that listeners are usefull
in some scenarios.

Thanks
Carsten 

Carsten Ziegeler 
Open Source Group, S&N AG


> -----Original Message-----
> From: Jakob Praher [mailto:jpraher@yahoo.de]
> Sent: Tuesday, February 11, 2003 10:59 AM
> To: cocoon-dev@xml.apache.org
> Subject: processing (lifecycle) events
> 
> 
> hi all,
> 
> it would be somehow great, to get notified, when Cocoon.process, starts
> and finishes its work.
> 
> I need to acquire resources for a processing phase and then would like
> to automatically release it at processing end.
> 
> Is there a clean way to do this now (having looked at the sources, I
> haven't found something, but maybe I overlooked it ... )
> 
> I could imagine doing it using a fake action or other sitemap component
> (that implements dispoable), that will loaded on every processing phase,
> but it is a little bit dirty ... .
> 
> doing it like the 2.3 servlet listeners, would be a cleaner way:
> 
> <map:listener event="processing" src="...." /> 
> 
> thanks for your help
> 
> -- Jakob
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
> 

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