You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mailet-api@james.apache.org by "Andrew C. Oliver" <an...@superlinksoftware.com> on 2006/11/08 21:44:12 UTC

injection and/or JNDI WAS Re: On Global vs Local jndi naming

>>
>> yes.  Once other have had time to sound of on this particular issue we
>> should start
>> specing it out on the wiki as well.  I prefer your code-first method but
>> think some level
>> of specification is also required.  Mainly because I'm way to lazy to
>> search mail archives
>> when it comes time to implement.
>
> I prefer dependency injection to service lookups, so much of what you
> guys are discussing seems moot to me.  Since you (one or both of you)
> have expressed preference for dependency injection as well, I'm
> struggling to picture the use cases for when JNDI lookup is necessary.
> Can you guys give some examples to help me understand this
> requirement?
>

Whether dependency injection is used is orthogonal to whether JNDI is 
used or available.  I do not object
to a strict dependency injection scenario either.  I simply stated that 
if JNDI is used that local namespaces
are probably needed as well.  I do prefer dependency injection to raw 
name lookup code.

This is an example of them used together:
http://docs.jboss.org/ejb3/app-server/tutorial/injection/injection.html
http://docs.jboss.org/ejb3/app-server/tutorial/jndibinding/jndi.html

(I do not presuppose EJB3 or this form of attribute based configuration, 
just it was what immediately came to mind
when you asked for an example)

I prefer something as POJO as possible with as few implicit contracts as 
possible except where exceptionally pragmatic (EJB3
has many implicit contracts).  I prefer what is reasonably easy to 
implement, maintain and support.   I prefer something that
supports configuration with as little complexity as possible but favor 
brevity to the exceptionally verbose.

I can be convinced in either direction as to whether JNDI is redundant 
or assists in portability here.  On one hand with field and
setter injection based on attributes with JNDI the code is very simple 
and the implementation could probably be common, on the
other hand with no jndi its simple and reduces a requirement on 
implementors of mailets and mailet containers.  In either case the
descriptor can be divergent (though some standardization could happen as 
well). 

I do have an opinion on this:  I like attribute based metadata for 
*standard* injection pathways, its useful, portable, easy.  However 
regardless
XML (or similar) based descriptors must be available in addition or at 
least as overrides in order to allow multiple instances with divergent
configuration.

-Andy