Thanks again. But another small issue ( sorrryy !!! )
I made and ran a dependency non-component class ( named Test that implemented an Interface called TestInterface ) with the HelloComponent. Worked fine and the ServiceManger looked that up for me as follows:
---------------------------------------------------------------------- /** * @avalon.dependency type="tutorial.TestInterface" key="test" * */
public void service( ServiceManager manager )
throws ServiceException
{ m_test = (TestInterface) manager.lookup("test");
}
---------------------------------------------------------------------
The above lifecycle service() method exists in HelloComponent cause if extends the Serviceable interface.
And as I mentioned the Test class doesn't implement any lifecycle interface. Now what if I want to use another non-component dependency class ( Test1 ), this time in the Test class.
Since Test won't have a service() method and hence won't get a ServiceManger, how could Test1 be looked up using Merlin. I mean I can just create a Test1 object and use it in Test but what abt automatic lookup using ServiceManger.
You know what I mean ??
Yep - the solution here is to use a custom contextualization phase handler. The handler can invoke any method you want on you "component" against operations that already exist. Providing you have some mechanisms to pass the information in (i.e. some operation your handler implementation can invoke on your component implementation).
Here is the tutorial: http://avalon.apache.org/merlin/starting/advanced/context.html
Steve.
Should a ServiceManager object be manually created or what should be the approach here ?
And thanks a lot for your patience.
Vikas
-----Original Message-----
From: Stephen McConnell [mailto:[EMAIL PROTECTED] Sent: Thursday, January 15, 2004 2:43 PM
To: Avalon framework users
Subject: Re: Dependencies
Vikas Phonsa wrote:
Thanks guys, I got another question though,
Do all dependencies that a component class is using ( e.g the RandomGenerator used by HelloComponent in the dependencies example ) have
to
be components based on Avalon Framework to be used with Merlin.
No.
All you need to do is add the @avalon.component name="whatever" tag.
I.e. meta-info is needed by the component DOES NOT need to be Avalon based.
Cheers, Steve.
I mean what if I define a simple class Test which is not a component ( and hence implements no Avalon lifecycle interfaces) and I try to use that as
a
dependency, like try to use of its method in the HelloComponent.
I tried to use such a class, doesn't work and I get a NoProviderDefinitionException.
Thanks
Vikas
-----Original Message-----
From: Stephen McConnell [mailto:[EMAIL PROTECTED] Sent: Thursday, January 15, 2004 1:42 PM
To: Avalon framework users
Subject: Re: Dependencies
Vikas Phonsa wrote:
Requirements, I understand. Now what do u mean by solutions ?
In the case of a dependency Merlin will automatically wire things together for you, however - sometime you want to override the things that Merlin does. This is achieved by declaring a <dependency> directive containing a definition of the <source> component address to use as the service provider.
The following examples should provide everything you need to know.
http://avalon.apache.org/merlin/starting/tutorial/dependencies/index.html
Cheers, Steve.
Thanks
Vikas
-----Original Message-----
From: Stephen McConnell [mailto:[EMAIL PROTECTED] Sent: Thursday, January 15, 2004 1:22 PM
To: Avalon framework users
Subject: Re: Dependencies
Vikas Phonsa wrote:
Hi Everybody
In the definition of <component> element of block.xml at http://avalon.apache.org/merlin/meta/block/components/index.html
<dependencies> nested element has been defined.
How is this element different from the <dependencies> element
automatically
generated in the classname.xinfo file for a component.
The definitions in the .xinfo file are the declaration of requirements. The definitions in the block are the declaration of solutions.
Cheers, Steve.
Or any comments regarding this ?
Thanks
Vikas
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--
|------------------------------------------------| | Magic by Merlin | | Production by Avalon | | | | http://avalon.apache.org/merlin | | http://dpml.net/merlin/distributions/latest | |------------------------------------------------|
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
