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 <echo...@gmail.com> wrote: > Thanks a lot. > > > On Wed, Jul 18, 2012 at 2:54 PM, Manuel Carrasco Moñino <man...@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 < >> man...@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 <echo...@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* >