Hi Niclas, I tried the below mentioned steps but was not successful.
Actually my requirement is as follows : I was using Avalon components as of now and am planning to move over to Merlin. In the earlier scenario, the component definition was an xml file having an attribute "type". This type was used to differentiate between 2 components (A and B) having the same implementation i.e. in my implementation, I used to check for the "type" and based on that performed diff operations. Actually, I had the control over deployment of components and thus was able to read the component definition and make a configuration object for the type,etc for each component and put in some object. In my implementation, I used to get the type from this particular object and check it to perform various operations.(Please note that there were two component definitions A.xml and B.xml. A.xml had type as 'A' and B.xml had type as 'B') Now in Merlin, the component definitions became transformed into .xinfos and the components were defined in the block.xml But now, my component implementation does not know about the type attribute which earlier it used to. Actually, Merlin deploys all the components by itself and now I do not have the liberty to read the xinfo of each component and make the configuration object which can then be used to make my custom object. Then this can be used by the implementation in order to proceed further. Is there any way I can read the xinfos and come up with a configuration object for each component. I am doing all this stuff since I do not want to change the component implmentation at all. Please give me some pointers so that I can proceed further without changing the implmentation for the components. Regards, Harvinder -----Original Message----- From: Niclas Hedhman [mailto:[EMAIL PROTECTED] Sent: Thursday, October 21, 2004 1:02 AM To: Avalon framework users Subject: Re: Error while running embedded merlin On Thursday 21 October 2004 05:36, Harvinder Singh wrote: > Question : Does this mean then that "MyComponent" will get resolved only if > it has the same class name as the xinfo file name. > Infact I tried with a sample component having the classname different from > the xinfo file name, and it did not get reolved and gave me an error. Issue > here is what suppose if I want to use the same implementation for two > different components.( my components have very similar functionality and > thus I wud like to use the same implementation passing a flag each time > which component to use.) > I will define both the components in block.xml having the same class names > and also an attribute 'type' which would suggest which one to use. > But the way merlin is behaving, it will need 2 different classes and two > different xinfos. > Will something like this work in Merlin : > > MyComponent1.xinfo and MyComponent.class - resolves 1st component > MyComponent2.xinfo and MyComponent.class - resolves 2nd component The .xinfo file defines the Type of the component. It does not define/declare an instance of the component. > If not then please let me know how to achieve that? MyComponent.class and MyComponent.xinfo belong together. Unless MyComponent is from a 3rdParty source, I strongly urge you to let Magic produce the .xinfo file automatically. In your block, you declare the component's usage, and for singleton lifestyle that directly translates to a component instance. (Please note, that under the Avalon concepts, more than one singleton instance of the same class can exist.) <block name="MyBlock" > <classloader> : </classloader> <component name="somename" class="com.me.MyComponent" /> <component name="anothername" class="com.me.MyComponent" /> </block> If you have other components that are depending on those and it is important which instance (for instance different config) is used, you need manual dependency resolution; http://avalon.apache.org/central/about/tutorials/basic/dependencies/manual.h tml (Also, I urge you to let Magic produce the block file, so that the classloader is properly established.) I hope this is enough for you to proceed. Cheers Niclas -- +------//-------------------+ / http://www.bali.ac / / http://niclas.hedhman.org / +------//-------------------+ --------------------------------------------------------------------- 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]