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 echo <ec...@gmail.com> on 2012/07/18 07:47:32 UTC

Should use Injector to inject Service-s and Locator-s in the RF

Hi manolo,
I updated the repository with your help. One problem about DI:
It is found that we must inject IMAPStoreCache when I tried to use the it
like org.apache.hupa.server.handler.AbstractSessionHandler. That means I
must implement some inject stuff to benefit with Inject. What's I want to
know is whether I have to implement a new one like
here[1]<https://groups.google.com/forum/?fromgroups#!topic/google-web-toolkit/9W_masZUUjc>instead
of the gwt-dispath's or something have been done I can referred.

[1]
https://groups.google.com/forum/?fromgroups#!topic/google-web-toolkit/9W_masZUUjc


-- 
*echo*

Re: Should use Injector to inject Service-s and Locator-s in the RF

Posted by echo <ec...@gmail.com>.
I've updated the demo code, and made it running locally.
I will make Hupa Evo run with it as soon as possible.
Thanks for your clean beautiful code and advises.

On Wed, Jul 18, 2012 at 6:42 PM, Manuel Carrasco Moñino
<ma...@apache.org>wrote:

> Hi echo,
>
> I have updated the RF example project in the evo experiments repo to use
> guice [1].
> As you can see, with this approach
> 1.- We dont need  Locators for domain objects anymore, since guice will
> create the appropriate implementation (this saves a lot of glue code)
> 2.- All client services shares the same Locator so as we use again guice
> to select the suitable service implementation.
> 3.- Note that you have service decorator which is shared in prod and test
> code.
>
> I think it is the best pattern for Hupa
>
> - Manolo
>
> [1]
> http://code.google.com/a/apache-extras.org/p/hupa-evo/source/detail?r=46#
>
>
> On Wed, Jul 18, 2012 at 9:29 AM, echo <ec...@gmail.com> wrote:
>
>> Thanks a lot.
>>
>>
>> On Wed, Jul 18, 2012 at 2:54 PM, Manuel Carrasco Moñino <
>> manolo@apache.org> wrote:
>>
>>> You can take advantage of this code and use Locators to get your service
>>> classes injected. It is Apache licensed.
>>>
>>> https://github.com/etiennep/injected-requestfactory
>>>
>>> - Manolo
>>>
>>>
>>> On Wed, Jul 18, 2012 at 8:32 AM, Manuel Carrasco Moñino <
>>> manolo@apache.org> wrote:
>>>
>>>> Actually we already use a GuiceServletContextListener so what you have
>>>> to do is to remove the /gwtRequest servlet-mapping from the web.xml so as
>>>> it is routed it via our guice listener, then serve that path in
>>>> the DispatchServletModule, despite the name of this class it it is not a
>>>> gwt-dispatcher class, in fact it should be call GuiceWebModule.
>>>>
>>>> - your configuration should look like:
>>>>     bind(HupaFactoryServlet.class).in(Singleton.class);
>>>>     serve("/gwtRequest",
>>>> "/hupa/gwtRequest").with(HupaFactoryServlet.class);
>>>>
>>>> - create the HupaFactoryServlet and use injection in the way tbroyer
>>>> says i the post
>>>> public class HupaFactoryServlet extends RequestFactoryServlet {
>>>>   implement your ServiceLayerDecorator
>>>> }
>>>>
>>>> - Manolo
>>>>
>>>>
>>>>
>>>>
>>>> On Wed, Jul 18, 2012 at 7:47 AM, echo <ec...@gmail.com> wrote:
>>>>
>>>>> Hi manolo,
>>>>> I updated the repository with your help. One problem about DI:
>>>>> It is found that we must inject IMAPStoreCache when I tried to use the
>>>>> it like org.apache.hupa.server.handler.AbstractSessionHandler. That means I
>>>>> must implement some inject stuff to benefit with Inject. What's I want to
>>>>> know is whether I have to implement a new one like here[1]<https://groups.google.com/forum/?fromgroups#!topic/google-web-toolkit/9W_masZUUjc>instead of the gwt-dispath's or something have been done I can referred.
>>>>>
>>>>> [1]
>>>>> https://groups.google.com/forum/?fromgroups#!topic/google-web-toolkit/9W_masZUUjc
>>>>>
>>>>>
>>>>> --
>>>>> *echo*
>>>>>
>>>>
>>>>
>>>
>>
>>
>> --
>> *echo*
>>
>
>


-- 
*echo*

Re: Should use Injector to inject Service-s and Locator-s in the RF

