Stefano Bagnara wrote:
Implementations MAY implement service look up using JNDI however not
all implementations would necessarily want the overhead of JNDI.

Therfore I propose that accessors are placed in MailetContext to allow
mailets to get User and Mail repositories by name. This does not
preclude implementations of these methods from using JNDI in the
background.

Maybe this is clear to most people but I prefer to write this again: I'm against the use of JNDI, and I prefer a solution based on dependency injection.

Keeping this in mind I think it would be interesting to decide what platform we want to target with the next mailet apis: can we think to java 5 for this? Java 5 would give us annotations and I like annotation based @service injection like EJB3 much more than JNDI.

An update: I don't want to be the "bad guy" here and to block new efforts that could bring advantages.

I want to make it clear that I won't veto the use of JNDI in mailet apis (and james) if:
1) someone else will do the work :-)
2) it will not be considered the FINAL solution (read: we can move to annotation based DI when we switch to java 1.5 and backward compatibility will not be raised as an issue).

I think that JNDI would be better than the use of the ServiceManager stored in the context, but I would prefer to simply add a "serviceLookup" method to the MailetContext as a temporary solution. Service lookup give much more easy and powerful solution than JNDI (to achieve good isolation for JNDI you have to use multiple nexted contexts and this has always been hard to be managed).

About the direct access to repositories (and not using the service lookup) via MailetContext my preference will vary depending on what release we want to target: is this something you're proposing for next-major (to be branched on Dec2006, storage and config compatible with 2.3) or something for later?

Stefano

Reply via email to