cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephan Coboos <cromo...@gmx.net>
Subject Re: component lifecycles
Date Mon, 28 Jun 2004 13:52:01 GMT
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.

Regards

Mime
View raw message