Posted by Manuel Carrasco Moñino <ma...@apache.org>.
Hi echo,

I have updated the RF example project in the evo experiments repo to use
guice [1].
As you can see, with this approach
1.- We dont need  Locators for domain objects anymore, since guice will
create the appropriate implementation (this saves a lot of glue code)
2.- All client services shares the same Locator so as we use again guice to
select the suitable service implementation.
3.- Note that you have service decorator which is shared in prod and test
code.

I think it is the best pattern for Hupa

- Manolo

[1]
http://code.google.com/a/apache-extras.org/p/hupa-evo/source/detail?r=46#


On Wed, Jul 18, 2012 at 9:29 AM, echo <ec...@gmail.com> wrote:

> Thanks a lot.
>
>
> On Wed, Jul 18, 2012 at 2:54 PM, Manuel Carrasco Moñino <manolo@apache.org
> > wrote:
>
>> You can take advantage of this code and use Locators to get your service
>> classes injected. It is Apache licensed.
>>
>> https://github.com/etiennep/injected-requestfactory
>>
>> - Manolo
>>
>>
>> On Wed, Jul 18, 2012 at 8:32 AM, Manuel Carrasco Moñino <
>> manolo@apache.org> wrote:
>>
>>> Actually we already use a GuiceServletContextListener so what you have
>>> to do is to remove the /gwtRequest servlet-mapping from the web.xml so as
>>> it is routed it via our guice listener, then serve that path in
>>> the DispatchServletModule, despite the name of this class it it is not a
>>> gwt-dispatcher class, in fact it should be call GuiceWebModule.
>>>
>>> - your configuration should look like:
>>>     bind(HupaFactoryServlet.class).in(Singleton.class);
>>>     serve("/gwtRequest",
>>> "/hupa/gwtRequest").with(HupaFactoryServlet.class);
>>>
>>> - create the HupaFactoryServlet and use injection in the way tbroyer
>>> says i the post
>>> public class HupaFactoryServlet extends RequestFactoryServlet {
>>>   implement your ServiceLayerDecorator
>>> }
>>>
>>> - Manolo
>>>
>>>
>>>
>>>
>>> On Wed, Jul 18, 2012 at 7:47 AM, echo <ec...@gmail.com> wrote:
>>>
>>>> Hi manolo,
>>>> I updated the repository with your help. One problem about DI:
>>>> It is found that we must inject IMAPStoreCache when I tried to use the
>>>> it like org.apache.hupa.server.handler.AbstractSessionHandler. That means I
>>>> must implement some inject stuff to benefit with Inject. What's I want to
>>>> know is whether I have to implement a new one like here[1]<https://groups.google.com/forum/?fromgroups#!topic/google-web-toolkit/9W_masZUUjc>instead of the gwt-dispath's or something have been done I can referred.
>>>>
>>>> [1]
>>>> https://groups.google.com/forum/?fromgroups#!topic/google-web-toolkit/9W_masZUUjc
>>>>
>>>>
>>>> --
>>>> *echo*
>>>>
>>>
>>>
>>
>
>
> --
> *echo*
>

Re: Should use Injector to inject Service-s and Locator-s in the RF

Posted by echo <ec...@gmail.com>.
Thanks a lot.

On Wed, Jul 18, 2012 at 2:54 PM, Manuel Carrasco Moñino
<ma...@apache.org>wrote:

> You can take advantage of this code and use Locators to get your service
> classes injected. It is Apache licensed.
>
> https://github.com/etiennep/injected-requestfactory
>
> - Manolo
>
>
> On Wed, Jul 18, 2012 at 8:32 AM, Manuel Carrasco Moñino <manolo@apache.org
> > wrote:
>
>> Actually we already use a GuiceServletContextListener so what you have to
>> do is to remove the /gwtRequest servlet-mapping from the web.xml so as it
>> is routed it via our guice listener, then serve that path in
>> the DispatchServletModule, despite the name of this class it it is not a
>> gwt-dispatcher class, in fact it should be call GuiceWebModule.
>>
>> - your configuration should look like:
>>     bind(HupaFactoryServlet.class).in(Singleton.class);
>>     serve("/gwtRequest",
>> "/hupa/gwtRequest").with(HupaFactoryServlet.class);
>>
>> - create the HupaFactoryServlet and use injection in the way tbroyer says
>> i the post
>> public class HupaFactoryServlet extends RequestFactoryServlet {
>>   implement your ServiceLayerDecorator
>> }
>>
>> - Manolo
>>
>>
>>
>>
>> On Wed, Jul 18, 2012 at 7:47 AM, echo <ec...@gmail.com> wrote:
>>
>>> Hi manolo,
>>> I updated the repository with your help. One problem about DI:
>>> It is found that we must inject IMAPStoreCache when I tried to use the
>>> it like org.apache.hupa.server.handler.AbstractSessionHandler. That means I
>>> must implement some inject stuff to benefit with Inject. What's I want to
>>> know is whether I have to implement a new one like here[1]<https://groups.google.com/forum/?fromgroups#!topic/google-web-toolkit/9W_masZUUjc>instead of the gwt-dispath's or something have been done I can referred.
>>>
>>> [1]
>>> https://groups.google.com/forum/?fromgroups#!topic/google-web-toolkit/9W_masZUUjc
>>>
>>>
>>> --
>>> *echo*
>>>
>>
>>
>


