cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Quinn <jer...@media.demon.co.uk>
Subject Re: component lifecycles
Date Mon, 28 Jun 2004 14:31:16 GMT

On 28 Jun 2004, at 14:52, Stephan Coboos wrote:

> Jeremy Quinn wrote:
>
>> How would I organise this differently, in the situation where I had 
>> several of these Components, each differently configured, that I 
>> wanted to be able to load in FlowScript in a similar way. Maybe we 
>> want one setup for read-only privs and another setup for read-write 
>> privs etc.
>
> Use the ServiceSelector like for DataSources. I dont't know where 
> documentation about this can be found, but the sources of Cocoon 
> should contain many lines of that kind and a search on 
> "ServiceSelector" should help.
>
> Using a ServiceSelector, a entry in cocoon.xconf looks like:
>
> <your-selector>
>   <component-instance class="bar.Foo" name="foo1">
>      <parameter ...../>
>   </component-instance>
>   <component-instance class="bar.Foo" name="foo2">
>      <parameter .../>
>   </component-instance>
> </your-selector>
>
> In a java class the code to retrieve the component foo1 should be 
> something like:
>
> ServiceSelector selector = 
> (ServiceSelector)this.serviceManager.lookup(Foo.ROLE);
> ...
> Foo foo1 = (Foo)selector.select("foo1");
> ...
>
> Hope this few lines helps.

Thanks for this.
I had seen ServiceSelector, but was not sure how it could be used from 
FlowScript,

regards Jeremy


--------------------------------------------------------

                   If email from this address is not signed
                                 IT IS NOT FROM ME

                         Always check the label, folks !!!!!
--------------------------------------------------------


Mime
View raw message