----- Original Message ----- From: "Stephen McConnell" <[EMAIL PROTECTED]> To: "'Avalon framework users'" <[EMAIL PROTECTED]> Sent: Friday, November 12, 2004 11:12 AM Subject: RE: Service configuration
> > > > -----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> On which block are you saying to do that? The block that exports the service or the block consuming the service? Placing these declarations on the exporting block would tie me to use only the same set of configurations for every consumer block. I guess I forgot to mention that my intention is to make a service package that is used by consumer blocks. This would work as a component library, so, ideally, the user blocks would not have access to the library block.xml's. On the other hand, placing these declarations on the consumer block would break interface/impl separation. (I don't know even if that's really an option... just antecipating to save messages) Does that leaves me only with the facility option you mentioned below? Thanks a lot. > > 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] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]