Avalon was probably conceived and developed by people who
focused on client/server architectures, often obeying a request/response pattern. Such applications often simply start a listener thread once initialization has completed and wait for incoming requests. So apart from the code that creates the listener thread there's no easily identifiable "main" method.
Whatever u guys say makes perfect sense, but I'm still going nuts on a very basic question.
When we say "merlin target\classes -execute", my classes folder has many components, but merlin goes and loads( starts or whatever )the HelloComponent among those. And then HelloComponent has dependencies.
So like I run a program from a jar file, the " java -jar" looks into the manifest to find the Main Class, which acts as the starting point of my Application. In Merlin tutorials, the HelloComponent is acting as the starting point. How does merlin know that it should hit HelloComponent and not the other components under the same package that might be implementing life cycle interfaces just like HelloComponent.
So how does "merlin -execute" determine that starting point. Doesn't it use "block.xml" ?
If yes then in block.xml I can have more than one <components> under one <container>, then how would Merlin find out which one to start with.
If is starting point a totally irrelevant concept in Merlin's case.
I don't know if I'm making myself clear.
Thanks for your patience guys.
Mathews
From: "Olaf Bergner" <[EMAIL PROTECTED]> Reply-To: "Avalon framework users" <[EMAIL PROTECTED]> To: "Avalon framework users" <[EMAIL PROTECTED]> Subject: RE: Non component class as the starting point Date: Mon, 19 Jan 2004 20:58:19 +0100
> -----Original Message----- > From: Mathews Julien [mailto:[EMAIL PROTECTED] > Sent: Monday, January 19, 2004 8:21 PM > To: [EMAIL PROTECTED] > Subject: Re: Non component class as the starting point > > > Thanks for your reply > > How does a container know which component is the starting point of any > application. Does the root component in the block.xml specify that ? >
No, a component that wants to be executed or started by the container once its initialization phase has completed should implement the or.apache.avalon.framework.activity.Executable or the org.apache.avalon.framework.activity.Startable interface.
> And how can we have container call a method on that component > which doesn't > implement any Framework interfaces.
You will probably have to write a wrapper for such a non-avalon component.
> > When I say starting point, I mean, like a gui application can > start from a > main program. So that main program would be the starting point of an > application. > > In my container, some component gotta be the starting point of my > application, right ? > > Or am on a wrong line of thinking.
I think you have a problem many people have when trying to understand avalon/merlin. Avalon was probably conceived and developed by people who focused on client/server architectures, often obeying a request/response pattern. Such applications often simply start a listener thread once initialization has completed and wait for incoming requests. So apart from the code that creates the listener thread there's no easily identifiable "main" method.
This does not mean that you cannot use merlin for, say, swing gui applications. I know that many people are using it that way. It only means that documentation does not necessarily address the need for such a "main" method.
So if you already have a class that starts up your (gui) app you should
probably write a wrapper component that implements either the Executable or
the Startable lifecycle interface. Thus, once merlin has finished
configuring your component it will either call its execute() (Executable) or
its start() (Startable) method.
Hope this helps,
Olaf
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
_________________________________________________________________
Scope out the new MSN Plus Internet Software — optimizes dial-up to the max! http://join.msn.com/?pgmarket=en-us&page=byoa/plus&ST=1
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]