Re: variable dependencies on Components
"Raffael Herzog" <[email protected]>
| Newsgroups | gmane.comp.jakarta.avalon.user |
|---|---|
| Organization | Organised? Me? |
| Message-ID | <[email protected]> |
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.