> -----Original Message-----
> From: Felipe Castro - M4U [mailto:[EMAIL PROTECTED]
> Sent: 12 November 2004 13:57
> To: [EMAIL PROTECTED]
> Subject: Service configuration
>
> Hello,
>
> I'm just begining with avalon-merlin and I'm really stuck with a
service
> configuration problem. I know merlin is being discontinued but I'm
just
> trying to learn the basics for now.
>
> I have a container myContainer that exports a service myService and a
> consumer container (myConsumerContainer) that declares some components
> wich depend on myService. Is it possible to modify the configuration
_of
> myService_ from the myConsumerContainer block.xml for each dependent
> component?
When you declare a component in a block using
<component name=".." class=".."/> you basically saying 'here is a
deployment scenario so the following example is basically creating a a
couple of components with a particular configurations.
<component name="red" class="Widget">
<configuration>
<color>red</color>
</configuration>
</component>
<component name="blue" class="Widget">
<configuration>
<color>blue</color>
</configuration>
</component>
Note that in both cases we are using the same component implementation
class. The next issue to deal with is to assign the right component to
the consuming services - lets assume you have a component named "fred"
that wants a 'red' widget and a component named "bill" that wants a
'blue' widget. This is basically handled by including a <dependency>
directive inside the 'fred' and 'bill' components within which you
reference the widget you want bound to the provider. There is a
tutorial on this (and supporting code) on the DPML site (something
similar should exist on the Avalon site as well).
http://www.dpml.net/central/guide/development/dependencies/manual.html
> As far as I now, I could write a "target" directive under the
"include" of
> myContainer and override the default configuration of myService.
That's ok
> but it raises a problem if more than one component depends on
myService,
> each of them needing myService to be configured in a specific way.
>
> Maybe I shouldn't use the service approach if a different
configuration is
> needed for each consumer component?
>
> Thanks for any info
Another approach is to do this dynamically using a facility - but if
your thinking in that direction then you should get yourself signed up
using:
http://www.dpml.net/central/about/resources/lists.html
Then do a checkout and build and Magic, Transit and Metro:
http://www.dpml.net/central/guide/setup/index.html
Cheers, Steve.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]