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

Reply via email to