sure, youre right!

MyComponent now can get the dep1 and dep2 from the ServiceManager, but what if i want 
a user to edit the block.xml and not the source code and the .xinfo files? so he can 
add a new Component from MyService and declare a new dependency with key="dep3". but 
in the service method from MyComponent this dependency will never be fulfilled. so 
there is no chance to style it variable!?

André Steinkamp
IT Projekte



-----Ursprüngliche Nachricht-----
Von: Raffael Herzog [mailto:[EMAIL PROTECTED]
Gesendet: Dienstag, 24. August 2004 11:02
An: [EMAIL PROTECTED]
Betreff: Re: variable dependencies on Components


Am Tue, 24 Aug 2004 09:12:52 +0200 schrieb Steinkamp Andre  
<[EMAIL PROTECTED]>:

> so i did it, but for every component i will add, i have to edit the  
> source code from the components interface to set a key for the new  
> dependency. it would be nice to be independent from the source code and  
> only to edit the block.xml by adding a new component using perhaps three  
> components from the second interface. can i get several objects from the  
> servicemanager with a lookup when they have the same key? can they have  
> the same key?

They don't have the same key. What you specify in the source code is just  
a default. If you declare the component with a name, this will be it's  
name, not the one specified in the code (xinfo). The same goes for  
dependencies:

<component name="c3" class="MyService"/>
<component name="c4" class="MyService"/>
<component name="c2" class="MyComponent">
   <dependencies>
     <dependency key="dep1" source="c3"/>
     <dependency key="dep2" source="c4"/>
   </dependencies>
</component>

Now, c2 will find c3 as dep1 and c4 as dep2 in the ServiceManager,  
regardless of what name you specified in the source code of MyService.

cu & HTH,
    Raffi

-- 
The difference between theory and practice is that in theory, there is no  
difference, but in practice, there is.


---------------------------------------------------------------------
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]

Reply via email to