You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Alexis Agahi <al...@users.sf.net> on 2003/10/03 20:21:02 UTC

Merlin block.xml & component Impl

Steve just told me that it is not mandatory to declare lazy component in 
block.xml (obviously if there is no need to configure it manually)


That is really a nice feature that help to keep but, I have a little question.

If I have 2 impl (ImplA & ImplB) of an interface 

for example
For ImplA
 * @avalon.component version="1.0" name="ImplAName" lifestyle="singleton"
 * @avalon.service type="path.Interface"

For ImplB
 * @avalon.component version="1.0" name="ImplBName" lifestyle="singleton"
 * @avalon.service type="path.Interface"


How can I declare a dependency using a specific implem
* @avalon.dependency type="path.Interface:1.0"  key="KeyA"
?

How will merlin choose one implem (A or B) instead of another?


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org


Re: Merlin block.xml & component Impl

Posted by Stephen McConnell <mc...@apache.org>.

Alexis Agahi wrote:

>Steve just told me that it is not mandatory to declare lazy component in 
>block.xml (obviously if there is no need to configure it manually)
>

Just a note concerning implicit components ...

1. if a packaged profile (<classname>.xprofile) is provided the
   implict component will be based on the first packaged profile

2. if a packaged configuration (<classname>.xconfig) is provided
   the implict component will be configured accordingly

>
>
>That is really a nice feature that help to keep but, I have a little question.
>
>If I have 2 impl (ImplA & ImplB) of an interface 
>
>for example
>For ImplA
> * @avalon.component version="1.0" name="ImplAName" lifestyle="singleton"
> * @avalon.service type="path.Interface"
>
>For ImplB
> * @avalon.component version="1.0" name="ImplBName" lifestyle="singleton"
> * @avalon.service type="path.Interface"
>
>
>How can I declare a dependency using a specific implem
>* @avalon.dependency type="path.Interface:1.0"  key="KeyA"
>?
>

You cannot declare a dependency on an implementation - but you can 
declare a directive under  a <component> tag in you block  descriptor to 
tell Merlin about you assembly requirement.  For example

     <component name="aaa" class="ImplAName"/>
     <component name="bbb" class="ImplBName"/>

     <component name="ccc" class="Whatever">
       <dependencies>
         <dependency key="KeyA" source="aaa"/>
       </dependencies>
     </component>

>How will merlin choose one implem (A or B) instead of another?
>

In the above example its simply a case of referencing a declared 
component.  The source attribute is a relative path statement, so for 
example if you have a component burried away deep inside a few nested 
blocks, you can reference it using something like "xxx/yyy/zzz/aaa" 
(whic is a path relative to the container in which the component is 
contained). 

There is a tutorial dealing with this subject at the following url.
http://avalon.apache.org/merlin/starting/tutorial/dependencies/index.html

Cheers, Steve.

-- 

Stephen J. McConnell
mailto:mcconnell@apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org