You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Aurélien DEHAY <ad...@zorel.org> on 2005/10/17 16:46:19 UTC

Writing my own generator.

Hello all.

I'm currently writing a generator. I'm a bit mess up about dispose() 
recycle(), Serviceable, Disposable and CacheableProcessingComponent...

What do I really need to have a cacheable and poolable generator? I've 
read the tutorial "Write a Custom Generator", but the Composable and 
Disposable is not very clear: do I need to implement both dispose() and 
compose() ?

Thank you for your answer.

Regards.
-- 
Aurélien DEHAY

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


Re: Writing my own generator.

Posted by Reinhard Poetz <re...@apache.org>.
Aurélien DEHAY wrote:
> Hello all.
> 
> I'm currently writing a generator. I'm a bit mess up about dispose() 
> recycle(), Serviceable, Disposable and CacheableProcessingComponent...
> 
> What do I really need to have a cacheable and poolable generator? I've 
> read the tutorial "Write a Custom Generator", but the Composable and 
> Disposable is not very clear: do I need to implement both dispose() and 
> compose() ?
> 
> Thank you for your answer.

See http://cocoon.zones.apache.org/daisy/documentation/writing/664.html


-- 
Reinhard Pötz           Independent Consultant, Trainer & (IT)-Coach 

{Software Engineering, Open Source, Web Applications, Apache Cocoon}

                                        web(log): http://www.poetz.cc
--------------------------------------------------------------------

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


Re: Writing my own generator.

Posted by Berin Loritsch <bl...@d-haven.org>.
Aurélien DEHAY wrote:

> Hello.
> I've just discovered 
> http://cocoon.zones.apache.org/daisy/documentation/g2/610.html


Did you discover this:

http://cocoon.zones.apache.org/daisy/documentation/g2/688.html

?


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


Re: Writing my own generator.

Posted by Aurélien DEHAY <ad...@zorel.org>.
Reinhard Poetz a écrit :
> Aurélien DEHAY wrote:
> 
>> Aurélien DEHAY a écrit :
>>
>>>
>>> ok, the dispose() comes from interface Disposable() from avalon 
>>> framework then?
>>
>>
>>
>> I think I'd rather ask the differences between dispose() and recycle() 
>> method...
>>
>> Rgds.
> 
> 
> see http://excalibur.apache.org/framework/lifecycle.html
> 

Ok... let's say I've understood.... I will keep my recycle() method for 
my component to be correctly poolable, and I will let the dispose() 
method from superclass to do the job.

I was thinking creating a custom generator was simplier...

Thanks.
-- 
Aurélien

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


Re: Writing my own generator.

Posted by Reinhard Poetz <re...@apache.org>.
Aurélien DEHAY wrote:
> Aurélien DEHAY a écrit :
> 
>>
>> ok, the dispose() comes from interface Disposable() from avalon 
>> framework then?
> 
> 
> I think I'd rather ask the differences between dispose() and recycle() 
> method...
> 
> Rgds.

see http://excalibur.apache.org/framework/lifecycle.html

-- 
Reinhard Pötz           Independent Consultant, Trainer & (IT)-Coach 

{Software Engineering, Open Source, Web Applications, Apache Cocoon}

                                        web(log): http://www.poetz.cc
--------------------------------------------------------------------

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


Re: Writing my own generator.

Posted by Aurélien DEHAY <ad...@zorel.org>.
Aurélien DEHAY a écrit :
> 
> ok, the dispose() comes from interface Disposable() from avalon 
> framework then?

I think I'd rather ask the differences between dispose() and recycle() 
method...

Rgds.
-- 
Aurélien

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


Re: Writing my own generator.

Posted by Aurélien DEHAY <ad...@zorel.org>.
Hello.

Ralph Goers a écrit :
> 
> The easiest answer is to tell you to look at the FileGenerator. It is 
> cacheable and poolable.

My generator have the same skeleton, i've just copied the file ;)

> 
> When components (such as generators) are pooled they are first 
> initialized by calling the lifecycle methods you have declared, such as 
> service, configure, etc.  The service method simply gives you access to 
> the service manager. If you need this then just extend 
> ServiceableGenerator.

That's what i've done.

> 
> Each time the generator is used its setup method is called first. This 
> should be as light as possible. They validity methods will then be 
> called to determine if the cached version can be used. If it cannot, the 
> generate method is then called.

I've read the Wiki "Writing cache for efficiency", who explain that very 
well IMHO.

> You only need to use the Disposable interface (and thus the dispose() 
> method) if you acquire a resource from the service manager that must be 
> released when your generator is freed by the component manager.  If you 
> acquire resources during the generate method they should be released there.

ok, the dispose() comes from interface Disposable() from avalon 
framework then?

> 
> BTW - these principals apply to most Avalon based components, not just 
> generators.

I've just discovered 
http://cocoon.zones.apache.org/daisy/documentation/g2/610.html

Thanks for all your answer.

> 
> HTH
> Ralph
> 



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


Re: Writing my own generator.

Posted by Ralph Goers <Ra...@dslextreme.com>.
Aurélien DEHAY wrote:

> Hello all.
>
> I'm currently writing a generator. I'm a bit mess up about dispose() 
> recycle(), Serviceable, Disposable and CacheableProcessingComponent...
>
> What do I really need to have a cacheable and poolable generator? I've 
> read the tutorial "Write a Custom Generator", but the Composable and 
> Disposable is not very clear: do I need to implement both dispose() 
> and compose() ?
>
> Thank you for your answer.
>
> Regards.

The easiest answer is to tell you to look at the FileGenerator. It is 
cacheable and poolable.

When components (such as generators) are pooled they are first 
initialized by calling the lifecycle methods you have declared, such as 
service, configure, etc.  The service method simply gives you access to 
the service manager. If you need this then just extend ServiceableGenerator.

Each time the generator is used its setup method is called first. This 
should be as light as possible. They validity methods will then be 
called to determine if the cached version can be used. If it cannot, the 
generate method is then called.
You only need to use the Disposable interface (and thus the dispose() 
method) if you acquire a resource from the service manager that must be 
released when your generator is freed by the component manager.  If you 
acquire resources during the generate method they should be released there.

BTW - these principals apply to most Avalon based components, not just 
generators.

HTH
Ralph

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