Thanks for your interest!

On Mar 24, 2007, at 9:26 PM, Fabien Carrion wrote:

Hi,

Here is my point of view.

I like the idea of "<create a new instance through various kinds of
magic>" to be replaced by "nice code that can do the object creation
and  injection in one step".
As I am still new on the code of Tomcat, having all the code
concentrated for the object creation and injection is a good idea. I
remember to have problem to find out where the filter, servlet...
objects were created when I did my first patch on the annotations. But
I have no solution to implement it on tomcat.

The patch doesn't seems to modify nothing on the catalina side
(ContextConfig.java, WebRuleSet.java, WebAnnotationSet.java). Just the
jasper side is taken in account.

I don't think an adapter between the LifecycleProvider interface and the
AnnotationProcessor interface is a good idea. This is one layer more
between the code which does the work and the code which requires the
work. The adapter has to be maintained. It is more work for us.


I personally think the AnnotationProcessor is a very questionable idea and hope no one uses it. However, it is pretty common now. The point of the adapter is to show that tomcat can still support people who want to integrate via something like AnnotationProcessor. I certainly don't think tomcat should be using a AnnotationProcessor wrapped in a LifecycleProvider. I was basically trying to show that tomcat could work through an interface like LifecycleProvider, and that it would provide uniformity that is currently lacking, not trying to show a great new implementation of the interface.

-- a little history and context --

I work on geronimo, and I started by getting annotation/injection support to work on our app client container and jetty integration, using some ideas I cribbed from OpenEjb and Xbean. With all of these projects it was a really natural fit to have an object creation service that, when given a class name, handed you back a fully baked object. The code tended to get simpler and more straightforward. Then I looked at MyFaces and realized that they could also simplify their code by using an object creation service where you say

getLifecycleProvider().newInstance(className);

 rather than continual repetition of

Object o = clazz.newInstance();
getAnnotationProcessor().inject(o);
getAnnotationProcessor().postConstruct(o);

They agreed.

Then I looked at Tomcat. I found that there was a lot of attention paid to all sorts of things such as security settings and whether the class was in tomcat for servlets, but no such attention paid for filters or listeners. I wondered if this was an oversight.... I guess I should have asked but was kind of busy. So, I wanted to see if I could get tomcat to work with an object creation service both standalone and in geronimo. I haven't located any tests for tomcat standalone so my criterion for tomcat working standalone so far is "it builds". I'm getting good results in geronimo with a geronimo implementation of LifecycleProvider.

So, if there's interest in pursuing this in tomcat, my idea of a possible path would be something like:

0.  find a better name than LifecycleProvider :-)

1. Modify the code that creates and destroys these "managed objects" so there is always a LifecycleProvider present. This eliminates a lot of "if (its there) { do it one way} else {do it another way}" code.

2. Write a suitable variety of LifecycleProvider implementations. An obvious simple one is clazz.newInstance() for newInstance, and {} for destroyInstance. There can be one with the security code of the current servlet construction code. There can be one that adapts to an AnnotationProcessor for those who prefer to provide an implementation of that interface. And there can be a "native" tomcat implementation that does annotations. Of course I think the geronimo implementation is close to ideal :-) and you're welcome to use it but it may not suit all the standalone tomcat needs.

3. Make sure its convenient to configure both tomcat and jasper (independently) with the LifecycleProvider instances of your choice.

Many thanks,
david jencks



Cheer's

Fabien


On 3/24/07, Filip Hanik - Dev Lists <[EMAIL PROTECTED]> wrote:
yo,
I've been in touch with the folks at Geronimo.
They use dependency injection, and have a suggestion on how they would
like the annotation processor to be able to be injected into tomcat

Here is the email
http://marc.info/?l=geronimo-dev&m=117467149802844&w=2

Here is the proposed patch:
https://issues.apache.org/jira/secure/attachment/12354097/ GERONIMO-3010-1.patch

I'd take out the word LifecycleProvider, and replace it with something
else as it conflicts with our own idea of Lifecycle.

I'd like to get your feedback, this is a chance step for our two
communities to work together.

Filip



--
Fabien Carrion

()  Campagne du ruban ASCII -- Contre les mails en html
/\  contre les pieces-jointes Microsoft
Web: http://fabien.carrion.free.fr/

---------------------------------------------------------------------
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]

Reply via email to