Olaf Bergner wrote:
As a proof of concept, I am currently working on converting a small web application of mine to merlin. Since the business logic is completely separated from the presentation layer I thought about transforming said business layer into avalon components to be managed by merlin. The presentation layer uses webwork2 which I find to be a great solution and thus I would be very reluctant to discard it.
Just a note - I'm actually interested in the potential of embedding merlin inside webwork.
So I am facing some problems:
(1) I have to set up an embedded merlin kernel/container/whatever (well,
what exactly do I have to set up?) in a servlet.
You need to setup either:
(a) an embedded kernel, or (b) include you web app in a merlin container
Is there some canonical way of doing so? Probably not.
Yes there is (for both).
If you embedding the kernel in a webapp - its reasonably strait forward and there are a few people who have already done this with Merlin 3.0 and with the new 3.2 snapshot (which makes the embedding process a lot cleaner). If you go for the second option - then Timothy's email provides a good summary.
(2) I will have to store a reference to this merlin thingy in the JNDI context or servlet context. What exactly would I put there?
Typically you would put either:
(a) the kernel instance, or (b) the root block, or (c) a specific named block, or (d) a custom service manager that wraps (a, b or c)
Also keep in mind that the Directory Project are working on a JNDI InitialContextFactory that includes an embedded Merlin instance (part of the Eve product) so this could also be leveraged (maybe - we would need to check with Alex on this).
(3) User requests are handled in Action classes instantiated and subsequently executed by the webwork servlet. Somehow this classes will have to access i.e. the apps user-manager, a component managed by merlin. How can I manage to do so?
How much control do you have over what resources are made available to the Action? Does it reference the request/session/app context? Can you supply parameters? Setting up a servlet to recieve a block, or even a specific set of services is not so hard - so supply on info to the Action is the primary question.
These questions are probably rather trivial, but the available documentation concentrates on solutions which live entirely within merlin. This leads to the impression that merlin is a rather closed system which does not easily allow interfacing with "outside" code.
Ouch!
Not at all - the Merlin system provides everything you need to do what your talking about. Its just that the focus has been on the core with respect to documetation. A working embedded servlet example is somwhere on the shortlist - and an overall Avalon HTTP solution is high up on the agenda. But even higher are the subjects of a new release, the profiling aspects (which link into JMX), subsystems replacement (e.g. logging), etc. But these itrems also play into the HTTP space in that they are central to the notion of turning Merlin into a web server simply by adding the right facilities.
It might be that my questions reveal an erroneous understanding of the concepts which drive merlin development. If this is the case, I would be thankful for any corrections.
Relative to 3.2 there are two things you should be aware of:
(a) dynamic service aquisition is available yet (i.e. lookup of a service without declaring a dependency) bu this is easy to do if you emabedding merlin
(b) embedding merlin in merlin is a non-trivial exercise (mainly related to logging - and some refactoring that will be required in this area and additional work on replaceable facilities)
Stephen.
Cheers,
Olaf
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--
Stephen J. McConnell mailto:[EMAIL PROTECTED]
|------------------------------------------------| | Magic by Merlin | | Production by Avalon | | | | http://avalon.apache.org/merlin | | http://dpml.net/ | |------------------------------------------------|
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