-- 
*echo*

Re: Should use Injector to inject Service-s and Locator-s in the RF

Posted by Manuel Carrasco Moñino <ma...@apache.org>.
You can take advantage of this code and use Locators to get your service
classes injected. It is Apache licensed.

https://github.com/etiennep/injected-requestfactory

- Manolo

On Wed, Jul 18, 2012 at 8:32 AM, Manuel Carrasco Moñino
<ma...@apache.org>wrote:

> Actually we already use a GuiceServletContextListener so what you have to
> do is to remove the /gwtRequest servlet-mapping from the web.xml so as it
> is routed it via our guice listener, then serve that path in
> the DispatchServletModule, despite the name of this class it it is not a
> gwt-dispatcher class, in fact it should be call GuiceWebModule.
>
> - your configuration should look like:
>     bind(HupaFactoryServlet.class).in(Singleton.class);
>     serve("/gwtRequest",
> "/hupa/gwtRequest").with(HupaFactoryServlet.class);
>
> - create the HupaFactoryServlet and use injection in the way tbroyer says
> i the post
> public class HupaFactoryServlet extends RequestFactoryServlet {
>   implement your ServiceLayerDecorator
> }
>
> - Manolo
>
>
>
>
> On Wed, Jul 18, 2012 at 7:47 AM, echo <ec...@gmail.com> wrote:
>
>> Hi manolo,
>> I updated the repository with your help. One problem about DI:
>> It is found that we must inject IMAPStoreCache when I tried to use the it
>> like org.apache.hupa.server.handler.AbstractSessionHandler. That means I
>> must implement some inject stuff to benefit with Inject. What's I want to
>> know is whether I have to implement a new one like here[1]<https://groups.google.com/forum/?fromgroups#!topic/google-web-toolkit/9W_masZUUjc>instead of the gwt-dispath's or something have been done I can referred.
>>
>> [1]
>> https://groups.google.com/forum/?fromgroups#!topic/google-web-toolkit/9W_masZUUjc
>>
>>
>> --
>> *echo*
>>
>
>

Re: Should use Injector to inject Service-s and Locator-s in the RF

Posted by Manuel Carrasco Moñino <ma...@apache.org>.
Actually we already use a GuiceServletContextListener so what you have to
do is to remove the /gwtRequest servlet-mapping from the web.xml so as it
is routed it via our guice listener, then serve that path in
the DispatchServletModule, despite the name of this class it it is not a
gwt-dispatcher class, in fact it should be call GuiceWebModule.

- your configuration should look like:
    bind(HupaFactoryServlet.class).in(Singleton.class);
    serve("/gwtRequest", "/hupa/gwtRequest").with(HupaFactoryServlet.class);

- create the HupaFactoryServlet and use injection in the way tbroyer says i
the post
public class HupaFactoryServlet extends RequestFactoryServlet {
  implement your ServiceLayerDecorator
}

- Manolo




On Wed, Jul 18, 2012 at 7:47 AM, echo <ec...@gmail.com> wrote:

> Hi manolo,
> I updated the repository with your help. One problem about DI:
> It is found that we must inject IMAPStoreCache when I tried to use the it
> like org.apache.hupa.server.handler.AbstractSessionHandler. That means I
> must implement some inject stuff to benefit with Inject. What's I want to
> know is whether I have to implement a new one like here[1]<https://groups.google.com/forum/?fromgroups#!topic/google-web-toolkit/9W_masZUUjc>instead of the gwt-dispath's or something have been done I can referred.
>
> [1]
> https://groups.google.com/forum/?fromgroups#!topic/google-web-toolkit/9W_masZUUjc
>
>
> --
> *echo*
>