You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Robert Burrell Donkin <ro...@gmail.com> on 2009/08/17 12:32:11 UTC

Guicification [WAS Re: [VOTE] Guice a.k.a DI Replacement]

<snip>

On Mon, Aug 17, 2009 at 10:57 AM, Norman Maurer<no...@apache.org> wrote:
> btw do you already have some idea about how this will work ? I saw you
> already created the sandbox :)

i've been taking a look at guice and remembering the problems in the
current james code base

complete replacement of avalon by guice is going to be a lot of work
for a number of good reasons

james has coupling issues at the component and service levels. i don't
think that these can be solved by guice, and the guice module system
may well be difficult to use as a service replacement until they are
resolved.  i started looking at guice in the sandbox but re-started
working on these problems (again). i think it's probably better to
sort these issues out on trunk.

i wonder whether it might be better to start by taking on something
more modest: replacing the ad hoc classloading for handlers and
mailets with an injection service. i think that PhoenixLoader could be
used to dynamically bind the services started by phoenix into a guice
module. guice could then to used to load mailets and handlers injected
with the services exposed by phoenix plus any other modules loaded.
the injection service would be used as a bridge between the service
locator mechanism used by avalon and dependency injection.

- robert

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Re: Guicification [WAS Re: [VOTE] Guice a.k.a DI Replacement]

Posted by Norman Maurer <no...@apache.org>.
Hi Robert,

I think one of the biggest problems with moving to guice is the way
how Avalon is injecting stuff. Currently (for example) the
Configuration and the ServiceManager is injected after the classes are
instanced. But with Guice we would need to have this stuff already
avaible on creation time ( at least from my understanding).

I thought about adding some kind of Wrapper around the our Services
which later decouple our JamesServices ( SMTPServer, POP3Server ...)
from the Avalon Livecycle and Injection. I think we could/should(?)
reuse the Avalon Configuration but just inject it like other services
etc. I'm not sure how well this will work out, but for this we would
prolly need to get sure that stuff handled by Guice will only get
created after the Inialize Livecycle of Avalon was called ( so we are
sure the Configuration and the ServiceManager is already injected).

Thoughts ?


2009/8/17 Robert Burrell Donkin <ro...@gmail.com>:
> <snip>
>
> On Mon, Aug 17, 2009 at 10:57 AM, Norman Maurer<no...@apache.org> wrote:
>> btw do you already have some idea about how this will work ? I saw you
>> already created the sandbox :)
>
> i've been taking a look at guice and remembering the problems in the
> current james code base
>
> complete replacement of avalon by guice is going to be a lot of work
> for a number of good reasons
>
> james has coupling issues at the component and service levels. i don't
> think that these can be solved by guice, and the guice module system
> may well be difficult to use as a service replacement until they are
> resolved.  i started looking at guice in the sandbox but re-started
> working on these problems (again). i think it's probably better to
> sort these issues out on trunk.
>
> i wonder whether it might be better to start by taking on something
> more modest: replacing the ad hoc classloading for handlers and
> mailets with an injection service. i think that PhoenixLoader could be
> used to dynamically bind the services started by phoenix into a guice
> module. guice could then to used to load mailets and handlers injected
> with the services exposed by phoenix plus any other modules loaded.
> the injection service would be used as a bridge between the service
> locator mechanism used by avalon and dependency injection.
>
> - robert
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Re: Guicification [WAS Re: [VOTE] Guice a.k.a DI Replacement]

Posted by Norman Maurer <no...@apache.org>.
</SNIP>
> i wonder whether it might be better to start by taking on something
> more modest: replacing the ad hoc classloading for handlers and
> mailets with an injection service. i think that PhoenixLoader could be
> used to dynamically bind the services started by phoenix into a guice
> module. guice could then to used to load mailets and handlers injected
> with the services exposed by phoenix plus any other modules loaded.
> the injection service would be used as a bridge between the service
> locator mechanism used by avalon and dependency injection.
>
> - robert
>

Good idea, I'm just had a look at it and it seems to be an option.
Anyway I think in the longterm we should replace the whole avalon
stuff.

Bye,
Norman

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org